geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsis...@apache.org
Subject svn commit: r404746 - /geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/rmi/RMIClassLoaderSpiImpl.java
Date Sun, 07 May 2006 09:52:51 GMT
Author: jsisson
Date: Sun May  7 02:52:49 2006
New Revision: 404746

URL: http://svn.apache.org/viewcvs?rev=404746&view=rev
Log:
GERONIMO-615 Merge fix that has been in trunk since Jan - RMIClassLoaderSpiImpl.normalizeCodebase(..)
unnecessarily caused MalformedURLExceptions to be generated and caught.

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

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/rmi/RMIClassLoaderSpiImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/rmi/RMIClassLoaderSpiImpl.java?rev=404746&r1=404745&r2=404746&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/rmi/RMIClassLoaderSpiImpl.java
(original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/rmi/RMIClassLoaderSpiImpl.java
Sun May  7 02:52:49 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