From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28619 invoked by alias); 17 Aug 2011 16:19:25 -0000 Received: (qmail 28589 invoked by uid 22791); 17 Aug 2011 16:19:21 -0000 X-SWARE-Spam-Status: No, hits=-8.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 17 Aug 2011 16:19:07 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p7HGJ7LE006833 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 17 Aug 2011 12:19:07 -0400 Received: from dhcp-lab-190.englab.brq.redhat.com (dhcp-2-245.brq.redhat.com [10.34.2.245]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p7HGJ6Mm032040 for ; Wed, 17 Aug 2011 12:19:07 -0400 Message-ID: <4E4BEA69.9040702@redhat.com> Date: Wed, 17 Aug 2011 16:19:00 -0000 From: Pavel Tisnovsky User-Agent: Thunderbird 2.0.0.23 (X11/20090825) MIME-Version: 1.0 To: mauve-discuss@sourceware.org Subject: Fix for test gnu/testlet/java/lang/Integer/parseInt.java Content-Type: multipart/mixed; boundary="------------070203020509010004060905" X-IsSubscribed: yes Mailing-List: contact mauve-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: mauve-discuss-owner@sourceware.org X-SW-Source: 2011-q3/txt/msg00002.txt.bz2 This is a multi-part message in MIME format. --------------070203020509010004060905 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-length: 764 Greetings, I think that the regression test "gnu/testlet/java/lang/Integer/parseInt.java" should be fixed to work correctly for pre JDK1.7 case (JDK1.0 .. JDK1.6) and also for JDK1.7 case. The difference between JDK1.6 and JDK1.7 is in the behaviour of method Integer.parseInt() when string beginning with '+' sign is parsed: Integer.parseInt("+42") JDK1.6 throws exception in this case, but parsing the same string is perfectly valid in JDK1.7. So I added the condition to the test which checks what JDK is being tested (I can't figure out how Mauve harness checks the "Tags: JDKxx" tag). I also changed the message printed in case JDK1.7 does not work correctly. Is it possible to push the fixed test to Mauve repository please? Thank you in advance, Pavel --------------070203020509010004060905 Content-Type: text/x-patch; name="parseInt.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="parseInt.patch" Content-length: 1309 --- 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 --------------070203020509010004060905--