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

Console output ASCII value instead of the character

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.2.0
    • 1.0.1
    • deploy
    • None
    • 1.2
    • generic
    • generic
    • Verified

        In Console.java, we did not convert the ASCII value to the string correctly:

        in the write(int b) method, we do:

        insert(Byte.toString((byte)b));

        this would not convert int(ASCII value) into the repsective string, e.g int 60 should represent the string "<", the above conversion will only convert int 60 to a string "60".

        It should be

        insert(String.valueOf((char)b));

        instead. It will return the string "<" if int b = 60.

        the attached test.java will demonstrate the problem and the fix clearly.

              ngthomas Thomas Ng (Inactive)
              ngthomas Thomas Ng (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: