harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikhail Markov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-1944) [classlib][rmi] default RMIClassLoader provider should not sort codebase URLs
Date Mon, 30 Oct 2006 11:51:19 GMT
    [ http://issues.apache.org/jira/browse/HARMONY-1944?page=comments#action_12445564 ] 
            
Mikhail Markov commented on HARMONY-1944:
-----------------------------------------

Everything is OK, Nathan. Thanks!
The only thing i'm thinking of is: perhaps it makes sense to put empty "all-allowing" SecurityManager
outside the test so other RMI tests coud use it (as RMI requires SecurityManager be always
set during the run)? One of candidates for such and improvement is org.apache.harmony.rmi.RegistryTest,
for example.

> [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
>         Assigned To: Nathan Beyer
>         Attachments: DefaultRMIClassLoaderSpi.2.patch, RMIClassLoaderTest.patch, testClass.jar
>
>
> 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

        

Mime
View raw message