From: Mark Wielaard <mark@klomp.org>
To: Andrew Haley <aph@redhat.com>
Cc: java@gcc.gnu.org
Subject: Re: MessageBundle ???
Date: Fri, 01 Apr 2011 19:32:00 -0000 [thread overview]
Message-ID: <1301686328.14810.6.camel@springer.wildebeest.org> (raw)
In-Reply-To: <4D960ECF.6030908@redhat.com>
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 <penberg@kernel.org>
* 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.
next prev parent reply other threads:[~2011-04-01 19:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-01 14:22 dj_def
2011-04-01 14:57 ` Andrew Haley
2011-04-01 17:43 ` Andrew Haley
2011-04-01 19:32 ` Mark Wielaard [this message]
2011-04-04 9:38 ` Andrew Haley
-- strict thread matches above, loose matches on Subject: below --
2011-04-04 13:04 dj_def
2011-04-04 13:09 ` Andrew Haley
2011-04-04 12:00 dj_def
2011-04-04 12:13 ` Andrew Haley
2011-04-01 8:51 dj_def
2011-04-01 9:57 ` Andrew Haley
2011-04-01 10:09 ` Andrew Haley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1301686328.14810.6.camel@springer.wildebeest.org \
--to=mark@klomp.org \
--cc=aph@redhat.com \
--cc=java@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).