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

Charset decoder throws exception when trying to decode EUC_TW encoded file.

XMLWordPrintable

    • b23
    • generic
    • generic
    • Verified

        The attached program and files will produce the following exception:

        java.lang.ArrayIndexOutOfBoundsException: 8192
                at sun.nio.cs.ext.EUC_TW$Decoder.decodeArrayLoop(EUC_TW.java:2252)
                at sun.nio.cs.ext.EUC_TW$Decoder.decodeLoop(EUC_TW.java:2428)
                at java.nio.charset.CharsetDecoder.decode(CharsetDecoder.java:536)
                at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:442)
                at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:182)
                at java.io.InputStreamReader.read(InputStreamReader.java:167)
                at java.io.BufferedReader.fill(BufferedReader.java:136)
                at java.io.BufferedReader.read(BufferedReader.java:157)
                at CharsetIOStreamClassTest.runDecodingTest(CharsetIOStreamClassTest.java:83)
                at CharsetIOStreamClassTest.main(CharsetIOStreamClassTest.java:43)

        To compile/run the attached programs, do the following:

        % javac CharsetIOStreamClassTest.java
        % java CharsetIOStreamClassTest EUC_TW.b2c

        The supporting classes will take the .b2c file and create a file 100,000 characters in size and will use this as the test data. The exception, however, will happen during the first read attempt from the stream.

        This will not happen if you use the nio API or the String class. It only seems to happen when the io class is used.

        ###@###.### 2003-03-18

              ilittlesunw Ian Little (Inactive)
              elousunw Edmund Lou (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: