ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject svn commit: r579270 - in /ant/core/trunk/src/main/org/apache/tools/ant/util: DOMElementWriter.java RegexpPatternMapper.java depend/bcel/DependencyVisitor.java regexp/JakartaOroRegexp.java regexp/JakartaRegexpRegexp.java regexp/Jdk14RegexpRegexp.java
Date Tue, 25 Sep 2007 14:44:49 GMT
Author: peterreilly
Date: Tue Sep 25 07:44:48 2007
New Revision: 579270

URL: http://svn.apache.org/viewvc?rev=579270&view=rev
Log:
magic numbers

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/util/DOMElementWriter.java
    ant/core/trunk/src/main/org/apache/tools/ant/util/RegexpPatternMapper.java
    ant/core/trunk/src/main/org/apache/tools/ant/util/depend/bcel/DependencyVisitor.java
    ant/core/trunk/src/main/org/apache/tools/ant/util/regexp/JakartaOroRegexp.java
    ant/core/trunk/src/main/org/apache/tools/ant/util/regexp/JakartaRegexpRegexp.java
    ant/core/trunk/src/main/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexp.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/util/DOMElementWriter.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/DOMElementWriter.java?rev=579270&r1=579269&r2=579270&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/util/DOMElementWriter.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/DOMElementWriter.java Tue Sep 25 07:44:48
2007
@@ -43,6 +43,8 @@
  */
 public class DOMElementWriter {
 
+    private static final int HEX = 16;
+
     /** prefix for generated prefixes */
     private static final String NS = "ns";
 
@@ -497,7 +499,7 @@
         if (ent.charAt(1) == '#') {
             if (ent.charAt(2) == 'x') {
                 try {
-                    Integer.parseInt(ent.substring(3, ent.length() - 1), 16);
+                    Integer.parseInt(ent.substring(3, ent.length() - 1), HEX);
                     return true;
                 } catch (NumberFormatException nfe) {
                     return false;

Modified: ant/core/trunk/src/main/org/apache/tools/ant/util/RegexpPatternMapper.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/RegexpPatternMapper.java?rev=579270&r1=579269&r2=579270&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/util/RegexpPatternMapper.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/RegexpPatternMapper.java Tue Sep 25
07:44:48 2007
@@ -29,6 +29,9 @@
  *
  */
 public class RegexpPatternMapper implements FileNameMapper {
+
+    private static final int DECIMAL = 10;
+
     // CheckStyle:VisibilityModifier OFF - bc
     protected RegexpMatcher reg = null;
     protected char[] to = null;
@@ -130,7 +133,7 @@
         for (int i = 0; i < to.length; i++) {
             if (to[i] == '\\') {
                 if (++i < to.length) {
-                    int value = Character.digit(to[i], 10);
+                    int value = Character.digit(to[i], DECIMAL);
                     if (value > -1) {
                         result.append((String) v.elementAt(value));
                     } else {

Modified: ant/core/trunk/src/main/org/apache/tools/ant/util/depend/bcel/DependencyVisitor.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/depend/bcel/DependencyVisitor.java?rev=579270&r1=579269&r2=579270&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/util/depend/bcel/DependencyVisitor.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/depend/bcel/DependencyVisitor.java Tue
Sep 25 07:44:48 2007
@@ -102,6 +102,7 @@
                     start = classname.charAt(0);
                 }
                 // Check to see if it's an inner class 'com.company.Class$Inner'
+                // CheckStyle:MagicNumber OFF
                 if ((start > 0x40) && (start < 0x5B)) {
                     // first letter of the previous segment of the class name 'Class'
                     // is upper case ascii. so according to the spec it's an inner class
@@ -112,6 +113,7 @@
                     // Add the class in dotted notation 'com.company.Class'
                     addClass(classname);
                 }
+                // CheckStyle:MagicNumber ON
             } else {
                 // Add a class with no package 'Class'
                 addClass(classname);

Modified: ant/core/trunk/src/main/org/apache/tools/ant/util/regexp/JakartaOroRegexp.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/regexp/JakartaOroRegexp.java?rev=579270&r1=579269&r2=579270&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/util/regexp/JakartaOroRegexp.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/regexp/JakartaOroRegexp.java Tue Sep
25 07:44:48 2007
@@ -27,6 +27,8 @@
  */
 public class JakartaOroRegexp extends JakartaOroMatcher implements Regexp {
 
+    private static final int DECIMAL = 10;
+
     /** Constructor for JakartaOroRegexp */
     public JakartaOroRegexp() {
         super();
@@ -52,7 +54,7 @@
             } else if (c == '\\') {
                 if (++i < argument.length()) {
                     c = argument.charAt(i);
-                    int value = Character.digit(c, 10);
+                    int value = Character.digit(c, DECIMAL);
                     if (value > -1) {
                         subst.append("$").append(value);
                     } else {

Modified: ant/core/trunk/src/main/org/apache/tools/ant/util/regexp/JakartaRegexpRegexp.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/regexp/JakartaRegexpRegexp.java?rev=579270&r1=579269&r2=579270&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/util/regexp/JakartaRegexpRegexp.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/regexp/JakartaRegexpRegexp.java Tue
Sep 25 07:44:48 2007
@@ -27,6 +27,8 @@
 public class JakartaRegexpRegexp extends JakartaRegexpMatcher
     implements Regexp {
 
+    private static final int DECIMAL = 10;
+
     /** Constructor for JakartaRegexpRegexp */
     public JakartaRegexpRegexp() {
         super();
@@ -65,7 +67,7 @@
             if (c == '\\') {
                 if (++i < argument.length()) {
                     c = argument.charAt(i);
-                    int value = Character.digit(c, 10);
+                    int value = Character.digit(c, DECIMAL);
                     if (value > -1) {
                         result.append((String) v.elementAt(value));
                     } else {

Modified: ant/core/trunk/src/main/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexp.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexp.java?rev=579270&r1=579269&r2=579270&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexp.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexp.java Tue Sep
25 07:44:48 2007
@@ -26,6 +26,8 @@
  */
 public class Jdk14RegexpRegexp extends Jdk14RegexpMatcher implements Regexp {
 
+    private static final int DECIMAL = 10;
+
     /** Constructor for Jdk14RegexpRegexp */
     public Jdk14RegexpRegexp() {
         super();
@@ -65,7 +67,7 @@
             } else if (c == '\\') {
                 if (++i < argument.length()) {
                     c = argument.charAt(i);
-                    int value = Character.digit(c, 10);
+                    int value = Character.digit(c, DECIMAL);
                     if (value > -1) {
                         subst.append("$").append(value);
                     } else {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message