Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7007868

Regression for java.lang.String,format FormatFlagsConversionMismatchException: C

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 7
    • core-libs
    • x86
    • windows_7

      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

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: