MessageBundle ???

Andrew Haley aph@redhat.com
Fri Apr 1 17:43:00 GMT 2011


>> 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.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /