You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by lu...@apache.org on 2003/08/07 20:14:35 UTC
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper JspC.java
luehe 2003/08/07 11:14:35
Modified: jasper2/src/share/org/apache/jasper JspC.java
Log:
Simplify the way the URLClassLoader gets initialized.
In the case where jspc is launched from the command line (instead of
ant), the same class path JARs were added 3 (!) times to the
URLClassLoader's URL array.
Notice that the URLClassLoader returned by
this.getClass().getClassLoader() is already initialized with all the
URLs from java.class.path, so those URLs don't need to be added
to the classpath.
Revision Changes Path
1.51 +15 -24 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java
Index: JspC.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- JspC.java 31 Jul 2003 18:40:27 -0000 1.50
+++ JspC.java 7 Aug 2003 18:14:35 -0000 1.51
@@ -74,6 +74,8 @@
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
+import org.apache.tools.ant.AntClassLoader;
+
import org.apache.jasper.compiler.ServletWriter;
import org.apache.jasper.compiler.Compiler;
import org.apache.jasper.compiler.TldLocationsCache;
@@ -940,30 +942,18 @@
private void initClassLoader(JspCompilationContext clctxt)
throws IOException {
- classPath = getClassPath();
-
- ClassLoader parent=this.getClass().getClassLoader();
+ String classPath = getClassPath();
- ArrayList urls = new ArrayList();
- File webappBase=new File(uriRoot);
-
- if( parent instanceof URLClassLoader ) {
- URLClassLoader uL=(URLClassLoader) parent;
- URL path[]=uL.getURLs();
- for( int i=0; i<path.length; i++ ) {
- urls.add( path[i] );
- classPath = classPath + File.pathSeparator +
- path[i].getFile();
- }
+ ClassLoader jspcLoader = getClass().getClassLoader();
+ if (jspcLoader instanceof AntClassLoader) {
+ classPath += File.pathSeparator
+ + ((AntClassLoader) jspcLoader).getClasspath();
}
- if( parent instanceof org.apache.tools.ant.AntClassLoader ) {
- classPath= classPath + File.pathSeparator +
- ((org.apache.tools.ant.AntClassLoader)parent).getClasspath();
- }
-
- // Turn the classPath in URLs
- StringTokenizer tokenizer = new StringTokenizer(classPath, File.pathSeparator);
+ // Turn the classPath into URLs
+ ArrayList urls = new ArrayList();
+ StringTokenizer tokenizer = new StringTokenizer(classPath,
+ File.pathSeparator);
while (tokenizer.hasMoreTokens()) {
String path = tokenizer.nextToken();
try {
@@ -977,6 +967,7 @@
}
}
+ File webappBase = new File(uriRoot);
if (webappBase.exists()) {
File classes = new File(webappBase, "/WEB-INF/classes");
try {