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

Console output ASCII value instead of the character

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 1.0.1
    • Fix Version/s: 1.2.0
    • Component/s: deploy
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      1.2
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Backports

        Description

        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.

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: