Author: remy.maucherat(a)jboss.com
Date: 2012-07-17 11:25:02 -0400 (Tue, 17 Jul 2012)
New Revision: 2050
Added:
trunk/src/main/java/org/jboss/web/ELLogger.java
trunk/src/main/java/org/jboss/web/ELMessages.java
trunk/src/main/java/org/jboss/web/JasperLogger.java
trunk/src/main/java/org/jboss/web/JasperMessages.java
Removed:
trunk/src/main/java/org/apache/el/Messages.properties
trunk/src/main/java/org/apache/el/Messages_es.properties
trunk/src/main/java/org/apache/el/util/MessageFactory.java
Modified:
trunk/src/main/java/org/apache/el/ExpressionFactoryImpl.java
trunk/src/main/java/org/apache/el/ValueExpressionLiteral.java
trunk/src/main/java/org/apache/el/lang/ELArithmetic.java
trunk/src/main/java/org/apache/el/lang/ELSupport.java
trunk/src/main/java/org/apache/el/lang/ExpressionBuilder.java
trunk/src/main/java/org/apache/el/parser/AstDotSuffix.java
trunk/src/main/java/org/apache/el/parser/AstFunction.java
trunk/src/main/java/org/apache/el/parser/AstIdentifier.java
trunk/src/main/java/org/apache/el/parser/AstValue.java
trunk/src/main/java/org/apache/el/parser/SimpleNode.java
trunk/src/main/java/org/apache/el/util/ReflectionUtil.java
trunk/src/main/java/org/apache/jasper/compiler/Localizer.java
trunk/src/main/java/org/apache/naming/StringManager.java
trunk/src/main/java/org/apache/tomcat/util/res/StringManager.java
Log:
- Add workarounds to allow running during logging conversion.
- Convert EL (ok, that was easy ...).
Modified: trunk/src/main/java/org/apache/el/ExpressionFactoryImpl.java
===================================================================
--- trunk/src/main/java/org/apache/el/ExpressionFactoryImpl.java 2012-07-13 15:39:34 UTC
(rev 2049)
+++ trunk/src/main/java/org/apache/el/ExpressionFactoryImpl.java 2012-07-17 15:25:02 UTC
(rev 2050)
@@ -17,6 +17,8 @@
package org.apache.el;
+import static org.jboss.web.ELMessages.MESSAGES;
+
import javax.el.ELContext;
import javax.el.ExpressionFactory;
import javax.el.MethodExpression;
@@ -24,9 +26,9 @@
import org.apache.el.lang.ELSupport;
import org.apache.el.lang.ExpressionBuilder;
-import org.apache.el.util.MessageFactory;
+
/**
* @see javax.el.ExpressionFactory
*
@@ -60,8 +62,7 @@
public ValueExpression createValueExpression(ELContext context,
String expression, Class<?> expectedType) {
if (expectedType == null) {
- throw new NullPointerException(MessageFactory
- .get("error.value.expectedType"));
+ throw new NullPointerException(MESSAGES.errorNullType());
}
ExpressionBuilder builder = new ExpressionBuilder(expression, context);
return builder.createValueExpression(expectedType);
@@ -71,8 +72,7 @@
public ValueExpression createValueExpression(Object instance,
Class<?> expectedType) {
if (expectedType == null) {
- throw new NullPointerException(MessageFactory
- .get("error.value.expectedType"));
+ throw new NullPointerException(MESSAGES.errorNullType());
}
return new ValueExpressionLiteral(instance, expectedType);
}
Deleted: trunk/src/main/java/org/apache/el/Messages.properties
===================================================================
--- trunk/src/main/java/org/apache/el/Messages.properties 2012-07-13 15:39:34 UTC (rev
2049)
+++ trunk/src/main/java/org/apache/el/Messages.properties 2012-07-17 15:25:02 UTC (rev
2050)
@@ -1,54 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-#
http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# General Errors
-error.convert=Cannot convert {0} of type {1} to {2}
-error.compare=Cannot compare {0} to {1}
-error.function=Problems calling function ''{0}''
-error.unreachable.base=Target Unreachable, identifier ''{0}'' resolved to
null
-error.unreachable.property=Target Unreachable, ''{0}'' returned null
-error.resolver.unhandled=ELResolver did not handle type: {0} with property of
''{1}''
-error.resolver.unhandled.null=ELResolver cannot handle a null base Object with identifier
''{0}''
-
-# ValueExpressionLiteral
-error.value.literal.write=ValueExpression is a literal and not writable: {0}
-
-# ExpressionFactoryImpl
-error.null=Expression cannot be null
-error.mixed=Expression cannot contain both '#{..}' and '${..}' : {0}
-error.method=Not a valid MethodExpression : {0}
-error.method.nullParms=Parameter types cannot be null
-error.value.expectedType=Expected type cannot be null
-
-# ExpressionBuilder
-error.parseFail=Failed to parse the expression [{0}]
-
-# ValueSetVisitor
-error.syntax.set=Illegal Syntax for Set Operation
-
-# ReflectionUtil
-error.method.notfound=Method not found: {0}.{1}({2})
-error.method.ambiguous=Unable to find unambiguous method: {0}.{1}({2})
-
-# ValidatingVisitor
-error.fnMapper.null=Expression uses functions, but no FunctionMapper was provided
-error.fnMapper.method=Function ''{0}'' not found
-error.fnMapper.paramcount=Function ''{0}'' specifies {1} params, but {2}
were declared
-
-# ExpressionImpl
-error.context.null=ELContext was null
-
-# Parser
-error.identifier.notjava=The identifier [{0}] is not a valid Java identifier as required
by section 1.19 of the EL specification (Identifier ::= Java language identifier). This
check can be disabled by setting the system property
org.apache.el.parser.SKIP_IDENTIFIER_CHECK to true.
\ No newline at end of file
Deleted: trunk/src/main/java/org/apache/el/Messages_es.properties
===================================================================
--- trunk/src/main/java/org/apache/el/Messages_es.properties 2012-07-13 15:39:34 UTC (rev
2049)
+++ trunk/src/main/java/org/apache/el/Messages_es.properties 2012-07-17 15:25:02 UTC (rev
2050)
@@ -1,35 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-#
http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-error.convert = No puedo convertir {0} desde tipo {1} a {2}
-error.compare = No puedo comparar {0} con {1}
-error.function = Problemas llamando a funci\u00F3n ''{0}''
-error.unreachable.base = Objetivo inalcanzable, identificador ''{0}''
resuelto a nulo
-error.unreachable.property = Objetivo inalcanzable, ''{0}'' devolvi\u00F3
nulo
-error.resolver.unhandled = ELResolver no manej\u00F3 el tipo\: {0} con propiedad de
''{1}''
-error.resolver.unhandled.null = ELResolver no puede manejar un Objeto base nulo con
identificador de ''{0}''
-error.value.literal.write = ValueExpression es un literal y no un grabable\: {0}
-error.null = La expresi\u00F3n no puede ser nula
-error.mixed = La expresi\u00F3n no puede contenera la vez '\#{..}' y
'${..}' \: {0}
-error.method = No es una MethodExpression v\u00E1lida\: {0}
-error.method.nullParms = Los tipos de par\u00E1metro no pueden ser nulo
-error.value.expectedType = El tipo esperado no puede ser nulo
-error.syntax.set = Sit\u00E1xis ilegal para Operaci\u00F3n de Poner Valor
-error.method.notfound = M\u00E9todo no hallado\: {0}.{1}({2})
-error.method.ambiguous = No pude hallar m\u00E9todo ambiguo\: {0}.{1}({2})
-error.fnMapper.null = La expresi\u00F3n usa funciones, pero no se ha suministrado
FunctionMapper
-error.fnMapper.method = Funci\u00F3n "{0}" no hallada
-error.fnMapper.paramcount = La funci\u00F3n ''{0}'' especifica {1}
par\u00E9metros, pero {2} fueron declarados
-error.context.null = ELContext era nulo
-error.identifier.notjava = El identificador [{0}] no es un identificado Java v\u00E1lido
seg\u00FAn se requiere en la secci\u00F3n 1.9 de la especificaci\u00F3n EL (Identificador
\:\:\= identificador de lenguaje Java). Este chequeo se puede desactivar poniendo la
propiedad del sistema org.apache.el.parser.SKIP_IDENTIFIER_CHECK a verdad (true).
Modified: trunk/src/main/java/org/apache/el/ValueExpressionLiteral.java
===================================================================
--- trunk/src/main/java/org/apache/el/ValueExpressionLiteral.java 2012-07-13 15:39:34 UTC
(rev 2049)
+++ trunk/src/main/java/org/apache/el/ValueExpressionLiteral.java 2012-07-17 15:25:02 UTC
(rev 2050)
@@ -17,6 +17,8 @@
package org.apache.el;
+import static org.jboss.web.ELMessages.MESSAGES;
+
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
@@ -27,7 +29,6 @@
import javax.el.ValueExpression;
import org.apache.el.lang.ELSupport;
-import org.apache.el.util.MessageFactory;
import org.apache.el.util.ReflectionUtil;
@@ -59,8 +60,7 @@
@Override
public void setValue(ELContext context, Object value) {
- throw new PropertyNotWritableException(MessageFactory.get(
- "error.value.literal.write", this.value));
+ throw new
PropertyNotWritableException(MESSAGES.errorPropertyNotWritable(this.value));
}
@Override
Modified: trunk/src/main/java/org/apache/el/lang/ELArithmetic.java
===================================================================
--- trunk/src/main/java/org/apache/el/lang/ELArithmetic.java 2012-07-13 15:39:34 UTC (rev
2049)
+++ trunk/src/main/java/org/apache/el/lang/ELArithmetic.java 2012-07-17 15:25:02 UTC (rev
2050)
@@ -17,12 +17,12 @@
package org.apache.el.lang;
+import static org.jboss.web.ELMessages.MESSAGES;
+
import java.math.BigDecimal;
import java.math.BigInteger;
-import org.apache.el.util.MessageFactory;
-
/**
* A helper class of Arithmetic defined by the EL Specification
* @author Jacob Hookom [jacob(a)hookom.net]
@@ -404,8 +404,7 @@
return coerce(Short.valueOf((short) ((Character) obj).charValue()));
}
- throw new IllegalArgumentException(MessageFactory.get("error.convert",
- obj, obj.getClass(), "Number"));
+ throw MESSAGES.errorConvertingWithException(obj, obj.getClass(),
"Number");
}
protected abstract Number coerce(final String str);
Modified: trunk/src/main/java/org/apache/el/lang/ELSupport.java
===================================================================
--- trunk/src/main/java/org/apache/el/lang/ELSupport.java 2012-07-13 15:39:34 UTC (rev
2049)
+++ trunk/src/main/java/org/apache/el/lang/ELSupport.java 2012-07-17 15:25:02 UTC (rev
2050)
@@ -17,6 +17,8 @@
package org.apache.el.lang;
+import static org.jboss.web.ELMessages.MESSAGES;
+
import java.beans.PropertyEditor;
import java.beans.PropertyEditorManager;
import java.math.BigDecimal;
@@ -24,9 +26,7 @@
import javax.el.ELException;
-import org.apache.el.util.MessageFactory;
-
/**
* A helper class that implements the EL Specification
*
@@ -104,7 +104,7 @@
final Comparable<Object> comparable = (Comparable<Object>) obj1;
return (obj0 != null) ? -comparable.compareTo(obj0) : -1;
}
- throw new ELException(MessageFactory.get("error.compare", obj0,
obj1));
+ throw new ELException(MESSAGES.errorComparing(obj0, obj1));
}
/**
@@ -171,16 +171,14 @@
}
if (!(obj instanceof String)) {
- throw new ELException(MessageFactory.get("error.convert",
- obj, obj.getClass(), type));
+ throw new ELException(MESSAGES.errorConverting(obj, obj.getClass(), type));
}
Enum<?> result;
try {
result = Enum.valueOf(type, (String) obj);
} catch (IllegalArgumentException iae) {
- throw new ELException(MessageFactory.get("error.convert",
- obj, obj.getClass(), type));
+ throw new ELException(MESSAGES.errorConverting(obj, obj.getClass(), type));
}
return result;
}
@@ -204,8 +202,7 @@
return Boolean.valueOf((String) obj);
}
- throw new ELException(MessageFactory.get("error.convert",
- obj, obj.getClass(), Boolean.class));
+ throw new ELException(MESSAGES.errorConverting(obj, obj.getClass(),
Boolean.class));
}
public static final Character coerceToCharacter(final Object obj)
@@ -224,8 +221,7 @@
return (Character) obj;
}
- throw new ELException(MessageFactory.get("error.convert",
- obj, objType, Character.class));
+ throw new ELException(MESSAGES.errorConverting(obj, objType, Character.class));
}
protected static final Number coerceToNumber(final Number number,
@@ -270,8 +266,7 @@
return number;
}
- throw new ELException(MessageFactory.get("error.convert",
- number, number.getClass(), type));
+ throw new ELException(MESSAGES.errorConverting(number, number.getClass(),
type));
}
public static final Number coerceToNumber(final Object obj,
@@ -291,8 +286,7 @@
.charValue()), type);
}
- throw new ELException(MessageFactory.get("error.convert",
- obj, obj.getClass(), type));
+ throw new ELException(MESSAGES.errorConverting(obj, obj.getClass(), type));
}
protected static final Number coerceToNumber(final String val,
@@ -301,69 +295,60 @@
try {
return Long.valueOf(val);
} catch (NumberFormatException nfe) {
- throw new ELException(MessageFactory.get("error.convert",
- val, String.class, type));
+ throw new ELException(MESSAGES.errorConverting(val, String.class,
type));
}
}
if (Integer.TYPE == type || Integer.class.equals(type)) {
try {
return Integer.valueOf(val);
} catch (NumberFormatException nfe) {
- throw new ELException(MessageFactory.get("error.convert",
- val, String.class, type));
+ throw new ELException(MESSAGES.errorConverting(val, String.class,
type));
}
}
if (Double.TYPE == type || Double.class.equals(type)) {
try {
return Double.valueOf(val);
} catch (NumberFormatException nfe) {
- throw new ELException(MessageFactory.get("error.convert",
- val, String.class, type));
+ throw new ELException(MESSAGES.errorConverting(val, String.class,
type));
}
}
if (BigInteger.class.equals(type)) {
try {
return new BigInteger(val);
} catch (NumberFormatException nfe) {
- throw new ELException(MessageFactory.get("error.convert",
- val, String.class, type));
+ throw new ELException(MESSAGES.errorConverting(val, String.class,
type));
}
}
if (BigDecimal.class.equals(type)) {
try {
return new BigDecimal(val);
} catch (NumberFormatException nfe) {
- throw new ELException(MessageFactory.get("error.convert",
- val, String.class, type));
+ throw new ELException(MESSAGES.errorConverting(val, String.class,
type));
}
}
if (Byte.TYPE == type || Byte.class.equals(type)) {
try {
return Byte.valueOf(val);
} catch (NumberFormatException nfe) {
- throw new ELException(MessageFactory.get("error.convert",
- val, String.class, type));
+ throw new ELException(MESSAGES.errorConverting(val, String.class,
type));
}
}
if (Short.TYPE == type || Short.class.equals(type)) {
try {
return Short.valueOf(val);
} catch (NumberFormatException nfe) {
- throw new ELException(MessageFactory.get("error.convert",
- val, String.class, type));
+ throw new ELException(MESSAGES.errorConverting(val, String.class,
type));
}
}
if (Float.TYPE == type || Float.class.equals(type)) {
try {
return Float.valueOf(val);
} catch (NumberFormatException nfe) {
- throw new ELException(MessageFactory.get("error.convert",
- val, String.class, type));
+ throw new ELException(MESSAGES.errorConverting(val, String.class,
type));
}
}
- throw new ELException(MessageFactory.get("error.convert",
- val, String.class, type));
+ throw new ELException(MESSAGES.errorConverting(val, String.class, type));
}
/**
@@ -417,8 +402,7 @@
return editor.getValue();
}
}
- throw new ELException(MessageFactory.get("error.convert",
- obj, obj.getClass(), type));
+ throw new ELException(MESSAGES.errorConverting(obj, obj.getClass(), type));
}
public static final boolean isBigDecimalOp(final Object obj0,
Modified: trunk/src/main/java/org/apache/el/lang/ExpressionBuilder.java
===================================================================
--- trunk/src/main/java/org/apache/el/lang/ExpressionBuilder.java 2012-07-13 15:39:34 UTC
(rev 2049)
+++ trunk/src/main/java/org/apache/el/lang/ExpressionBuilder.java 2012-07-17 15:25:02 UTC
(rev 2050)
@@ -17,6 +17,8 @@
package org.apache.el.lang;
+import static org.jboss.web.ELMessages.MESSAGES;
+
import java.io.StringReader;
import java.lang.reflect.Method;
import java.security.AccessController;
@@ -43,7 +45,6 @@
import org.apache.el.parser.Node;
import org.apache.el.parser.NodeVisitor;
import org.apache.el.util.ConcurrentCache;
-import org.apache.el.util.MessageFactory;
/**
* @author Jacob Hookom [jacob(a)hookom.net]
@@ -114,7 +115,7 @@
private static final Node createNodeInternal(String expr)
throws ELException {
if (expr == null) {
- throw new ELException(MessageFactory.get("error.null"));
+ throw new ELException(MESSAGES.errorNullExpression());
}
Node n = (cache != null) ? cache.get(expr) : unlimitedCache.get(expr);
@@ -138,8 +139,7 @@
type = child.getClass();
else {
if (!type.equals(child.getClass())) {
- throw new ELException(MessageFactory.get(
- "error.mixed", expr));
+ throw new
ELException(MESSAGES.errorMixedExpression(expr));
}
}
}
@@ -155,8 +155,7 @@
unlimitedCache.put(expr, n);
}
} catch (Exception e) {
- throw new ELException(
- MessageFactory.get("error.parseFail", expr), e);
+ throw new ELException(MESSAGES.errorParse(expr), e);
}
}
return n;
@@ -202,19 +201,17 @@
AstFunction funcNode = (AstFunction) node;
if (this.fnMapper == null) {
- throw new
ELException(MessageFactory.get("error.fnMapper.null"));
+ throw new ELException(MESSAGES.missingFunctionMapper());
}
Method m = fnMapper.resolveFunction(funcNode.getPrefix(), funcNode
.getLocalName());
if (m == null) {
- throw new ELException(MessageFactory.get(
- "error.fnMapper.method", funcNode.getOutputName()));
+ throw new
ELException(MESSAGES.functionNotFound(funcNode.getOutputName()));
}
int pcnt = m.getParameterTypes().length;
if (node.jjtGetNumChildren() != pcnt) {
- throw new ELException(MessageFactory.get(
- "error.fnMapper.paramcount", funcNode.getOutputName(),
- "" + pcnt, "" + node.jjtGetNumChildren()));
+ throw new
ELException(MESSAGES.functionWrongParameterCount(funcNode.getOutputName(),
+ pcnt, node.jjtGetNumChildren()));
}
} else if (node instanceof AstIdentifier && this.varMapper != null) {
String variable = ((AstIdentifier) node).getImage();
@@ -235,8 +232,7 @@
Class<?>[] expectedParamTypes) throws ELException {
Node n = this.build();
if (!n.isParametersProvided() && expectedParamTypes == null) {
- throw new NullPointerException(MessageFactory
- .get("error.method.nullParms"));
+ throw new NullPointerException(MESSAGES.nullParameterTypes());
}
if (n instanceof AstValue || n instanceof AstIdentifier) {
return new MethodExpressionImpl(expression, n, this.fnMapper,
Modified: trunk/src/main/java/org/apache/el/parser/AstDotSuffix.java
===================================================================
--- trunk/src/main/java/org/apache/el/parser/AstDotSuffix.java 2012-07-13 15:39:34 UTC
(rev 2049)
+++ trunk/src/main/java/org/apache/el/parser/AstDotSuffix.java 2012-07-17 15:25:02 UTC
(rev 2050)
@@ -18,10 +18,11 @@
package org.apache.el.parser;
+import static org.jboss.web.ELMessages.MESSAGES;
+
import javax.el.ELException;
import org.apache.el.lang.EvaluationContext;
-import org.apache.el.util.MessageFactory;
import org.apache.el.util.Validation;
@@ -43,8 +44,7 @@
@Override
public void setImage(String image) {
if (!Validation.isIdentifier(image)) {
- throw new
ELException(MessageFactory.get("error.identifier.notjava",
- image));
+ throw new ELException(MESSAGES.errorNotJavaIdentifier(image));
}
this.image = image;
}
Modified: trunk/src/main/java/org/apache/el/parser/AstFunction.java
===================================================================
--- trunk/src/main/java/org/apache/el/parser/AstFunction.java 2012-07-13 15:39:34 UTC (rev
2049)
+++ trunk/src/main/java/org/apache/el/parser/AstFunction.java 2012-07-17 15:25:02 UTC (rev
2050)
@@ -18,6 +18,8 @@
package org.apache.el.parser;
+import static org.jboss.web.ELMessages.MESSAGES;
+
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -25,7 +27,6 @@
import javax.el.FunctionMapper;
import org.apache.el.lang.EvaluationContext;
-import org.apache.el.util.MessageFactory;
/**
@@ -66,12 +67,11 @@
// quickly validate again for this request
if (fnMapper == null) {
- throw new ELException(MessageFactory.get("error.fnMapper.null"));
+ throw new ELException(MESSAGES.missingFunctionMapper());
}
Method m = fnMapper.resolveFunction(this.prefix, this.localName);
if (m == null) {
- throw new ELException(MessageFactory.get("error.fnMapper.method",
- this.getOutputName()));
+ throw new ELException(MESSAGES.functionNotFound(this.getOutputName()));
}
return m.getReturnType();
}
@@ -84,12 +84,11 @@
// quickly validate again for this request
if (fnMapper == null) {
- throw new ELException(MessageFactory.get("error.fnMapper.null"));
+ throw new ELException(MESSAGES.missingFunctionMapper());
}
Method m = fnMapper.resolveFunction(this.prefix, this.localName);
if (m == null) {
- throw new ELException(MessageFactory.get("error.fnMapper.method",
- this.getOutputName()));
+ throw new ELException(MESSAGES.functionNotFound(this.getOutputName()));
}
Class<?>[] paramTypes = m.getParameterTypes();
@@ -104,14 +103,13 @@
params[i] = coerceToType(params[i], paramTypes[i]);
}
} catch (ELException ele) {
- throw new ELException(MessageFactory.get("error.function",
this
- .getOutputName()), ele);
+ throw new
ELException(MESSAGES.errorCallingFunction(this.getOutputName()), ele);
}
}
try {
result = m.invoke(null, params);
} catch (IllegalAccessException iae) {
- throw new ELException(MessageFactory.get("error.function", this
+ throw new ELException(MESSAGES.errorCallingFunction(this
.getOutputName()), iae);
} catch (InvocationTargetException ite) {
Throwable cause = ite.getCause();
@@ -121,7 +119,7 @@
if (cause instanceof VirtualMachineError) {
throw (VirtualMachineError) cause;
}
- throw new ELException(MessageFactory.get("error.function", this
+ throw new ELException(MESSAGES.errorCallingFunction(this
.getOutputName()), cause);
}
return result;
Modified: trunk/src/main/java/org/apache/el/parser/AstIdentifier.java
===================================================================
--- trunk/src/main/java/org/apache/el/parser/AstIdentifier.java 2012-07-13 15:39:34 UTC
(rev 2049)
+++ trunk/src/main/java/org/apache/el/parser/AstIdentifier.java 2012-07-17 15:25:02 UTC
(rev 2050)
@@ -18,6 +18,8 @@
package org.apache.el.parser;
+import static org.jboss.web.ELMessages.MESSAGES;
+
import javax.el.ELException;
import javax.el.MethodExpression;
import javax.el.MethodInfo;
@@ -28,7 +30,6 @@
import javax.el.VariableMapper;
import org.apache.el.lang.EvaluationContext;
-import org.apache.el.util.MessageFactory;
import org.apache.el.util.Validation;
@@ -53,8 +54,7 @@
ctx.setPropertyResolved(false);
Class<?> result = ctx.getELResolver().getType(ctx, null, this.image);
if (!ctx.isPropertyResolved()) {
- throw new PropertyNotFoundException(MessageFactory.get(
- "error.resolver.unhandled.null", this.image));
+ throw new
PropertyNotFoundException(MESSAGES.errorNullBaseObject(this.image));
}
return result;
}
@@ -71,8 +71,7 @@
ctx.setPropertyResolved(false);
Object result = ctx.getELResolver().getValue(ctx, null, this.image);
if (!ctx.isPropertyResolved()) {
- throw new PropertyNotFoundException(MessageFactory.get(
- "error.resolver.unhandled.null", this.image));
+ throw new
PropertyNotFoundException(MESSAGES.errorNullBaseObject(this.image));
}
return result;
}
@@ -89,8 +88,7 @@
ctx.setPropertyResolved(false);
boolean result = ctx.getELResolver().isReadOnly(ctx, null, this.image);
if (!ctx.isPropertyResolved()) {
- throw new PropertyNotFoundException(MessageFactory.get(
- "error.resolver.unhandled.null", this.image));
+ throw new
PropertyNotFoundException(MESSAGES.errorNullBaseObject(this.image));
}
return result;
}
@@ -109,8 +107,7 @@
ctx.setPropertyResolved(false);
ctx.getELResolver().setValue(ctx, null, this.image, value);
if (!ctx.isPropertyResolved()) {
- throw new PropertyNotFoundException(MessageFactory.get(
- "error.resolver.unhandled.null", this.image));
+ throw new
PropertyNotFoundException(MESSAGES.errorNullBaseObject(this.image));
}
}
@@ -130,8 +127,7 @@
@Override
public void setImage(String image) {
if (!Validation.isIdentifier(image)) {
- throw new
ELException(MessageFactory.get("error.identifier.notjava",
- image));
+ throw new ELException(MESSAGES.errorNotJavaIdentifier(image));
}
this.image = image;
}
Modified: trunk/src/main/java/org/apache/el/parser/AstValue.java
===================================================================
--- trunk/src/main/java/org/apache/el/parser/AstValue.java 2012-07-13 15:39:34 UTC (rev
2049)
+++ trunk/src/main/java/org/apache/el/parser/AstValue.java 2012-07-17 15:25:02 UTC (rev
2050)
@@ -18,6 +18,8 @@
package org.apache.el.parser;
+import static org.jboss.web.ELMessages.MESSAGES;
+
import java.lang.reflect.Array;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -32,7 +34,6 @@
import org.apache.el.lang.ELSupport;
import org.apache.el.lang.EvaluationContext;
-import org.apache.el.util.MessageFactory;
import org.apache.el.util.ReflectionUtil;
@@ -83,8 +84,7 @@
ctx.setPropertyResolved(false);
Class<?> result = ctx.getELResolver().getType(ctx, t.base, t.property);
if (!ctx.isPropertyResolved()) {
- throw new PropertyNotFoundException(MessageFactory.get(
- "error.resolver.unhandled", t.base, t.property));
+ throw new PropertyNotFoundException(MESSAGES.errorResolving(t.base,
t.property));
}
return result;
}
@@ -95,8 +95,7 @@
// if our base is null (we know there are more properties to evaluate)
if (base == null) {
- throw new PropertyNotFoundException(MessageFactory.get(
- "error.unreachable.base", this.children[0].getImage()));
+ throw new
PropertyNotFoundException(MESSAGES.errorResolvingIdentifierType(this.children[0].getImage()));
}
// set up our start/end
@@ -124,16 +123,14 @@
// if we are in this block, we have more properties to resolve,
// but our base was null
if (base == null || property == null) {
- throw new PropertyNotFoundException(MessageFactory.get(
- "error.unreachable.property", property));
+ throw new
PropertyNotFoundException(MESSAGES.errorResolvingProperty(property));
}
}
property = this.children[i].getValue(ctx);
if (property == null) {
- throw new PropertyNotFoundException(MessageFactory.get(
- "error.unreachable.property", this.children[i]));
+ throw new
PropertyNotFoundException(MESSAGES.errorResolvingProperty(this.children[i]));
}
Target t = new Target();
@@ -171,8 +168,7 @@
}
}
if (!ctx.isPropertyResolved()) {
- throw new PropertyNotFoundException(MessageFactory.get(
- "error.resolver.unhandled", base, suffix));
+ throw new PropertyNotFoundException(MESSAGES.errorResolving(base, suffix));
}
return base;
}
@@ -184,8 +180,7 @@
boolean result =
ctx.getELResolver().isReadOnly(ctx, t.base, t.property);
if (!ctx.isPropertyResolved()) {
- throw new PropertyNotFoundException(MessageFactory.get(
- "error.resolver.unhandled", t.base, t.property));
+ throw new PropertyNotFoundException(MESSAGES.errorResolving(t.base,
t.property));
}
return result;
}
@@ -207,8 +202,7 @@
resolver.setValue(ctx, t.base, t.property, value);
}
if (!ctx.isPropertyResolved()) {
- throw new PropertyNotFoundException(MessageFactory.get(
- "error.resolver.unhandled", t.base, t.property));
+ throw new PropertyNotFoundException(MESSAGES.errorResolving(t.base,
t.property));
}
}
Modified: trunk/src/main/java/org/apache/el/parser/SimpleNode.java
===================================================================
--- trunk/src/main/java/org/apache/el/parser/SimpleNode.java 2012-07-13 15:39:34 UTC (rev
2049)
+++ trunk/src/main/java/org/apache/el/parser/SimpleNode.java 2012-07-17 15:25:02 UTC (rev
2050)
@@ -18,6 +18,8 @@
package org.apache.el.parser;
+import static org.jboss.web.ELMessages.MESSAGES;
+
import java.util.Arrays;
import javax.el.ELException;
@@ -27,7 +29,6 @@
import org.apache.el.lang.ELSupport;
import org.apache.el.lang.EvaluationContext;
-import org.apache.el.util.MessageFactory;
/**
@@ -139,7 +140,7 @@
@Override
public void setValue(EvaluationContext ctx, Object value)
throws ELException {
- throw new
PropertyNotWritableException(MessageFactory.get("error.syntax.set"));
+ throw new PropertyNotWritableException(MESSAGES.errorWithSetSyntax());
}
@Override
Deleted: trunk/src/main/java/org/apache/el/util/MessageFactory.java
===================================================================
--- trunk/src/main/java/org/apache/el/util/MessageFactory.java 2012-07-13 15:39:34 UTC
(rev 2049)
+++ trunk/src/main/java/org/apache/el/util/MessageFactory.java 2012-07-17 15:25:02 UTC
(rev 2050)
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *
http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.el.util;
-
-import java.text.MessageFormat;
-import java.util.ResourceBundle;
-
-/**
- * @author Jacob Hookom [jacob(a)hookom.net]
- * @version $Id: MessageFactory.java 1882 2011-12-06 15:27:15Z remy.maucherat(a)jboss.com
$
- */
-public final class MessageFactory {
-
- protected static final ResourceBundle bundle =
- ResourceBundle.getBundle("org.apache.el.Messages");
-
- public MessageFactory() {
- super();
- }
-
- public static String get(final String key) {
- return bundle.getString(key);
- }
-
- public static String get(final String key, final Object... args) {
- String value = get(key);
- if (value == null) {
- value = key;
- }
-
- MessageFormat mf = new MessageFormat(value);
- return mf.format(args, new StringBuffer(), null).toString();
- }
-}
Modified: trunk/src/main/java/org/apache/el/util/ReflectionUtil.java
===================================================================
--- trunk/src/main/java/org/apache/el/util/ReflectionUtil.java 2012-07-13 15:39:34 UTC
(rev 2049)
+++ trunk/src/main/java/org/apache/el/util/ReflectionUtil.java 2012-07-17 15:25:02 UTC
(rev 2050)
@@ -16,6 +16,8 @@
*/
package org.apache.el.util;
+import static org.jboss.web.ELMessages.MESSAGES;
+
import java.lang.reflect.Array;
import java.lang.reflect.Method;
import java.util.Arrays;
@@ -118,8 +120,7 @@
Class<?>[] paramTypes, Object[] paramValues)
throws MethodNotFoundException {
if (base == null || property == null) {
- throw new MethodNotFoundException(MessageFactory.get(
- "error.method.notfound", base, property,
+ throw new MethodNotFoundException(MESSAGES.methodNotFound(base, property,
paramString(paramTypes)));
}
@@ -234,16 +235,14 @@
if (match == null) {
// If multiple methods have the same matching number of parameters
// the match is ambiguous so throw an exception
- throw new MethodNotFoundException(MessageFactory.get(
- "error.method.ambiguous", base, property,
+ throw new MethodNotFoundException(MESSAGES.ambiguousMethod(base,
property,
paramString(paramTypes)));
}
}
// Handle case where no match at all was found
if (match == null) {
- throw new MethodNotFoundException(MessageFactory.get(
- "error.method.notfound", base, property,
+ throw new MethodNotFoundException(MESSAGES.methodNotFound(base, property,
paramString(paramTypes)));
}
Modified: trunk/src/main/java/org/apache/jasper/compiler/Localizer.java
===================================================================
--- trunk/src/main/java/org/apache/jasper/compiler/Localizer.java 2012-07-13 15:39:34 UTC
(rev 2049)
+++ trunk/src/main/java/org/apache/jasper/compiler/Localizer.java 2012-07-17 15:25:02 UTC
(rev 2050)
@@ -52,6 +52,9 @@
* @return Localized error message
*/
public static String getMessage(String errCode) {
+ if (bundle == null) {
+ return errCode;
+ }
String errMsg = errCode;
try {
errMsg = bundle.getString(errCode);
@@ -145,6 +148,9 @@
* @return Localized error message
*/
public static String getMessage(String errCode, Object[] args) {
+ if (bundle == null) {
+ return errCode;
+ }
String errMsg = errCode;
try {
errMsg = bundle.getString(errCode);
Modified: trunk/src/main/java/org/apache/naming/StringManager.java
===================================================================
--- trunk/src/main/java/org/apache/naming/StringManager.java 2012-07-13 15:39:34 UTC (rev
2049)
+++ trunk/src/main/java/org/apache/naming/StringManager.java 2012-07-17 15:25:02 UTC (rev
2050)
@@ -65,8 +65,12 @@
private StringManager(String packageName) {
String bundleName = packageName + ".LocalStrings";
+ try {
bundle = ResourceBundle.getBundle(bundleName);
+ } catch (MissingResourceException mre) {
+ // Ignore
}
+ }
/**
* Get a string from the underlying resource bundle.
@@ -80,6 +84,9 @@
throw new NullPointerException(msg);
}
+ if (bundle == null) {
+ return key;
+ }
String str = null;
Modified: trunk/src/main/java/org/apache/tomcat/util/res/StringManager.java
===================================================================
--- trunk/src/main/java/org/apache/tomcat/util/res/StringManager.java 2012-07-13 15:39:34
UTC (rev 2049)
+++ trunk/src/main/java/org/apache/tomcat/util/res/StringManager.java 2012-07-17 15:25:02
UTC (rev 2050)
@@ -106,6 +106,9 @@
throw new IllegalArgumentException(msg);
}
+ if (bundle == null) {
+ return key;
+ }
String str = null;
Added: trunk/src/main/java/org/jboss/web/ELLogger.java
===================================================================
--- trunk/src/main/java/org/jboss/web/ELLogger.java (rev 0)
+++ trunk/src/main/java/org/jboss/web/ELLogger.java 2012-07-17 15:25:02 UTC (rev 2050)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.jboss.web;
+
+import static org.jboss.logging.Logger.Level.ERROR;
+import static org.jboss.logging.Logger.Level.INFO;
+import static org.jboss.logging.Logger.Level.WARN;
+
+import org.jboss.logging.BasicLogger;
+import org.jboss.logging.Cause;
+import org.jboss.logging.LogMessage;
+import org.jboss.logging.Logger;
+import org.jboss.logging.Message;
+import org.jboss.logging.MessageLogger;
+
+/**
+ * Logging IDs 6500-7000
+ * @author remm
+ */
+@MessageLogger(projectCode = "JBWEB")
+public interface ELLogger extends BasicLogger {
+
+ /**
+ * A logger with the category of the package name.
+ */
+ ELLogger ROOT_LOGGER = Logger.getMessageLogger(ELLogger.class,
"org.apache.el");
+
+}
Added: trunk/src/main/java/org/jboss/web/ELMessages.java
===================================================================
--- trunk/src/main/java/org/jboss/web/ELMessages.java (rev 0)
+++ trunk/src/main/java/org/jboss/web/ELMessages.java 2012-07-17 15:25:02 UTC (rev 2050)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.jboss.web;
+
+import org.jboss.logging.Cause;
+import org.jboss.logging.Message;
+import org.jboss.logging.MessageBundle;
+import org.jboss.logging.Messages;
+
+/**
+ * Logging IDs 6000-6500
+ * @author remm
+ */
+@MessageBundle(projectCode = "JBWEB")
+public interface ELMessages {
+
+ /**
+ * The messages
+ */
+ ELMessages MESSAGES = Messages.getBundle(ELMessages.class);
+
+ @Message(id = 6000, value = "Expected type cannot be null")
+ String errorNullType();
+
+ @Message(id = 6001, value = "ValueExpression is a literal and not writable:
%s")
+ String errorPropertyNotWritable(Object value);
+
+ @Message(id = 6002, value = "Cannot convert %s of type %s to %s")
+ IllegalArgumentException errorConvertingWithException(Object obj, Class<? extends
Object> clazz, String type);
+
+ @Message(id = 6003, value = "Cannot convert %s of type %s to %s")
+ String errorConverting(Object obj, Class<? extends Object> clazz, Class<?
extends Object> type);
+
+ @Message(id = 6004, value = "Cannot compare %s to %s")
+ String errorComparing(Object obj1, Object obj2);
+
+ @Message(id = 6005, value = "Expression cannot be null")
+ String errorNullExpression();
+
+ @Message(id = 6006, value = "Expression cannot contain both '#{..}' and
'${..}' : %s")
+ String errorMixedExpression(String expression);
+
+ @Message(id = 6007, value = "Failed to parse the expression [%s]")
+ String errorParse(String expression);
+
+ @Message(id = 6008, value = "Expression uses functions, but no FunctionMapper
was provided")
+ String missingFunctionMapper();
+
+ @Message(id = 6009, value = "Function ''%s'' not found")
+ String functionNotFound(String function);
+
+ @Message(id = 6010, value = "Function ''%s'' specifies %s
params, but %s were declared")
+ String functionWrongParameterCount(String function, int count, int declared);
+
+ @Message(id = 6011, value = "Parameter types cannot be null")
+ String nullParameterTypes();
+
+ @Message(id = 6012, value = "The identifier [%s] is not a valid Java identifier
as required by section 1.19 of the EL specification (Identifier ::= Java language
identifier). This check can be disabled by setting the system property
org.apache.el.parser.SKIP_IDENTIFIER_CHECK to true.")
+ String errorNotJavaIdentifier(String identifier);
+
+ @Message(id = 6013, value = "Error calling function
''%s''")
+ String errorCallingFunction(String function);
+
+ @Message(id = 6014, value = "ELResolver cannot handle a null base Object with
identifier ''%s''")
+ String errorNullBaseObject(String identifier);
+
+ @Message(id = 6015, value = "ELResolver did not handle type: %s with property of
''%s''")
+ String errorResolving(Object type, Object property);
+
+ @Message(id = 6016, value = "Target Unreachable, identifier
''%s'' resolved to null")
+ String errorResolvingIdentifierType(String identifier);
+
+ @Message(id = 6017, value = "Target Unreachable, ''%s'' returned
null")
+ String errorResolvingProperty(Object property);
+
+ @Message(id = 6018, value = "Illegal Syntax for Set Operation")
+ String errorWithSetSyntax();
+
+ @Message(id = 6019, value = "Method not found: %s.%s(%s)")
+ String methodNotFound(Object base, Object method, String parameters);
+
+ @Message(id = 6020, value = "Unable to find unambiguous method:
%s.%s(%s)")
+ String ambiguousMethod(Object base, Object method, String parameters);
+
+}
Added: trunk/src/main/java/org/jboss/web/JasperLogger.java
===================================================================
--- trunk/src/main/java/org/jboss/web/JasperLogger.java (rev 0)
+++ trunk/src/main/java/org/jboss/web/JasperLogger.java 2012-07-17 15:25:02 UTC (rev
2050)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.jboss.web;
+
+import static org.jboss.logging.Logger.Level.ERROR;
+import static org.jboss.logging.Logger.Level.INFO;
+import static org.jboss.logging.Logger.Level.WARN;
+
+import org.jboss.logging.BasicLogger;
+import org.jboss.logging.Cause;
+import org.jboss.logging.LogMessage;
+import org.jboss.logging.Logger;
+import org.jboss.logging.Message;
+import org.jboss.logging.MessageLogger;
+
+/**
+ * Logging IDs 5000-6000
+ * @author remm
+ */
+@MessageLogger(projectCode = "JBWEB")
+public interface JasperLogger extends BasicLogger {
+
+ /**
+ * A logger with the category of the package name.
+ */
+ JasperLogger ROOT_LOGGER = Logger.getMessageLogger(JasperLogger.class,
"org.apache.jasper");
+
+}
Added: trunk/src/main/java/org/jboss/web/JasperMessages.java
===================================================================
--- trunk/src/main/java/org/jboss/web/JasperMessages.java (rev 0)
+++ trunk/src/main/java/org/jboss/web/JasperMessages.java 2012-07-17 15:25:02 UTC (rev
2050)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.jboss.web;
+
+import org.jboss.logging.Cause;
+import org.jboss.logging.Message;
+import org.jboss.logging.MessageBundle;
+import org.jboss.logging.Messages;
+
+/**
+ * Logging IDs 4000-5000
+ * @author remm
+ */
+@MessageBundle(projectCode = "JBWEB")
+public interface JasperMessages {
+
+ /**
+ * The messages
+ */
+ JasperMessages MESSAGES = Messages.getBundle(JasperMessages.class);
+
+}