struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject svn commit: r771772 - /struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
Date Tue, 05 May 2009 15:09:46 GMT
Author: wesw
Date: Tue May  5 15:09:45 2009
New Revision: 771772

URL: http://svn.apache.org/viewvc?rev=771772&view=rev
Log:
WW-3114, working around GAE class loader incompatibilities, patch from Leonard Broman, thanks!

Modified:
    struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java

Modified: struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java?rev=771772&r1=771771&r2=771772&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
(original)
+++ struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
Tue May  5 15:09:45 2009
@@ -369,10 +369,22 @@
         if (parent != null)
             urlSet = urlSet.exclude(parent);
 
-        urlSet = urlSet.exclude(new ClassLoaderInterfaceDelegate(ClassLoader.getSystemClassLoader().getParent()));
+        try {
+        	// This may fail in some sandboxes, ie GAE
+        	ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
+        	urlSet = urlSet.exclude(new ClassLoaderInterfaceDelegate(systemClassLoader.getParent()));
+        	
+        } catch (SecurityException e) {
+        	LOG.warn("Could not get the system classloader due to security constraints, there
may be improper urls left to scan");
+        }
         urlSet = urlSet.excludeJavaExtDirs();
         urlSet = urlSet.excludeJavaEndorsedDirs();
-        urlSet = urlSet.excludeJavaHome();
+        try {
+        	urlSet = urlSet.excludeJavaHome();
+        } catch (NullPointerException e) {
+        	// This happens in GAE since the sandbox contains no java.home directory
+        	LOG.warn("Could not exclude JAVA_HOME, is this a sandbox jvm?");
+        }
         urlSet = urlSet.excludePaths(System.getProperty("sun.boot.class.path", ""));
         urlSet = urlSet.exclude(".*/JavaVM.framework/.*");
 



Mime
View raw message