### Eclipse Workspace Patch 1.0 #P luni Index: src/main/java/org/apache/harmony/luni/util/FloatingPointParser.java =================================================================== --- src/main/java/org/apache/harmony/luni/util/FloatingPointParser.java (revision 999591) +++ src/main/java/org/apache/harmony/luni/util/FloatingPointParser.java (working copy) @@ -280,6 +280,24 @@ throw new NumberFormatException(); } + private static boolean parseAsHex(String s) { + int length = s.length(); + if (length < 2) { + return false; + } + char first = s.charAt(0); + char second = s.charAt(1); + if (first == '+' || first == '-') { + // Move along + if (length < 3) { + return false; + } + first = second; + second = s.charAt(2); + } + return (first == '0') && (second == 'x' || second == 'X'); + } + /** * Returns the closest double value to the real number in the string. * @@ -305,7 +323,7 @@ } // See if it could be a hexadecimal representation - if (s.toLowerCase().indexOf("0x") != -1) { //$NON-NLS-1$ + if (parseAsHex(s)) { return HexStringParser.parseDouble(s); } @@ -354,7 +372,7 @@ } // See if it could be a hexadecimal representation - if (s.toLowerCase().indexOf("0x") != -1) { //$NON-NLS-1$ + if (parseAsHex(s)) { return HexStringParser.parseFloat(s); }