so, i have two "fixes" to the problem mentioned below, and i wanted to run
them by somebody...

both fixes involve "normalizing" the paths that make up the classpath by
essentially passing them through File objects.  the big difference is where
this normalization takes place.

one place to do it is in WebappLoader.setClassPath().  the other is in
JikesJavaCompiler.setClasspath().

attached are the diffs.

does anyone have an opinion and/or care about this?

tia for any input :)

-kevin.

> 
> has anybody tried using jikes to compile jsp's with tomcat 4 
> on windows
> recently?  i have.  it barfed :)
> 
> basically what's happening is the classpath is getting messed 
> up.  more
> specifically, the entry in the classpath that points at 
> WEB-INF/classes/ is
> getting messed up.  the classpath ends up looking like this:
>     ...;/c:/tomcat/webapps/myWebapp/WEB-INF/classes/;...
> 
> it's the beginning "/" that appears to be screwing jikes up.  
> apparently
> javac can handle this kind of path, but jikes can't.
> 
> it looks like the classpath for jsp's is being set in
> WebappLoader.setClasspath(), which get's respositories (which 
> are URL's)
> from an instance of WebappClassLoader.  then, for URL's that 
> are of the
> "file" scheme, it pulls of the file part and adds this to the 
> classpath.  in
> the case of the above example, one of these URL's will be
> "file:/c:/tomcat/webapps/myWebapp/WEB-INF/classes/".
> 
> i can think of some potential hacks... but i was hoping 
> someone who knows
> this code better would have some ideas on how this might be 
> fixed or worked
> around :)  or, is this a problem with jikes itself?
> 
> tia, 
> 
> -kevin.
> 

Index: catalina/src/share/org/apache/catalina/loader/WebappLoader.java
===================================================================
RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/WebappLoader.java,v
retrieving revision 1.12
diff -u -r1.12 WebappLoader.java
--- catalina/src/share/org/apache/catalina/loader/WebappLoader.java     2001/07/22 
20:25:10     1.12
+++ catalina/src/share/org/apache/catalina/loader/WebappLoader.java     2001/08/08 
+20:38:42
@@ -1030,9 +1030,9 @@
             for (int i = 0; i < repositories.length; i++) {
                 String repository = repositories[i].toString();
                 if (repository.startsWith("file://"))
-                    repository = repository.substring(7);
+                    repository = new File(repository.substring(7)).toString();
                 else if (repository.startsWith("file:"))
-                    repository = repository.substring(5);
+                    repository = new File(repository.substring(5)).toString();
                 else if (repository.startsWith("jndi:"))
                     repository =
                         servletContext.getRealPath(repository.substring(5));
Index: jasper/src/share/org/apache/jasper/compiler/JikesJavaCompiler.java
===================================================================
RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JikesJavaCompiler.java,v
retrieving revision 1.4
diff -u -r1.4 JikesJavaCompiler.java
--- jasper/src/share/org/apache/jasper/compiler/JikesJavaCompiler.java  2001/02/08 
13:37:54     1.4
+++ jasper/src/share/org/apache/jasper/compiler/JikesJavaCompiler.java  2001/08/08 
+20:38:42
@@ -66,6 +66,7 @@
 import java.io.IOException;
 import java.io.File;
 import java.io.ByteArrayOutputStream;
+import java.util.StringTokenizer;
 
 /**
   * A Plug-in class for specifying a 'jikes' compile.
@@ -110,7 +111,17 @@
      * Set the class path for the compiler
      */ 
     public void setClasspath(String classpath) {
-      this.classpath = classpath;
+        StringBuffer buf = new StringBuffer(classpath.length());
+        StringTokenizer tok = new StringTokenizer(classpath,
+                                                  File.pathSeparator);
+        while (tok.hasMoreTokens()) {
+            String token = tok.nextToken();
+            File file = new File(token);
+               buf.append(file.toString());
+            buf.append(File.pathSeparator);
+        }
+        
+        this.classpath = buf.toString();
     }
 
     /**
@@ -162,6 +173,7 @@
                "-classpath", quote + classpath + MicrosoftClasspath + quote,
                "-d", quote + outdir + quote,
                "-nowarn",
+                "+E",
                quote + source + quote
             };
        } else {
@@ -170,6 +182,7 @@
                 //XXX - add encoding once Jikes supports it
                 "-classpath", quote + classpath + MicrosoftClasspath + quote,
                 "-nowarn",                
+                "+E",
                 quote + source + quote    
             };
        }

Reply via email to