geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsis...@apache.org
Subject svn commit: r372115 - /geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/rmi/RMIClassLoaderSpiImpl.java
Date Wed, 25 Jan 2006 05:33:54 GMT
Author: jsisson
Date: Tue Jan 24 21:33:42 2006
New Revision: 372115

URL: http://svn.apache.org/viewcvs?rev=372115&view=rev
Log:
GERONIMO-615 - improve code where RMIClassLoaderSpiImpl.normalizeCodebase(..) unnecessarily
caused MalformedURLExceptions to be generated and caught.

Modified:
    geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/rmi/RMIClassLoaderSpiImpl.java

Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/rmi/RMIClassLoaderSpiImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/rmi/RMIClassLoaderSpiImpl.java?rev=372115&r1=372114&r2=372115&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/rmi/RMIClassLoaderSpiImpl.java
(original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/rmi/RMIClassLoaderSpiImpl.java
Tue Jan 24 21:33:42 2006
@@ -102,21 +102,26 @@
         
         while (stok.hasMoreTokens()) {
             String item = stok.nextToken();
-            try {
-                URL url = new URL(item);
-                // System.out.println("Created URL: " + url);
-                
-                // If we got this far then item is a valid url, so commit the current
-                // buffer and start collecting any trailing bits from where we are now
-                
-                updateCodebase(working, codebase);
-            }
-            catch (MalformedURLException ignore) {
-                // just keep going & append to the working buffer
+            // Optimisation: This optimisation to prevent unnecessary MalformedURLExceptions

+            //   being generated is most helpful on windows where directory names in the
path 
+            //   often contain spaces.  E.G:
+            //     file:/C:/Program Files/Apache Software Foundation/Maven 1.0.2/lib/ant-1.5.3-1.jar
+            //
+            //   Therefore we won't attempt URL("Files/Apache) or URL(" ") for the path delimiter.
+            if ( item.indexOf(':') != -1 )
+            {
+                try {
+                    URL url = new URL(item);
+                    // If we got this far then item is a valid url, so commit the current
+                    // buffer and start collecting any trailing bits from where we are now
+                    updateCodebase(working, codebase);
+                } catch (MalformedURLException ignore) {
+                    // just keep going & append to the working buffer
+                }
             }
             
+            // Append the URL or delimiter to the working buffer
             working.append(item);
-            // System.out.println("Added to working buffer: " + item);
         }
         
         // Handle trailing elements
@@ -164,4 +169,4 @@
     public interface ClassLoaderServerAware {
         public URL[] getClassLoaderServerURLs();
     }
-}
+        }



Mime
View raw message