tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
Date Thu, 20 Jun 2002 22:55:12 GMT
costin      2002/06/20 15:55:12

  Modified:    jasper2/src/share/org/apache/jasper/compiler Compiler.java
  Log:
  Aparently plugging a different ant logger creates some problems.
  
  Set optimize to the reverse of debug - if debug is enabled we also need
  optimize disabled otherwise line numbers get lost.  Many compilers ignore
  the flag anyway.
  
  Also few changes to make sure the servlet is loaded, part of work to
  detect dependencies from CLI.
  
  Revision  Changes    Path
  1.17      +34 -13    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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Compiler.java	15 Jun 2002 00:12:22 -0000	1.16
  +++ Compiler.java	20 Jun 2002 22:55:12 -0000	1.17
  @@ -64,6 +64,7 @@
   import java.io.*;
   import java.net.URL;
   import javax.servlet.jsp.tagext.TagInfo;
  +import javax.servlet.ServletException;
   
   import org.xml.sax.Attributes;
   
  @@ -142,12 +143,15 @@
           // Initializing project
           project = new Project();
           // XXX We should use a specialized logger to redirect to jasperlog
  -        DefaultLogger bl=new JasperAntLogger();
  -        bl.setOutputPrintStream(System.out);
  +        //        DefaultLogger bl=new JasperAntLogger();
  +        DefaultLogger bl=new DefaultLogger();
  +        bl.setOutputPrintStream(System.err);
           bl.setErrorPrintStream(System.err);
   
           if( Constants.jasperLog.getVerbosityLevel() >= Logger.DEBUG ) {
               bl.setMessageOutputLevel( Project.MSG_VERBOSE );
  +        } else {
  +            bl.setMessageOutputLevel( Project.MSG_INFO );
           }
           project.addBuildListener( bl );
           
  @@ -156,6 +160,12 @@
               project.setProperty("build.compiler", options.getCompiler() );
           }
           project.init();
  +//         Vector v=project.getBuildListeners();
  +//         if( v.size() > 0 ) {
  +//             BuildListener bl=(BuildListener)v.elementAt(0);
  +//             System.out.println("XXX " + bl );
  +//             ((DefaultLogger)bl).setMessageOutputLevel(Project.MSG_VERBOSE);
  +//         }
           return project;
       }
   
  @@ -246,6 +256,9 @@
           String errorReport = null;
           boolean success = true;
   
  +        // Start capturing the System.err output for this thread
  +        SystemLogHandler.setThread();
  +
           // Initializing javac task
           getProject();
           Javac javac = (Javac) project.createTask("javac");
  @@ -265,7 +278,7 @@
           //javac.setDestdir(new File(options.getScratchDir().getAbsolutePath()));
           javac.setDebug(ctxt.getOptions().getClassDebugInfo());
           javac.setSrcdir(srcPath);
  -        javac.setOptimize(true);
  +        javac.setOptimize(! ctxt.getOptions().getClassDebugInfo() );
   
           // Set the Java compiler to use
           if (options.getCompiler() != null) {
  @@ -275,13 +288,11 @@
           // Build includes path
           javac.setIncludes(ctxt.getJspPath());
   
  -        // Start capturing the System.err output for this thread
  -        SystemLogHandler.setThread();
  -
           try {
               javac.execute();
           } catch (BuildException e) {
  -            e.printStackTrace();
  +            //   System.out.println("Javac execption ");
  +            //   e.printStackTrace(System.out);
               success = false;
           }
   
  @@ -295,8 +306,9 @@
   
           if (!success) {
               Constants.jasperLog.log( "Error compiling file: " + javaFileName + " " + errorReport,
  -                               Logger.ERROR);
  -            errDispatcher.javacError(errorReport, javaFileName, pageNodes);
  +                                     Logger.ERROR);
  +            if(errorReport!=null ) 
  +                errDispatcher.javacError(errorReport, javaFileName, pageNodes);
           }
       }
   
  @@ -356,6 +368,7 @@
           }
           targetLastModified = targetFile.lastModified();
           if (targetLastModified < jspRealLastModified) {
  +            //System.out.println("Compiler: outdated, " + targetFile + " " + targetLastModified
);
               return true;
           }
   
  @@ -363,8 +376,14 @@
           if( jsw==null ) {
               return false;
           }
  -        HttpJspBase servlet = jsw.getServlet();
  +        HttpJspBase servlet=null;
  +        try {
  +            servlet = jsw.getServlet();
  +        } catch( ServletException ex1 ) {
  +        } catch( IOException ex2 ) {
  +        }
           if (servlet == null) {
  +            // System.out.println("Compiler: outdated, no servlet " + targetFile );
               return true;
           }
           List includes = servlet.getIncludes();
  @@ -378,10 +397,12 @@
               try {
                   URL includeUrl = ctxt.getResource(include);
                   if (includeUrl == null) {
  +                    System.out.println("Compiler: outdated, no includeUri " + include );
                       return true;
                   }
                   if (includeUrl.openConnection().getLastModified() >
                       targetLastModified) {
  +                    System.out.println("Compiler: outdated, include old " + include );
                       return true;
                   }
               } catch (Exception e) {
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message