Author: remy.maucherat(a)jboss.com
Date: 2012-10-01 12:46:15 -0400 (Mon, 01 Oct 2012)
New Revision: 2093
Modified:
branches/7.2.x/src/main/java/org/apache/el/lang/ExpressionBuilder.java
branches/7.2.x/src/main/java/org/apache/el/lang/FunctionMapperFactory.java
branches/7.2.x/src/main/java/org/apache/el/lang/FunctionMapperImpl.java
branches/7.2.x/src/main/java/org/apache/el/lang/VariableMapperFactory.java
branches/7.2.x/src/main/java/org/apache/el/parser/AstIdentifier.java
branches/7.2.x/src/main/java/org/apache/jasper/compiler/Compiler.java
branches/7.2.x/src/main/java/org/apache/jasper/compiler/DefaultErrorHandler.java
branches/7.2.x/src/main/java/org/apache/jasper/compiler/JDTCompiler.java
branches/7.2.x/src/main/java/org/apache/jasper/compiler/JspRuntimeContext.java
branches/7.2.x/src/main/java/org/apache/jasper/compiler/Parser.java
branches/7.2.x/src/main/java/org/apache/jasper/compiler/SmapStratum.java
branches/7.2.x/src/main/java/org/apache/jasper/compiler/SmapUtil.java
branches/7.2.x/src/main/java/org/apache/jasper/compiler/TagFileProcessor.java
branches/7.2.x/src/main/java/org/apache/jasper/el/ELResolverImpl.java
branches/7.2.x/src/main/java/org/apache/jasper/runtime/BodyContentImpl.java
branches/7.2.x/src/main/java/org/apache/jasper/runtime/CharBuffer.java
branches/7.2.x/src/main/java/org/apache/jasper/runtime/InstanceManagerFactory.java
branches/7.2.x/src/main/java/org/apache/jasper/runtime/JspApplicationContextImpl.java
branches/7.2.x/src/main/java/org/apache/jasper/runtime/JspFactoryImpl.java
branches/7.2.x/src/main/java/org/apache/jasper/runtime/JspWriterImpl.java
branches/7.2.x/src/main/java/org/apache/jasper/runtime/PageContextImpl.java
branches/7.2.x/src/main/java/org/apache/jasper/runtime/ProtectedFunctionMapper.java
branches/7.2.x/src/main/java/org/apache/jasper/security/SecurityClassLoad.java
branches/7.2.x/src/main/java/org/apache/jasper/servlet/JspServlet.java
branches/7.2.x/src/main/java/org/apache/jasper/xmlparser/XMLEncodingDetector.java
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/BayeuxServlet.java
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/ChannelImpl.java
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/ClientImpl.java
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/RequestBase.java
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/UUIDGenerator.java
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaConnectRequest.java
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaDisconnectRequest.java
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaHandshakeRequest.java
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaSubscribeRequest.java
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaUnsubscribeRequest.java
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/PublishRequest.java
branches/7.2.x/src/main/java/org/apache/tomcat/jni/Library.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/DomUtil.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/IntrospectionUtils.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/B2CConverter.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/Base64.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/ByteChunk.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/C2BConverter.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/CharChunk.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/StringCache.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/UDecoder.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/http/CookieSupport.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/http/ServerCookie.java
branches/7.2.x/src/main/java/org/jboss/web/CoyoteLogger.java
branches/7.2.x/src/main/java/org/jboss/web/CoyoteMessages.java
branches/7.2.x/src/main/java/org/jboss/web/ELMessages.java
branches/7.2.x/src/main/java/org/jboss/web/JasperLogger.java
branches/7.2.x/src/main/java/org/jboss/web/JasperMessages.java
Log:
Visual inspection of the Jasper and util (part 1) classes for i18n
Modified: branches/7.2.x/src/main/java/org/apache/el/lang/ExpressionBuilder.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/el/lang/ExpressionBuilder.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/el/lang/ExpressionBuilder.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -241,8 +241,7 @@
return new MethodExpressionLiteral(expression, expectedReturnType,
expectedParamTypes);
} else {
- throw new ELException("Not a Valid Method Expression: "
- + expression);
+ throw new ELException(MESSAGES.invalidMethodExpression(expression));
}
}
}
Modified: branches/7.2.x/src/main/java/org/apache/el/lang/FunctionMapperFactory.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/el/lang/FunctionMapperFactory.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/el/lang/FunctionMapperFactory.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.el.lang;
+import static org.jboss.web.ELMessages.MESSAGES;
+
import java.lang.reflect.Method;
import javax.el.FunctionMapper;
@@ -32,7 +34,7 @@
public FunctionMapperFactory(FunctionMapper mapper) {
if (mapper == null) {
- throw new NullPointerException("FunctionMapper target cannot be
null");
+ throw MESSAGES.invalidNullFunctionMapper();
}
this.target = mapper;
}
Modified: branches/7.2.x/src/main/java/org/apache/el/lang/FunctionMapperImpl.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/el/lang/FunctionMapperImpl.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/el/lang/FunctionMapperImpl.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.el.lang;
+import static org.jboss.web.ELMessages.MESSAGES;
+
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
@@ -102,10 +104,10 @@
*/
public Function(String prefix, String localName, Method m) {
if (localName == null) {
- throw new NullPointerException("LocalName cannot be null");
+ throw MESSAGES.invalidNullLocalName();
}
if (m == null) {
- throw new NullPointerException("Method cannot be null");
+ throw MESSAGES.invalidNullMethod();
}
this.prefix = prefix;
this.localName = localName;
Modified: branches/7.2.x/src/main/java/org/apache/el/lang/VariableMapperFactory.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/el/lang/VariableMapperFactory.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/el/lang/VariableMapperFactory.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.el.lang;
+import static org.jboss.web.ELMessages.MESSAGES;
+
import javax.el.ValueExpression;
import javax.el.VariableMapper;
@@ -27,7 +29,7 @@
public VariableMapperFactory(VariableMapper target) {
if (target == null) {
- throw new NullPointerException("Target VariableMapper cannot be
null");
+ throw MESSAGES.invalidNullVariableMapper();
}
this.target = target;
}
@@ -50,6 +52,6 @@
@Override
public ValueExpression setVariable(String variable, ValueExpression expression) {
- throw new UnsupportedOperationException("Cannot Set Variables on
Factory");
+ throw MESSAGES.cannotSetVariablesOnFactory();
}
}
Modified: branches/7.2.x/src/main/java/org/apache/el/parser/AstIdentifier.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/el/parser/AstIdentifier.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/el/parser/AstIdentifier.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -176,14 +176,9 @@
if (obj instanceof MethodExpression) {
return (MethodExpression) obj;
} else if (obj == null) {
- throw new MethodNotFoundException("Identity '" + this.image
- + "' was null and was unable to invoke");
+ throw new MethodNotFoundException(MESSAGES.invalidNullIdentity(this.image));
} else {
- throw new ELException(
- "Identity '"
- + this.image
- + "' does not reference a MethodExpression instance,
returned type: "
- + obj.getClass().getName());
+ throw new ELException(MESSAGES.invalidIdentityHasWrongType(this.image,
obj.getClass().getName()));
}
}
}
Modified: branches/7.2.x/src/main/java/org/apache/jasper/compiler/Compiler.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/compiler/Compiler.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/compiler/Compiler.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -35,6 +35,7 @@
import org.apache.jasper.JspCompilationContext;
import org.apache.jasper.Options;
import org.apache.jasper.servlet.JspServletWrapper;
+import org.jboss.web.JasperLogger;
/**
* Main JSP compiler class. This class uses Ant for compiling.
@@ -48,9 +49,6 @@
*/
public abstract class Compiler {
- protected org.jboss.logging.Logger log = org.jboss.logging.Logger
- .getLogger(Compiler.class);
-
// ----------------------------------------------------- Instance Variables
protected JspCompilationContext ctxt;
@@ -102,7 +100,7 @@
t1 = t2 = t3 = t4 = 0;
- if (log.isDebugEnabled()) {
+ if (JasperLogger.COMPILER_LOGGER.isDebugEnabled()) {
t1 = System.currentTimeMillis();
}
@@ -212,7 +210,7 @@
// directives we validated in pass 1
Validator.validateExDirectives(this, pageNodes);
- if (log.isDebugEnabled()) {
+ if (JasperLogger.COMPILER_LOGGER.isDebugEnabled()) {
t2 = System.currentTimeMillis();
}
@@ -224,7 +222,7 @@
tfp = new TagFileProcessor();
tfp.loadTagFiles(this, pageNodes);
- if (log.isDebugEnabled()) {
+ if (JasperLogger.COMPILER_LOGGER.isDebugEnabled()) {
t3 = System.currentTimeMillis();
}
@@ -252,9 +250,9 @@
// to be GC'd and save memory.
ctxt.setWriter(null);
- if (log.isDebugEnabled()) {
+ if (JasperLogger.COMPILER_LOGGER.isDebugEnabled()) {
t4 = System.currentTimeMillis();
- log.debug("Generated " + javaFileName + " total=" +
(t4 - t1)
+ JasperLogger.COMPILER_LOGGER.debug("Generated " + javaFileName
+ " total=" + (t4 - t1)
+ " generate=" + (t4 - t3) + " validate=" +
(t2 - t1));
}
@@ -468,8 +466,8 @@
jsw.setServletClassLastModifiedTime(targetLastModified);
}
if (targetLastModified < jspRealLastModified) {
- if (log.isDebugEnabled()) {
- log.debug("Compiler: outdated: " + targetFile + " "
+ if (JasperLogger.COMPILER_LOGGER.isDebugEnabled()) {
+ JasperLogger.COMPILER_LOGGER.debug("Compiler: outdated: " +
targetFile + " "
+ targetLastModified);
}
return true;
@@ -543,8 +541,8 @@
String classFileName = ctxt.getClassFileName();
if (classFileName != null) {
File classFile = new File(classFileName);
- if (log.isDebugEnabled())
- log.debug("Deleting " + classFile);
+ if (JasperLogger.COMPILER_LOGGER.isDebugEnabled())
+ JasperLogger.COMPILER_LOGGER.debug("Deleting " +
classFile);
classFile.delete();
}
} catch (Exception e) {
@@ -554,8 +552,8 @@
String javaFileName = ctxt.getServletJavaFileName();
if (javaFileName != null) {
File javaFile = new File(javaFileName);
- if (log.isDebugEnabled())
- log.debug("Deleting " + javaFile);
+ if (JasperLogger.COMPILER_LOGGER.isDebugEnabled())
+ JasperLogger.COMPILER_LOGGER.debug("Deleting " +
javaFile);
javaFile.delete();
}
} catch (Exception e) {
@@ -568,8 +566,8 @@
String classFileName = ctxt.getClassFileName();
if (classFileName != null) {
File classFile = new File(classFileName);
- if (log.isDebugEnabled())
- log.debug("Deleting " + classFile);
+ if (JasperLogger.COMPILER_LOGGER.isDebugEnabled())
+ JasperLogger.COMPILER_LOGGER.debug("Deleting " +
classFile);
classFile.delete();
}
} catch (Exception e) {
Modified:
branches/7.2.x/src/main/java/org/apache/jasper/compiler/DefaultErrorHandler.java
===================================================================
---
branches/7.2.x/src/main/java/org/apache/jasper/compiler/DefaultErrorHandler.java 2012-09-30
10:42:08 UTC (rev 2092)
+++
branches/7.2.x/src/main/java/org/apache/jasper/compiler/DefaultErrorHandler.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -81,7 +81,7 @@
buf.append(details[i].getErrorMessage());
}
}
- buf.append("\n\nStacktrace:");
+ buf.append("\n\n").append(MESSAGES.stacktrace());
throw new JasperException(MESSAGES.failedClassCompilation(buf.toString()));
}
Modified: branches/7.2.x/src/main/java/org/apache/jasper/compiler/JDTCompiler.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/compiler/JDTCompiler.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/compiler/JDTCompiler.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -49,6 +49,7 @@
import org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
+import org.jboss.web.JasperLogger;
/**
* JDT class compiler. This compiler will load source dependencies from the
@@ -68,7 +69,7 @@
throws FileNotFoundException, JasperException, Exception {
long t1 = 0;
- if (log.isDebugEnabled()) {
+ if (JasperLogger.COMPILER_LOGGER.isDebugEnabled()) {
t1 = System.currentTimeMillis();
}
@@ -116,7 +117,7 @@
buf.getChars(0, result.length, result, 0);
}
} catch (IOException e) {
- log.error("Compilation error", e);
+ JasperLogger.COMPILER_LOGGER.errorReadingSourceFile(sourceFile, e);
} finally {
if (reader != null) {
try {
@@ -217,9 +218,9 @@
new NameEnvironmentAnswer(classFileReader, null);
}
} catch (IOException exc) {
- log.error("Compilation error", exc);
+ JasperLogger.COMPILER_LOGGER.errorReadingClassFile(className,
exc);
} catch
(org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException exc) {
- log.error("Compilation error", exc);
+ JasperLogger.COMPILER_LOGGER.errorReadingClassFile(className,
exc);
} finally {
if (is != null) {
try {
@@ -314,7 +315,7 @@
settings.put(CompilerOptions.OPTION_Source,
CompilerOptions.VERSION_1_7);
} else {
- log.warn("Unknown source VM " + opt + " ignored.");
+ JasperLogger.COMPILER_LOGGER.unknownSourceJvm(opt);
settings.put(CompilerOptions.OPTION_Source,
CompilerOptions.VERSION_1_5);
}
@@ -355,7 +356,7 @@
settings.put(CompilerOptions.OPTION_Compliance,
CompilerOptions.VERSION_1_7);
} else {
- log.warn("Unknown target VM " + opt + " ignored.");
+ JasperLogger.COMPILER_LOGGER.unknownTargetJvm(opt);
settings.put(CompilerOptions.OPTION_TargetPlatform,
CompilerOptions.VERSION_1_5);
}
@@ -385,7 +386,7 @@
(name, pageNodes, new
StringBuilder(problem.getMessage()),
problem.getSourceLineNumber(),
ctxt));
} catch (JasperException e) {
- log.error("Error visiting node", e);
+
JasperLogger.COMPILER_LOGGER.errorCreatingCompilerReport(e);
}
}
}
@@ -416,7 +417,7 @@
}
}
} catch (IOException exc) {
- log.error("Compilation error", exc);
+ JasperLogger.COMPILER_LOGGER.errorCompiling(exc);
}
}
};
@@ -446,9 +447,9 @@
errDispatcher.javacError(jeds);
}
- if( log.isDebugEnabled() ) {
+ if( JasperLogger.COMPILER_LOGGER.isDebugEnabled() ) {
long t2=System.currentTimeMillis();
- log.debug("Compiled " + ctxt.getServletJavaFileName() + "
"
+ JasperLogger.COMPILER_LOGGER.debug("Compiled " +
ctxt.getServletJavaFileName() + " "
+ (t2-t1) + "ms");
}
Modified: branches/7.2.x/src/main/java/org/apache/jasper/compiler/JspRuntimeContext.java
===================================================================
---
branches/7.2.x/src/main/java/org/apache/jasper/compiler/JspRuntimeContext.java 2012-09-30
10:42:08 UTC (rev 2092)
+++
branches/7.2.x/src/main/java/org/apache/jasper/compiler/JspRuntimeContext.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.jasper.compiler;
+import static org.jboss.web.JasperMessages.MESSAGES;
+
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FilePermission;
@@ -284,8 +286,7 @@
} catch (FileNotFoundException ex) {
ctxt.incrementRemoved();
} catch (Throwable t) {
- jsw.getServletContext().log("Background compile failed",
- t);
+ jsw.getServletContext().log(MESSAGES.backgroundCompilationFailed(),
t);
}
}
}
@@ -422,7 +423,7 @@
new FilePermission(jndiUrl,"read") );
}
} catch(Exception e) {
- context.log("Security Init for context failed",e);
+ context.log(MESSAGES.errorInitializingSecurity(), e);
}
}
}
Modified: branches/7.2.x/src/main/java/org/apache/jasper/compiler/Parser.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/compiler/Parser.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/compiler/Parser.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -254,7 +254,7 @@
quote, isElIgnored,
pageInfo.isDeferredSyntaxAllowedAsLiteral());
} catch (IllegalArgumentException iae) {
- err.jspError(start, iae.getMessage());
+ err.jspError(start, MESSAGES.errorUnquotingAttributeValue(), iae);
}
if (watch.length() == 1) // quote
return ret;
Modified: branches/7.2.x/src/main/java/org/apache/jasper/compiler/SmapStratum.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/compiler/SmapStratum.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/compiler/SmapStratum.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.jasper.compiler;
+import static org.jboss.web.JasperMessages.MESSAGES;
+
import java.util.List;
import java.util.ArrayList;
@@ -47,14 +49,14 @@
/** Sets InputStartLine. */
public void setInputStartLine(int inputStartLine) {
if (inputStartLine < 0)
- throw new IllegalArgumentException("" + inputStartLine);
+ throw MESSAGES.invalidNegativeSmapPosition(inputStartLine);
this.inputStartLine = inputStartLine;
}
/** Sets OutputStartLine. */
public void setOutputStartLine(int outputStartLine) {
if (outputStartLine < 0)
- throw new IllegalArgumentException("" + outputStartLine);
+ throw MESSAGES.invalidNegativeSmapPosition(outputStartLine);
this.outputStartLine = outputStartLine;
}
@@ -66,7 +68,7 @@
*/
public void setLineFileID(int lineFileID) {
if (lineFileID < 0)
- throw new IllegalArgumentException("" + lineFileID);
+ throw MESSAGES.invalidNegativeSmapPosition(lineFileID);
this.lineFileID = lineFileID;
this.lineFileIDSet = true;
}
@@ -74,14 +76,14 @@
/** Sets InputLineCount. */
public void setInputLineCount(int inputLineCount) {
if (inputLineCount < 0)
- throw new IllegalArgumentException("" + inputLineCount);
+ throw MESSAGES.invalidNegativeSmapPosition(inputLineCount);
this.inputLineCount = inputLineCount;
}
/** Sets OutputLineIncrement. */
public void setOutputLineIncrement(int outputLineIncrement) {
if (outputLineIncrement < 0)
- throw new IllegalArgumentException("" + outputLineIncrement);
+ throw MESSAGES.invalidNegativeSmapPosition(outputLineIncrement);
this.outputLineIncrement = outputLineIncrement;
}
@@ -92,7 +94,7 @@
*/
public String getString() {
if (inputStartLine == -1 || outputStartLine == -1)
- throw new IllegalStateException();
+ throw MESSAGES.undefinedPosition();
StringBuilder out = new StringBuilder();
out.append(inputStartLine);
if (lineFileIDSet)
@@ -251,8 +253,7 @@
// check the input - what are you doing here??
int fileIndex = filePathList.indexOf(inputFileName);
if (fileIndex == -1) // still
- throw new IllegalArgumentException(
- "inputFileName: " + inputFileName);
+ throw MESSAGES.unknownFileName(inputFileName);
//Jasper incorrectly SMAPs certain Nodes, giving them an
//outputStartLine of 0. This can cause a fatal error in
Modified: branches/7.2.x/src/main/java/org/apache/jasper/compiler/SmapUtil.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/compiler/SmapUtil.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/compiler/SmapUtil.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -44,9 +44,6 @@
*/
public class SmapUtil {
- private org.jboss.logging.Logger log=
- org.jboss.logging.Logger.getLogger( SmapUtil.class );
-
//*********************************************************************
// Constants
Modified: branches/7.2.x/src/main/java/org/apache/jasper/compiler/TagFileProcessor.java
===================================================================
---
branches/7.2.x/src/main/java/org/apache/jasper/compiler/TagFileProcessor.java 2012-09-30
10:42:08 UTC (rev 2092)
+++
branches/7.2.x/src/main/java/org/apache/jasper/compiler/TagFileProcessor.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -123,15 +123,15 @@
private Vector variableVector;
- private static final String ATTR_NAME = "the name attribute of the attribute
directive";
+ private static final String ATTR_NAME = MESSAGES.tagFileProcessorAttrName();
- private static final String VAR_NAME_GIVEN = "the name-given attribute of
the variable directive";
+ private static final String VAR_NAME_GIVEN =
MESSAGES.tagFileProcessorVarNameGiven();
- private static final String VAR_NAME_FROM = "the name-from-attribute
attribute of the variable directive";
+ private static final String VAR_NAME_FROM =
MESSAGES.tagFileProcessorVarNameFrom();
- private static final String VAR_ALIAS = "the alias attribute of the variable
directive";
+ private static final String VAR_ALIAS = MESSAGES.tagFileProcessorVarAlias();
- private static final String TAG_DYNAMIC = "the dynamic-attributes attribute
of the tag directive";
+ private static final String TAG_DYNAMIC = MESSAGES.tagFileProcessorTagDynamic();
private HashMap nameTable = new HashMap();
Modified: branches/7.2.x/src/main/java/org/apache/jasper/el/ELResolverImpl.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/el/ELResolverImpl.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/el/ELResolverImpl.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.jasper.el;
+import static org.jboss.web.JasperMessages.MESSAGES;
+
import java.util.Iterator;
import javax.el.ArrayELResolver;
@@ -59,7 +61,7 @@
public Object getValue(ELContext context, Object base, Object property)
throws NullPointerException, PropertyNotFoundException, ELException {
if (context == null) {
- throw new NullPointerException();
+ throw MESSAGES.elResolverNullContext();
}
if (base == null) {
@@ -69,7 +71,8 @@
return this.variableResolver.resolveVariable(property
.toString());
} catch (javax.servlet.jsp.el.ELException e) {
- throw new ELException(e.getMessage(), e.getCause());
+ throw new ELException(MESSAGES.errorResolvingVariable
+ (property.toString(), e.getMessage()), e.getCause());
}
}
}
@@ -83,7 +86,7 @@
public Class<?> getType(ELContext context, Object base, Object property)
throws NullPointerException, PropertyNotFoundException, ELException {
if (context == null) {
- throw new NullPointerException();
+ throw MESSAGES.elResolverNullContext();
}
if (base == null) {
@@ -94,7 +97,8 @@
.toString());
return (obj != null) ? obj.getClass() : null;
} catch (javax.servlet.jsp.el.ELException e) {
- throw new ELException(e.getMessage(), e.getCause());
+ throw new ELException(MESSAGES.errorResolvingVariable
+ (property.toString(), e.getMessage()), e.getCause());
}
}
}
@@ -110,13 +114,12 @@
PropertyNotFoundException, PropertyNotWritableException,
ELException {
if (context == null) {
- throw new NullPointerException();
+ throw MESSAGES.elResolverNullContext();
}
if (base == null) {
context.setPropertyResolved(true);
- throw new PropertyNotWritableException(
- "Legacy VariableResolver wrapped, not writable");
+ throw new PropertyNotWritableException(MESSAGES.legacyVariableResolver());
}
if (!context.isPropertyResolved()) {
@@ -127,7 +130,7 @@
public boolean isReadOnly(ELContext context, Object base, Object property)
throws NullPointerException, PropertyNotFoundException, ELException {
if (context == null) {
- throw new NullPointerException();
+ throw MESSAGES.elResolverNullContext();
}
if (base == null) {
Modified: branches/7.2.x/src/main/java/org/apache/jasper/runtime/BodyContentImpl.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/runtime/BodyContentImpl.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/runtime/BodyContentImpl.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.jasper.runtime;
+import static org.jboss.web.JasperMessages.MESSAGES;
+
import java.io.CharArrayReader;
import java.io.IOException;
import java.io.Reader;
@@ -310,7 +312,7 @@
private void ensureOpen() throws IOException {
if (closed) {
- throw new IOException("Stream closed");
+ throw new IOException(MESSAGES.streamClosed());
}
else {
return;
Modified: branches/7.2.x/src/main/java/org/apache/jasper/runtime/CharBuffer.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/runtime/CharBuffer.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/runtime/CharBuffer.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.jasper.runtime;
+import static org.jboss.web.JasperMessages.MESSAGES;
+
import java.io.IOException;
import java.io.Writer;
import java.util.Iterator;
@@ -111,13 +113,13 @@
return;
}
if (text == null) {
- throw new IllegalArgumentException("text: may not be null.");
+ throw MESSAGES.nullCharBufferTextArgument();
}
if (start > text.length()) {
- throw new IllegalArgumentException("start: points beyond end of
text.");
+ throw MESSAGES.invalidCharBufferStartPosition();
}
if ((start + length) > text.length()) {
- throw new IllegalArgumentException("length: specifies length in excess
of text length.");
+ throw MESSAGES.invalidCharBufferLength();
}
//If length of string to add is greater than will fit in current char array then
add what will fit
@@ -161,13 +163,13 @@
return;
}
if (characters == null) {
- throw new IllegalArgumentException("characters: may not be
null.");
+ throw MESSAGES.nullCharBufferCharactersArgument();
}
if (start > characters.length) {
- throw new IllegalArgumentException("start: points beyond end of
array.");
+ throw MESSAGES.invalidCharBufferStartPosition();
}
if ((start + length) > characters.length) {
- throw new IllegalArgumentException("length: specifies length in excess
of array length.");
+ throw MESSAGES.invalidCharBufferLength();
}
//If length of string to add is greater than will fit in current char array then
add what will fit
@@ -263,7 +265,7 @@
*/
public void writeOut(Writer writer) throws IOException, IllegalArgumentException {
if (writer == null) {
- throw new IllegalArgumentException("writer: may not be null.");
+ throw MESSAGES.nullCharBufferWriterArgument();
}
for (Iterator iter = this.bufList.iterator(); iter.hasNext();) {
char[] curBuf = (char[]) iter.next();
Modified:
branches/7.2.x/src/main/java/org/apache/jasper/runtime/InstanceManagerFactory.java
===================================================================
---
branches/7.2.x/src/main/java/org/apache/jasper/runtime/InstanceManagerFactory.java 2012-09-30
10:42:08 UTC (rev 2092)
+++
branches/7.2.x/src/main/java/org/apache/jasper/runtime/InstanceManagerFactory.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -20,6 +20,8 @@
package org.apache.jasper.runtime;
+import static org.jboss.web.JasperMessages.MESSAGES;
+
import javax.servlet.ServletConfig;
import org.apache.tomcat.InstanceManager;
@@ -36,7 +38,7 @@
InstanceManager instanceManager =
(InstanceManager)
config.getServletContext().getAttribute(InstanceManager.class.getName());
if (instanceManager == null) {
- throw new IllegalStateException("No org.apache.tomcat.InstanceManager
set in ServletContext");
+ throw MESSAGES.noInstanceManager();
}
return instanceManager;
}
Modified:
branches/7.2.x/src/main/java/org/apache/jasper/runtime/JspApplicationContextImpl.java
===================================================================
---
branches/7.2.x/src/main/java/org/apache/jasper/runtime/JspApplicationContextImpl.java 2012-09-30
10:42:08 UTC (rev 2092)
+++
branches/7.2.x/src/main/java/org/apache/jasper/runtime/JspApplicationContextImpl.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -16,6 +16,8 @@
*/
package org.apache.jasper.runtime;
+import static org.jboss.web.JasperMessages.MESSAGES;
+
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
@@ -67,14 +69,14 @@
public void addELContextListener(ELContextListener listener) {
if (listener == null) {
- throw new IllegalArgumentException("ELConextListener was null");
+ throw MESSAGES.nullElContextListener();
}
this.contextListeners.add(listener);
}
public static JspApplicationContextImpl getInstance(ServletContext context) {
if (context == null) {
- throw new IllegalArgumentException("ServletContext was null");
+ throw MESSAGES.nullServletContext();
}
JspApplicationContextImpl impl = (JspApplicationContextImpl) context
.getAttribute(KEY);
@@ -87,7 +89,7 @@
public ELContextImpl createELContext(JspContext context) {
if (context == null) {
- throw new IllegalArgumentException("JspContext was null");
+ throw MESSAGES.nullJspContext();
}
// create ELContext for JspContext
@@ -135,11 +137,10 @@
public void addELResolver(ELResolver resolver) throws IllegalStateException {
if (resolver == null) {
- throw new IllegalArgumentException("ELResolver was null");
+ throw MESSAGES.nullElResolver();
}
if (this.instantiated) {
- throw new IllegalStateException(
- "cannot call addELResolver after the first request has been made");
+ throw MESSAGES.cannotAddElResolver();
}
this.resolvers.add(resolver);
}
Modified: branches/7.2.x/src/main/java/org/apache/jasper/runtime/JspFactoryImpl.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/runtime/JspFactoryImpl.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/runtime/JspFactoryImpl.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -30,6 +30,7 @@
import org.apache.jasper.Constants;
import org.jboss.logging.Logger;
+import org.jboss.web.JasperLogger;
/**
* Implementation of JspFactory.
@@ -38,9 +39,6 @@
*/
public class JspFactoryImpl extends JspFactory {
- // Logger
- private Logger log = Logger.getLogger(JspFactoryImpl.class);
-
private static final String SPEC_VERSION = "2.2";
private static final boolean USE_POOL =
Boolean.valueOf(System.getProperty("org.apache.jasper.runtime.JspFactoryImpl.USE_POOL",
"true")).booleanValue();
@@ -108,7 +106,7 @@
return pc;
} catch (Throwable ex) {
/* FIXME: need to do something reasonable here!! */
- log.fatal("Exception initializing page context", ex);
+ JasperLogger.ROOT_LOGGER.errorInitializingPageContext(ex);
return null;
}
}
Modified: branches/7.2.x/src/main/java/org/apache/jasper/runtime/JspWriterImpl.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/runtime/JspWriterImpl.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/runtime/JspWriterImpl.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -79,7 +79,7 @@
boolean autoFlush) {
super(sz, autoFlush);
if (sz < 0)
- throw new IllegalArgumentException("Buffer size <= 0");
+ throw MESSAGES.invalidNegativeBufferSize();
this.response = response;
cb = sz == 0 ? null : new char[sz];
nextChar = 0;
@@ -187,7 +187,7 @@
/** check to make sure that the stream has not been closed */
private void ensureOpen() throws IOException {
if (response == null || closed)
- throw new IOException("Stream closed");
+ throw new IOException(MESSAGES.streamClosed());
}
Modified: branches/7.2.x/src/main/java/org/apache/jasper/runtime/PageContextImpl.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/runtime/PageContextImpl.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/runtime/PageContextImpl.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -146,8 +146,7 @@
if (request instanceof HttpServletRequest && needsSession)
this.session = ((HttpServletRequest) request).getSession();
if (needsSession && session == null)
- throw new IllegalStateException(
- "Page needs a session and none is available");
+ throw MESSAGES.pageNeedsSession();
// initialize the initial out ...
depth = -1;
@@ -753,7 +752,7 @@
public void handlePageException(final Throwable t) throws IOException,
ServletException {
if (t == null)
- throw new NullPointerException("null Throwable");
+ throw MESSAGES.nullThrowable();
if (SecurityUtil.isPackageProtectionEnabled()) {
try {
Modified:
branches/7.2.x/src/main/java/org/apache/jasper/runtime/ProtectedFunctionMapper.java
===================================================================
---
branches/7.2.x/src/main/java/org/apache/jasper/runtime/ProtectedFunctionMapper.java 2012-09-30
10:42:08 UTC (rev 2092)
+++
branches/7.2.x/src/main/java/org/apache/jasper/runtime/ProtectedFunctionMapper.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.jasper.runtime;
+import static org.jboss.web.JasperMessages.MESSAGES;
+
import java.util.HashMap;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -105,17 +107,13 @@
}
});
} catch (PrivilegedActionException ex) {
- throw new RuntimeException(
- "Invalid function mapping - no such method: "
- + ex.getException().getMessage());
+ throw MESSAGES.invalidFunctionMapping(ex.getException().getMessage());
}
} else {
try {
method = c.getDeclaredMethod(methodName, args);
} catch (NoSuchMethodException e) {
- throw new RuntimeException(
- "Invalid function mapping - no such method: "
- + e.getMessage());
+ throw MESSAGES.invalidFunctionMapping(e.getMessage());
}
}
@@ -159,18 +157,14 @@
}
});
} catch (PrivilegedActionException ex) {
- throw new RuntimeException(
- "Invalid function mapping - no such method: "
- + ex.getException().getMessage());
+ throw MESSAGES.invalidFunctionMapping(ex.getException().getMessage());
}
} else {
funcMapper = new ProtectedFunctionMapper();
try {
method = c.getDeclaredMethod(methodName, args);
} catch (NoSuchMethodException e) {
- throw new RuntimeException(
- "Invalid function mapping - no such method: "
- + e.getMessage());
+ throw MESSAGES.invalidFunctionMapping(e.getMessage());
}
}
funcMapper.theMethod = method;
Modified: branches/7.2.x/src/main/java/org/apache/jasper/security/SecurityClassLoad.java
===================================================================
---
branches/7.2.x/src/main/java/org/apache/jasper/security/SecurityClassLoad.java 2012-09-30
10:42:08 UTC (rev 2092)
+++
branches/7.2.x/src/main/java/org/apache/jasper/security/SecurityClassLoad.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -18,6 +18,8 @@
package org.apache.jasper.security;
+import org.jboss.web.JasperLogger;
+
/**
* Static class used to preload java classes when using the
* Java SecurityManager so that the defineClassInPackage
@@ -28,9 +30,6 @@
public final class SecurityClassLoad {
- private static org.jboss.logging.Logger log=
- org.jboss.logging.Logger.getLogger( SecurityClassLoad.class );
-
public static void securityClassLoad(ClassLoader loader){
if( System.getSecurityManager() == null ){
@@ -108,7 +107,7 @@
loader.loadClass( basePackage +
"runtime.JspWriterImpl$1");
} catch (ClassNotFoundException ex) {
- log.error("SecurityClassLoad", ex);
+ JasperLogger.ROOT_LOGGER.errorLoadingCoreClass(ex);
}
}
}
Modified: branches/7.2.x/src/main/java/org/apache/jasper/servlet/JspServlet.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/servlet/JspServlet.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/servlet/JspServlet.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -190,9 +190,7 @@
// precompilation request can be ignored.
return (true); // ?jsp_precompile=false
} else {
- throw new ServletException("Cannot have request parameter " +
- Constants.PRECOMPILE + " set to " +
- value);
+ throw new
ServletException(MESSAGES.invalidRequestParameterValue(Constants.PRECOMPILE, value));
}
}
Modified:
branches/7.2.x/src/main/java/org/apache/jasper/xmlparser/XMLEncodingDetector.java
===================================================================
---
branches/7.2.x/src/main/java/org/apache/jasper/xmlparser/XMLEncodingDetector.java 2012-09-30
10:42:08 UTC (rev 2092)
+++
branches/7.2.x/src/main/java/org/apache/jasper/xmlparser/XMLEncodingDetector.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -1549,7 +1549,7 @@
char c1 = Character.toLowerCase(target.charAt(1));
char c2 = Character.toLowerCase(target.charAt(2));
if (c0 == 'x' && c1 == 'm' && c2 ==
'l') {
- err.jspError("jsp.error.xml.reservedPITarget");
+ err.jspError(MESSAGES.reservedPiTarget());
}
}
@@ -1562,7 +1562,7 @@
}
else {
// if there is data there should be some space
- err.jspError("jsp.error.xml.spaceRequiredInPI");
+ err.jspError(MESSAGES.requiredWhiteSpaceAfterPiTarget());
}
}
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/BayeuxServlet.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/BayeuxServlet.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/BayeuxServlet.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -16,6 +16,8 @@
*/
package org.apache.tomcat.bayeux;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.IOException;
import javax.servlet.ServletContext;
@@ -29,9 +31,9 @@
import org.apache.tomcat.util.json.JSONArray;
import org.apache.tomcat.util.json.JSONException;
import org.apache.tomcat.util.json.JSONObject;
-import org.jboss.logging.Logger;
import org.jboss.servlet.http.HttpEvent;
import org.jboss.servlet.http.HttpEventServlet;
+import org.jboss.web.CoyoteLogger;
/**
*
@@ -42,9 +44,6 @@
public class BayeuxServlet extends HttpServlet implements HttpEventServlet {
- private static Logger log = Logger.getLogger(BayeuxServlet.class);
-
-
/**
* The timeout.
*/
@@ -96,8 +95,8 @@
public void event(HttpEvent cometEvent) throws IOException, ServletException {
HttpEvent.EventType type = cometEvent.getType();
- if (log.isTraceEnabled()) {
- log.trace("["+Thread.currentThread().getName()+"] Received
Comet Event type="+type);
+ if (CoyoteLogger.BAYEUX_LOGGER.isTraceEnabled()) {
+
CoyoteLogger.BAYEUX_LOGGER.trace("["+Thread.currentThread().getName()+"]
Received Comet Event type="+type);
}
switch (type) {
case BEGIN:
@@ -140,14 +139,14 @@
} else { // GET method or application/x-www-form-urlencoded
String message = cometEvent.getHttpServletRequest().getParameter(
Bayeux.MESSAGE_PARAMETER);
- if (log.isTraceEnabled()) {
- log.trace("[" + Thread.currentThread().getName()
+ if (CoyoteLogger.BAYEUX_LOGGER.isTraceEnabled()) {
+ CoyoteLogger.BAYEUX_LOGGER.trace("[" +
Thread.currentThread().getName()
+ "] Received JSON message:" + message);
}
try {
int action = handleBayeux(message, cometEvent);
- if (log.isTraceEnabled()) {
- log.trace("[" + Thread.currentThread().getName()
+ if (CoyoteLogger.BAYEUX_LOGGER.isTraceEnabled()) {
+ CoyoteLogger.BAYEUX_LOGGER.trace("[" +
Thread.currentThread().getName()
+ "] Bayeux handling complete, action result="
+ action);
}
@@ -156,7 +155,7 @@
}
} catch (Exception e) {
tb.remove(cometEvent);
- log.warn("Exception in check", e);
+ CoyoteLogger.BAYEUX_LOGGER.errorInCheckBayeux(e);
cometEvent.close();
}
}
@@ -172,37 +171,37 @@
for (int i = 0; i < jsArray.length(); i++) {
JSONObject msg = jsArray.getJSONObject(i);
- if (log.isTraceEnabled()) {
- log.trace("["+Thread.currentThread().getName()+"]
Processing bayeux message:"+msg);
+ if (CoyoteLogger.BAYEUX_LOGGER.isTraceEnabled()) {
+
CoyoteLogger.BAYEUX_LOGGER.trace("["+Thread.currentThread().getName()+"]
Processing bayeux message:"+msg);
}
request = RequestFactory.getRequest(tb,event,msg);
- if (log.isTraceEnabled()) {
- log.trace("["+Thread.currentThread().getName()+"]
Processing bayeux message using request:"+request);
+ if (CoyoteLogger.BAYEUX_LOGGER.isTraceEnabled()) {
+
CoyoteLogger.BAYEUX_LOGGER.trace("["+Thread.currentThread().getName()+"]
Processing bayeux message using request:"+request);
}
result = request.process(result);
- if (log.isTraceEnabled()) {
- log.trace("["+Thread.currentThread().getName()+"]
Processing bayeux message result:"+result);
+ if (CoyoteLogger.BAYEUX_LOGGER.isTraceEnabled()) {
+
CoyoteLogger.BAYEUX_LOGGER.trace("["+Thread.currentThread().getName()+"]
Processing bayeux message result:"+result);
}
}
if (result>0 && request!=null) {
event.getHttpServletRequest().setAttribute(BayeuxRequest.LAST_REQ_ATTR,
request);
ClientImpl ci =
(ClientImpl)tb.getClient(((RequestBase)request).getClientId());
ci.addCometEvent(event);
- if (log.isTraceEnabled()) {
- log.trace("["+Thread.currentThread().getName()+"] Done
bayeux message added to request attribute");
+ if (CoyoteLogger.BAYEUX_LOGGER.isTraceEnabled()) {
+
CoyoteLogger.BAYEUX_LOGGER.trace("["+Thread.currentThread().getName()+"]
Done bayeux message added to request attribute");
}
} else if (result == 0 && request!=null) {
RequestBase.deliver(event,(ClientImpl)tb.getClient(((RequestBase)request).getClientId()));
- if (log.isTraceEnabled()) {
- log.trace("["+Thread.currentThread().getName()+"] Done
bayeux message, delivered to client");
+ if (CoyoteLogger.BAYEUX_LOGGER.isTraceEnabled()) {
+
CoyoteLogger.BAYEUX_LOGGER.trace("["+Thread.currentThread().getName()+"]
Done bayeux message, delivered to client");
}
}
}catch (JSONException e) {
- log.warn("Error", e);// FIXME impl error handling
+ CoyoteLogger.BAYEUX_LOGGER.errorProcessingBayeux(e);
result = -1;
}catch (BayeuxException e) {
- log.warn("Error", e); // FIXME impl error handling
+ CoyoteLogger.BAYEUX_LOGGER.errorProcessingBayeux(e);
result = -1;
}
return result;
@@ -231,9 +230,9 @@
public void service(ServletRequest servletRequest, ServletResponse servletResponse)
throws ServletException, IOException {
if (servletResponse instanceof HttpServletResponse) {
- ( (HttpServletResponse) servletResponse).sendError(500, "Misconfigured
Tomcat server, must be configured to support Comet operations.");
+ ( (HttpServletResponse) servletResponse).sendError(500,
MESSAGES.invalidBayeuxConfiguration());
} else {
- throw new ServletException("Misconfigured Tomcat server, must be
configured to support Comet operations for the Bayeux protocol.");
+ throw new ServletException(MESSAGES.invalidBayeuxConfiguration());
}
}
}
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/ChannelImpl.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/ChannelImpl.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/ChannelImpl.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -16,6 +16,8 @@
*/
package org.apache.tomcat.bayeux;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
@@ -79,7 +81,7 @@
*/
public boolean matches(String pattern) {
if (pattern == null)
- throw new NullPointerException("Channel pattern must not be
null.");
+ throw MESSAGES.invalidNullChannelPattern();
if (getId().equals(pattern))
return true;
int wildcardPos = pattern.indexOf("/*");
@@ -125,8 +127,7 @@
Message data = msgs[i];
if (!(data instanceof MessageImpl))
- throw new IllegalArgumentException("Invalid message class, you can
only publish messages "+
- "created through the
Bayeux.newMessage() method");
+ throw MESSAGES.invalidMessagePublish();
/*if (log.isDebugEnabled()) {
log.debug("Publishing message:"+data+" to
channel:"+this);
}*/
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/ClientImpl.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/ClientImpl.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/ClientImpl.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -31,13 +31,11 @@
import org.apache.cometd.bayeux.Listener;
import org.apache.cometd.bayeux.Message;
import org.apache.tomcat.util.json.JSONObject;
-import org.jboss.logging.Logger;
import org.jboss.servlet.http.HttpEvent;
+import org.jboss.web.CoyoteLogger;
public class ClientImpl implements Client {
- private static Logger log = Logger.getLogger(ClientImpl.class);
-
public static final int SUPPORT_CALLBACK_POLL = 0x1;
public static final int SUPPORT_LONG_POLL = 0x2;
@@ -139,8 +137,8 @@
map.put(Bayeux.CHANNEL_FIELD,message.getChannel().getId());
map.put(Bayeux.DATA_FIELD,message);
JSONObject json = new JSONObject(map);
- if (log.isTraceEnabled()) {
- log.trace("Message instantly delivered to remote
client["+this+"] message:"+json);
+ if (CoyoteLogger.BAYEUX_LOGGER.isTraceEnabled()) {
+ CoyoteLogger.BAYEUX_LOGGER.trace("Message instantly
delivered to remote client["+this+"] message:"+json);
}
rq.addToDeliveryQueue(this, json);
//deliver the batch
@@ -152,13 +150,13 @@
delivered = true;
} catch (Exception e) {
// TODO: fix
- log.warn("Exception", e);
+ CoyoteLogger.BAYEUX_LOGGER.errorDeliveringBayeux(e);
}
}
}
if (!delivered) {
- if (log.isTraceEnabled()) {
- log.trace("Message added to queue for remote
client["+this+"] message:"+message);
+ if (CoyoteLogger.BAYEUX_LOGGER.isTraceEnabled()) {
+ CoyoteLogger.BAYEUX_LOGGER.trace("Message added to queue for
remote client["+this+"] message:"+message);
}
//queue the message for the next round
messages.add(message);
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/RequestBase.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/RequestBase.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/RequestBase.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -16,6 +16,8 @@
*/
package org.apache.tomcat.bayeux;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
@@ -36,6 +38,7 @@
import org.apache.tomcat.util.json.JSONObject;
import org.jboss.logging.Logger;
import org.jboss.servlet.http.HttpEvent;
+import org.jboss.web.CoyoteLogger;
/**
* Common functionality and member variables for all Bayeux requests.
@@ -47,8 +50,6 @@
*/
public abstract class RequestBase implements BayeuxRequest {
- private static Logger log = Logger.getLogger(RequestBase.class);
-
protected static final SimpleDateFormat timestampFmt =
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
static {
@@ -155,10 +156,10 @@
protected static void deliver(HttpEvent event, ClientImpl to) throws IOException,
ServletException, BayeuxException {
JSONArray jarray = getJSONArray(event,true);
- if ( jarray == null ) throw new BayeuxException("No message to
send!");
+ if ( jarray == null ) throw new BayeuxException(MESSAGES.noBayeuxMessage());
String jsonstring = jarray.toString();
- if (log.isTraceEnabled()) {
- log.trace("["+Thread.currentThread().getName()+"] Delivering
message to[" + to + "] message:" + jsonstring);
+ if (CoyoteLogger.BAYEUX_LOGGER.isTraceEnabled()) {
+
CoyoteLogger.BAYEUX_LOGGER.trace("["+Thread.currentThread().getName()+"]
Delivering message to[" + to + "] message:" + jsonstring);
}
if (to!=null) {
@@ -182,7 +183,7 @@
out.print(jsonp);
out.print('(');
} else {
- throw new BayeuxException("Client doesn't support any appropriate
connection type.");
+ throw new BayeuxException(MESSAGES.noBayeuxConnectionType());
}
out.print(jsonstring);
if ( to == null ) {
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/UUIDGenerator.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/UUIDGenerator.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/UUIDGenerator.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -15,6 +15,8 @@
*/
package org.apache.tomcat.bayeux;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.security.SecureRandom;
import java.util.Random;
@@ -43,7 +45,7 @@
public static byte[] randomUUID(boolean secure, byte[] into, int offset) {
if ( (offset+UUID_LENGTH)>into.length )
- throw new ArrayIndexOutOfBoundsException("Unable to fit
"+UUID_LENGTH+" bytes into the array. length:"+into.length+" required
length:"+(offset+UUID_LENGTH));
+ throw MESSAGES.errorGeneratingUuid(UUID_LENGTH, into.length, offset +
UUID_LENGTH);
Random r = (secure&&(secrand!=null))?secrand:rand;
nextBytes(into,offset,UUID_LENGTH,r);
into[6+offset] &= 0x0F;
Modified:
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaConnectRequest.java
===================================================================
---
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaConnectRequest.java 2012-09-30
10:42:08 UTC (rev 2092)
+++
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaConnectRequest.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -16,6 +16,8 @@
*/
package org.apache.tomcat.bayeux.request;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.IOException;
import java.util.HashMap;
@@ -70,9 +72,9 @@
*/
public HttpError validate() {
if(clientId==null|| (!getTomcatBayeux().hasClient(clientId)))
- return new HttpError(400,"Client Id not valid.", null);
+ return new HttpError(400, MESSAGES.invalidBayeuxClientId(), null);
if (! (Bayeux.TRANSPORT_LONG_POLL.equals(conType) ||
Bayeux.TRANSPORT_CALLBACK_POLL.equals(conType)))
- return new HttpError(400,"Unsupported connection type.",null);
+ return new HttpError(400, MESSAGES.noBayeuxConnectionType(), null);
return null;//no error
}
Modified:
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaDisconnectRequest.java
===================================================================
---
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaDisconnectRequest.java 2012-09-30
10:42:08 UTC (rev 2092)
+++
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaDisconnectRequest.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -16,6 +16,8 @@
*/
package org.apache.tomcat.bayeux.request;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.IOException;
import java.util.HashMap;
@@ -66,7 +68,7 @@
*/
public HttpError validate() {
if(clientId==null|| (!this.getTomcatBayeux().hasClient(clientId)))
- return new HttpError(400,"Client Id not valid.", null);
+ return new HttpError(400, MESSAGES.invalidBayeuxClientId(), null);
// if (! (Bayeux.TRANSPORT_LONG_POLL.equals(conType) ||
Bayeux.TRANSPORT_CALLBACK_POLL.equals(conType)))
// return new HttpError(400,"Unsupported connection type.",null);
return null;//no error
Modified:
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaHandshakeRequest.java
===================================================================
---
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaHandshakeRequest.java 2012-09-30
10:42:08 UTC (rev 2092)
+++
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaHandshakeRequest.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -16,6 +16,8 @@
*/
package org.apache.tomcat.bayeux.request;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.IOException;
import java.util.HashMap;
@@ -74,7 +76,7 @@
public HttpError validate() {
boolean error = (version==null || version.length()==0);
if (!error) error = suppConnTypesFlag==0;
- if (error) return new HttpError(400,"Invalid handshake request,
supportedConnectionType field missing.",null);
+ if (error) return new HttpError(400, MESSAGES.invalidBayeuxHandshake(),null);
else return null;
}
Modified:
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaSubscribeRequest.java
===================================================================
---
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaSubscribeRequest.java 2012-09-30
10:42:08 UTC (rev 2092)
+++
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaSubscribeRequest.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -16,6 +16,8 @@
*/
package org.apache.tomcat.bayeux.request;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
@@ -71,9 +73,9 @@
*/
public HttpError validate() {
if(clientId==null|| (!this.getTomcatBayeux().hasClient(clientId)))
- return new HttpError(400,"Client Id not valid.", null);
+ return new HttpError(400, MESSAGES.invalidBayeuxClientId(), null);
if (subscription==null||subscription.length()==0)
- return new HttpError(400,"Subscription missing.",null);
+ return new HttpError(400, MESSAGES.noBayeuxSubscription(), null);
return null;//no error
}
Modified:
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaUnsubscribeRequest.java
===================================================================
---
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaUnsubscribeRequest.java 2012-09-30
10:42:08 UTC (rev 2092)
+++
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaUnsubscribeRequest.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -16,6 +16,8 @@
*/
package org.apache.tomcat.bayeux.request;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
@@ -72,9 +74,9 @@
*/
public HttpError validate() {
if(clientId==null|| (!this.getTomcatBayeux().hasClient(clientId)))
- return new HttpError(400,"Client Id not valid.", null);
+ return new HttpError(400, MESSAGES.invalidBayeuxClientId(), null);
if (subscription==null||subscription.length()==0)
- return new HttpError(400,"Subscription missing.",null);
+ return new HttpError(400, MESSAGES.noBayeuxSubscription(), null);
return null;//no error
}
Modified:
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/PublishRequest.java
===================================================================
---
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/PublishRequest.java 2012-09-30
10:42:08 UTC (rev 2092)
+++
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/PublishRequest.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -16,6 +16,8 @@
*/
package org.apache.tomcat.bayeux.request;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.IOException;
import java.util.HashMap;
@@ -69,16 +71,16 @@
*/
public HttpError validate() {
if(channel==null|| (!this.getTomcatBayeux().hasChannel(channel)))
- return new HttpError(400,"Channel Id not valid.", null);
+ return new HttpError(400, MESSAGES.invalidBayeuxClientId(), null);
if(data==null || data.length()==0)
- return new HttpError(400,"Message data missing.", null);
+ return new HttpError(400, MESSAGES.noBayeuxMessageData(), null);
try {
this.msgData = new JSONObject(data);
}catch (JSONException x) {
- return new HttpError(400,"Invalid JSON object in data
attribute.",x);
+ return new HttpError(400, MESSAGES.invalidBayeuxMessageData(), x);
}
if(clientId==null|| (!this.getTomcatBayeux().hasClient(clientId)))
- return new HttpError(400,"Client Id not valid.", null);
+ return new HttpError(400, MESSAGES.invalidBayeuxClientId(), null);
return null;//no error
}
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/jni/Library.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/jni/Library.java 2012-09-30 10:42:08
UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/jni/Library.java 2012-10-01 16:46:15
UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.tomcat.jni;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
/** Library
*
* @author Mladen Turk
@@ -61,7 +63,7 @@
for (int j=0; j<paths.length; j++) {
java.io.File fd = new java.io.File(paths[j] +
System.getProperty("file.separator") + name);
if (fd.exists()) {
- err += "(Error on: " + paths[j] +
System.getProperty("file.separator") + name +")";
+ err += MESSAGES.aprError() + paths[j] +
System.getProperty("file.separator") + name +")";
}
}
err += e.getMessage();
@@ -217,11 +219,10 @@
APR_TCP_NODELAY_INHERITED = has(19);
APR_O_NONBLOCK_INHERITED = has(20);
if (APR_MAJOR_VERSION < 1) {
- throw new UnsatisfiedLinkError("Unsupported APR Version (" +
- aprVersionString() + ")");
+ throw MESSAGES.unsupportedAprVersion(aprVersionString());
}
if (!APR_HAS_THREADS) {
- throw new UnsatisfiedLinkError("Missing APR_HAS_THREADS");
+ throw MESSAGES.missingAprThreadsSupport();
}
}
return initialize();
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/DomUtil.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/DomUtil.java 2012-09-30 10:42:08
UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/DomUtil.java 2012-10-01 16:46:15
UTC (rev 2093)
@@ -31,6 +31,7 @@
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import org.jboss.web.CoyoteLogger;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
@@ -45,8 +46,6 @@
* @author Costin Manolache
*/
public class DomUtil {
- private static org.jboss.logging.Logger log=
- org.jboss.logging.Logger.getLogger( DomUtil.class );
// -------------------- DOM utils --------------------
@@ -73,7 +72,6 @@
for (Node node = first; node != null;
node = node.getNextSibling()) {
- //System.out.println("getNode: " + name + " " +
node.getNodeName());
if( node.getNodeType()!=Node.ELEMENT_NODE)
continue;
if( name != null &&
@@ -207,8 +205,8 @@
String systemId)
throws SAXException, IOException
{
- if( log.isTraceEnabled())
- log.trace("ResolveEntity: " + publicId + " " +
systemId);
+ if( CoyoteLogger.UTIL_LOGGER.isTraceEnabled())
+ CoyoteLogger.UTIL_LOGGER.trace("ResolveEntity: " + publicId +
" " + systemId);
return new InputSource(new StringReader(""));
}
}
@@ -223,8 +221,8 @@
String name=n.getNodeName();
String value=n.getNodeValue();
- if( log.isTraceEnabled() )
- log.trace("Attribute " + parent.getNodeName() + " "
+
+ if( CoyoteLogger.UTIL_LOGGER.isTraceEnabled() )
+ CoyoteLogger.UTIL_LOGGER.trace("Attribute " +
parent.getNodeName() + " " +
name + "=" + value);
try {
IntrospectionUtils.setProperty(o, name, value);
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/IntrospectionUtils.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/IntrospectionUtils.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/IntrospectionUtils.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -22,6 +22,8 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
+import org.jboss.web.CoyoteLogger;
+
// Depends: JDK1.1
/**
@@ -31,9 +33,6 @@
public final class IntrospectionUtils {
- private static org.jboss.logging.Logger log=
- org.jboss.logging.Logger.getLogger( IntrospectionUtils.class );
-
/**
* Find a method with the right name If found, call the method ( if param is
* int or boolean we'll convert value to the right type before) - that means
@@ -138,7 +137,7 @@
}
} catch (IllegalArgumentException ex2) {
- log.warn("IAE " + o + " " + name + " " + value,
ex2);
+ CoyoteLogger.UTIL_LOGGER.errorSettingProperty(name, o, value, ex2);
} catch (SecurityException ex1) {
if (dbg > 0)
d("SecurityException for " + o.getClass() + " " +
name + "="
@@ -192,7 +191,7 @@
}
} catch (IllegalArgumentException ex2) {
- log.warn("IAE " + o + " " + name, ex2);
+ CoyoteLogger.UTIL_LOGGER.errorGettingProperty(name, o, ex2);
} catch (SecurityException ex1) {
if (dbg > 0)
d("SecurityException for " + o.getClass() + " " +
name + ")");
@@ -289,7 +288,7 @@
static final int dbg = 0;
static void d(String s) {
- if (log.isDebugEnabled())
- log.debug("IntrospectionUtils: " + s);
+ if (CoyoteLogger.UTIL_LOGGER.isDebugEnabled())
+ CoyoteLogger.UTIL_LOGGER.debug("IntrospectionUtils: " + s);
}
}
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/B2CConverter.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/B2CConverter.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/B2CConverter.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -33,9 +33,6 @@
*/
public class B2CConverter {
- protected static org.jboss.logging.Logger log =
- org.jboss.logging.Logger.getLogger(B2CConverter.class);
-
protected CharsetDecoder decoder = null;
protected ByteBuffer bb = null;
protected CharBuffer cb = null;
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/Base64.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/Base64.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/Base64.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -18,7 +18,9 @@
package org.apache.tomcat.util.buf;
+import org.jboss.web.CoyoteLogger;
+
/**
* This class provides encode/decode for RFC 2045 Base64 as
* defined by RFC 2045, N. Freed and N. Borenstein.
@@ -33,10 +35,6 @@
public final class Base64 {
-
- private static org.jboss.logging.Logger log=
- org.jboss.logging.Logger.getLogger( Base64.class );
-
static private final int BASELENGTH = 255;
static private final int LOOKUPLENGTH = 63;
static private final int TWENTYFOURBITGROUP = 24;
@@ -250,8 +248,8 @@
if ( v >= 64 ) {
if( chars[i] != '=' )
- if (log.isDebugEnabled())
- log.debug("Wrong char in base64: " + chars[i]);
+ if (CoyoteLogger.UTIL_LOGGER.isDebugEnabled())
+ CoyoteLogger.UTIL_LOGGER.debug("Wrong char in base64: " + chars[i]);
} else {
acc= ( acc << 6 ) | v;
shift += 6;
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/ByteChunk.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/ByteChunk.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/ByteChunk.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.tomcat.util.buf;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.IOException;
import java.io.Serializable;
@@ -443,8 +445,7 @@
{
//assert out!=null
if( out==null ) {
- throw new IOException( "Buffer overflow, no sink " + limit + " "
+
- buff.length );
+ throw new IOException(MESSAGES.bufferOverflow(buff.length, limit));
}
out.realWriteBytes( buff, start, end-start );
end=start;
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/C2BConverter.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/C2BConverter.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/C2BConverter.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -33,9 +33,6 @@
*/
public class C2BConverter {
- protected static org.jboss.logging.Logger log =
- org.jboss.logging.Logger.getLogger(C2BConverter.class);
-
protected CharsetEncoder encoder = null;
protected ByteBuffer bb = null;
protected CharBuffer cb = null;
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/CharChunk.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/CharChunk.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/CharChunk.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.tomcat.util.buf;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.IOException;
import java.io.Serializable;
@@ -463,8 +465,7 @@
{
//assert out!=null
if( out==null ) {
- throw new IOException( "Buffer overflow, no sink " + limit + " "
+
- buff.length );
+ throw new IOException(MESSAGES.bufferOverflow(buff.length, limit));
}
out.realWriteChars( buff, start, end - start );
end=start;
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/StringCache.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/StringCache.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/StringCache.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -22,6 +22,8 @@
import java.util.Iterator;
import java.util.TreeMap;
+import org.jboss.web.CoyoteLogger;
+
/**
* This class implements a String cache for ByteChunk and CharChunk.
*
@@ -30,10 +32,6 @@
public class StringCache {
- private static org.jboss.logging.Logger log=
- org.jboss.logging.Logger.getLogger( StringCache.class );
-
-
// ------------------------------------------------------- Static Variables
@@ -278,9 +276,9 @@
bcCount = 0;
bcStats.clear();
bcCache = tempbcCache;
- if (log.isDebugEnabled()) {
+ if (CoyoteLogger.UTIL_LOGGER.isDebugEnabled()) {
long t2 = System.currentTimeMillis();
- log.debug("ByteCache generation time: " + (t2 - t1)
+ "ms");
+ CoyoteLogger.UTIL_LOGGER.debug("ByteCache generation
time: " + (t2 - t1) + "ms");
}
} else {
bcCount++;
@@ -392,9 +390,9 @@
ccCount = 0;
ccStats.clear();
ccCache = tempccCache;
- if (log.isDebugEnabled()) {
+ if (CoyoteLogger.UTIL_LOGGER.isDebugEnabled()) {
long t2 = System.currentTimeMillis();
- log.debug("CharCache generation time: " + (t2 - t1)
+ "ms");
+ CoyoteLogger.UTIL_LOGGER.debug("CharCache generation
time: " + (t2 - t1) + "ms");
}
} else {
ccCount++;
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/UDecoder.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/UDecoder.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/UDecoder.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.tomcat.util.buf;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.CharConversionException;
import java.io.IOException;
@@ -30,9 +32,6 @@
*/
public final class UDecoder {
- private static org.jboss.logging.Logger log=
- org.jboss.logging.Logger.getLogger(UDecoder.class );
-
protected static final boolean ALLOW_ENCODED_SLASH =
Boolean.valueOf(System.getProperty("org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH",
"false")).booleanValue();
@@ -80,17 +79,17 @@
} else {
// read next 2 digits
if( j+2 >= end ) {
- throw new CharConversionException("EOF");
+ throw new CharConversionException(MESSAGES.unexpectedEof());
}
byte b1= buff[j+1];
byte b2=buff[j+2];
if( !isHexDigit( b1 ) || ! isHexDigit(b2 ))
- throw new CharConversionException( "isHexDigit");
+ throw new CharConversionException(MESSAGES.invalidHex());
j+=2;
int res=x2c( b1, b2 );
if (noSlash && (res == '/')) {
- throw new CharConversionException( "noSlash");
+ throw new CharConversionException(MESSAGES.invalidSlash());
}
buff[idx]=(byte)res;
}
@@ -143,12 +142,12 @@
// read next 2 digits
if( j+2 >= cend ) {
// invalid
- throw new CharConversionException("EOF");
+ throw new CharConversionException(MESSAGES.unexpectedEof());
}
char b1= buff[j+1];
char b2=buff[j+2];
if( !isHexDigit( b1 ) || ! isHexDigit(b2 ))
- throw new CharConversionException("isHexDigit");
+ throw new CharConversionException(MESSAGES.invalidHex());
j+=2;
int res=x2c( b1, b2 );
@@ -276,10 +275,4 @@
return digit;
}
- private final static int debug=0;
- private static void log( String s ) {
- if (log.isDebugEnabled())
- log.debug("URLDecoder: " + s );
- }
-
}
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/http/CookieSupport.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/http/CookieSupport.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/http/CookieSupport.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -19,6 +19,8 @@
package org.apache.tomcat.util.http;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
/**
* Static constants for this package.
*/
@@ -137,8 +139,7 @@
public static final boolean isV0Separator(final char c) {
if (c < 0x20 || c >= 0x7f) {
if (c != 0x09) {
- throw new IllegalArgumentException(
- "Control character in cookie value or attribute.");
+ throw MESSAGES.invalidControlCharacter();
}
}
@@ -174,8 +175,7 @@
public static final boolean isHttpSeparator(final char c) {
if (c < 0x20 || c >= 0x7f) {
if (c != 0x09) {
- throw new IllegalArgumentException(
- "Control character in cookie value or attribute.");
+ throw MESSAGES.invalidControlCharacter();
}
}
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/http/ServerCookie.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/http/ServerCookie.java 2012-09-30
10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/http/ServerCookie.java 2012-10-01
16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.tomcat.util.http;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.Serializable;
import java.text.DateFormat;
import java.text.FieldPosition;
@@ -322,7 +324,7 @@
if (c == '\\' ) {
b.append(c);
//ignore the character after an escape, just append it
- if (++i>=endIndex) throw new IllegalArgumentException("Invalid
escape character in cookie value.");
+ if (++i>=endIndex) throw MESSAGES.invalidEscapeCharacter();
b.append(s.charAt(i));
} else if (c == '"')
b.append('\\').append('"');
Modified: branches/7.2.x/src/main/java/org/jboss/web/CoyoteLogger.java
===================================================================
--- branches/7.2.x/src/main/java/org/jboss/web/CoyoteLogger.java 2012-09-30 10:42:08 UTC
(rev 2092)
+++ branches/7.2.x/src/main/java/org/jboss/web/CoyoteLogger.java 2012-10-01 16:46:15 UTC
(rev 2093)
@@ -59,6 +59,11 @@
*/
CoyoteLogger AJP_LOGGER = Logger.getMessageLogger(CoyoteLogger.class,
"org.apache.coyote.ajp");
+ /**
+ * A logger with the category of the package name.
+ */
+ CoyoteLogger BAYEUX_LOGGER = Logger.getMessageLogger(CoyoteLogger.class,
"org.apache.tomcat.bayeux");
+
@LogMessage(level = INFO)
@Message(id = 3000, value = "Coyote HTTP/1.1 starting on: %s")
void startHttpConnector(String name);
@@ -383,4 +388,24 @@
@Message(id = 3080, value = "Error initializing socket factory")
void errorInitializingSocketFactory(@Cause Throwable t);
+ @LogMessage(level = WARN)
+ @Message(id = 3081, value = "Check Bayeux exception")
+ void errorInCheckBayeux(@Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3082, value = "Error processing Bayeux")
+ void errorProcessingBayeux(@Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3083, value = "Message delivery error")
+ void errorDeliveringBayeux(@Cause Throwable t);
+
+ @LogMessage(level = WARN)
+ @Message(id = 3084, value = "Failed setting property %s on object %s to
%s")
+ void errorSettingProperty(String propertyName, Object object, String propertyValue,
@Cause Throwable t);
+
+ @LogMessage(level = WARN)
+ @Message(id = 3085, value = "Failed getting property %s on object %s")
+ void errorGettingProperty(String propertyName, Object object, @Cause Throwable t);
+
}
Modified: branches/7.2.x/src/main/java/org/jboss/web/CoyoteMessages.java
===================================================================
--- branches/7.2.x/src/main/java/org/jboss/web/CoyoteMessages.java 2012-09-30 10:42:08 UTC
(rev 2092)
+++ branches/7.2.x/src/main/java/org/jboss/web/CoyoteMessages.java 2012-10-01 16:46:15 UTC
(rev 2093)
@@ -100,4 +100,64 @@
@Message(id = 2020, value = "Invalid chunk header")
IOException invalidChunkHeader();
+ @Message(id = 2021, value = "Channel pattern must not be null")
+ NullPointerException invalidNullChannelPattern();
+
+ @Message(id = 2022, value = "Invalid message class, you can only publish
messages created through the Bayeux.newMessage() method")
+ IllegalArgumentException invalidMessagePublish();
+
+ @Message(id = 2023, value = "Misconfigured server, must be configured to support
Comet operations")
+ String invalidBayeuxConfiguration();
+
+ @Message(id = 2024, value = "No Bayeux message to send")
+ String noBayeuxMessage();
+
+ @Message(id = 2025, value = "Client doesn't support any appropriate
connection type")
+ String noBayeuxConnectionType();
+
+ @Message(id = 2026, value = "Unable to fit %s bytes into the array. length:%s
required length: %s")
+ ArrayIndexOutOfBoundsException errorGeneratingUuid(int uuidLength, int destLength,
int reqLength);
+
+ @Message(id = 2027, value = "Invalid client id")
+ String invalidBayeuxClientId();
+
+ @Message(id = 2028, value = "Invalid handshake")
+ String invalidBayeuxHandshake();
+
+ @Message(id = 2029, value = "No Bayeux subscription")
+ String noBayeuxSubscription();
+
+ @Message(id = 2030, value = "Message data missing")
+ String noBayeuxMessageData();
+
+ @Message(id = 2031, value = "Invalid JSON object in data attribute")
+ String invalidBayeuxMessageData();
+
+ @Message(id = 2032, value = "Unsupported APR Version %s")
+ UnsatisfiedLinkError unsupportedAprVersion(String version);
+
+ @Message(id = 2033, value = "Missing APR threads support")
+ UnsatisfiedLinkError missingAprThreadsSupport();
+
+ @Message(id = 2034, value = "(Error on: ")
+ String aprError();
+
+ @Message(id = 2035, value = "Buffer length %s overflow with limit %s and no
sink")
+ String bufferOverflow(int length, int limit);
+
+ @Message(id = 2036, value = "Unexpected EOF")
+ String unexpectedEof();
+
+ @Message(id = 2037, value = "Invalid HEX")
+ String invalidHex();
+
+ @Message(id = 2038, value = "Invalid slash")
+ String invalidSlash();
+
+ @Message(id = 2039, value = "Control character in cookie value or
attribute")
+ IllegalArgumentException invalidControlCharacter();
+
+ @Message(id = 2040, value = "Invalid escape character in cookie value")
+ IllegalArgumentException invalidEscapeCharacter();
+
}
Modified: branches/7.2.x/src/main/java/org/jboss/web/ELMessages.java
===================================================================
--- branches/7.2.x/src/main/java/org/jboss/web/ELMessages.java 2012-09-30 10:42:08 UTC
(rev 2092)
+++ branches/7.2.x/src/main/java/org/jboss/web/ELMessages.java 2012-10-01 16:46:15 UTC
(rev 2093)
@@ -98,4 +98,28 @@
@Message(id = 6020, value = "Unable to find unambiguous method:
%s.%s(%s)")
String ambiguousMethod(Object base, Object method, String parameters);
+ @Message(id = 6021, value = "Invalid method expression: %s")
+ String invalidMethodExpression(String expression);
+
+ @Message(id = 6022, value = "Function mapper is null")
+ NullPointerException invalidNullFunctionMapper();
+
+ @Message(id = 6023, value = "Local name is null")
+ NullPointerException invalidNullLocalName();
+
+ @Message(id = 6024, value = "Method is null")
+ NullPointerException invalidNullMethod();
+
+ @Message(id = 6025, value = "Variable mapper is null")
+ NullPointerException invalidNullVariableMapper();
+
+ @Message(id = 6026, value = "Cannot set variables on factory")
+ UnsupportedOperationException cannotSetVariablesOnFactory();
+
+ @Message(id = 6027, value = "Identity '%s' was null and was unable to
invoke")
+ String invalidNullIdentity(String image);
+
+ @Message(id = 6028, value = "Identity '%s' does not reference a
MethodExpression instance, returned type: %s")
+ String invalidIdentityHasWrongType(String image, String returnedType);
+
}
Modified: branches/7.2.x/src/main/java/org/jboss/web/JasperLogger.java
===================================================================
--- branches/7.2.x/src/main/java/org/jboss/web/JasperLogger.java 2012-09-30 10:42:08 UTC
(rev 2092)
+++ branches/7.2.x/src/main/java/org/jboss/web/JasperLogger.java 2012-10-01 16:46:15 UTC
(rev 2093)
@@ -160,4 +160,36 @@
@Message(id = 5026, value = "Compilation classpath: %s")
void logCompilationClasspath(String classpath);
+ @LogMessage(level = ERROR)
+ @Message(id = 5027, value = "Error reading source file %s")
+ void errorReadingSourceFile(String sourceFile, @Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 5028, value = "Error reading class file %s")
+ void errorReadingClassFile(String className, @Cause Throwable t);
+
+ @LogMessage(level = WARN)
+ @Message(id = 5029, value = "Unknown source JVM %s ignored")
+ void unknownSourceJvm(String version);
+
+ @LogMessage(level = WARN)
+ @Message(id = 5030, value = "Unknown target JVM %s ignored")
+ void unknownTargetJvm(String version);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 5031, value = "Error creating compiler report")
+ void errorCreatingCompilerReport(@Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 5032, value = "Compiler error")
+ void errorCompiling(@Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 5033, value = "Exception initializing page context")
+ void errorInitializingPageContext(@Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 5034, value = "Error loading core class")
+ void errorLoadingCoreClass(@Cause Throwable t);
+
}
Modified: branches/7.2.x/src/main/java/org/jboss/web/JasperMessages.java
===================================================================
--- branches/7.2.x/src/main/java/org/jboss/web/JasperMessages.java 2012-09-30 10:42:08 UTC
(rev 2092)
+++ branches/7.2.x/src/main/java/org/jboss/web/JasperMessages.java 2012-10-01 16:46:15 UTC
(rev 2093)
@@ -670,4 +670,106 @@
@Message(id = 4210, value = "Security exception for class %s")
String securityExceptionLoadingClass(String className);
+ @Message(id = 4211, value = "Stacktrace:")
+ String stacktrace();
+
+ @Message(id = 4212, value = "Background compilation failed")
+ String backgroundCompilationFailed();
+
+ @Message(id = 4213, value = "Security initialization failed")
+ String errorInitializingSecurity();
+
+ @Message(id = 4214, value = "Error unquoting attribute value")
+ String errorUnquotingAttributeValue();
+
+ @Message(id = 4215, value = "Invalid negative parameter: %s")
+ IllegalArgumentException invalidNegativeSmapPosition(int position);
+
+ @Message(id = 4216, value = "Undefined position")
+ IllegalArgumentException undefinedPosition();
+
+ @Message(id = 4217, value = "Unknown file name: %s")
+ IllegalArgumentException unknownFileName(String fileName);
+
+ @Message(id = 4218, value = "the name attribute of the attribute
directive")
+ String tagFileProcessorAttrName();
+
+ @Message(id = 4219, value = "the name-given attribute of the variable
directive")
+ String tagFileProcessorVarNameGiven();
+
+ @Message(id = 4220, value = "the name-from-attribute attribute of the variable
directive")
+ String tagFileProcessorVarNameFrom();
+
+ @Message(id = 4221, value = "the alias attribute of the variable
directive")
+ String tagFileProcessorVarAlias();
+
+ @Message(id = 4222, value = "the dynamic-attributes attribute of the tag
directive")
+ String tagFileProcessorTagDynamic();
+
+ @Message(id = 4223, value = "Null context")
+ NullPointerException elResolverNullContext();
+
+ @Message(id = 4224, value = "Error resolving variable %s due to %s")
+ String errorResolvingVariable(String variable, String message);
+
+ @Message(id = 4225, value = "Legacy VariableResolver wrapped, not
writable")
+ String legacyVariableResolver();
+
+ @Message(id = 4226, value = "Stream closed")
+ String streamClosed();
+
+ @Message(id = 4227, value = "Null text argument")
+ IllegalArgumentException nullCharBufferTextArgument();
+
+ @Message(id = 4228, value = "Null characters argument")
+ IllegalArgumentException nullCharBufferCharactersArgument();
+
+ @Message(id = 4229, value = "Null writer argument")
+ IllegalArgumentException nullCharBufferWriterArgument();
+
+ @Message(id = 4230, value = "Invalid start position")
+ IllegalArgumentException invalidCharBufferStartPosition();
+
+ @Message(id = 4231, value = "Invalid length")
+ IllegalArgumentException invalidCharBufferLength();
+
+ @Message(id = 4232, value = "No org.apache.tomcat.InstanceManager set in
ServletContext")
+ IllegalStateException noInstanceManager();
+
+ @Message(id = 4233, value = "Null ELContextListener")
+ IllegalArgumentException nullElContextListener();
+
+ @Message(id = 4234, value = "Null ServletContext")
+ IllegalArgumentException nullServletContext();
+
+ @Message(id = 4235, value = "Null JspContext")
+ IllegalArgumentException nullJspContext();
+
+ @Message(id = 4236, value = "Null ELResolver")
+ IllegalArgumentException nullElResolver();
+
+ @Message(id = 4237, value = "Cannot add ELResolver after the first request has
been made")
+ IllegalStateException cannotAddElResolver();
+
+ @Message(id = 4238, value = "Negative buffer size")
+ IllegalArgumentException invalidNegativeBufferSize();
+
+ @Message(id = 4239, value = "Page needs a session and none is available")
+ IllegalStateException pageNeedsSession();
+
+ @Message(id = 4240, value = "Null throwable")
+ NullPointerException nullThrowable();
+
+ @Message(id = 4241, value = "Invalid function mapping - no such method:
%s")
+ RuntimeException invalidFunctionMapping(String message);
+
+ @Message(id = 4242, value = "Invalid request parameter %s value %s")
+ String invalidRequestParameterValue(String name, String value);
+
+ @Message(id = 4243, value = "The processing instruction target matching
\"[xX][mM][lL]\" is not allowed.")
+ String reservedPiTarget();
+
+ @Message(id = 4244, value = "White space is required between the processing
instruction target and data.")
+ String requiredWhiteSpaceAfterPiTarget();
+
}