You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2002/05/24 01:34:45 UTC
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
remm 02/05/23 16:34:45
Modified: jasper2/src/share/org/apache/jasper/compiler Compiler.java
Log:
- Misc improvements (non static, no sync).
Revision Changes Path
1.6 +35 -95 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Compiler.java 23 May 2002 06:53:23 -0000 1.5
+++ Compiler.java 23 May 2002 23:34:45 -0000 1.6
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v 1.5 2002/05/23 06:53:23 remm Exp $
- * $Revision: 1.5 $
- * $Date: 2002/05/23 06:53:23 $
+ * $Header: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v 1.6 2002/05/23 23:34:45 remm Exp $
+ * $Revision: 1.6 $
+ * $Date: 2002/05/23 23:34:45 $
*
* ====================================================================
*
@@ -94,32 +94,10 @@
// ----------------------------------------------------------------- Static
- protected static Project project;
- protected static Javac javac;
- protected static Path path;
- protected static Path srcPath;
-
- protected static CompilerBuildListener listener;
-
static {
System.setErr(new SystemLogHandler(System.err));
- // Initializing project
- project = new Project();
- project.init();
-
- // Initializing javac task
- javac = (Javac) project.createTask("javac");
-
- // Initializing paths
- path = new Path(project);
- srcPath = new Path(project);
-
- // Initializing listener
- listener = new CompilerBuildListener();
- project.addBuildListener(listener);
-
}
@@ -132,6 +110,8 @@
private ErrorDispatcher errDispatcher;
private PageInfo pageInfo;
+ protected Project project;
+
// ------------------------------------------------------------ Constructor
@@ -139,6 +119,9 @@
public Compiler(JspCompilationContext ctxt) {
this.ctxt = ctxt;
this.errDispatcher = new ErrorDispatcher();
+ // Initializing project
+ project = new Project();
+ project.init();
}
@@ -212,43 +195,43 @@
String errorReport = null;
boolean success = true;
- // Call the actual Java compiler
- synchronized (project) {
-
- path.setPath(System.getProperty("java.class.path") + sep
- + classpath);
- srcPath.setPath(ctxt.getOutputDir());
-
- /*
- * Configure the compiler object
- */
- javac.setEncoding(javaEncoding);
- javac.setClasspath(path);
- if (ctxt.getJavacOutputDir() != null) {
- javac.setDestdir(new File(ctxt.getJavacOutputDir()));
- }
- javac.setDebug(ctxt.getOptions().getClassDebugInfo());
- javac.setSrcdir(srcPath);
-
- listener.clear();
+ // Initializing javac task
+ Javac javac = (Javac) project.createTask("javac");
- SystemLogHandler.setThread();
+ // Initializing paths
+ Path path = new Path(project);
+ Path srcPath = new Path(project);
- try {
- javac.execute();
- } catch (BuildException e) {
- success = false;
- }
+ path.setPath(System.getProperty("java.class.path") + sep
+ + classpath);
+ srcPath.setPath(ctxt.getOutputDir());
+
+ /*
+ * Configure the compiler object
+ */
+ javac.setEncoding(javaEncoding);
+ javac.setClasspath(path);
+ if (ctxt.getJavacOutputDir() != null) {
+ javac.setDestdir(new File(ctxt.getJavacOutputDir()));
+ }
+ javac.setDebug(ctxt.getOptions().getClassDebugInfo());
+ javac.setSrcdir(srcPath);
- errorReport = SystemLogHandler.unsetThread();
+ SystemLogHandler.setThread();
+ try {
+ javac.execute();
+ } catch (BuildException e) {
+ success = false;
}
+ errorReport = SystemLogHandler.unsetThread();
+
if (!ctxt.keepGenerated()) {
File javaFile = new File(javaFileName);
javaFile.delete();
}
-
+
if (!success) {
errDispatcher.javacError(errorReport, javaFileName, pageNodes);
}
@@ -363,49 +346,6 @@
} catch (Exception e) {
//Remove as much as possible, ignore possible exceptions
}
- }
-
-
- // -------------------------------------- CompilerBuildListener Inner Class
-
-
- protected static class CompilerBuildListener
- implements BuildListener {
-
- protected StringBuffer report = null;
-
- public String getReport() {
- return report.toString();
- }
-
- public void clear() {
- report = new StringBuffer();
- }
-
- public void buildStarted(BuildEvent event) {
- }
-
- public void buildFinished(BuildEvent event) {
- }
-
- public void targetStarted(BuildEvent event) {
- }
-
- public void targetFinished(BuildEvent event) {
- }
-
- public void taskStarted(BuildEvent event) {
- }
-
- public void taskFinished(BuildEvent event) {
- }
-
- public void messageLogged(BuildEvent event) {
- String line = event.getMessage();
- report.append(line);
- report.append("\n");
- }
-
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>