LANG-1072 Duplicated "0x" check in createBigInteger in NumberUtils
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1643038 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
21201210e2
commit
0162032aa4
|
@ -22,6 +22,7 @@
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<release version="3.4" date="tba" description="tba">
|
<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-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-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>
|
<action issue="LANG-536" type="add" dev="djones" due-to="James Sawle">Add isSorted() to ArrayUtils</action>
|
||||||
|
|
|
@ -734,7 +734,7 @@ public static BigInteger createBigInteger(final String str) {
|
||||||
negate = true;
|
negate = true;
|
||||||
pos = 1;
|
pos = 1;
|
||||||
}
|
}
|
||||||
if (str.startsWith("0x", pos) || str.startsWith("0x", pos)) { // hex
|
if (str.startsWith("0x", pos) || str.startsWith("0X", pos)) { // hex
|
||||||
radix = 16;
|
radix = 16;
|
||||||
pos += 2;
|
pos += 2;
|
||||||
} else if (str.startsWith("#", pos)) { // alternative hex (allowed by Long/Integer)
|
} else if (str.startsWith("#", pos)) { // alternative hex (allowed by Long/Integer)
|
||||||
|
|
|
@ -427,6 +427,7 @@ public void testCreateBigInteger() {
|
||||||
// Funky whitespaces
|
// Funky whitespaces
|
||||||
this.testCreateBigIntegerFailure("\u00A0\uFEFF\u000B\u000C\u001C\u001D\u001E\u001F");
|
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("0Xff"));
|
||||||
assertEquals("createBigInteger(String) failed", new BigInteger("255"), NumberUtils.createBigInteger("#ff"));
|
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("-0xff"));
|
||||||
assertEquals("createBigInteger(String) failed", new BigInteger("255"), NumberUtils.createBigInteger("0377"));
|
assertEquals("createBigInteger(String) failed", new BigInteger("255"), NumberUtils.createBigInteger("0377"));
|
||||||
|
|
Loading…
Reference in New Issue