You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by lu...@apache.org on 2003/01/22 21:08:25 UTC
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/xmlparser ASCIIReader.java ParserUtils.java UTF8Reader.java XercesEncodingDetector.java
luehe 2003/01/22 12:08:25
Modified: jasper2/src/share/org/apache/jasper Constants.java
EmbededServletOptions.java JspC.java
JspCompilationContext.java
jasper2/src/share/org/apache/jasper/compiler
DefaultErrorHandler.java ErrorDispatcher.java
JspConfig.java JspDocumentParser.java
JspRuntimeContext.java JspUtil.java
ParserController.java TagLibraryInfoImpl.java
TldLocationsCache.java Validator.java
jasper2/src/share/org/apache/jasper/resources
messages.properties messages_es.properties
messages_fr.properties messages_ja.properties
jasper2/src/share/org/apache/jasper/runtime HttpJspBase.java
JspRuntimeLibrary.java JspWriterImpl.java
PageContextImpl.java
jasper2/src/share/org/apache/jasper/servlet JspServlet.java
JspServletWrapper.java
jasper2/src/share/org/apache/jasper/xmlparser
ASCIIReader.java ParserUtils.java UTF8Reader.java
XercesEncodingDetector.java
Added: jasper2/src/share/org/apache/jasper/compiler Localizer.java
Log:
First pass at replacing calls to org.apache.jasper.logging.Logger with
commons-logging.
Also removed any localization of error message codes from
org.apache.jasper.Constants.
Revision Changes Path
1.11 +0 -80 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/Constants.java
Index: Constants.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/Constants.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Constants.java 28 Nov 2002 04:18:07 -0000 1.10
+++ Constants.java 22 Jan 2003 20:08:23 -0000 1.11
@@ -141,8 +141,6 @@
* Default tag handler pool size.
*/
public static final int MAX_POOL_SIZE = 5;
- public static final Integer MAX_POOL_SIZE_INTEGER
- = new Integer(MAX_POOL_SIZE);
/**
* The query parameter that causes the JSP engine to just
@@ -228,84 +226,6 @@
*/
public static final String TEMP_VARIABLE_NAME_PREFIX =
"_jspx_temp";
-
- /**
- * This is where all our error messages and such are stored.
- */
- private static ResourceBundle resources;
-
- private static void initResources() {
- try {
- resources =
- ResourceBundle.getBundle("org.apache.jasper.resources.messages");
- } catch (MissingResourceException e) {
- throw new Error("Fatal Error: missing resource bundle: "+e.getClassName());
- }
- }
-
- /**
- * Get hold of a "message" or any string from our resources
- * database.
- */
- public static final String getString(String key) {
- return getString(key, null);
- }
-
- /**
- * Format the string that is looked up using "key" using "args".
- */
- public static final String getString(String key, Object[] args) {
- if (resources == null)
- initResources();
-
- try {
- String msg = resources.getString(key);
- if (args == null)
- return msg;
- MessageFormat form = new MessageFormat(msg);
- return form.format(args);
- } catch (MissingResourceException ignore) {
- throw new Error("Fatal Error: missing resource: "+ignore.getClassName());
- }
- }
-
- /**
- * Print a message into standard error with a certain verbosity
- * level.
- *
- * @param key is used to look up the text for the message (using
- * getString()).
- * @param verbosityLevel is used to determine if this output is
- * appropriate for the current verbosity
- * level.
- */
- public static final void message(String key, int verbosityLevel) {
- message(key, null, verbosityLevel);
- }
-
-
- /**
- * Print a message into standard error with a certain verbosity
- * level after formatting it using "args".
- *
- * @param key is used to look up the message.
- * @param args is used to format the message.
- * @param verbosityLevel is used to determine if this output is
- * appropriate for the current verbosity
- * level.
- */
- public static final void message(String key, Object[] args, int verbosityLevel) {
- if (jasperLog == null) {
- jasperLog = Logger.getLogger("JASPER_LOG");
- if (jasperLog == null) {
- jasperLog = Logger.getDefaultLogger();
- }
- }
-
- if (jasperLog != null) {
- jasperLog.log(getString(key, args), verbosityLevel);
- }
- }
public static Logger jasperLog = null;
}
1.18 +91 -49 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbededServletOptions.java
Index: EmbededServletOptions.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbededServletOptions.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- EmbededServletOptions.java 1 Jan 2003 15:21:01 -0000 1.17
+++ EmbededServletOptions.java 22 Jan 2003 20:08:23 -0000 1.18
@@ -62,18 +62,18 @@
package org.apache.jasper;
import java.io.File;
+import java.util.*;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
-import org.apache.jasper.logging.Logger;
-
import org.apache.jasper.compiler.TldLocationsCache;
import org.apache.jasper.compiler.JspConfig;
import org.apache.jasper.compiler.TagPluginManager;
+import org.apache.jasper.compiler.Localizer;
import org.apache.jasper.xmlparser.ParserUtils;
-
-import java.util.*;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* A class to hold all init parameters specific to the JSP engine.
@@ -83,7 +83,11 @@
* @author Pierre Delisle
*/
public final class EmbededServletOptions implements Options {
- private Properties settings=new Properties();
+
+ // Logger
+ private static Log log = LogFactory.getLog(EmbededServletOptions.class);
+
+ private Properties settings = new Properties();
/**
* Is Jasper being used in development mode?
@@ -342,21 +346,29 @@
String keepgen = config.getInitParameter("keepgenerated");
if (keepgen != null) {
- if (keepgen.equalsIgnoreCase("true"))
+ if (keepgen.equalsIgnoreCase("true")) {
this.keepGenerated = true;
- else if (keepgen.equalsIgnoreCase("false"))
+ } else if (keepgen.equalsIgnoreCase("false")) {
this.keepGenerated = false;
- else Constants.message ("jsp.warning.keepgen", Logger.WARNING);
+ } else {
+ if (log.isWarnEnabled()) {
+ log.warn(Localizer.getMessage("jsp.warning.keepgen"));
+ }
+ }
}
String largeFile = config.getInitParameter("largefile");
if (largeFile != null) {
- if (largeFile.equalsIgnoreCase("true"))
+ if (largeFile.equalsIgnoreCase("true")) {
this.largeFile = true;
- else if (largeFile.equalsIgnoreCase("false"))
+ } else if (largeFile.equalsIgnoreCase("false")) {
this.largeFile = false;
- else Constants.message ("jsp.warning.largeFile", Logger.WARNING);
+ } else {
+ if (log.isWarnEnabled()) {
+ log.warn(Localizer.getMessage("jsp.warning.largeFile"));
+ }
+ }
}
this.isPoolingEnabled = true;
@@ -364,10 +376,13 @@
= config.getInitParameter("enablePooling");
if (poolingEnabledParam != null
&& !poolingEnabledParam.equalsIgnoreCase("true")) {
- if (poolingEnabledParam.equalsIgnoreCase("false"))
+ if (poolingEnabledParam.equalsIgnoreCase("false")) {
this.isPoolingEnabled = false;
- else Constants.message("jsp.warning.enablePooling",
- Logger.WARNING);
+ } else {
+ if (log.isWarnEnabled()) {
+ log.warn(Localizer.getMessage("jsp.warning.enablePooling"));
+ }
+ }
}
String tagPoolSizeParam = config.getInitParameter("tagPoolSize");
@@ -376,42 +391,56 @@
this.tagPoolSize = Integer.parseInt(tagPoolSizeParam);
if (this.tagPoolSize <= 0) {
this.tagPoolSize = Constants.MAX_POOL_SIZE;
- Constants.message("jsp.warning.invalidTagPoolSize",
- new Object[] { Constants.MAX_POOL_SIZE_INTEGER },
- Logger.WARNING);
+ if (log.isWarnEnabled()) {
+ log.warn(Localizer.getMessage("jsp.warning.invalidTagPoolSize",
+ Integer.toString(Constants.MAX_POOL_SIZE)));
+ }
}
} catch(NumberFormatException ex) {
- Constants.message("jsp.warning.invalidTagPoolSize",
- new Object[] { Constants.MAX_POOL_SIZE_INTEGER },
- Logger.WARNING);
+ if (log.isWarnEnabled()) {
+ log.warn(Localizer.getMessage("jsp.warning.invalidTagPoolSize",
+ Integer.toString(Constants.MAX_POOL_SIZE)));
+ }
}
}
String mapFile = config.getInitParameter("mappedfile");
if (mapFile != null) {
- if (mapFile.equalsIgnoreCase("true"))
+ if (mapFile.equalsIgnoreCase("true")) {
this.mappedFile = true;
- else if (mapFile.equalsIgnoreCase("false"))
+ } else if (mapFile.equalsIgnoreCase("false")) {
this.mappedFile = false;
- else Constants.message ("jsp.warning.mappedFile", Logger.WARNING);
+ } else {
+ if (log.isWarnEnabled()) {
+ log.warn(Localizer.getMessage("jsp.warning.mappedFile"));
+ }
+ }
}
String senderr = config.getInitParameter("sendErrToClient");
if (senderr != null) {
- if (senderr.equalsIgnoreCase("true"))
+ if (senderr.equalsIgnoreCase("true")) {
this.sendErrorToClient = true;
- else if (senderr.equalsIgnoreCase("false"))
+ } else if (senderr.equalsIgnoreCase("false")) {
this.sendErrorToClient = false;
- else Constants.message ("jsp.warning.sendErrToClient", Logger.WARNING);
+ } else {
+ if (log.isWarnEnabled()) {
+ log.warn(Localizer.getMessage("jsp.warning.sendErrToClient"));
+ }
+ }
}
String debugInfo = config.getInitParameter("classdebuginfo");
if (debugInfo != null) {
- if (debugInfo.equalsIgnoreCase("true"))
+ if (debugInfo.equalsIgnoreCase("true")) {
this.classDebugInfo = true;
- else if (debugInfo.equalsIgnoreCase("false"))
+ } else if (debugInfo.equalsIgnoreCase("false")) {
this.classDebugInfo = false;
- else Constants.message ("jsp.warning.classDebugInfo", Logger.WARNING);
+ } else {
+ if (log.isWarnEnabled()) {
+ log.warn(Localizer.getMessage("jsp.warning.classDebugInfo"));
+ }
+ }
}
String checkInterval = config.getInitParameter("checkInterval");
@@ -420,30 +449,41 @@
this.checkInterval = Integer.parseInt(checkInterval);
if (this.checkInterval == 0) {
this.checkInterval = 300;
- Constants.message("jsp.warning.checkInterval",
- Logger.WARNING);
+ if (log.isWarnEnabled()) {
+ log.warn(Localizer.getMessage("jsp.warning.checkInterval"));
+ }
}
} catch(NumberFormatException ex) {
- Constants.message ("jsp.warning.checkInterval", Logger.WARNING);
+ if (log.isWarnEnabled()) {
+ log.warn(Localizer.getMessage("jsp.warning.checkInterval"));
+ }
}
}
String development = config.getInitParameter("development");
if (development != null) {
- if (development.equalsIgnoreCase("true"))
+ if (development.equalsIgnoreCase("true")) {
this.development = true;
- else if (development.equalsIgnoreCase("false"))
+ } else if (development.equalsIgnoreCase("false")) {
this.development = false;
- else Constants.message ("jsp.warning.development", Logger.WARNING);
+ } else {
+ if (log.isWarnEnabled()) {
+ log.warn(Localizer.getMessage("jsp.warning.development"));
+ }
+ }
}
String reloading = config.getInitParameter("reloading");
if (reloading != null) {
- if (reloading.equalsIgnoreCase("true"))
+ if (reloading.equalsIgnoreCase("true")) {
this.reloading = true;
- else if (reloading.equalsIgnoreCase("false"))
+ } else if (reloading.equalsIgnoreCase("false")) {
this.reloading = false;
- else Constants.message ("jsp.warning.reloading", Logger.WARNING);
+ } else {
+ if (log.isWarnEnabled()) {
+ log.warn(Localizer.getMessage("jsp.warning.reloading"));
+ }
+ }
}
String ieClassId = config.getInitParameter("ieClassId");
@@ -472,16 +512,14 @@
}
}
if (this.scratchDir == null) {
- Constants.message("jsp.error.no.scratch.dir", Logger.FATAL);
+ log.fatal(Localizer.getMessage("jsp.error.no.scratch.dir"));
return;
}
if (!(scratchDir.exists() && scratchDir.canRead() &&
scratchDir.canWrite() && scratchDir.isDirectory()))
- Constants.message("jsp.error.bad.scratch.dir",
- new Object[] {
- scratchDir.getAbsolutePath()
- }, Logger.FATAL);
+ log.fatal(Localizer.getMessage("jsp.error.bad.scratch.dir",
+ scratchDir.getAbsolutePath()));
this.compiler = config.getInitParameter("compiler");
@@ -492,11 +530,15 @@
String fork = config.getInitParameter("fork");
if (fork != null) {
- if (fork.equalsIgnoreCase("true"))
+ if (fork.equalsIgnoreCase("true")) {
this.fork = true;
- else if (fork.equalsIgnoreCase("false"))
+ } else if (fork.equalsIgnoreCase("false")) {
this.fork = false;
- else Constants.message ("jsp.warning.fork", Logger.WARNING);
+ } else {
+ if (log.isWarnEnabled()) {
+ log.warn(Localizer.getMessage("jsp.warning.fork"));
+ }
+ }
}
// Setup the global Tag Libraries location cache for this
1.27 +41 -29 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java
Index: JspC.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- JspC.java 22 Jan 2003 19:00:35 -0000 1.26
+++ JspC.java 22 Jan 2003 20:08:23 -0000 1.27
@@ -71,11 +71,14 @@
import org.apache.jasper.servlet.JspCServletContext;
-import org.apache.jasper.logging.Logger;
-import org.apache.jasper.logging.JasperLogger;
import org.apache.jasper.compiler.JspConfig;
import org.apache.jasper.compiler.JspConfig;
import org.apache.jasper.compiler.TagPluginManager;
+import org.apache.jasper.compiler.Localizer;
+import org.apache.jasper.logging.Logger;
+import org.apache.jasper.logging.JasperLogger;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* Shell for the jspc compiler. Handles all options associated with the
@@ -116,6 +119,9 @@
public static final String DEFAULT_IE_CLASS_ID =
"clsid:8AD9C840-044E-11D1-B3E9-00805F499D93";
+ // Logger
+ private static Log log = LogFactory.getLog(JspC.class);
+
public static final String SWITCH_VERBOSE = "-v";
public static final String SWITCH_QUIET = "-q";
public static final String SWITCH_OUTPUT_DIR = "-d";
@@ -190,7 +196,7 @@
CharArrayWriter servletout;
CharArrayWriter mappingout;
- static PrintStream log;
+ static PrintStream logStream;
JspCServletContext context;
@@ -586,18 +592,21 @@
// Generate mapping
generateWebMapping( file, clctxt );
if ( showSuccess ) {
- log.println( "Built File: " + file );
+ logStream.println( "Built File: " + file );
}
return true;
} catch (FileNotFoundException fne) {
- Constants.message("jspc.error.fileDoesNotExist",
- new Object[] {fne.getMessage()}, Logger.WARNING);
+ if (log.isWarnEnabled()) {
+ log.warn(Localizer.getMessage("jspc.error.fileDoesNotExist",
+ fne.getMessage()));
+ }
throw new JasperException( fne );
} catch (Exception e) {
- Constants.message("jspc.error.generalException",
- new Object[] {file, e}, Logger.ERROR);
+ log.error(Localizer.getMessage("jspc.error.generalException",
+ file),
+ e);
if ( listErrors ) {
- log.println( "Error in File: " + file );
+ logStream.println( "Error in File: " + file );
return true;
} else if (dieLevel != NO_DIE_LEVEL) {
dieOnExit = true;
@@ -623,9 +632,10 @@
if (g.exists() && g.isDirectory()) {
uriRoot = f.getCanonicalPath();
uriBase = tUriBase;
- Constants.message("jspc.implicit.uriRoot",
- new Object[] { uriRoot },
- Logger.INFORMATION);
+ if (log.isInfoEnabled()) {
+ log.info(Localizer.getMessage("jspc.implicit.uriRoot",
+ uriRoot));
+ }
break;
}
if (f.exists() && f.isDirectory()) {
@@ -717,9 +727,9 @@
mappingout = null;
}
if (webxmlLevel >= ALL_WEBXML) {
- mapout.write(Constants.getString("jspc.webxml.header"));
+ mapout.write(Localizer.getMessage("jspc.webxml.header"));
} else if (webxmlLevel>= INC_WEBXML) {
- mapout.write(Constants.getString("jspc.webinc.header"));
+ mapout.write(Localizer.getMessage("jspc.webinc.header"));
}
} catch (IOException ioe) {
mapout = null;
@@ -734,9 +744,9 @@
servletout.writeTo(mapout);
mappingout.writeTo(mapout);
if (webxmlLevel >= ALL_WEBXML) {
- mapout.write(Constants.getString("jspc.webxml.footer"));
+ mapout.write(Localizer.getMessage("jspc.webxml.footer"));
} else if (webxmlLevel >= INC_WEBXML) {
- mapout.write(Constants.getString("jspc.webinc.footer"));
+ mapout.write(Localizer.getMessage("jspc.webinc.footer"));
}
mapout.close();
} catch (IOException ioe) {
@@ -777,7 +787,8 @@
File uriRootF = new File(uriRoot);
if (!uriRootF.exists() || !uriRootF.isDirectory()) {
- throw new JasperException(Constants.getString("jsp.error.jspc.uriroot_not_dir"));
+ throw new JasperException(
+ Localizer.getMessage("jsp.error.jspc.uriroot_not_dir"));
}
if( context==null )
@@ -791,8 +802,10 @@
try {
File fjsp = new File(nextjsp);
if (!fjsp.exists()) {
- Constants.message("jspc.error.fileDoesNotExist",
- new Object[] {fjsp}, Logger.WARNING);
+ if (log.isWarnEnabled()) {
+ log.warn(Localizer.getMessage("jspc.error.fileDoesNotExist",
+ fjsp.toString()));
+ }
continue;
}
String s = fjsp.getCanonicalPath();
@@ -824,10 +837,10 @@
public static void main(String arg[]) {
if (arg.length == 0) {
- System.out.println(Constants.getString("jspc.usage"));
+ System.out.println(Localizer.getMessage("jspc.usage"));
} else {
try {
- log=System.out;
+ logStream = System.out;
JspC jspc = new JspC();
jspc.setArgs(arg);
jspc.execute();
@@ -878,10 +891,9 @@
verbosityLevel
= Integer.parseInt(tok.substring(SWITCH_VERBOSE.length()));
} catch (NumberFormatException nfe) {
- log.println(
- "Verbosity level "
- + tok.substring(SWITCH_VERBOSE.length())
- + " is not valid. Option ignored.");
+ logStream.println("Verbosity level "
+ + tok.substring(SWITCH_VERBOSE.length())
+ + " is not valid. Option ignored.");
}
} else if (tok.equals(SWITCH_OUTPUT_DIR)) {
tok = nextArg();
@@ -959,7 +971,7 @@
* @param log
*/
public static void setLog( PrintStream log ) {
- JspC.log = log;
+ JspC.logStream = log;
}
/**
1.29 +10 -9 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspCompilationContext.java
Index: JspCompilationContext.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspCompilationContext.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- JspCompilationContext.java 18 Dec 2002 23:18:20 -0000 1.28
+++ JspCompilationContext.java 22 Jan 2003 20:08:23 -0000 1.29
@@ -71,6 +71,7 @@
import org.apache.jasper.compiler.JspRuntimeContext;
import org.apache.jasper.compiler.ServletWriter;
import org.apache.jasper.compiler.Compiler;
+import org.apache.jasper.compiler.Localizer;
import org.apache.jasper.servlet.JspServletWrapper;
import org.apache.jasper.servlet.JasperLoader;
@@ -574,8 +575,8 @@
throw ex;
} catch (Exception ex) {
ex.printStackTrace();
- throw new JasperException(
- Constants.getString("jsp.error.unable.compile"),ex);
+ throw new JasperException(Localizer.getMessage("jsp.error.unable.compile"),
+ ex);
}
}
}
@@ -608,11 +609,11 @@
}
servletClass = jspLoader.loadClass(name);
} catch (ClassNotFoundException cex) {
- throw new JasperException(
- Constants.getString("jsp.error.unable.load"),cex);
+ throw new JasperException(Localizer.getMessage("jsp.error.unable.load"),
+ cex);
} catch (Exception ex) {
- throw new JasperException
- (Constants.getString("jsp.error.unable.compile"), ex);
+ throw new JasperException(Localizer.getMessage("jsp.error.unable.compile"),
+ ex);
}
removed = 0;
reload = false;
1.6 +7 -17 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/DefaultErrorHandler.java
Index: DefaultErrorHandler.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/DefaultErrorHandler.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DefaultErrorHandler.java 4 Nov 2002 20:43:07 -0000 1.5
+++ DefaultErrorHandler.java 22 Jan 2003 20:08:24 -0000 1.6
@@ -69,17 +69,6 @@
*/
class DefaultErrorHandler implements ErrorHandler {
- private ErrorDispatcher err;
-
- /*
- * Constructor.
- *
- * @param err Error dispatcher for localization support
- */
- DefaultErrorHandler(ErrorDispatcher err) {
- this.err = err;
- }
-
/*
* Processes the given JSP parse error.
*
@@ -121,13 +110,14 @@
new Integer(details[i].getJspBeginLineNumber()),
details[i].getJspFileName()
};
- buf.append(err.getString("jsp.error.single.line.number", args));
- buf.append(err.getString("jsp.error.corresponding.servlet"));
+ buf.append(Localizer.getMessage("jsp.error.single.line.number",
+ args));
+ buf.append(Localizer.getMessage("jsp.error.corresponding.servlet"));
buf.append(details[i].getErrorMessage());
buf.append('\n');
}
- throw new JasperException(err.getString("jsp.error.unable.compile")
+ throw new JasperException(Localizer.getMessage("jsp.error.unable.compile")
+ buf);
}
}
1.9 +5 -103 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ErrorDispatcher.java
Index: ErrorDispatcher.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ErrorDispatcher.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ErrorDispatcher.java 11 Dec 2002 22:34:06 -0000 1.8
+++ ErrorDispatcher.java 22 Jan 2003 20:08:24 -0000 1.9
@@ -93,7 +93,7 @@
*/
public ErrorDispatcher() {
// XXX check web.xml for custom error handler
- errHandler = new DefaultErrorHandler(this);
+ errHandler = new DefaultErrorHandler();
}
/*
@@ -307,104 +307,6 @@
errHandler.javacError(errDetails);
}
- /*
- * Returns the localized error message corresponding to the given error
- * code.
- *
- * If the given error code is not defined in the resource bundle for
- * localized error messages, it is used as the error message.
- *
- * @param errCode Error code to localize
- *
- * @return Localized error message
- */
- public String getString(String errCode) {
- String errMsg = errCode;
- try {
- errMsg = bundle.getString(errCode);
- } catch (MissingResourceException e) {
- }
- return errMsg;
- }
-
- /*
- * Returns the localized error message corresponding to the given error
- * code.
- *
- * If the given error code is not defined in the resource bundle for
- * localized error messages, it is used as the error message.
- *
- * @param errCode Error code to localize
- * @param arg Argument for parametric replacement
- *
- * @return Localized error message
- */
- public String getString(String errCode, String arg) {
- return getString(errCode, new Object[] {arg});
- }
-
- /*
- * Returns the localized error message corresponding to the given error
- * code.
- *
- * If the given error code is not defined in the resource bundle for
- * localized error messages, it is used as the error message.
- *
- * @param errCode Error code to localize
- * @param arg1 First argument for parametric replacement
- * @param arg2 Second argument for parametric replacement
- *
- * @return Localized error message
- */
- public String getString(String errCode, String arg1, String arg2) {
- return getString(errCode, new Object[] {arg1, arg2});
- }
-
- /*
- * Returns the localized error message corresponding to the given error
- * code.
- *
- * If the given error code is not defined in the resource bundle for
- * localized error messages, it is used as the error message.
- *
- * @param errCode Error code to localize
- * @param arg1 First argument for parametric replacement
- * @param arg2 Second argument for parametric replacement
- * @param arg3 Third argument for parametric replacement
- *
- * @return Localized error message
- */
- public String getString(String errCode, String arg1, String arg2,
- String arg3) {
- return getString(errCode, new Object[] {arg1, arg2, arg3});
- }
-
- /*
- * Returns the localized error message corresponding to the given error
- * code.
- *
- * If the given error code is not defined in the resource bundle for
- * localized error messages, it is used as the error message.
- *
- * @param errCode Error code to localize
- * @param args Arguments for parametric replacement
- *
- * @return Localized error message
- */
- public String getString(String errCode, Object[] args) {
- String errMsg = errCode;
- try {
- errMsg = bundle.getString(errCode);
- if (args != null) {
- MessageFormat formatter = new MessageFormat(errMsg);
- errMsg = formatter.format(args);
- }
- } catch (MissingResourceException e) {
- }
-
- return errMsg;
- }
-
//*********************************************************************
// Private utility methods
@@ -431,7 +333,7 @@
// Localize
if (errCode != null) {
- errMsg = getString(errCode, args);
+ errMsg = Localizer.getMessage(errCode, args);
} else if (e != null) {
// give a hint about what's wrong
errMsg = e.getMessage();
1.6 +13 -10 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspConfig.java
Index: JspConfig.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspConfig.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- JspConfig.java 9 Oct 2002 18:25:39 -0000 1.5
+++ JspConfig.java 22 Jan 2003 20:08:24 -0000 1.6
@@ -68,11 +68,11 @@
import javax.servlet.ServletContext;
import org.apache.jasper.Constants;
-import org.apache.jasper.logging.Logger;
import org.apache.jasper.JasperException;
import org.apache.jasper.xmlparser.ParserUtils;
import org.apache.jasper.xmlparser.TreeNode;
-
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* Handles the jsp-config element in WEB_INF/web.xml. This is used
@@ -83,7 +83,10 @@
public class JspConfig {
- static private final String WEB_XML = "/WEB-INF/web.xml";
+ private static final String WEB_XML = "/WEB-INF/web.xml";
+
+ // Logger
+ private static Log log = LogFactory.getLog(JspConfig.class);
private Vector jspProperties = null;
private ServletContext ctxt;
@@ -182,10 +185,10 @@
} else if (file.startsWith("*.")) {
extension = file.substring(file.indexOf('.')+1);
} else {
- Constants.message(
- "jsp.warning.bad.urlpattern.propertygroup",
- new Object[] {urlPattern},
- Logger.WARNING);
+ if (log.isWarnEnabled()) {
+ log.warn(Localizer.getMessage("jsp.warning.bad.urlpattern.propertygroup",
+ urlPattern));
+ }
continue;
}
}
1.35 +31 -24 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java
Index: JspDocumentParser.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- JspDocumentParser.java 18 Dec 2002 23:18:20 -0000 1.34
+++ JspDocumentParser.java 22 Jan 2003 20:08:24 -0000 1.35
@@ -226,8 +226,9 @@
try {
attrsCopy = addCustomTagLibraries(attrs);
} catch (JasperException je) {
- throw new SAXParseException( err.getString(
- "jsp.error.could.not.add.taglibraries" ), locator, je );
+ throw new SAXParseException(
+ Localizer.getMessage("jsp.error.could.not.add.taglibraries"),
+ locator, je );
}
if (qName.equals(JSP_ROOT)) {
@@ -241,7 +242,7 @@
} else if (qName.equals(JSP_PAGE_DIRECTIVE)) {
if (isTagFile) {
throw new SAXParseException(
- err.getString("jsp.error.action.istagfile", qName),
+ Localizer.getMessage("jsp.error.action.istagfile", qName),
locator);
}
node = new Node.PageDirective(attrsCopy, start, current);
@@ -286,7 +287,8 @@
} else if (qName.equals(JSP_TAG_DIRECTIVE)) {
if (!isTagFile) {
throw new SAXParseException(
- err.getString("jsp.error.action.isnottagfile", qName),
+ Localizer.getMessage("jsp.error.action.isnottagfile",
+ qName),
locator);
}
node = new Node.TagDirective(attrsCopy, start, current);
@@ -298,28 +300,32 @@
} else if (qName.equals(JSP_ATTRIBUTE_DIRECTIVE)) {
if (!isTagFile) {
throw new SAXParseException(
- err.getString("jsp.error.action.isnottagfile", qName),
+ Localizer.getMessage("jsp.error.action.isnottagfile",
+ qName),
locator);
}
node = new Node.AttributeDirective(attrsCopy, start, current);
} else if (qName.equals(JSP_VARIABLE_DIRECTIVE)) {
if (!isTagFile) {
throw new SAXParseException(
- err.getString("jsp.error.action.isnottagfile", qName),
+ Localizer.getMessage("jsp.error.action.isnottagfile",
+ qName),
locator);
}
node = new Node.VariableDirective(attrsCopy, start, current);
} else if (qName.equals(JSP_INVOKE)) {
if (!isTagFile) {
throw new SAXParseException(
- err.getString("jsp.error.action.isnottagfile", qName),
+ Localizer.getMessage("jsp.error.action.isnottagfile",
+ qName),
locator);
}
node = new Node.InvokeAction(attrsCopy, start, current);
} else if (qName.equals(JSP_DO_BODY)) {
if (!isTagFile) {
throw new SAXParseException(
- err.getString("jsp.error.action.isnottagfile", qName),
+ Localizer.getMessage("jsp.error.action.isnottagfile",
+ qName),
locator);
}
node = new Node.DoBodyAction(attrsCopy, start, current);
@@ -389,7 +395,8 @@
for (; ; i++) {
if (i >= limit) {
throw new SAXParseException(
- err.getString("jsp.error.unterminated", "${"),
+ Localizer.getMessage("jsp.error.unterminated",
+ "${"),
locator);
}
@@ -592,8 +599,8 @@
TagInfo tagInfo = tagLibInfo.getTag(shortName);
TagFileInfo tagFileInfo = tagLibInfo.getTagFile(shortName);
if (tagInfo == null && tagFileInfo == null) {
- throw new SAXException(err.getString("jsp.error.bad_tag",
- shortName, prefix));
+ throw new SAXException(Localizer.getMessage("jsp.error.bad_tag",
+ shortName, prefix));
}
Class tagHandlerClass = null;
if (tagFileInfo == null) {
@@ -601,9 +608,9 @@
tagHandlerClass
= ctxt.getClassLoader().loadClass(tagInfo.getTagClassName());
} catch (Exception e) {
- throw new SAXException(err.getString(
- "jsp.error.unable.loadclass",
- shortName, prefix));
+ throw new SAXException(
+ Localizer.getMessage("jsp.error.unable.loadclass",
+ shortName, prefix));
}
} else {
tagInfo = tagFileInfo.getTagInfo();
@@ -641,9 +648,9 @@
if( taglibs.containsKey( prefix ) ) {
// Prefix already in taglib map.
- throw new JasperException( err.getString(
- "jsp.error.xmlns.redefinition.notimplemented",
- prefix ) );
+ throw new JasperException(
+ Localizer.getMessage("jsp.error.xmlns.redefinition.notimplemented",
+ prefix));
}
// get the uri
@@ -715,7 +722,7 @@
elemType = JSP_DECLARATION;
if (scriptingElem instanceof Node.Expression)
elemType = JSP_EXPRESSION;
- String msg = err.getString(
+ String msg = Localizer.getMessage(
"jsp.error.parse.xml.scripting.invalid.body",
elemType);
throw new SAXException(msg);
@@ -761,9 +768,9 @@
try {
parserController.parse(fname, includeDir, null);
} catch (FileNotFoundException fnfe) {
- throw new SAXParseException(err.getString(
- "jsp.error.file.not.found", fname),
- locator, fnfe);
+ throw new SAXParseException(
+ Localizer.getMessage("jsp.error.file.not.found", fname),
+ locator, fnfe);
} catch (Exception e) {
throw new SAXException(e);
}
1.10 +20 -16 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspRuntimeContext.java
Index: JspRuntimeContext.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspRuntimeContext.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- JspRuntimeContext.java 28 Dec 2002 01:47:11 -0000 1.9
+++ JspRuntimeContext.java 22 Jan 2003 20:08:24 -0000 1.10
@@ -84,9 +84,10 @@
import org.apache.jasper.Constants;
import org.apache.jasper.JspCompilationContext;
import org.apache.jasper.Options;
-import org.apache.jasper.logging.Logger;
import org.apache.jasper.runtime.JspFactoryImpl;
import org.apache.jasper.servlet.JspServletWrapper;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* Class for tracking JSP compile time file dependencies when the
@@ -103,6 +104,9 @@
*/
public final class JspRuntimeContext implements Runnable {
+ // Logger
+ private static Log log = LogFactory.getLog(JspRuntimeContext.class);
+
/**
* Preload classes required at runtime by a JSP servlet so that
* we don't get a defineClassInPackage security exception.
@@ -170,16 +174,15 @@
parentClassLoader =
(URLClassLoader)this.getClass().getClassLoader();
}
- if (parentClassLoader != null) {
- Constants.message("jsp.message.parent_class_loader_is",
- new Object[] {
- parentClassLoader.toString()
- }, Logger.DEBUG);
- } else {
- Constants.message("jsp.message.parent_class_loader_is",
- new Object[] {
- "<none>"
- }, Logger.DEBUG);
+
+ if (log.isDebugEnabled()) {
+ if (parentClassLoader != null) {
+ log.debug(Localizer.getMessage("jsp.message.parent_class_loader_is",
+ parentClassLoader.toString()));
+ } else {
+ log.debug(Localizer.getMessage("jsp.message.parent_class_loader_is",
+ "<none>"));
+ }
}
initSecurity();
@@ -329,7 +332,8 @@
} catch (FileNotFoundException ex) {
ctxt.incrementRemoved();
} catch (Throwable t) {
- jsw.getServletContext().log("Background compile failed",t);
+ jsw.getServletContext().log("Background compile failed",
+ t);
}
}
}
1.28 +13 -19 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspUtil.java
Index: JspUtil.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspUtil.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- JspUtil.java 6 Jan 2003 18:57:15 -0000 1.27
+++ JspUtil.java 22 Jan 2003 20:08:24 -0000 1.28
@@ -75,7 +75,6 @@
import org.apache.jasper.Constants;
import org.apache.jasper.JspCompilationContext;
import org.apache.jasper.JasperException;
-import org.apache.jasper.logging.Logger;
import org.xml.sax.Attributes;
@@ -656,9 +655,8 @@
} while( ws.indexOf( paren ) != -1 );
if( !paren.equals( "(" ) ) {
- throw new JasperException( err.getString(
- "jsp.error.tld.fn.invalid.signature.parenexpected",
- tagName, this.methodName ) );
+ err.jspError("jsp.error.tld.fn.invalid.signature.parenexpected",
+ tagName, this.methodName);
}
// ( <arg-type> S? ( ',' S? <arg-type> S? )* )? ')'
@@ -673,9 +671,8 @@
ArrayList parameterTypes = new ArrayList();
do {
if( ",(".indexOf( argType ) != -1 ) {
- throw new JasperException( err.getString(
- "jsp.error.tld.fn.invalid.signature",
- tagName, this.methodName ) );
+ err.jspError("jsp.error.tld.fn.invalid.signature",
+ tagName, this.methodName);
}
parameterTypes.add(toClass(argType, loader));
@@ -689,9 +686,8 @@
break;
}
if( !comma.equals( "," ) ) {
- throw new JasperException( err.getString(
- "jsp.error.tld.fn.invalid.signature.commaexpected",
- tagName, this.methodName ) );
+ err.jspError("jsp.error.tld.fn.invalid.signature.commaexpected",
+ tagName, this.methodName);
}
// <arg-type>
@@ -704,14 +700,12 @@
}
}
catch( NoSuchElementException e ) {
- throw new JasperException( err.getString(
- "jsp.error.tld.fn.invalid.signature",
- tagName, this.methodName ) );
+ err.jspError("jsp.error.tld.fn.invalid.signature",
+ tagName, this.methodName);
}
catch( ClassNotFoundException e ) {
- throw new JasperException( err.getString(
- "jsp.error.tld.fn.invalid.signature.classnotfound",
- e.getMessage(), tagName, this.methodName ) );
+ err.jspError("jsp.error.tld.fn.invalid.signature.classnotfound",
+ e.getMessage(), tagName, this.methodName);
}
}
1.29 +0 -1 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ParserController.java
Index: ParserController.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ParserController.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- ParserController.java 18 Dec 2002 23:18:21 -0000 1.28
+++ ParserController.java 22 Jan 2003 20:08:24 -0000 1.29
@@ -62,7 +62,6 @@
import org.xml.sax.InputSource;
import org.xml.sax.Attributes;
import org.apache.jasper.*;
-import org.apache.jasper.logging.Logger;
import org.apache.jasper.xmlparser.XMLEncodingDetector;
/**
1.33 +45 -36 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java
Index: TagLibraryInfoImpl.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- TagLibraryInfoImpl.java 13 Jan 2003 20:09:44 -0000 1.32
+++ TagLibraryInfoImpl.java 22 Jan 2003 20:08:24 -0000 1.33
@@ -68,9 +68,10 @@
import org.apache.jasper.JspCompilationContext;
import org.apache.jasper.JasperException;
import org.apache.jasper.Constants;
-import org.apache.jasper.logging.Logger;
import org.apache.jasper.xmlparser.ParserUtils;
import org.apache.jasper.xmlparser.TreeNode;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* Implementation of the TagLibraryInfo class from the JSP spec.
@@ -79,9 +80,13 @@
* @author Mandar Raje
* @author Pierre Delisle
* @author Kin-man Chung
+ * @author Jan Luehe
*/
class TagLibraryInfoImpl extends TagLibraryInfo {
+ // Logger
+ private static Log log = LogFactory.getLog(TagLibraryInfoImpl.class);
+
private Hashtable jarEntries;
private JspCompilationContext ctxt;
private ErrorDispatcher err;
@@ -299,10 +304,10 @@
} else if ("taglib-extension".equals(tname)) {
// Recognized but ignored
} else {
- Constants.message("jsp.warning.unknown.element.in.TLD",
- new Object[] {tname},
- Logger.WARNING
- );
+ if (log.isWarnEnabled()) {
+ log.warn(Localizer.getMessage("jsp.warning.unknown.element.in.TLD",
+ tname));
+ }
}
}
@@ -379,10 +384,10 @@
} else if ("tag-extension".equals(tname)) {
// Ignored
} else {
- Constants.message("jsp.warning.unknown.element.in.tag",
- new Object[] {tname},
- Logger.WARNING
- );
+ if (log.isWarnEnabled()) {
+ log.warn(Localizer.getMessage("jsp.warning.unknown.element.in.tag",
+ tname));
+ }
}
}
@@ -443,10 +448,10 @@
} else if ("path".equals(tname)) {
path = child.getBody();
} else {
- Constants.message("jsp.warning.unknown.element.in.attribute",
- new Object[] {tname},
- Logger.WARNING
- );
+ if (log.isWarnEnabled()) {
+ log.warn(Localizer.getMessage("jsp.warning.unknown.element.in.attribute",
+ tname));
+ }
}
}
@@ -494,10 +499,10 @@
false) {
;
} else {
- Constants.message("jsp.warning.unknown.element.in.attribute",
- new Object[] {tname},
- Logger.WARNING
- );
+ if (log.isWarnEnabled()) {
+ log.warn(Localizer.getMessage("jsp.warning.unknown.element.in.attribute",
+ tname));
+ }
}
}
@@ -546,9 +551,10 @@
} else if ("description".equals(tname) || // Ignored elements
false ) {
} else {
- Constants.message("jsp.warning.unknown.element.in.variable",
- new Object[] {tname},
- Logger.WARNING);
+ if (log.isWarnEnabled()) {
+ log.warn(Localizer.getMessage("jsp.warning.unknown.element.in.variable",
+ tname));
+ }
}
}
return new TagVariableInfo(nameGiven, nameFromAttribute,
@@ -573,9 +579,10 @@
} else if ("description".equals(tname) || // Ignored elements
false ) {
} else {
- Constants.message("jsp.warning.unknown.element.in.validator", //@@@ add in properties
- new Object[] {tname},
- Logger.WARNING);
+ if (log.isWarnEnabled()) {
+ log.warn(Localizer.getMessage("jsp.warning.unknown.element.in.validator",
+ tname));
+ }
}
}
@@ -603,16 +610,17 @@
while (list.hasNext()) {
TreeNode element = (TreeNode) list.next();
String tname = element.getName();
- if ("param-name".equals(tname))
+ if ("param-name".equals(tname)) {
initParam[0] = element.getBody();
- else if ("param-value".equals(tname))
+ } else if ("param-value".equals(tname)) {
initParam[1] = element.getBody();
- else if ("description".equals(tname))
+ } else if ("description".equals(tname)) {
; // Do nothing
- else {
- Constants.message("jsp.warning.unknown.element.in.initParam", //@@@ properties
- new Object[] {tname},
- Logger.WARNING);
+ } else {
+ if (log.isWarnEnabled()) {
+ log.warn(Localizer.getMessage("jsp.warning.unknown.element.in.initParam",
+ tname));
+ }
}
}
return initParam;
@@ -641,9 +649,10 @@
"description".equals(tname) ||
"example".equals(tname)) {
} else {
- Constants.message("jsp.warning.unknown.element.in.function",
- new Object[] {tname},
- Logger.WARNING);
+ if (log.isWarnEnabled()) {
+ log.warn(Localizer.getMessage("jsp.warning.unknown.element.in.function",
+ tname));
+ }
}
}
1.11 +10 -7 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TldLocationsCache.java
Index: TldLocationsCache.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TldLocationsCache.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- TldLocationsCache.java 13 Dec 2002 19:09:52 -0000 1.10
+++ TldLocationsCache.java 22 Jan 2003 20:08:24 -0000 1.11
@@ -73,9 +73,10 @@
import org.apache.jasper.Constants;
import org.apache.jasper.JasperException;
-import org.apache.jasper.logging.Logger;
import org.apache.jasper.xmlparser.ParserUtils;
import org.apache.jasper.xmlparser.TreeNode;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* A container for all tag libraries that are defined "globally"
@@ -112,6 +113,9 @@
public class TldLocationsCache {
+ // Logger
+ private static Log log = LogFactory.getLog(TldLocationsCache.class);
+
/**
* The types of URI one may specify for a tag library
*/
@@ -168,9 +172,7 @@
processTldsInFileSystem();
initialized = true;
} catch (JasperException ex) {
- Constants.message("jsp.error.internal.tldinit",
- new Object[] { ex.getMessage() },
- Logger.ERROR);
+ log.error(Localizer.getMessage("jsp.error.internal.tldinit"), ex);
}
}
@@ -182,9 +184,10 @@
// Acquire an input stream to the web application deployment descriptor
InputStream is = ctxt.getResourceAsStream(WEB_XML);
if (is == null) {
- Constants.message("jsp.error.internal.filenotfound",
- new Object[] {WEB_XML},
- Logger.WARNING);
+ if (log.isWarnEnabled()) {
+ log.warn(Localizer.getMessage("jsp.error.internal.filenotfound",
+ WEB_XML));
+ }
return;
}
1.68 +7 -7 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java
Index: Validator.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- Validator.java 14 Jan 2003 23:14:58 -0000 1.67
+++ Validator.java 22 Jan 2003 20:08:24 -0000 1.68
@@ -1123,8 +1123,8 @@
if (errors != null && errors.length != 0) {
StringBuffer errMsg = new StringBuffer();
errMsg.append("<h3>");
- errMsg.append(err.getString("jsp.error.tei.invalid.attributes",
- n.getName()));
+ errMsg.append(Localizer.getMessage("jsp.error.tei.invalid.attributes",
+ n.getName()));
errMsg.append("</h3>");
for (int i=0; i<errors.length; i++) {
errMsg.append("<p>");
@@ -1228,8 +1228,8 @@
errMsg = new StringBuffer();
}
errMsg.append("<h3>");
- errMsg.append(errDisp.getString("jsp.error.tlv.invalid.page",
- tli.getShortName()));
+ errMsg.append(Localizer.getMessage("jsp.error.tlv.invalid.page",
+ tli.getShortName()));
errMsg.append("</h3>");
for (int i=0; i<errors.length; i++) {
if (errors[i] != null) {
1.1 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Localizer.java
Index: Localizer.java
===================================================================
/*
* $Header: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Localizer.java,v 1.1 2003/01/22 20:08:24 luehe Exp $
* $Revision: 1.1 $
* $Date: 2003/01/22 20:08:24 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.jasper.compiler;
import java.util.*;
import java.io.*;
import java.text.MessageFormat;
import org.xml.sax.*;
import org.apache.jasper.JasperException;
/**
* Class responsible for converting error codes to corresponding localized
* error messages.
*
* @author Jan Luehe
*/
public class Localizer {
private static final ResourceBundle bundle = ResourceBundle.getBundle(
"org.apache.jasper.resources.messages");
/*
* Returns the localized error message corresponding to the given error
* code.
*
* If the given error code is not defined in the resource bundle for
* localized error messages, it is used as the error message.
*
* @param errCode Error code to localize
*
* @return Localized error message
*/
public static String getMessage(String errCode) {
String errMsg = errCode;
try {
errMsg = bundle.getString(errCode);
} catch (MissingResourceException e) {
}
return errMsg;
}
/*
* Returns the localized error message corresponding to the given error
* code.
*
* If the given error code is not defined in the resource bundle for
* localized error messages, it is used as the error message.
*
* @param errCode Error code to localize
* @param arg Argument for parametric replacement
*
* @return Localized error message
*/
public static String getMessage(String errCode, String arg) {
return getMessage(errCode, new Object[] {arg});
}
/*
* Returns the localized error message corresponding to the given error
* code.
*
* If the given error code is not defined in the resource bundle for
* localized error messages, it is used as the error message.
*
* @param errCode Error code to localize
* @param arg1 First argument for parametric replacement
* @param arg2 Second argument for parametric replacement
*
* @return Localized error message
*/
public static String getMessage(String errCode, String arg1, String arg2) {
return getMessage(errCode, new Object[] {arg1, arg2});
}
/*
* Returns the localized error message corresponding to the given error
* code.
*
* If the given error code is not defined in the resource bundle for
* localized error messages, it is used as the error message.
*
* @param errCode Error code to localize
* @param arg1 First argument for parametric replacement
* @param arg2 Second argument for parametric replacement
* @param arg3 Third argument for parametric replacement
*
* @return Localized error message
*/
public static String getMessage(String errCode, String arg1, String arg2,
String arg3) {
return getMessage(errCode, new Object[] {arg1, arg2, arg3});
}
/*
* Returns the localized error message corresponding to the given error
* code.
*
* If the given error code is not defined in the resource bundle for
* localized error messages, it is used as the error message.
*
* @param errCode Error code to localize
* @param args Arguments for parametric replacement
*
* @return Localized error message
*/
public static String getMessage(String errCode, Object[] args) {
String errMsg = errCode;
try {
errMsg = bundle.getString(errCode);
if (args != null) {
MessageFormat formatter = new MessageFormat(errMsg);
errMsg = formatter.format(args);
}
} catch (MissingResourceException e) {
}
return errMsg;
}
}
1.82 +12 -9 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages.properties
Index: messages.properties
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages.properties,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- messages.properties 22 Jan 2003 11:55:40 -0000 1.81
+++ messages.properties 22 Jan 2003 20:08:24 -0000 1.82
@@ -138,9 +138,13 @@
jsp.warning.reloading=Warning: Invalid value for the initParam reloading. Will use the default value of \"true\"
jsp.error.badtaglib=Unable to open taglibrary {0} : {1}
jsp.error.badGetReader=Cannot create a reader when the stream is not buffered
-jsp.warning.unknown.element.in.TLD=Warning: Unknown element {0} in TLD
-jsp.warning.unknown.element.in.tag=Warning: Unknown element {0} in tag
-jsp.warning.unknown.element.in.attribute=Warning: Unknown element {0} in attribute
+jsp.warning.unknown.element.in.TLD=Unknown element {0} in TLD
+jsp.warning.unknown.element.in.tag=Unknown element {0} in <tag>
+jsp.warning.unknown.element.in.attribute=Unknown element {0} in <attribute>
+jsp.warning.unknown.element.in.variable=Unknown element {0} in <variable>
+jsp.warning.unknown.element.in.validator=Unknown element {0} in <validator>
+jsp.warning.unknown.element.in.initParam=Unknown element {0} in validator's <init-param>
+jsp.warning.unknown.element.in.function=Unknown element {0} in <function>
jsp.error.more.than.one.taglib=More than one taglib in the TLD: {0}
jsp.error.teiclass.instantiation=Failed to load or instantiate TagExtraInfo class: {0}
jsp.error.non_null_tei_and_var_subelems=Tag {0} has one or more variable subelements and a TagExtraInfo class that returns one or more VariableInfo
@@ -233,7 +237,7 @@
env-entry, and ejb-ref elements should follow this fragment.\n\
-->\n
jspc.error.jasperException=error-the file ''{0}'' generated the following parse exception: {1}
-jspc.error.generalException=ERROR-the file ''{0}'' generated the following general exception: {1}
+jspc.error.generalException=ERROR-the file ''{0}'' generated the following general exception:
jspc.error.fileDoesNotExist=The file argument ''{0}'' does not exist
jspc.error.emptyWebApp=-webapp requires a trailing file argument
jsp.error.library.invalid=JSP page is invalid according to library {0}: {1}
@@ -245,17 +249,16 @@
jsp.parser.sax.featurenotsupported=SAX feature not supported: {0}
jsp.parser.sax.featurenotrecognized=SAX feature not recognized: {0}
jsp.error.no.more.content=End of content reached while more parsing required: tag nesting error?
-jsp.error.parse.xml=XML parsing error on file {0}: {1}
-jsp.error.parse.xml.line=XML parsing error on file {0}: (line {1}, col {2}): {3}
+jsp.error.parse.xml=XML parsing error on file {0}
+jsp.error.parse.xml.line=XML parsing error on file {0}: (line {1}, col {2})
jsp.error.parse.xml.scripting.invalid.body=Body of {0} element must not contain any XML elements
-jsp.error.internal.tldinit=Exception initializing TldLocationsCache: {0}
+jsp.error.internal.tldinit=Exception initializing TldLocationsCache
jsp.error.internal.filenotfound=Internal Error: File {0} not found
jsp.error.internal.evaluator_not_found=Internal error: unable to load expression evaluator
jsp.error.parse.xml.invalidPublicId=Invalid PUBLIC ID: {0}
jsp.error.include.flush.invalid.value=Invalid value for the flush attribute: {0}
jsp.error.page.invalid.pageencoding=Page directive: invalid value for pageEncoding
jsp.error.unsupported.encoding=Unsupported encoding: {0}
-jsp.warning.unknown.element.in.variable=Warning: Unknown element {0} in variable
tld.error.variableNotAllowed=It is an error for a tag that has one or more variable subelements to have a TagExtraInfo class that returns a non-null object.
jsp.error.tldInWebDotXmlNotFound=Could not locate TLD {1} for URI {0} specified in web.xml
jsp.error.taglibDirective.absUriCannotBeResolved=The absolute uri: {0} cannot be resolved in either web.xml or the jar files deployed with this application
1.29 +2 -2 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_es.properties
Index: messages_es.properties
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_es.properties,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- messages_es.properties 13 Jan 2003 23:50:48 -0000 1.28
+++ messages_es.properties 22 Jan 2003 20:08:24 -0000 1.29
@@ -189,7 +189,7 @@
env-entry, y ejb-ref deberan ir despues de este fragmento .\n\
-->\n
jspc.error.jasperException=error-el archivo ''{0}'' ha generado la excepcion de sintaxis siguiente: {1}
-jspc.error.generalException=ERROR-el archivo ''{0}'' ha generado la excepcion general siguiente: {1}
+jspc.error.generalException=ERROR-el archivo ''{0}'' ha generado la excepcion general siguiente:
jspc.error.fileDoesNotExist=El archivo ''{0}'' utilizado como argumento no existe.
jspc.error.emptyWebApp=-webapp necesita un argumento de archivo
jsp.error.library.invalid=
1.12 +5 -5 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_fr.properties
Index: messages_fr.properties
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_fr.properties,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- messages_fr.properties 13 Jan 2003 23:50:48 -0000 1.11
+++ messages_fr.properties 22 Jan 2003 20:08:24 -0000 1.12
@@ -220,7 +220,7 @@
env-entry, and ejb-ref elements should follow this fragment.\n\
-->\n
jspc.error.jasperException=erreur-le fichier ''{0}'' a g�n�r� l''exception d''�valuation suivante: {1}
-jspc.error.generalException=ERREUR-le fichier ''{0}'' a g�n�r� l''exception g�n�rale suivante: {1}
+jspc.error.generalException=ERREUR-le fichier ''{0}'' a g�n�r� l''exception g�n�rale suivante:
jspc.error.fileDoesNotExist=L''argument fichier ''{0}'' n''existe pas
jspc.error.emptyWebApp=-webapp n�cessite � sa suite un argument fichier
jsp.error.library.invalid=La page JSP page est incorrecte d''apr�s la librairie {0}: {1}
@@ -232,10 +232,10 @@
jsp.parser.sax.featurenotsupported=Fonctionnalit� SAX non support�e: {0}
jsp.parser.sax.featurenotrecognized=Fonctionnalit� SAX non reconnue: {0}
jsp.error.no.more.content=Fin de contenu alors que l''�valution n''�tait pas termin�e: erreur de tags imbriqu�s?
-jsp.error.parse.xml=Erreur d''�valuation XML sur le fichier {0}: {1}
-jsp.error.parse.xml.line=Erreur d''�valuation XML sur le fichier {0}: (ligne {1}, col {2}): {3}
+jsp.error.parse.xml=Erreur d''�valuation XML sur le fichier {0}
+jsp.error.parse.xml.line=Erreur d''�valuation XML sur le fichier {0}: (ligne {1}, col {2})
jsp.error.parse.xml.scripting.invalid.body=Le corps de l''�l�ment {0} ne doit contenir aucun �l�ments XML
-jsp.error.internal.tldinit=Exception lors de l'initialisation de TldLocationsCache: {0}
+jsp.error.internal.tldinit=Exception lors de l'initialisation de TldLocationsCache
jsp.error.internal.filenotfound=Erreur interne: Fichier {0} introuvable
jsp.error.internal.evaluator_not_found=Erreur interne: Impossible de charger l''�valuateur d''expression
jsp.error.parse.xml.invalidPublicId=PUBLIC ID invalide: {0}
1.29 +5 -5 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_ja.properties
Index: messages_ja.properties
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_ja.properties,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- messages_ja.properties 13 Jan 2003 23:50:48 -0000 1.28
+++ messages_ja.properties 22 Jan 2003 20:08:24 -0000 1.29
@@ -203,7 +203,7 @@
env-entry, and ejb-ref elements should follow this fragment.\n\
-->\n
jspc.error.jasperException=\u30a8\u30e9\u30fc: \u30d5\u30a1\u30a4\u30eb ''{0}'' \u306f\u6b21\u306e\u4f8b\u5916\u3092\u767a\u751f\u3057\u307e\u3057\u305f: {1}
-jspc.error.generalException=\u30a8\u30e9\u30fc: \u30d5\u30a1\u30a4\u30eb ''{0}'' \u306f\u6b21\u306e\u4f8b\u5916\u3092\u767a\u751f\u3057\u307e\u3057\u305f: {1}
+jspc.error.generalException=\u30a8\u30e9\u30fc: \u30d5\u30a1\u30a4\u30eb ''{0}'' \u306f\u6b21\u306e\u4f8b\u5916\u3092\u767a\u751f\u3057\u307e\u3057\u305f:
jspc.error.fileDoesNotExist=\u30d5\u30a1\u30a4\u30eb\u5f15\u6570 ''{0}'' \u306f\u5b58\u5728\u3057\u307e\u305b\u3093\u3002
jspc.error.emptyWebApp=-webapp\u30aa\u30d7\u30b7\u30e7\u30f3\u306b\u306f\u3001\u30d5\u30a1\u30a4\u30eb\u5f15\u6570\u304c\u5fc5\u8981\u3067\u3059
jsp.error.library.invalid=\u30e9\u30a4\u30d6\u30e9\u30ea{0}\u306b\u5f93\u3046\u3068JSP\u30da\u30fc\u30b8\u306f\u7121\u52b9\u3067\u3059: {1}
@@ -215,9 +215,9 @@
jsp.parser.sax.featurenotsupported=SAX\u30d5\u30a3\u30fc\u30c1\u30e3\u304c\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u307e\u305b\u3093: {0}
jsp.parser.sax.featurenotrecognized=SAX\u30d5\u30a3\u30fc\u30c1\u30e3\u304c\u8a8d\u8b58\u3055\u308c\u307e\u305b\u3093: {0}
jsp.error.no.more.content=\u5fc5\u8981\u306a\u89e3\u6790\u4e2d\u306b\u5185\u5bb9\u306e\u6700\u5f8c\u307e\u3067\u9054\u3057\u307e\u3057\u305f: \u30bf\u30b0\u306e\u30cd\u30b9\u30c8\u306e\u30a8\u30e9\u30fc\u304b\u3082\u3057\u308c\u307e\u305b\u3093
-jsp.error.parse.xml=\u30d5\u30a1\u30a4\u30eb{0}\u306eXML\u89e3\u6790\u30a8\u30e9\u30fc: {1}
-jsp.error.parse.xml.line=\u30d5\u30a1\u30a4\u30eb{0}\u306eXML\u89e3\u6790\u30a8\u30e9\u30fc: (\u884c {1}, \u5217 {2}): {3}
-jsp.error.internal.tldinit=TldLocationsCache\u3092\u521d\u671f\u5316\u4e2d\u306e\u4f8b\u5916\u304c\u767a\u751f\u3057\u307e\u3057\u305f: {0}
+jsp.error.parse.xml=\u30d5\u30a1\u30a4\u30eb{0}\u306eXML\u89e3\u6790\u30a8\u30e9\u30fc
+jsp.error.parse.xml.line=\u30d5\u30a1\u30a4\u30eb{0}\u306eXML\u89e3\u6790\u30a8\u30e9\u30fc: (\u884c {1}, \u5217 {2})
+jsp.error.internal.tldinit=TldLocationsCache\u3092\u521d\u671f\u5316\u4e2d\u306e\u4f8b\u5916\u304c\u767a\u751f\u3057\u307e\u3057\u305f
jsp.error.internal.filenotfound=\u5185\u90e8\u30a8\u30e9\u30fc: \u30d5\u30a1\u30a4\u30eb {0} \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093
jsp.error.parse.xml.invalidPublicId=\u7121\u52b9\u306aPUBLIC ID: {0}
jsp.error.include.flush.invalid.value=flush\u5c5e\u6027\u306b\u7121\u52b9\u306a\u5024\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u3059: {0}
1.9 +2 -2 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/HttpJspBase.java
Index: HttpJspBase.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/HttpJspBase.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- HttpJspBase.java 7 Nov 2002 21:11:40 -0000 1.8
+++ HttpJspBase.java 22 Jan 2003 20:08:25 -0000 1.9
@@ -68,7 +68,7 @@
import javax.servlet.jsp.*;
import org.apache.jasper.JasperException;
-import org.apache.jasper.Constants;
+import org.apache.jasper.compiler.Localizer;
/**
* This is the super class of all JSP-generated servlets.
@@ -118,7 +118,7 @@
}
public String getServletInfo() {
- return Constants.getString ("jsp.engine.info");
+ return Localizer.getMessage("jsp.engine.info");
}
public final void destroy() {
1.15 +38 -35 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspRuntimeLibrary.java
Index: JspRuntimeLibrary.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspRuntimeLibrary.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- JspRuntimeLibrary.java 7 Jan 2003 20:47:27 -0000 1.14
+++ JspRuntimeLibrary.java 22 Jan 2003 20:08:25 -0000 1.15
@@ -80,8 +80,8 @@
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.BodyContent;
-import org.apache.jasper.Constants;
import org.apache.jasper.JasperException;
+import org.apache.jasper.compiler.Localizer;
// for JSTL expression interpreter
import javax.servlet.jsp.PageContext;
@@ -348,9 +348,8 @@
if ( method != null ) {
if (type.isArray()) {
if (request == null) {
- throw new JasperException(Constants.getString(
- "jsp.error.beans.setproperty.noindexset",
- new Object[] {}));
+ throw new JasperException(
+ Localizer.getMessage("jsp.error.beans.setproperty.noindexset"));
}
Class t = type.getComponentType();
String[] values = request.getParameterValues(param);
@@ -375,14 +374,16 @@
}
if (!ignoreMethodNF && (method == null)) {
if (type == null) {
- throw new JasperException(Constants.getString(
- "jsp.error.beans.noproperty",
- new Object[] { prop, bean.getClass().getName() }));
+ throw new JasperException(
+ Localizer.getMessage("jsp.error.beans.noproperty",
+ prop,
+ bean.getClass().getName()));
} else {
- throw new JasperException(Constants.getString(
- "jsp.error.beans.nomethod.setproperty",
- new Object[] { prop, type.getName(),
- bean.getClass().getName() }));
+ throw new JasperException(
+ Localizer.getMessage("jsp.error.beans.nomethod.setproperty",
+ prop,
+ type.getName(),
+ bean.getClass().getName()));
}
}
}
@@ -611,8 +612,8 @@
public static Object handleGetProperty(Object o, String prop)
throws JasperException {
if (o == null) {
- throw new JasperException(Constants.getString(
- "jsp.error.beans.nullbean", new Object[] {}));
+ throw new JasperException(
+ Localizer.getMessage("jsp.error.beans.nullbean"));
}
Object value = null;
try {
@@ -794,23 +795,25 @@
}
} else {
// just in case introspection silently fails.
- throw new JasperException(Constants.getString(
- "jsp.error.beans.nobeaninfo",
- new Object[] { beanClass.getName() }));
+ throw new JasperException(
+ Localizer.getMessage("jsp.error.beans.nobeaninfo",
+ beanClass.getName()));
}
} catch (Exception ex) {
throw new JasperException (ex);
}
if (method == null) {
if (type == null) {
- throw new JasperException(Constants.getString(
- "jsp.error.beans.noproperty",
- new Object[] { prop, beanClass.getName() }));
+ throw new JasperException(
+ Localizer.getMessage("jsp.error.beans.noproperty",
+ prop,
+ beanClass.getName()));
} else {
- throw new JasperException(Constants.getString(
- "jsp.error.beans.nomethod.setproperty",
- new Object[] { prop, type.getName(),
- beanClass.getName() }));
+ throw new JasperException(
+ Localizer.getMessage("jsp.error.beans.nomethod.setproperty",
+ prop,
+ type.getName(),
+ beanClass.getName()));
}
}
return method;
@@ -836,22 +839,22 @@
}
} else {
// just in case introspection silently fails.
- throw new JasperException(Constants.getString(
- "jsp.error.beans.nobeaninfo",
- new Object[] { beanClass.getName() }));
+ throw new JasperException(
+ Localizer.getMessage("jsp.error.beans.nobeaninfo",
+ beanClass.getName()));
}
} catch (Exception ex) {
throw new JasperException (ex);
}
if (method == null) {
if (type == null) {
- throw new JasperException(Constants.getString(
- "jsp.error.beans.noproperty",
- new Object[] { prop, beanClass.getName() }));
+ throw new JasperException(
+ Localizer.getMessage("jsp.error.beans.noproperty", prop,
+ beanClass.getName()));
} else {
- throw new JasperException(Constants.getString(
- "jsp.error.beans.nomethod",
- new Object[] { prop, beanClass.getName() }));
+ throw new JasperException(
+ Localizer.getMessage("jsp.error.beans.nomethod", prop,
+ beanClass.getName()));
}
}
1.7 +11 -7 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspWriterImpl.java
Index: JspWriterImpl.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspWriterImpl.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- JspWriterImpl.java 19 Dec 2002 16:29:58 -0000 1.6
+++ JspWriterImpl.java 22 Jan 2003 20:08:25 -0000 1.7
@@ -68,6 +68,7 @@
import javax.servlet.jsp.JspWriter;
import org.apache.jasper.Constants;
+import org.apache.jasper.compiler.Localizer;
/**
* Write text to a character-output stream, buffering characters so as
@@ -171,22 +172,25 @@
*/
public final void clear() throws IOException {
if (bufferSize == 0)
- throw new IllegalStateException(Constants.getString("jsp.error.ise_on_clear"));
+ throw new IllegalStateException(
+ Localizer.getMessage("jsp.error.ise_on_clear"));
if (flushed)
- throw new IOException(Constants.getString("jsp.error.attempt_to_clear_flushed_buffer"));
+ throw new IOException(
+ Localizer.getMessage("jsp.error.attempt_to_clear_flushed_buffer"));
ensureOpen();
nextChar = 0;
}
public void clearBuffer() throws IOException {
if (bufferSize == 0)
- throw new IllegalStateException(Constants.getString("jsp.error.ise_on_clear"));
+ throw new IllegalStateException(
+ Localizer.getMessage("jsp.error.ise_on_clear"));
ensureOpen();
nextChar = 0;
}
private final void bufferOverflow() throws IOException {
- throw new IOException(Constants.getString("jsp.error.overflow"));
+ throw new IOException(Localizer.getMessage("jsp.error.overflow"));
}
/**
1.39 +13 -13 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/PageContextImpl.java
Index: PageContextImpl.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/PageContextImpl.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- PageContextImpl.java 18 Dec 2002 18:46:59 -0000 1.38
+++ PageContextImpl.java 22 Jan 2003 20:08:25 -0000 1.39
@@ -94,8 +94,10 @@
import javax.servlet.jsp.el.VariableResolver;
import org.apache.jasper.Constants;
-import org.apache.jasper.logging.Logger;
+import org.apache.jasper.compiler.Localizer;
import org.apache.jasper.runtime.el.jstl.JSTLVariableResolver;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* Implementation of the PageContext class from the JSP spec.
@@ -107,12 +109,10 @@
* @author Pierre Delisle
* @author Mark Roth
*/
-public class PageContextImpl
- extends PageContext
- implements VariableResolver
-{
+public class PageContextImpl extends PageContext implements VariableResolver {
- Logger.Helper loghelper = new Logger.Helper("JASPER_LOG", "PageContextImpl");
+ // Logger
+ private static Log log = LogFactory.getLog(PageContextImpl.class);
/**
* The expression evaluator, for evaluating EL expressions.
@@ -219,7 +219,7 @@
((JspWriterImpl)out).flushBuffer();
}
} catch (IOException ex) {
- loghelper.log("Internal error flushing the buffer in release()");
+ log.warn("Internal error flushing the buffer in release()");
}
servlet = null;
@@ -486,8 +486,8 @@
try {
out.clear();
} catch (IOException ex) {
- throw new IllegalStateException(Constants.getString(
- "jsp.error.attempt_to_clear_flushed_buffer"));
+ throw new IllegalStateException(
+ Localizer.getMessage("jsp.error.attempt_to_clear_flushed_buffer"));
}
// Make sure that the response object is not the wrapper for include
@@ -733,7 +733,7 @@
try {
return new JspWriterImpl(response, bufferSize, autoFlush);
} catch( Throwable t ) {
- loghelper.log("creating out", t);
+ log.warn("creating out", t);
return null;
}
}
1.17 +15 -8 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServlet.java
Index: JspServlet.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServlet.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- JspServlet.java 17 Dec 2002 19:21:07 -0000 1.16
+++ JspServlet.java 22 Jan 2003 20:08:25 -0000 1.17
@@ -81,11 +81,15 @@
import org.apache.jasper.EmbededServletOptions;
import org.apache.jasper.compiler.JspRuntimeContext;
+import org.apache.jasper.compiler.Localizer;
import org.apache.jasper.logging.Logger;
import org.apache.jasper.logging.DefaultLogger;
import org.apache.jasper.logging.JasperLogger;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
/**
* The JSP engine (a.k.a Jasper).
*
@@ -104,6 +108,9 @@
*/
public class JspServlet extends HttpServlet {
+ // Logger
+ private static Log log = LogFactory.getLog(JspServlet.class);
+
private Logger.Helper loghelper;
private ServletContext context;
@@ -131,11 +138,11 @@
// Initialize the JSP Runtime Context
rctxt = new JspRuntimeContext(context,options);
- Constants.message("jsp.message.scratch.dir.is",
- new Object[] { options.getScratchDir().toString() },
- Logger.INFORMATION );
- Constants.message("jsp.message.dont.modify.servlets",
- Logger.INFORMATION);
+ if (log.isInfoEnabled()) {
+ log.info(Localizer.getMessage("jsp.message.scratch.dir.is",
+ options.getScratchDir().toString()));
+ log.info(Localizer.getMessage("jsp.message.dont.modify.servlets"));
+ }
}
1.25 +13 -9 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServletWrapper.java
Index: JspServletWrapper.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServletWrapper.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- JspServletWrapper.java 18 Dec 2002 23:18:21 -0000 1.24
+++ JspServletWrapper.java 22 Jan 2003 20:08:25 -0000 1.25
@@ -86,8 +86,10 @@
import org.apache.jasper.JspCompilationContext;
import org.apache.jasper.compiler.JspRuntimeContext;
import org.apache.jasper.compiler.JspUtil;
+import org.apache.jasper.compiler.Localizer;
import org.apache.jasper.runtime.JspSourceDependent;
-import org.apache.jasper.logging.Logger;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* The JSP engine (a.k.a Jasper).
@@ -108,6 +110,9 @@
public class JspServletWrapper {
+ // Logger
+ private static Log log = LogFactory.getLog(JspServletWrapper.class);
+
private Servlet theServlet;
private String jspUri;
private Class servletClass;
@@ -284,7 +289,7 @@
response.setDateHeader("Retry-After", available);
response.sendError
(HttpServletResponse.SC_SERVICE_UNAVAILABLE,
- Constants.getString("jsp.error.unavailable"));
+ Localizer.getMessage("jsp.error.unavailable"));
}
if (options.getDevelopment() || firstTime ) {
@@ -344,10 +349,9 @@
response.sendError(HttpServletResponse.SC_NOT_FOUND,
ex.getMessage());
} catch (IllegalStateException ise) {
- Constants.jasperLog.log(
- Constants.getString("jsp.error.file.not.found",
- new Object[] { ex.getMessage() }),
- ex, Logger.ERROR);
+ log.error(Localizer.getMessage("jsp.error.file.not.found",
+ ex.getMessage()),
+ ex);
}
}
} catch (ServletException ex) {
1.2 +7 -12 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/xmlparser/ASCIIReader.java
Index: ASCIIReader.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/xmlparser/ASCIIReader.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ASCIIReader.java 6 Nov 2002 20:14:20 -0000 1.1
+++ ASCIIReader.java 22 Jan 2003 20:08:25 -0000 1.2
@@ -60,7 +60,7 @@
import java.io.InputStream;
import java.io.IOException;
import java.io.Reader;
-import org.apache.jasper.compiler.ErrorDispatcher;
+import org.apache.jasper.compiler.Localizer;
/**
* A simple ASCII byte reader. This is an optimized reader for reading
@@ -90,8 +90,6 @@
/** Byte buffer. */
protected byte[] fBuffer;
- private ErrorDispatcher err;
-
//
// Constructors
//
@@ -102,13 +100,10 @@
*
* @param inputStream The input stream.
* @param size The initial buffer size.
- * @param err The error dispatcher.
*/
- public ASCIIReader(InputStream inputStream, int size,
- ErrorDispatcher err) {
+ public ASCIIReader(InputStream inputStream, int size) {
fInputStream = inputStream;
fBuffer = new byte[size];
- this.err = err;
}
//
@@ -131,8 +126,8 @@
public int read() throws IOException {
int b0 = fInputStream.read();
if (b0 > 0x80) {
- throw new IOException(err.getString("jsp.error.xml.invalidASCII",
- Integer.toString(b0)));
+ throw new IOException(Localizer.getMessage("jsp.error.xml.invalidASCII",
+ Integer.toString(b0)));
}
return b0;
} // read():int
@@ -159,8 +154,8 @@
for (int i = 0; i < count; i++) {
int b0 = fBuffer[i];
if (b0 > 0x80) {
- throw new IOException(err.getString("jsp.error.xml.invalidASCII",
- Integer.toString(b0)));
+ throw new IOException(Localizer.getMessage("jsp.error.xml.invalidASCII",
+ Integer.toString(b0)));
}
ch[offset + i] = (char)b0;
}
1.7 +20 -18 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/xmlparser/ParserUtils.java
Index: ParserUtils.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/xmlparser/ParserUtils.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ParserUtils.java 9 Oct 2002 18:25:39 -0000 1.6
+++ ParserUtils.java 22 Jan 2003 20:08:25 -0000 1.7
@@ -64,6 +64,10 @@
import org.apache.jasper.Constants;
import org.apache.jasper.JasperException;
import org.apache.jasper.logging.Logger;
+import org.apache.jasper.compiler.Localizer;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Comment;
import org.w3c.dom.Document;
@@ -91,12 +95,14 @@
public class ParserUtils {
+ // Logger
+ static Log log = LogFactory.getLog(ParserUtils.class);
+
/**
* An error handler for use when parsing XML documents.
*/
static ErrorHandler errorHandler = new MyErrorHandler();
-
/**
* An entity resolver for use when parsing XML documents.
*/
@@ -135,24 +141,20 @@
document = builder.parse(is);
} catch (ParserConfigurationException ex) {
throw new JasperException
- (Constants.getString("jsp.error.parse.xml",
- new Object[]{uri, ex.getMessage()}));
+ (Localizer.getMessage("jsp.error.parse.xml", uri), ex);
} catch (SAXParseException ex) {
throw new JasperException
- (Constants.getString
- ("jsp.error.parse.xml.line",
- new Object[]{uri,
- new Integer(ex.getLineNumber()),
- new Integer(ex.getColumnNumber()),
- ex.getMessage()}));
+ (Localizer.getMessage("jsp.error.parse.xml.line",
+ uri,
+ Integer.toString(ex.getLineNumber()),
+ Integer.toString(ex.getColumnNumber())),
+ ex);
} catch (SAXException sx) {
throw new JasperException
- (Constants.getString("jsp.error.parse.xml",
- new Object[]{uri, sx.getMessage()}));
+ (Localizer.getMessage("jsp.error.parse.xml", uri), sx);
} catch (IOException io) {
throw new JasperException
- (Constants.getString("jsp.error.parse.xml",
- new Object[]{uri, io.toString()}));
+ (Localizer.getMessage("jsp.error.parse.xml", uri), io);
}
// Convert the resulting document to a graph of TreeNodes
@@ -227,8 +229,8 @@
this.getClass().getResourceAsStream(resourcePath);
if (input == null) {
throw new SAXException(
- Constants.getString("jsp.error.internal.filenotfound",
- new Object[]{resourcePath}));
+ Localizer.getMessage("jsp.error.internal.filenotfound",
+ resourcePath));
}
InputSource isrc = new InputSource(input);
return isrc;
@@ -236,8 +238,8 @@
}
System.out.println("Resolve entity failed" + publicId + " "
+ systemId );
- Constants.message("jsp.error.parse.xml.invalidPublicId",
- new Object[]{publicId}, Logger.ERROR);
+ ParserUtils.log.error(Localizer.getMessage("jsp.error.parse.xml.invalidPublicId",
+ publicId));
return null;
}
}
1.2 +14 -17 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/xmlparser/UTF8Reader.java
Index: UTF8Reader.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/xmlparser/UTF8Reader.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- UTF8Reader.java 6 Nov 2002 20:14:20 -0000 1.1
+++ UTF8Reader.java 22 Jan 2003 20:08:25 -0000 1.2
@@ -61,7 +61,7 @@
import java.io.IOException;
import java.io.Reader;
import java.io.UTFDataFormatException;
-import org.apache.jasper.compiler.ErrorDispatcher;
+import org.apache.jasper.compiler.Localizer;
/**
* @author Andy Clark, IBM
@@ -99,8 +99,6 @@
/** Surrogate character. */
private int fSurrogate = -1;
- private ErrorDispatcher err;
-
//
// Constructors
//
@@ -111,12 +109,10 @@
*
* @param inputStream The input stream.
* @param size The initial buffer size.
- * @param err The error dispatcher.
*/
- public UTF8Reader(InputStream inputStream, int size, ErrorDispatcher err) {
+ public UTF8Reader(InputStream inputStream, int size) {
fInputStream = inputStream;
fBuffer = new byte[size];
- this.err = err;
}
//
@@ -604,8 +600,9 @@
* or if some other I/O error occurs
*/
public void mark(int readAheadLimit) throws IOException {
- throw new IOException(err.getString("jsp.error.xml.operationNotSupported",
- "mark()", "UTF-8"));
+ throw new IOException(
+ Localizer.getMessage("jsp.error.xml.operationNotSupported",
+ "mark()", "UTF-8"));
}
/**
@@ -646,9 +643,9 @@
throws UTFDataFormatException {
throw new UTFDataFormatException(
- err.getString("jsp.error.xml.expectedByte",
- Integer.toString(position),
- Integer.toString(count)));
+ Localizer.getMessage("jsp.error.xml.expectedByte",
+ Integer.toString(position),
+ Integer.toString(count)));
} // expectedByte(int,int,int)
@@ -657,17 +654,17 @@
throws UTFDataFormatException {
throw new UTFDataFormatException(
- err.getString("jsp.error.xml.invalidByte",
- Integer.toString(position),
- Integer.toString(count)));
+ Localizer.getMessage("jsp.error.xml.invalidByte",
+ Integer.toString(position),
+ Integer.toString(count)));
} // invalidByte(int,int,int,int)
/** Throws an exception for invalid surrogate bits. */
private void invalidSurrogate(int uuuuu) throws UTFDataFormatException {
throw new UTFDataFormatException(
- err.getString("jsp.error.xml.invalidHighSurrogate",
- Integer.toHexString(uuuuu)));
+ Localizer.getMessage("jsp.error.xml.invalidHighSurrogate",
+ Integer.toHexString(uuuuu)));
} // invalidSurrogate(int)
} // class UTF8Reader
1.3 +2 -2 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/xmlparser/XercesEncodingDetector.java
Index: XercesEncodingDetector.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/xmlparser/XercesEncodingDetector.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XercesEncodingDetector.java 16 Jan 2003 02:32:56 -0000 1.2
+++ XercesEncodingDetector.java 22 Jan 2003 20:08:25 -0000 1.3
@@ -239,10 +239,10 @@
// try to use an optimized reader
String ENCODING = encoding.toUpperCase(Locale.ENGLISH);
if (ENCODING.equals("UTF-8")) {
- return new UTF8Reader(inputStream, fBufferSize, err);
+ return new UTF8Reader(inputStream, fBufferSize);
}
if (ENCODING.equals("US-ASCII")) {
- return new ASCIIReader(inputStream, fBufferSize, err);
+ return new ASCIIReader(inputStream, fBufferSize);
}
if (ENCODING.equals("ISO-10646-UCS-4")) {
if (isBigEndian != null) {
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>