[Top][All Lists]

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

[commit-cp] classpath ChangeLog java/util/

From: Pekka Enberg
Subject: [commit-cp] classpath ChangeLog java/util/
Date: Wed, 16 Feb 2011 19:44:29 +0000

CVSROOT:        /sources/classpath
Module name:    classpath
Changes by:     Pekka Enberg <penberg>  11/02/16 19:44:29

Modified files:
        .              : ChangeLog 
        java/util      : 

Log message:
        Fix Formatter.parseInt() wrt. leading zeroes
        The following test case:
          public class StringTest {
            public static void main(String[] args) {
              System.out.println(String.format("%08x", 1234));
        produces the following error:
        Exception in thread "main" java.lang.NumberFormatException: invalid 
character at position 2 in 08
           at java.lang.Integer.parseInt(
           at java.lang.Integer.decode(
           at java.util.Formatter.parseInt(
           at java.util.Formatter.parseArgumentIndex(
           at java.util.Formatter.format(
           at java.util.Formatter.format(
           at java.lang.String.format(
           at java.lang.String.format(
           at StringTest.main(
        This patch fixes the issue by switching to Integer.parseInt() in
        Reviewed-by: Dr Andrew John Hughes <address@hidden>
        2010-02-16  Pekka Enberg  <address@hidden>
               * java/util/
               (parseInt): Use Integer.parseInt() insted of Integer.decode()
               because the latter doesn't work with leading zeros which are
               used in String.format() formatting, for example.


reply via email to

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