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

Class.forName() throws java.lang.IndexOutOfBoundsException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • 5.0M8
    • 5.0M16
    • JDK
    • None

    Description

      Using latest harmony (r713673), I notified that calling Class.forName( "foo.bar.com" ); throws IndexOutOfBoundsException.

      Here is the stacktrace:

      http://harmony.apache.org
      Uncaught exception in main:
      java.lang.IndexOutOfBoundsException
      	at java.nio.ByteBuffer.wrap(ByteBuffer.java:110)
      	at java.util.jar.InitManifest.decode(InitManifest.java:210)
      	at java.util.jar.InitManifest.readValue(InitManifest.java:201)
      	at java.util.jar.InitManifest.readHeader(InitManifest.java:117)
      	at java.util.jar.InitManifest.<init>(InitManifest.java:56)
      	at java.util.jar.Manifest.read(Manifest.java:223)
      	at java.util.jar.Manifest.<init>(Manifest.java:116)
      	at java.util.jar.JarFile.getManifest(JarFile.java:268)
      	at java.net.URLClassLoader.createURLJarHandler(URLClassLoader.java:1044)
      	at java.net.URLClassLoader.makeNewHandler(URLClassLoader.java:997)
      	at java.net.URLClassLoader.getHandler(URLClassLoader.java:980)
      	at java.net.URLClassLoader.findClassImpl(URLClassLoader.java:1189)
      	at java.net.URLClassLoader$4.run(URLClassLoader.java:888)
      	at java.net.URLClassLoader$4.run(URLClassLoader.java:1)
      	at java.security.AccessController.doPrivilegedImpl(AccessController.java:171)
      	at java.security.AccessController.doPrivileged(AccessController.java:64)
      	at java.net.URLClassLoader.findClass(URLClassLoader.java:885)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:489)
      	at java.lang.ClassLoader$SystemClassLoader.loadClass(ClassLoader.java:871)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
      	at java.lang.Class.forName(Class.java:130)
      	at java.lang.Class.forName(Class.java:90)
      	at test.Test.main(Test.java:32)
      

      Here is the dummy code:

      public class Test
      {
          public static void main( String[] args )
              throws Exception
          {
              System.out.println( System.getProperty( "java.vendor.url" ) );
      
              Class.forName( "foo.bar.com" );
          }
      }
      

      This project uses only one dependency: icu4j [1]. I tried with some other icu4j distributions [2] with success.

      [1] http://repo2.maven.org/eclipse/com/ibm/icu/com.ibm.icu/3.4.5/com.ibm.icu-3.4.5.jar
      [2] http://repo2.maven.org/maven2/com/ibm/icu/icu4j/

      Attachments

        Activity

          People

            tellison Tim Ellison
            vsiveton Vincent Siveton
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: