You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Vera Petrashkova (JIRA)" <ji...@apache.org> on 2006/11/07 11:26:51 UTC

[jira] Updated: (HARMONY-1932) [drlvm] ClassLoader.defineClass() method should throw LinkageError if it's called more that once for the same class.

     [ http://issues.apache.org/jira/browse/HARMONY-1932?page=all ]

Vera Petrashkova updated HARMONY-1932:
--------------------------------------

    Attachment: LinkageErrorTest.zip

defineClass(...) does not throw LinkageError when name argument is null and it also does not throw
LinkageError when the name of used class is specified. 
Attached LinkageErrorTest test demonstrates VM behavior in these cases.


> [drlvm] ClassLoader.defineClass() method should throw LinkageError if it's called more that once for the same class.
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1932
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1932
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: IA32, WinXP
>            Reporter: Mikhail Markov
>         Attachments: LinkageErrorTest.zip
>
>
> The test below called 2 times method defineClass() of ClassLoader for the same class:
> ----------------------- Test.java -------------------------
> public class Test {
>     public static void main(String[] args) throws Exception {
>         ClassLoader loader = new TestClassLoader();
>         loader.loadClass("/TestClass");
>         try {
>             loader.loadClass("/TestClass");
>             System.out.println("Test failed.");
>         } catch (LinkageError le) {
>             System.out.println("Test passed: " + le);
>         }
>     }
>     static class TestClassLoader extends ClassLoader {
>         /*
>          * Byte array of bytecode equivalent to the following source code:
>          *     public class TestClass {
>          *     }
>          */
>         private byte[] classData = new byte[] {
>             -54, -2, -70, -66, 0, 0, 0, 49, 0, 13,
>             10, 0, 3, 0, 10, 7, 0, 11, 7, 0,
>             12, 1, 0, 6, 60, 105, 110, 105, 116, 62,
>             1, 0, 3, 40, 41, 86, 1, 0, 4, 67,
>             111, 100, 101, 1, 0, 15, 76, 105, 110, 101,
>             78, 117, 109, 98, 101, 114, 84, 97, 98, 108,
>             101, 1, 0, 10, 83, 111, 117, 114, 99, 101,
>             70, 105, 108, 101, 1, 0, 14, 84, 101, 115,
>             116, 67, 108, 97, 115, 115, 46, 106, 97, 118,
>             97, 12, 0, 4, 0, 5, 1, 0, 9, 84,
>             101, 115, 116, 67, 108, 97, 115, 115, 1, 0,
>             16, 106, 97, 118, 97, 47, 108, 97, 110, 103,
>             47, 79, 98, 106, 101, 99, 116, 0, 33, 0,
>             2, 0, 3, 0, 0, 0, 0, 0, 1, 0,
>             1, 0, 4, 0, 5, 0, 1, 0, 6, 0,
>             0, 0, 29, 0, 1, 0, 1, 0, 0, 0,
>             5, 42, -73, 0, 1, -79, 0, 0, 0, 1,
>             0, 7, 0, 0, 0, 6, 0, 1, 0, 0,
>             0, 1, 0, 1, 0, 8, 0, 0, 0, 2,
>             0, 9 };
>         protected Class findClass(String name) throws ClassNotFoundException {
>             if (name.equals("/TestClass")) {
>                 return defineClass(null, classData, 0, classData.length);
>             } else {
>                 throw new ClassNotFoundException("Class " + name + " not found.");
>             }
>         }
>     }
> }
> ------------------------------------------------
> Output on RI:
> Test passed: java.lang.LinkageError: duplicate class definition: TestClass
> Output on Harmony:
> Test failed.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira