From: markt Date: Wed, 8 Dec 2010 01:12:03 +0000 (+0000) Subject: Jasper should not depend on Catalina X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=42d81f0acd161d61fba4f5a92e544787b6c8d370;p=tomcat7.0 Jasper should not depend on Catalina 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 --- diff --git a/java/org/apache/jasper/Constants.java b/java/org/apache/jasper/Constants.java index 694017661..ec2024aa1 100644 --- a/java/org/apache/jasper/Constants.java +++ b/java/org/apache/jasper/Constants.java @@ -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"; } diff --git a/java/org/apache/jasper/compiler/AntCompiler.java b/java/org/apache/jasper/compiler/AntCompiler.java index d59a89096..c3d70712e 100644 --- a/java/org/apache/jasper/compiler/AntCompiler.java +++ b/java/org/apache/jasper/compiler/AntCompiler.java @@ -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); }