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

Getting ArrayIndexOutOfBoundsException for URL's openStream method in ko locale

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.2.0
    • 1.1.2, 1.1.5, 1.2.0
    • core-libs
    • None
    • 1.2fcs
    • x86, sparc
    • solaris_2.5, solaris_2.5.1, windows_nt
    • Not verified

      Getting java.lang.ArrayIndexOutOfBoundsException: -32768 when using openStream
      method in the URL class to open an input stream that points to a directory and
      the locale is ko. If the locale is set to ko_KR, ja, or zh then no error is
      generated for the call.

      Here is the result of the stack trace:
      java.lang.ArrayIndexOutOfBoundsException: -32768
              at java.text.CompactIntArray.compact(CompactIntArray.java:188)
              at java.text.RuleBasedCollator.build(RuleBasedCollator.java:546)
              at java.text.RuleBasedCollator.<init>(RuleBasedCollator.java:278)
              at java.text.Collator.getInstance(Collator.java:232)
              at java.text.Collator.getInstance(Collator.java:198)
              at sun.net.www.protocol.file.StringCompare.&lt;init&gt;(FileURLConnection.java
      :186)
              at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection
      .java:79)
              at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLCon
      nection.java:170)
              at java.net.URL.openStream(URL.java)
              at Demo.main(Demo.java:8)

      Instructions to reproduce the problem:
      1. Use a system that has the Asian locales installed
      2. set LANG to "ko"
      3. javac Demo.java
      4. java Demo

      Source code for Demo.java:
      import java.io.InputStream;
      import java.net.URL;

      public class Demo {
          public static void main( String[] args ) {
      try {
      URL url = new URL( "file:/tmp/" );
      InputStream ins = url.openStream();
      ins.close();
      }
      catch ( Exception e ) {
      e.printStackTrace();
      }
          }
      }

            lwernersunw Laura Werner (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: