[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/42752] New: formats like "%08X", "%09d" crash java.util.

From: klaus dot stehle at uni-tuebingen dot de
Subject: [Bug classpath/42752] New: formats like "%08X", "%09d" crash java.util.Formatter
Date: 15 Jan 2010 08:45:04 -0000

The function
runs into octal mode if there are leading zeroes.

That is: a `0' formatting flag will crash the function
if there are digits > 7


class A {
    public static void main(String[] argv) {
        System.out.format("%08X", 123);

will cause the following runtime error:

$ gij A
Exception in thread "main" java.lang.NumberFormatException: invalid character
t position 2 in 08
   at java.lang.Integer.parseInt(libgcj.so.90)
   at java.lang.Integer.decode(libgcj.so.90)
   at java.util.Formatter.parseInt(libgcj.so.90)
   at java.util.Formatter.parseArgumentIndex(libgcj.so.90)
   at java.util.Formatter.format(libgcj.so.90)
   at java.util.Formatter.format(libgcj.so.90)
   at java.io.PrintStream.format(libgcj.so.90)
   at java.io.PrintStream.format(libgcj.so.90)
   at A.main(A.java:3)

           Summary: formats like "%08X", "%09d" crash java.util.Formatter
           Product: classpath
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: classpath
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: klaus dot stehle at uni-tuebingen dot de


reply via email to

[Prev in Thread] Current Thread [Next in Thread]