Jasper should not depend on Catalina
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 8 Dec 2010 01:12:03 +0000 (01:12 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 8 Dec 2010 01:12:03 +0000 (01:12 +0000)
Re-use constants where possible
Fix a FindBugs niggle

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1043263 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/jasper/Constants.java
java/org/apache/jasper/compiler/AntCompiler.java

index 6940176..ec2024a 100644 (file)
@@ -214,4 +214,15 @@ public class Constants {
         System.getProperty("org.apache.catalina.SESSION_PARAMETER_NAME",
                 "jsessionid");
 
+    /**
+     * Name of the system property containing
+     * the tomcat product installation path
+     */
+    public static final String CATALINA_HOME_PROP = "catalina.home";
+
+    /**
+     * Name of the system property containing
+     * the tomcat instance installation path
+     */
+    public static final String CATALINA_BASE_PROP = "catalina.base";
 }
index d59a890..c3d7071 100644 (file)
@@ -24,7 +24,7 @@ import java.io.IOException;
 import java.io.PrintStream;
 import java.util.StringTokenizer;
 
-import org.apache.catalina.Globals;
+import org.apache.jasper.Constants;
 import org.apache.jasper.JasperException;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
@@ -75,8 +75,8 @@ public class AntCompiler extends Compiler {
         logger.setErrorPrintStream(System.err);
         logger.setMessageOutputLevel(Project.MSG_INFO);
         project.addBuildListener( logger);
-        if (System.getProperty(Globals.CATALINA_HOME_PROP) != null) {
-            project.setBasedir(System.getProperty(Globals.CATALINA_HOME_PROP));
+        if (System.getProperty(Constants.CATALINA_HOME_PROP) != null) {
+            project.setBasedir(System.getProperty(Constants.CATALINA_HOME_PROP));
         }
         
         if( options.getCompiler() != null ) {
@@ -88,7 +88,7 @@ public class AntCompiler extends Compiler {
         return project;
     }
     
-    public class JasperAntLogger extends DefaultLogger {
+    public static class JasperAntLogger extends DefaultLogger {
         
         protected StringBuilder reportBuf = new StringBuilder();
         
@@ -101,7 +101,7 @@ public class AntCompiler extends Compiler {
         @Override
         protected void log(String message) {
             reportBuf.append(message);
-            reportBuf.append(System.getProperty("line.separator"));
+            reportBuf.append(Constants.NEWLINE);
         }
         
         protected String getReport() {
@@ -245,7 +245,7 @@ public class AntCompiler extends Compiler {
         // Stop capturing the System.err output for this thread
         String errorCapture = SystemLogHandler.unsetThread();
         if (errorCapture != null) {
-            errorReport.append(System.getProperty("line.separator"));
+            errorReport.append(Constants.NEWLINE);
             errorReport.append(errorCapture);
         }