remm        2002/09/09 03:57:50

  Modified:    jasper2/src/share/org/apache/jasper/compiler Tag:
                        tomcat_4_branch Compiler.java
  Log:
  - Cleanup Ant path generation, as using Strings doesn't work correctly. This
    is more resources intensive than before, but at least it now works fine on
    Windows.
  - Provides a workaround for bug 12387.
  - Fixes problems if path contains spaces (may affect Unix also).
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.18.2.5  +16 -10    
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java
  
  Index: Compiler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v
  retrieving revision 1.18.2.4
  retrieving revision 1.18.2.5
  diff -u -r1.18.2.4 -r1.18.2.5
  --- Compiler.java     8 Sep 2002 05:45:59 -0000       1.18.2.4
  +++ Compiler.java     9 Sep 2002 10:57:50 -0000       1.18.2.5
  @@ -77,6 +77,7 @@
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.taskdefs.Javac;
   import org.apache.tools.ant.types.Path;
  +import org.apache.tools.ant.types.PatternSet;
   
   import org.apache.jasper.JspCompilationContext;
   import org.apache.jasper.Constants;
  @@ -238,8 +239,8 @@
        * Compile the jsp file from the current engine context
        */
       public void generateClass()
  -        throws FileNotFoundException, JasperException, Exception
  -    {
  +        throws FileNotFoundException, JasperException, Exception {
  +
           String javaEncoding = ctxt.getOptions().getJavaEncoding();
           String javaFileName = ctxt.getServletJavaFileName();
           String classpath = ctxt.getClassPath(); 
  @@ -258,17 +259,21 @@
   
           // Initializing classpath
           Path path = new Path(project);
  -        path.setPath(System.getProperty("java.class.path") + sep
  -                     + classpath);
  +        path.setPath(System.getProperty("java.class.path"));
  +        StringTokenizer tokenizer = new StringTokenizer(classpath, sep);
  +        while (tokenizer.hasMoreElements()) {
  +            String pathElement = tokenizer.nextToken();
  +            File repository = new File(pathElement);
  +            path.setLocation(repository);
  +        }
   
           // Initializing sourcepath
           Path srcPath = new Path(project);
  -        srcPath.setPath(options.getScratchDir().getAbsolutePath());
  +        srcPath.setLocation(options.getScratchDir());
   
           // Configure the compiler object
           javac.setEncoding(javaEncoding);
           javac.setClasspath(path);
  -        //javac.setDestdir(new File(options.getScratchDir().getAbsolutePath()));
           javac.setDebug(ctxt.getOptions().getClassDebugInfo());
           javac.setSrcdir(srcPath);
           javac.setOptimize(! ctxt.getOptions().getClassDebugInfo() );
  @@ -279,7 +284,8 @@
           }
   
           // Build includes path
  -        javac.setIncludes(ctxt.getJspPath());
  +        PatternSet.NameEntry includes = javac.createInclude();
  +        includes.setName(ctxt.getJspPath());
   
           try {
               javac.execute();
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to