FULL PRODUCT VERSION :
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b116)
Java HotSpot(TM) Client VM (build 20.0-b02, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Versione 6.1.7600]
A DESCRIPTION OF THE PROBLEM :
using the format strring "%1$#8s" throws a FormatFlagsConversionMismatchException on Jdk7, on jdk6 there is no error
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
public static void main(String .... args) {
long l = 1000;
String length = String.format("%1$#8s", (Long)l);
}
simply run it...
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
no exception
ACTUAL -
Exception in thread "main" java.util.FormatFlagsConversionMismatchException: Conversion = s, Flags = #
at java.util.Formatter$FormatSpecifier.failMismatch(Formatter.java:4019)
at java.util.Formatter$FormatSpecifier.printString(Formatter.java:2812)
at java.util.Formatter$FormatSpecifier.print(Formatter.java:2696)
at java.util.Formatter.format(Formatter.java:2472)
at java.util.Formatter.format(Formatter.java:2400)
at java.lang.String.format(String.java:2845)
at mysft.TestFormat.main(TestFormat.java:15)
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.util.FormatFlagsConversionMismatchException: Conversion = s, Flags = #
at java.util.Formatter$FormatSpecifier.failMismatch(Formatter.java:4019)
at java.util.Formatter$FormatSpecifier.printString(Formatter.java:2812)
at java.util.Formatter$FormatSpecifier.print(Formatter.java:2696)
at java.util.Formatter.format(Formatter.java:2472)
at java.util.Formatter.format(Formatter.java:2400)
at java.lang.String.format(String.java:2845)
at mysft.TestFormat.main(TestFormat.java:15)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public static void main(String .... args) {
long l = 1000;
String length = String.format("%1$#8s", (Long)l);
}
---------- END SOURCE ----------
SUPPORT :
YES
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b116)
Java HotSpot(TM) Client VM (build 20.0-b02, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Versione 6.1.7600]
A DESCRIPTION OF THE PROBLEM :
using the format strring "%1$#8s" throws a FormatFlagsConversionMismatchException on Jdk7, on jdk6 there is no error
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
public static void main(String .... args) {
long l = 1000;
String length = String.format("%1$#8s", (Long)l);
}
simply run it...
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
no exception
ACTUAL -
Exception in thread "main" java.util.FormatFlagsConversionMismatchException: Conversion = s, Flags = #
at java.util.Formatter$FormatSpecifier.failMismatch(Formatter.java:4019)
at java.util.Formatter$FormatSpecifier.printString(Formatter.java:2812)
at java.util.Formatter$FormatSpecifier.print(Formatter.java:2696)
at java.util.Formatter.format(Formatter.java:2472)
at java.util.Formatter.format(Formatter.java:2400)
at java.lang.String.format(String.java:2845)
at mysft.TestFormat.main(TestFormat.java:15)
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.util.FormatFlagsConversionMismatchException: Conversion = s, Flags = #
at java.util.Formatter$FormatSpecifier.failMismatch(Formatter.java:4019)
at java.util.Formatter$FormatSpecifier.printString(Formatter.java:2812)
at java.util.Formatter$FormatSpecifier.print(Formatter.java:2696)
at java.util.Formatter.format(Formatter.java:2472)
at java.util.Formatter.format(Formatter.java:2400)
at java.lang.String.format(String.java:2845)
at mysft.TestFormat.main(TestFormat.java:15)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public static void main(String .... args) {
long l = 1000;
String length = String.format("%1$#8s", (Long)l);
}
---------- END SOURCE ----------
SUPPORT :
YES
- relates to
-
JDK-5063507 (fmt) missing exception for "%#s" format specifier
-
- Resolved
-