Harmony
  1. Harmony
  2. HARMONY-1147

[classlib] [ibm vme] Harmony+j9 throws NPE while Harmony+drlvm and RI throws IndexOutOfBoundsException for SecureClassLoader.defineClass()

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Classlib
    • Labels:
      None

      Description

      Harmony+j9 throws NPE for SecureClassLoader.defineClass(..) while Harmony+drlvm and RI throws IndexOutOfBoundsException.

      ==================== test.java =====================
      import java.net.URL;
      import java.security.*;

      public class test {
      public static void main(String args[]) {
      try {
      CodeSource lcs = new CodeSource(new URL(new URL("http://www.intel.com"), "0"), new CodeSigner[192]);
      new CL().test1((String) null, new byte[]

      {2,2}

      , 0, 127, lcs);
      } catch (Exception e)

      { System.out.println("exception: " + e); }

      }
      }
      class CL extends SecureClassLoader {
      CL()

      { super(); }

      public int test1 (String name, byte[] array, int off, int len, CodeSource cs) {
      try

      { defineClass(name, array, off, len, cs); }

      catch(Exception e)

      { e.printStackTrace(); }

      return 0;
      }
      }
      ================================================

      Output:
      C:\tmp\tmp17>C:\jrockit-jdk1.5.0-windows-ia32\bin\java.exe -cp . -showversion test
      java version "1.5.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
      BEA WebLogic JRockit(R) (build dra-38972-20041208-2001-win-ia32, R25.0.0-75, GC: System optimized over throughput (initial strategy singleparpar))

      java.lang.ArrayIndexOutOfBoundsException
      at java.lang.ClassLoader.defineClass(Ljava.lang.String;[BIILjava.security.ProtectionDomain;)Ljava.lang.Class;(Unknown Source)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
      at CL.test1(test.java:18)
      at test.main(test.java:8)

      C:\tmp\tmp17>C:\harmony\classlib1.5\deploy\jdk\jre\bin\java.exe -cp . -showversion test
      java version 1.5 (subset)

      (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
      java.lang.NullPointerException
      at java.security.CodeSource.getCertificatesNoClone(CodeSource.java:170)
      at java.security.CodeSource.getCertificates(CodeSource.java:145)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:238)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:68)
      at CL.test1(test.java:18)
      at test.main(test.java:8)

      C:\tmp\tmp17>C:\harmony\drlvm1.5\build\win_ia32_msvc_debug\deploy\jre\bin\java -Dvm.assert_dialog=false -cp . -showversion test
      java version "1.5.0"
      pre-alpha : not complete or compatible
      svn = r430209, (Aug 10 2006), Windows/ia32/msvc 1310, debug build
      http://incubator.apache.org/harmony
      java.lang.IndexOutOfBoundsException: Check your arguments
      at java.lang.ClassLoader.defineClass()
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:68)
      at CL.test1(test.java:18)
      at test.main(test.java:8)

        Activity

        Hide
        Boris Kuznetsov added a comment -

        Looks like IBM VM's implementation of java.lang.ClassLoader.defineClass() behaves differently (see stack trace)

        Show
        Boris Kuznetsov added a comment - Looks like IBM VM's implementation of java.lang.ClassLoader.defineClass() behaves differently (see stack trace)
        Hide
        Mikhail Loenko added a comment -

        changed name to reflect sub-component

        Show
        Mikhail Loenko added a comment - changed name to reflect sub-component
        Hide
        Mikhail Markov added a comment -

        I've created the patch for the tests.

        Vladimir, could you please change the prefix of this JIRA to "[classlib] [ibm vme]"?
        Thanks.

        Show
        Mikhail Markov added a comment - I've created the patch for the tests. Vladimir, could you please change the prefix of this JIRA to " [classlib] [ibm vme] "? Thanks.

          People

          • Assignee:
            Unassigned
            Reporter:
            Vladimir Ivanov
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development