public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Haley <aph@redhat.com>
To: java@gcc.gnu.org
Subject: Re: MessageBundle ???
Date: Fri, 01 Apr 2011 17:43:00 -0000	[thread overview]
Message-ID: <4D960ECF.6030908@redhat.com> (raw)
In-Reply-To: <4D95E7BB.4020409@redhat.com>


>> at position 1 g$ò< ...
>>
>>
>> 2)
>> This other test is not working with both the versions.
>>
>> class Test {
>>
>>    public static void main(String argv[]) {
>>
>>        System.out.printf("%09.3f%n",3.1415926535);
>>    }
>> }
>>
>> -------------> gives a: Exception in thread "main"
>> 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));
   }

   /**

BUT:

I just had a look, and as far as I can tell floating-point formatted
conversion has never been implemented in gcj.  Sorry.

Andrew.

  reply	other threads:[~2011-04-01 17:43 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 [this message]
2011-04-01 19:32     ` Mark Wielaard
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=4D960ECF.6030908@redhat.com \
    --to=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).