commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ima...@apache.org
Subject svn commit: r537717 - /jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/StandardFileSystemManager.java
Date Mon, 14 May 2007 06:00:48 GMT
Author: imario
Date: Sun May 13 23:00:47 2007
New Revision: 537717

URL: http://svn.apache.org/viewvc?view=rev&rev=537717
Log:
VFS-136: Don't force-set the classloader - Thanks to Adam Heath for the patch

Modified:
    jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/StandardFileSystemManager.java

Modified: jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/StandardFileSystemManager.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/StandardFileSystemManager.java?view=diff&rev=537717&r1=537716&r2=537717
==============================================================================
--- jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/StandardFileSystemManager.java
(original)
+++ jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/StandardFileSystemManager.java
Sun May 13 23:00:47 2007
@@ -103,12 +103,15 @@
         setReplicator(new PrivilegedFileReplicator(replicator));
         setTemporaryFileStore(replicator);
 
-        if (classLoader == null)
+		/* replaced by findClassLoader
+		if (classLoader == null)
         {
             // Use default classloader
             classLoader = getClass().getClassLoader();
         }
-        if (configUri == null)
+        */
+
+		if (configUri == null)
         {
             // Use default config
             final URL url = getClass().getResource(CONFIG_RESOURCE);
@@ -146,7 +149,7 @@
 		{
 			throw new FileSystemException(e);
 		}
-		
+
 		while (enumResources.hasMoreElements())
 		{
 			URL url = (URL) enumResources.nextElement();
@@ -156,6 +159,11 @@
 
 	private ClassLoader findClassLoader()
 	{
+		if (classLoader != null)
+		{
+			return classLoader;
+		}
+
 		ClassLoader cl = Thread.currentThread().getContextClassLoader();
 		if (cl == null)
 		{
@@ -261,7 +269,7 @@
             final Element operationProvider = (Element) operationProviders.item(i);
             addOperationProvider(operationProvider);
         }
-        
+
         // Add the default provider
         final NodeList defProviders = config.getElementsByTagName("default-provider");
         if (defProviders.getLength() > 0)
@@ -380,7 +388,7 @@
             }
         }
     }
-    
+
     /**
      * Tests if a class is available.
      */
@@ -388,7 +396,7 @@
     {
         try
         {
-            classLoader.loadClass(className);
+            findClassLoader().loadClass(className);
             return true;
         }
         catch (final ClassNotFoundException e)
@@ -461,7 +469,7 @@
     {
         try
         {
-            final Class clazz = classLoader.loadClass(className);
+            final Class clazz = findClassLoader().loadClass(className);
             return clazz.newInstance();
         }
         catch (final Exception e)



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message