Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-4196

[classlib][luni] InputStreamReader can't handle UnicodeBig encoding

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • Classlib
    • None

    Description

      Consider the following simple test:

      import java.io.*;

      public class Test {
      public static void main(String[] args) {
      try {
      new InputStreamReader(new ByteArrayInputStream(new byte[]

      {(byte) 0xFE, (byte) 0xFF}

      ), "UnicodeBig");
      System.out.println("SUCCESS");
      } catch (Throwable e)

      { System.out.println("FAIL:"); e.printStackTrace(System.out); }

      }
      }

      Output on RI:

      SUCCESS

      Output on Harmony (both DRL VM and IBM VM):

      FAIL:
      java.io.UnsupportedEncodingException
      at java.io.InputStreamReader.<init>(InputStreamReader.java:104)
      at Test.main(Test.java:6)

      Additional investigation shows that the cause for this exception is:

      java.nio.charset.UnsupportedCharsetException: The unsupported charset name is "UnicodeBig".
      at java.nio.charset.Charset.forName(Charset.java:564)
      at java.io.InputStreamReader.<init>(InputStreamReader.java:99)
      at Test.main(Test.java:5)

      Interesting point is, the direct call to Charset.forName("UnicodeBig") causes the same exception on RI also.
      So it seems the problem is not in Charset but in InputStreamReader itself.

      Attachments

        1. Harmony-4196-InputStreamReader_diagnostics.patch
          0.6 kB
          Vasily Zakharov
        2. HARMONY-4196.diff
          3 kB
          Charles Lee

        Issue Links

          Activity

            People

              Unassigned Unassigned
              vmz Vasily Zakharov
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated: