git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@579270 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -43,6 +43,8 @@ import org.w3c.dom.Text; | |||||
| */ | */ | ||||
| public class DOMElementWriter { | public class DOMElementWriter { | ||||
| private static final int HEX = 16; | |||||
| /** prefix for generated prefixes */ | /** prefix for generated prefixes */ | ||||
| private static final String NS = "ns"; | private static final String NS = "ns"; | ||||
| @@ -497,7 +499,7 @@ public class DOMElementWriter { | |||||
| if (ent.charAt(1) == '#') { | if (ent.charAt(1) == '#') { | ||||
| if (ent.charAt(2) == 'x') { | if (ent.charAt(2) == 'x') { | ||||
| try { | try { | ||||
| Integer.parseInt(ent.substring(3, ent.length() - 1), 16); | |||||
| Integer.parseInt(ent.substring(3, ent.length() - 1), HEX); | |||||
| return true; | return true; | ||||
| } catch (NumberFormatException nfe) { | } catch (NumberFormatException nfe) { | ||||
| return false; | return false; | ||||
| @@ -29,6 +29,9 @@ import org.apache.tools.ant.util.regexp.RegexpMatcherFactory; | |||||
| * | * | ||||
| */ | */ | ||||
| public class RegexpPatternMapper implements FileNameMapper { | public class RegexpPatternMapper implements FileNameMapper { | ||||
| private static final int DECIMAL = 10; | |||||
| // CheckStyle:VisibilityModifier OFF - bc | // CheckStyle:VisibilityModifier OFF - bc | ||||
| protected RegexpMatcher reg = null; | protected RegexpMatcher reg = null; | ||||
| protected char[] to = null; | protected char[] to = null; | ||||
| @@ -130,7 +133,7 @@ public class RegexpPatternMapper implements FileNameMapper { | |||||
| for (int i = 0; i < to.length; i++) { | for (int i = 0; i < to.length; i++) { | ||||
| if (to[i] == '\\') { | if (to[i] == '\\') { | ||||
| if (++i < to.length) { | if (++i < to.length) { | ||||
| int value = Character.digit(to[i], 10); | |||||
| int value = Character.digit(to[i], DECIMAL); | |||||
| if (value > -1) { | if (value > -1) { | ||||
| result.append((String) v.elementAt(value)); | result.append((String) v.elementAt(value)); | ||||
| } else { | } else { | ||||
| @@ -102,6 +102,7 @@ public class DependencyVisitor extends EmptyVisitor { | |||||
| start = classname.charAt(0); | start = classname.charAt(0); | ||||
| } | } | ||||
| // Check to see if it's an inner class 'com.company.Class$Inner' | // Check to see if it's an inner class 'com.company.Class$Inner' | ||||
| // CheckStyle:MagicNumber OFF | |||||
| if ((start > 0x40) && (start < 0x5B)) { | if ((start > 0x40) && (start < 0x5B)) { | ||||
| // first letter of the previous segment of the class name 'Class' | // 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 | // is upper case ascii. so according to the spec it's an inner class | ||||
| @@ -112,6 +113,7 @@ public class DependencyVisitor extends EmptyVisitor { | |||||
| // Add the class in dotted notation 'com.company.Class' | // Add the class in dotted notation 'com.company.Class' | ||||
| addClass(classname); | addClass(classname); | ||||
| } | } | ||||
| // CheckStyle:MagicNumber ON | |||||
| } else { | } else { | ||||
| // Add a class with no package 'Class' | // Add a class with no package 'Class' | ||||
| addClass(classname); | addClass(classname); | ||||
| @@ -27,6 +27,8 @@ import org.apache.tools.ant.BuildException; | |||||
| */ | */ | ||||
| public class JakartaOroRegexp extends JakartaOroMatcher implements Regexp { | public class JakartaOroRegexp extends JakartaOroMatcher implements Regexp { | ||||
| private static final int DECIMAL = 10; | |||||
| /** Constructor for JakartaOroRegexp */ | /** Constructor for JakartaOroRegexp */ | ||||
| public JakartaOroRegexp() { | public JakartaOroRegexp() { | ||||
| super(); | super(); | ||||
| @@ -52,7 +54,7 @@ public class JakartaOroRegexp extends JakartaOroMatcher implements Regexp { | |||||
| } else if (c == '\\') { | } else if (c == '\\') { | ||||
| if (++i < argument.length()) { | if (++i < argument.length()) { | ||||
| c = argument.charAt(i); | c = argument.charAt(i); | ||||
| int value = Character.digit(c, 10); | |||||
| int value = Character.digit(c, DECIMAL); | |||||
| if (value > -1) { | if (value > -1) { | ||||
| subst.append("$").append(value); | subst.append("$").append(value); | ||||
| } else { | } else { | ||||
| @@ -27,6 +27,8 @@ import org.apache.tools.ant.BuildException; | |||||
| public class JakartaRegexpRegexp extends JakartaRegexpMatcher | public class JakartaRegexpRegexp extends JakartaRegexpMatcher | ||||
| implements Regexp { | implements Regexp { | ||||
| private static final int DECIMAL = 10; | |||||
| /** Constructor for JakartaRegexpRegexp */ | /** Constructor for JakartaRegexpRegexp */ | ||||
| public JakartaRegexpRegexp() { | public JakartaRegexpRegexp() { | ||||
| super(); | super(); | ||||
| @@ -65,7 +67,7 @@ public class JakartaRegexpRegexp extends JakartaRegexpMatcher | |||||
| if (c == '\\') { | if (c == '\\') { | ||||
| if (++i < argument.length()) { | if (++i < argument.length()) { | ||||
| c = argument.charAt(i); | c = argument.charAt(i); | ||||
| int value = Character.digit(c, 10); | |||||
| int value = Character.digit(c, DECIMAL); | |||||
| if (value > -1) { | if (value > -1) { | ||||
| result.append((String) v.elementAt(value)); | result.append((String) v.elementAt(value)); | ||||
| } else { | } else { | ||||
| @@ -26,6 +26,8 @@ import org.apache.tools.ant.BuildException; | |||||
| */ | */ | ||||
| public class Jdk14RegexpRegexp extends Jdk14RegexpMatcher implements Regexp { | public class Jdk14RegexpRegexp extends Jdk14RegexpMatcher implements Regexp { | ||||
| private static final int DECIMAL = 10; | |||||
| /** Constructor for Jdk14RegexpRegexp */ | /** Constructor for Jdk14RegexpRegexp */ | ||||
| public Jdk14RegexpRegexp() { | public Jdk14RegexpRegexp() { | ||||
| super(); | super(); | ||||
| @@ -65,7 +67,7 @@ public class Jdk14RegexpRegexp extends Jdk14RegexpMatcher implements Regexp { | |||||
| } else if (c == '\\') { | } else if (c == '\\') { | ||||
| if (++i < argument.length()) { | if (++i < argument.length()) { | ||||
| c = argument.charAt(i); | c = argument.charAt(i); | ||||
| int value = Character.digit(c, 10); | |||||
| int value = Character.digit(c, DECIMAL); | |||||
| if (value > -1) { | if (value > -1) { | ||||
| subst.append("$").append(value); | subst.append("$").append(value); | ||||
| } else { | } else { | ||||