You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Mikhail Markov (JIRA)" <ji...@apache.org> on 2006/10/24 10:14:17 UTC

[jira] Updated: (HARMONY-1944) [classlib][rmi] default RMIClassLoader provider should not sort codebase URLs

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

Mikhail Markov updated HARMONY-1944:
------------------------------------

    Attachment: DefaultRMIClassLoaderSpi.2.patch

Here is the patch fixing the problem. It's based on proposed fix in HARMONY-1936.

> [classlib][rmi] default RMIClassLoader provider should not sort codebase URLs
> -----------------------------------------------------------------------------
>
>                 Key: HARMONY-1944
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1944
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: IA32, WinXP
>            Reporter: Mikhail Markov
>         Attachments: DefaultRMIClassLoaderSpi.2.patch
>
>
> Default RMIClassLoader provider (org.apache.harmony.rmi.DefaultRMIClassLoaderSpi) should retain the order of incoming codebase URLs. Currently it sorts the list, which is demonstrated by the test below (note: TestClass.class should be put to testClasses.jar file and should be accessible through http server on localhost and 8080 port ):
> Output on RI:
> Test passed.
> Output on Harmony:
> URL[0].getPath() = /fake.jar, expected: /testClasses.jar
> URL[1].getPath() = /testClasses.jar, expected: /fake.jar
> Test failed.
> ------------Test.java-------------
> import java.net.URL;
> import java.net.URLClassLoader;
> import java.rmi.server.RMIClassLoader;
> public class Test {
>     public static void main(String[] args) throws Exception {
>         System.setProperty("java.security.policy", "policy.all");
>         System.setSecurityManager(new SecurityManager());
>         String[] pathes = new String[] { "/testClasses.jar", "/fake.jar" };
>         Class c = RMIClassLoader.loadClass("http://localhost:8080"
>                 + pathes[0] + " http://localhost:8080" + pathes[1],
>                 "TestClass", null);
>         ClassLoader cl = c.getClassLoader();
>         if (cl instanceof URLClassLoader) {
>             URL[] urls = ((URLClassLoader) cl).getURLs();
>             if (urls.length != 2) {
>                 System.out.println("Test failed, unexpected number of URLs: " + urls.length);
>                 return;
>             }
>             boolean failed = false;
>             for (int i = 0; i < urls.length; ++i) {
>                 if (!urls[i].getPath().equals(pathes[i])) {
>                     System.out.println("URL[" + i + "].getPath() = "
>                             + urls[i].getPath() +", expected: " + pathes[i]);
>                     failed = true;
>                 }
>             }
>             if (failed) {
>                 System.out.println("Test failed.");
>             } else {
>                 System.out.println("Test passes.");
>             }
>         } else {
>             System.out.println("Test failed, class is loaded by non-URLClassLoader");
>         }
>     }
> }
> ------------TestClass.java---------------
> public class TestClass {
> }

-- 
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