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

Method: com/sun/tools/javac/util/Log.printErrLine() assumes UTF-8 encoding

XMLWordPrintable

    • b35
    • generic
    • generic
    • Verified

      Name: dk106046 Date: 04/10/2003

      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1)
      Classic VM (build 1.4.1, J2RE 1.4.1 IBM z/OS Persistent Reusable VM build cmdev-20030212 (JIT enabled: jitc))


      ------------
      The javac compiler produces garbled error messages when source code is not ASCII encoded and file.encoding is not ASCII

      Here's a very simple test class that contains a syntax error:
          public class tmp {
            public void test() {
              abcdefg
            }
          }
      If this is encoded in EBCDIC, and file.encoding=CP1047 then javac produces garbled error messages.
      The problem lies in com/sun/tools/javac/util/Log.printErrLine which reads the source code directly into a
      byte array and then parses this expecting to see ASCII CR and LF characters. Also The String constructed
      for display of the error line column indicator assumes default platform encoding, but the text is constructed
      from UTF-8 spaces and '^' characters.

      Note that this is probably not a problem for Sun SDKs, however the code in
      com/sun/tools/javac/util/Log.printErrLine is really not right.

      ======================================================================
      ###@###.### 10/26/04 02:38 GMT

      Should be fixed when we do JSR199 work.
      ###@###.### 2005-2-14 22:47:53 GMT

            jjg Jonathan Gibbons
            dkorbel David Korbel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: