From 0abf6cd6c914d69b90e219a8e931f7587d14042b Mon Sep 17 00:00:00 2001 From: hlaaf Date: Mon, 4 Apr 2016 00:45:13 +0300 Subject: [PATCH] Fixed broken parsing for numbers starting with 0 It set the radix to 8 if the number was, say, 09, and threw an exception. --- src/main/org/codehaus/groovy/syntax/Numbers.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/org/codehaus/groovy/syntax/Numbers.java b/src/main/org/codehaus/groovy/syntax/Numbers.java index 652ec97d68c..53a60553b10 100644 --- a/src/main/org/codehaus/groovy/syntax/Numbers.java +++ b/src/main/org/codehaus/groovy/syntax/Numbers.java @@ -182,16 +182,14 @@ public static Number parseInteger(AST reportNode, String text ) int radix = 10; if( text.charAt(0) == '0' && length > 1 ) { c = text.charAt(1); - if( c == 'X' || c == 'x' ) { + if( c == 'X' || c == 'x' ) { // hex radix = 16; - text = text.substring( 2, length); + text = text.substring(2, length); length -= 2; - } else if ( c == 'B' || c == 'b' ) { + } else if ( c == 'B' || c == 'b' ) { // binary radix = 2; text = text.substring(2, length); length -= 2; - } else { - radix = 8; } }