Author: sebb Date: 2014-12-03 01:35:22 +0000 (Wed, 03 Dec 2014) New Revision: r1643038
URL: http://svn.apache.org/r1643038 Log: LANG-1072 Duplicated "0x" check in createBigInteger in NumberUtils Modified: /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/math/NumberUtils.java /commons/proper/lang/trunk/src/changes/changes.xml Index: commons/proper/lang/trunk/src/changes/changes.xml =================================================================== --- commons/proper/lang/trunk/src/changes/changes.xml (revision 1643037) +++ commons/proper/lang/trunk/src/changes/changes.xml (revision 1643038) @@ -22,6 +22,7 @@ <body> <release version="3.4" date="tba" description="tba"> + <action issue="LANG-1072" type="fix" dev="sebb" due-to="haiyang li">Duplicated "0x" check in createBigInteger in NumberUtils</action> <action issue="LANG-1064" type="fix" dev="djones" due-to="B.J. Herbison">StringUtils.abbreviate description doesn't agree with the examples</action> <action issue="LANG-1052" type="add" dev="britter" due-to="Jan Matèrne">Multiline recursive to string style</action> <action issue="LANG-536" type="add" dev="djones" due-to="James Sawle">Add isSorted() to ArrayUtils</action> Index: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java =================================================================== --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java (revision 1643037) +++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java (revision 1643038) @@ -427,6 +427,7 @@ // Funky whitespaces this.testCreateBigIntegerFailure("\u00A0\uFEFF\u000B\u000C\u001C\u001D\u001E\u001F"); assertEquals("createBigInteger(String) failed", new BigInteger("255"), NumberUtils.createBigInteger("0xff")); + assertEquals("createBigInteger(String) failed", new BigInteger("255"), NumberUtils.createBigInteger("0Xff")); assertEquals("createBigInteger(String) failed", new BigInteger("255"), NumberUtils.createBigInteger("#ff")); assertEquals("createBigInteger(String) failed", new BigInteger("-255"), NumberUtils.createBigInteger("-0xff")); assertEquals("createBigInteger(String) failed", new BigInteger("255"), NumberUtils.createBigInteger("0377")); Index: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/math/NumberUtils.java =================================================================== --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/math/NumberUtils.java (revision 1643037) +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/math/NumberUtils.java (revision 1643038) @@ -734,7 +734,7 @@ negate = true; pos = 1; } - if (str.startsWith("0x", pos) || str.startsWith("0x", pos)) { // hex + if (str.startsWith("0x", pos) || str.startsWith("0X", pos)) { // hex radix = 16; pos += 2; } else if (str.startsWith("#", pos)) { // alternative hex (allowed by Long/Integer)
