From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8604 invoked by alias); 1 Apr 2011 19:32:19 -0000 Received: (qmail 8476 invoked by uid 22791); 1 Apr 2011 19:32:18 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from wildebeest.demon.nl (HELO gnu.wildebeest.org) (80.101.103.228) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 01 Apr 2011 19:32:11 +0000 Received: from springer.wildebeest.org ([172.31.17.34]) by gnu.wildebeest.org with esmtp (Exim 4.63) (envelope-from ) id 1Q5k4m-0000tZ-CW; Fri, 01 Apr 2011 21:32:09 +0200 Subject: Re: MessageBundle ??? From: Mark Wielaard To: Andrew Haley Cc: java@gcc.gnu.org In-Reply-To: <4D960ECF.6030908@redhat.com> References: <1301667745.1724.2.camel@linux-pc> <4D95E7BB.4020409@redhat.com> <4D960ECF.6030908@redhat.com> Content-Type: text/plain; charset="UTF-8" Date: Fri, 01 Apr 2011 19:32:00 -0000 Message-ID: <1301686328.14810.6.camel@springer.wildebeest.org> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Spam-Score: -4.4 (----) X-IsSubscribed: yes Mailing-List: contact java-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-owner@gcc.gnu.org X-SW-Source: 2011-04/txt/msg00011.txt.bz2 On Fri, 2011-04-01 at 18:43 +0100, Andrew Haley wrote: > >> java.lang.NumberFormatException: invalid character at position 2 in 09 > > > > That's just a bug: leading zeroes in format fields aren't being handled > > correctly. The "09" is being parsed as an octal number because it begins > > with a zero. > > The fix for the exception is > > Index: Formatter.java > =================================================================== > --- Formatter.java (revision 171834) > +++ Formatter.java (working copy) > @@ -1188,7 +1188,7 @@ > advance(); > if (start == index) > return -1; > - return Integer.decode(format.substring(start, index)); > + return Integer.parseInt(format.substring(start, index)); > } > Coincidentally the exact same problem and fix were discovered by Pekka and went into GNU Classpath recently. 2010-02-16 Pekka Enberg * java/util/Formatter.java: (parseInt): Use Integer.parseInt() insted of Integer.decode() because the latter doesn't work with leading zeros which are used in String.format() formatting, for example.