--- gnu/testlet/java/lang/Integer/parseInt.java 2008-05-12 23:35:49.000000000 +0200 +++ gnu/testlet/java/lang/Integer/parseInt.java 2011-08-17 17:17:16.000000000 +0200 @@ -106,15 +106,31 @@ } // In JDK1.7, '+' is considered a valid character. - try - { - i = Integer.parseInt("+10"); - harness.check(true); - harness.check(i, 10); - } - catch (NumberFormatException nfe) - { - harness.fail("Leading '+' does not throw NumberFormatException"); + // it means that the following step should be divided + // for pre JDK1.7 case and >= JDK1.7 + String[] javaVersion = System.getProperty("java.version").split("\\."); + if (Integer.parseInt(javaVersion[1]) >= 7) { + try + { + i = Integer.parseInt("+10"); + harness.check(true); + harness.check(i, 10); + } + catch (NumberFormatException nfe) + { + harness.fail("'+10' string is not parsed correctly as expected in JDK1.7"); + } + } + else { // pre JDK1.7 branch + try + { + i = Integer.parseInt("+10"); + harness.fail("'+10' must throw NumberFormatException"); + } + catch (NumberFormatException nfe) + { + harness.check(true); + } } try