This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push: new 2e62f51 Align EL impl with 9.0.x. i18n improvements and minor code clean-up 2e62f51 is described below commit 2e62f51ca7d511c88eacd5cccf11ea25398bf3ac Author: Mark Thomas <ma...@apache.org> AuthorDate: Tue Jun 11 20:59:00 2019 +0100 Align EL impl with 9.0.x. i18n improvements and minor code clean-up --- java/javax/el/ArrayELResolver.java | 2 +- java/javax/el/ExpressionFactory.java | 21 +++++++-------------- java/javax/el/ListELResolver.java | 2 +- java/javax/el/LocalStrings.properties | 4 ++++ java/javax/el/LocalStrings_es.properties | 7 +++++++ java/javax/el/StaticFieldELResolver.java | 10 +++++----- 6 files changed, 25 insertions(+), 21 deletions(-) diff --git a/java/javax/el/ArrayELResolver.java b/java/javax/el/ArrayELResolver.java index 5bbb2a1..d500e85 100644 --- a/java/javax/el/ArrayELResolver.java +++ b/java/javax/el/ArrayELResolver.java @@ -138,7 +138,7 @@ public class ArrayELResolver extends ELResolver { return ((Character) property).charValue(); } if (property instanceof Boolean) { - return (((Boolean) property).booleanValue() ? 1 : 0); + return ((Boolean) property).booleanValue() ? 1 : 0; } if (property instanceof String) { return Integer.parseInt((String) property); diff --git a/java/javax/el/ExpressionFactory.java b/java/javax/el/ExpressionFactory.java index 58c80b6..cc80a9e 100644 --- a/java/javax/el/ExpressionFactory.java +++ b/java/javax/el/ExpressionFactory.java @@ -151,9 +151,7 @@ public abstract class ExpressionFactory { writeLock.unlock(); } } catch (ClassNotFoundException e) { - throw new ELException( - "Unable to find ExpressionFactory of type: " + className, - e); + throw new ELException(Util.message(null, "expressionFactory.cannotFind", className), e); } } @@ -177,17 +175,13 @@ public abstract class ExpressionFactory { (ExpressionFactory) constructor.newInstance(properties); } - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | - NoSuchMethodException e) { - throw new ELException( - "Unable to create ExpressionFactory of type: " + clazz.getName(), - e); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); Util.handleThrowable(cause); - throw new ELException( - "Unable to create ExpressionFactory of type: " + clazz.getName(), - e); + throw new ELException(Util.message(null, "expressionFactory.cannotCreate", clazz.getName()), e); + } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | + NoSuchMethodException e) { + throw new ELException(Util.message(null, "expressionFactory.cannotCreate", clazz.getName()), e); } return result; @@ -400,8 +394,7 @@ public abstract class ExpressionFactory { // Should never happen with UTF-8 // If it does - ignore & return null } catch (IOException e) { - throw new ELException("Failed to read " + SERVICE_RESOURCE_NAME, - e); + throw new ELException(Util.message(null, "expressionFactory.readFailed", SERVICE_RESOURCE_NAME), e); } finally { try { is.close(); @@ -425,7 +418,7 @@ public abstract class ExpressionFactory { } catch (FileNotFoundException e) { // Should not happen - ignore it if it does } catch (IOException e) { - throw new ELException("Failed to read " + PROPERTY_FILE, e); + throw new ELException(Util.message(null, "expressionFactory.readFailed", PROPERTY_FILE), e); } } return null; diff --git a/java/javax/el/ListELResolver.java b/java/javax/el/ListELResolver.java index 749fdae..cd88620 100644 --- a/java/javax/el/ListELResolver.java +++ b/java/javax/el/ListELResolver.java @@ -144,7 +144,7 @@ public class ListELResolver extends ELResolver { return ((Character) property).charValue(); } if (property instanceof Boolean) { - return (((Boolean) property).booleanValue() ? 1 : 0); + return ((Boolean) property).booleanValue() ? 1 : 0; } if (property instanceof String) { return Integer.parseInt((String) property); diff --git a/java/javax/el/LocalStrings.properties b/java/javax/el/LocalStrings.properties index 6eabde2..b875ab4 100644 --- a/java/javax/el/LocalStrings.properties +++ b/java/javax/el/LocalStrings.properties @@ -22,6 +22,10 @@ elProcessor.defineFunctionInvalidParameterTypeName=The parameter type [{0}] for elProcessor.defineFunctionNoMethod=A public static method [{0}] on class [{1}] could not be found elProcessor.defineFunctionNullParams=One or more of the input parameters was null +expressionFactory.cannotCreate=Unable to create ExpressionFactory of type [{0}] +expressionFactory.cannotFind=Unable to find ExpressionFactory of type [{0}] +expressionFactory.readFailed=Failed to read [{0}] + importHandler.ambiguousImport=The class [{0}] could not be imported as it conflicts with [{1}] which has already been imported importHandler.ambiguousStaticImport=The static import [{0}] could not be processed as it conflicts with [{1}] which has already been imported importHandler.classNotFound=The class [{0}] could not be imported as it could not be found diff --git a/java/javax/el/LocalStrings_es.properties b/java/javax/el/LocalStrings_es.properties index 7a71ca2..bbcebf8 100644 --- a/java/javax/el/LocalStrings_es.properties +++ b/java/javax/el/LocalStrings_es.properties @@ -13,6 +13,13 @@ # See the License for the specific language governing permissions and # limitations under the License. +elProcessor.defineFunctionInvalidMethod=El método [{0}] en la clase [{1}] no es un método estático público + +importHandler.ambiguousStaticImport=La importación estática [{0}] no puede ser procesada pues entra en conflicto con [{1}] la cual ya ha sido importada +importHandler.classNotFound=La clase [{0}] no puede ser importada debido a que no fué encontrada +importHandler.invalidClassNameForStatic=La clase [{0}] especificada para importación estática [{1}] no es valida +importHandler.staticNotFound=La importación estática [{0}] no se pudo encontrar en la clase [{1}] para importar [{2}] + objectNotAssignable=No puedo añadir un objeto del tipo [{0}] a un arreglo de objetos del tipo [{1}] propertyNotFound=Propiedad [{1}] no hallada en el tipo [{0}] propertyNotReadable=Propiedad [{1}] no legible para el tipo [{0}] diff --git a/java/javax/el/StaticFieldELResolver.java b/java/javax/el/StaticFieldELResolver.java index 19911dc..6316602 100644 --- a/java/javax/el/StaticFieldELResolver.java +++ b/java/javax/el/StaticFieldELResolver.java @@ -47,8 +47,8 @@ public class StaticFieldELResolver extends ELResolver { Modifier.isPublic(modifiers)) { return field.get(null); } - } catch (IllegalArgumentException | IllegalAccessException - | NoSuchFieldException | SecurityException e) { + } catch (IllegalArgumentException | IllegalAccessException | + NoSuchFieldException | SecurityException e) { exception = e; } String msg = Util.message(context, "staticFieldELResolver.notFound", @@ -101,13 +101,13 @@ public class StaticFieldELResolver extends ELResolver { try { result = match.newInstance(parameters); - } catch (IllegalArgumentException | IllegalAccessException | - InstantiationException e) { - throw new ELException(e); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); Util.handleThrowable(cause); throw new ELException(cause); + } catch (IllegalArgumentException | IllegalAccessException | + InstantiationException e) { + throw new ELException(e); } return result; --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org