harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r490074 - in /harmony/enhanced/classlib/trunk/modules/rmi/src: main/java/org/apache/harmony/rmi/DefaultRMIClassLoaderSpi.java test/api/java/org/apache/harmony/rmi/server/RMIClassLoaderTest.java
Date Sun, 24 Dec 2006 21:46:24 GMT
Author: ayza
Date: Sun Dec 24 13:46:23 2006
New Revision: 490074

URL: http://svn.apache.org/viewvc?view=rev&rev=490074
Log:
Applying fixes for HARMONY-1133 and HARMONY-1134 ([classlib][rmi] no expected MalformedURLException
for ...)

Modified:
    harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/DefaultRMIClassLoaderSpi.java
    harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RMIClassLoaderTest.java

Modified: harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/DefaultRMIClassLoaderSpi.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/DefaultRMIClassLoaderSpi.java?view=diff&rev=490074&r1=490073&r2=490074
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/DefaultRMIClassLoaderSpi.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/DefaultRMIClassLoaderSpi.java
Sun Dec 24 13:46:23 2006
@@ -103,6 +103,7 @@
         Class[] interfCl = new Class[interf.length];
         ClassLoader codebaseLoader = null;
         Exception ex = null;
+        stringToURLs(codebase);
 
         try {
             codebaseLoader = getClassLoader1(codebase);
@@ -263,6 +264,7 @@
                     new Object[]{name, ((codebase == null) ? "" : codebase), //$NON-NLS-1$
                     defaultLoader}));
         }
+        stringToURLs(codebase);
 
         try {
             if (defaultLoader != null) {
@@ -382,6 +384,7 @@
      */
     public ClassLoader getClassLoader(String codebase)
             throws MalformedURLException {
+        stringToURLs(codebase);
         SecurityManager mgr = System.getSecurityManager();
 
         if (mgr == null) {

Modified: harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RMIClassLoaderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RMIClassLoaderTest.java?view=diff&rev=490074&r1=490073&r2=490074
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RMIClassLoaderTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RMIClassLoaderTest.java
Sun Dec 24 13:46:23 2006
@@ -18,6 +18,7 @@
 
 package org.apache.harmony.rmi.server;
 
+import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.rmi.server.RMIClassLoader;
@@ -76,5 +77,62 @@
             // reset the security manager back to null state
             System.setSecurityManager(previous);
         }
+    }
+
+    /**
+      * Test for java.rmi.server.RMIClassLoader.loadProxyClass(String, String[], ClassLoader)
+      * testing invalid url as a codebase.
+      */
+    public void testLoadProxyClassInvalidCodebase() throws Exception {
+        //Regression for HARMONY-1133
+        SecurityManager previous = System.getSecurityManager();
+        System.setSecurityManager(null);
+        
+        try {
+            RMIClassLoader.loadProxyClass("zzz", new String[] {}, null);
+            fail("MalformedURLException expected");
+        } catch (MalformedURLException e) { 
+            //expected 
+        } finally {
+            System.setSecurityManager(previous);            
+        }
+    }
+
+    /**
+     * Test for java.rmi.server.RMIClassLoader.loadClass(String, String)
+     * testing invalid url as a codebase.
+     */
+    public void testLoadClassInvalidCodebase() throws Exception {
+        //Regression for HARMONY-1133
+        SecurityManager previous = System.getSecurityManager();
+        System.setSecurityManager(null);
+        
+        try { 
+            RMIClassLoader.loadClass("zzz", "a123");
+            fail("MalformedURLException expected");
+        } catch (MalformedURLException e) { 
+            //expected 
+        } finally {
+            System.setSecurityManager(previous);            
+        } 
+    }
+
+    /**
+     * Test for java.rmi.server.RMIClassLoader.getClassLoader(String)
+     * testing invalid url as a codebase.
+     */
+    public void testGetClassLoaderInvalidCodebase() throws Exception {
+        //Regression for HARMONY-1134
+        SecurityManager previous = System.getSecurityManager();
+        System.setSecurityManager(null);
+
+        try { 
+            RMIClassLoader.getClassLoader("zzz");
+            fail("MalformedURLException expected");
+        } catch (MalformedURLException e) { 
+            //expected 
+        } finally {
+            System.setSecurityManager(previous);            
+        } 
     }
 }



Mime
View raw message