geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r885264 - /geronimo/external/trunk/tomcat-parent-6.0.20/jasper/src/main/java/org/apache/jasper/compiler/JspRuntimeContext.java
Date Sun, 29 Nov 2009 20:26:10 GMT
Author: djencks
Date: Sun Nov 29 20:26:10 2009
New Revision: 885264

URL: http://svn.apache.org/viewvc?rev=885264&view=rev
Log:
GERONIMO-4962 don't assume URLClassLoader

Modified:
    geronimo/external/trunk/tomcat-parent-6.0.20/jasper/src/main/java/org/apache/jasper/compiler/JspRuntimeContext.java

Modified: geronimo/external/trunk/tomcat-parent-6.0.20/jasper/src/main/java/org/apache/jasper/compiler/JspRuntimeContext.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-6.0.20/jasper/src/main/java/org/apache/jasper/compiler/JspRuntimeContext.java?rev=885264&r1=885263&r2=885264&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-6.0.20/jasper/src/main/java/org/apache/jasper/compiler/JspRuntimeContext.java
(original)
+++ geronimo/external/trunk/tomcat-parent-6.0.20/jasper/src/main/java/org/apache/jasper/compiler/JspRuntimeContext.java
Sun Nov 29 20:26:10 2009
@@ -110,11 +110,9 @@
         this.options = options;
 
         // Get the parent class loader
-        parentClassLoader =
-            (URLClassLoader) Thread.currentThread().getContextClassLoader();
+        parentClassLoader =  Thread.currentThread().getContextClassLoader();
         if (parentClassLoader == null) {
-            parentClassLoader =
-                (URLClassLoader)this.getClass().getClassLoader();
+            parentClassLoader = this.getClass().getClassLoader();
         }
 
 	if (log.isDebugEnabled()) {
@@ -154,7 +152,7 @@
      */
     private ServletContext context;
     private Options options;
-    private URLClassLoader parentClassLoader;
+    private ClassLoader parentClassLoader;
     private PermissionCollection permissionCollection;
     private CodeSource codeSource;                    
     private String classpath;
@@ -222,7 +220,7 @@
      *
      * @return URLClassLoader parent
      */
-    public URLClassLoader getParentClassLoader() {
+    public ClassLoader getParentClassLoader() {
         return parentClassLoader;
     }
 
@@ -325,22 +323,24 @@
      */
     private void initClassPath() {
 
-        URL [] urls = parentClassLoader.getURLs();
-        StringBuffer cpath = new StringBuffer();
         String sep = System.getProperty("path.separator");
+        StringBuilder cpath = new StringBuilder();
+        if (parentClassLoader instanceof URLClassLoader) {
+            URL [] urls = ((URLClassLoader)parentClassLoader).getURLs();
+
+            for(int i = 0; i < urls.length; i++) {
+                // Tomcat 4 can use URL's other than file URL's,
+                // a protocol other than file: will generate a
+                // bad file system path, so only add file:
+                // protocol URL's to the classpath.
 
-        for(int i = 0; i < urls.length; i++) {
-            // Tomcat 4 can use URL's other than file URL's,
-            // a protocol other than file: will generate a
-            // bad file system path, so only add file:
-            // protocol URL's to the classpath.
-            
-            if( urls[i].getProtocol().equals("file") ) {
-                cpath.append((String)urls[i].getFile()+sep);
+                if( urls[i].getProtocol().equals("file") ) {
+                    cpath.append(urls[i].getFile() +sep);
+                }
             }
-        }    
+        }
 
-	cpath.append(options.getScratchDir() + sep);
+        cpath.append(options.getScratchDir()).append(sep);
 
         String cp = (String) context.getAttribute(Constants.SERVLET_CLASSPATH);
         if (cp == null || cp.equals("")) {
@@ -409,7 +409,7 @@
                     "accessClassInPackage.org.apache.jasper.runtime") );
 
                 if (parentClassLoader instanceof URLClassLoader) {
-                    URL [] urls = parentClassLoader.getURLs();
+                    URL [] urls = ((URLClassLoader)parentClassLoader).getURLs();
                     String jarUrl = null;
                     String jndiUrl = null;
                     for (int i=0; i<urls.length; i++) {



Mime
View raw message