This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit f9e377e7f3992e4cc0559cd8e0197e074d110337 Author: Mark Thomas <ma...@apache.org> AuthorDate: Fri Aug 9 15:17:54 2024 +0100 Code clean-up - formatting. No functional change. --- java/org/apache/el/parser/ArithmeticNode.java | 3 +- java/org/apache/el/parser/AstAnd.java | 3 +- java/org/apache/el/parser/AstBracketSuffix.java | 3 +- java/org/apache/el/parser/AstChoice.java | 6 +- .../apache/el/parser/AstCompositeExpression.java | 6 +- .../apache/el/parser/AstDeferredExpression.java | 12 +-- java/org/apache/el/parser/AstDiv.java | 3 +- java/org/apache/el/parser/AstDotSuffix.java | 6 +- .../org/apache/el/parser/AstDynamicExpression.java | 12 +-- java/org/apache/el/parser/AstEmpty.java | 6 +- java/org/apache/el/parser/AstEqual.java | 3 +- java/org/apache/el/parser/AstFalse.java | 3 +- java/org/apache/el/parser/AstFloatingPoint.java | 6 +- java/org/apache/el/parser/AstFunction.java | 3 +- java/org/apache/el/parser/AstGreaterThan.java | 3 +- java/org/apache/el/parser/AstGreaterThanEqual.java | 3 +- java/org/apache/el/parser/AstIdentifier.java | 44 ++++----- java/org/apache/el/parser/AstInteger.java | 6 +- java/org/apache/el/parser/AstLambdaExpression.java | 31 +++---- java/org/apache/el/parser/AstLessThan.java | 3 +- java/org/apache/el/parser/AstLessThanEqual.java | 3 +- .../org/apache/el/parser/AstLiteralExpression.java | 2 +- java/org/apache/el/parser/AstMapEntry.java | 9 +- java/org/apache/el/parser/AstMinus.java | 3 +- java/org/apache/el/parser/AstMod.java | 3 +- java/org/apache/el/parser/AstMult.java | 3 +- java/org/apache/el/parser/AstNegative.java | 6 +- java/org/apache/el/parser/AstNot.java | 6 +- java/org/apache/el/parser/AstNotEqual.java | 3 +- java/org/apache/el/parser/AstNull.java | 6 +- java/org/apache/el/parser/AstOr.java | 3 +- java/org/apache/el/parser/AstPlus.java | 3 +- java/org/apache/el/parser/AstString.java | 6 +- java/org/apache/el/parser/AstTrue.java | 3 +- java/org/apache/el/parser/AstValue.java | 102 ++++++++------------- java/org/apache/el/parser/BooleanNode.java | 3 +- 36 files changed, 119 insertions(+), 210 deletions(-) diff --git a/java/org/apache/el/parser/ArithmeticNode.java b/java/org/apache/el/parser/ArithmeticNode.java index 2a665d1d30..69dacaa4ec 100644 --- a/java/org/apache/el/parser/ArithmeticNode.java +++ b/java/org/apache/el/parser/ArithmeticNode.java @@ -30,8 +30,7 @@ public abstract class ArithmeticNode extends SimpleNode { } @Override - public Class<?> getType(EvaluationContext ctx) - throws ELException { + public Class<?> getType(EvaluationContext ctx) throws ELException { return Number.class; } } diff --git a/java/org/apache/el/parser/AstAnd.java b/java/org/apache/el/parser/AstAnd.java index 85d268e99f..8a87feaaaa 100644 --- a/java/org/apache/el/parser/AstAnd.java +++ b/java/org/apache/el/parser/AstAnd.java @@ -32,8 +32,7 @@ public final class AstAnd extends BooleanNode { } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { Object obj = children[0].getValue(ctx); Boolean b = ELSupport.coerceToBoolean(ctx, obj, true); if (!b.booleanValue()) { diff --git a/java/org/apache/el/parser/AstBracketSuffix.java b/java/org/apache/el/parser/AstBracketSuffix.java index 16f2e01700..48e47181d8 100644 --- a/java/org/apache/el/parser/AstBracketSuffix.java +++ b/java/org/apache/el/parser/AstBracketSuffix.java @@ -31,8 +31,7 @@ public final class AstBracketSuffix extends SimpleNode { } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { return this.children[0].getValue(ctx); } } diff --git a/java/org/apache/el/parser/AstChoice.java b/java/org/apache/el/parser/AstChoice.java index 173ea22b3b..3981a97704 100644 --- a/java/org/apache/el/parser/AstChoice.java +++ b/java/org/apache/el/parser/AstChoice.java @@ -32,15 +32,13 @@ public final class AstChoice extends SimpleNode { } @Override - public Class<?> getType(EvaluationContext ctx) - throws ELException { + public Class<?> getType(EvaluationContext ctx) throws ELException { Object val = this.getValue(ctx); return (val != null) ? val.getClass() : null; } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { Object obj0 = this.children[0].getValue(ctx); Boolean b0 = ELSupport.coerceToBoolean(ctx, obj0, true); return this.children[((b0.booleanValue() ? 1 : 2))].getValue(ctx); diff --git a/java/org/apache/el/parser/AstCompositeExpression.java b/java/org/apache/el/parser/AstCompositeExpression.java index e893cd466e..a682bd0436 100644 --- a/java/org/apache/el/parser/AstCompositeExpression.java +++ b/java/org/apache/el/parser/AstCompositeExpression.java @@ -33,14 +33,12 @@ public final class AstCompositeExpression extends SimpleNode { } @Override - public Class<?> getType(EvaluationContext ctx) - throws ELException { + public Class<?> getType(EvaluationContext ctx) throws ELException { return String.class; } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { StringBuilder sb = new StringBuilder(16); Object obj = null; if (this.children != null) { diff --git a/java/org/apache/el/parser/AstDeferredExpression.java b/java/org/apache/el/parser/AstDeferredExpression.java index 302b6fad53..78c8b44ce0 100644 --- a/java/org/apache/el/parser/AstDeferredExpression.java +++ b/java/org/apache/el/parser/AstDeferredExpression.java @@ -31,26 +31,22 @@ public final class AstDeferredExpression extends SimpleNode { } @Override - public Class<?> getType(EvaluationContext ctx) - throws ELException { + public Class<?> getType(EvaluationContext ctx) throws ELException { return this.children[0].getType(ctx); } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { return this.children[0].getValue(ctx); } @Override - public boolean isReadOnly(EvaluationContext ctx) - throws ELException { + public boolean isReadOnly(EvaluationContext ctx) throws ELException { return this.children[0].isReadOnly(ctx); } @Override - public void setValue(EvaluationContext ctx, Object value) - throws ELException { + public void setValue(EvaluationContext ctx, Object value) throws ELException { this.children[0].setValue(ctx, value); } } diff --git a/java/org/apache/el/parser/AstDiv.java b/java/org/apache/el/parser/AstDiv.java index fd723d9cad..a5104d557b 100644 --- a/java/org/apache/el/parser/AstDiv.java +++ b/java/org/apache/el/parser/AstDiv.java @@ -32,8 +32,7 @@ public final class AstDiv extends ArithmeticNode { } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { Object obj0 = this.children[0].getValue(ctx); Object obj1 = this.children[1].getValue(ctx); return ELArithmetic.divide(obj0, obj1); diff --git a/java/org/apache/el/parser/AstDotSuffix.java b/java/org/apache/el/parser/AstDotSuffix.java index 2e02ee8d38..7bd44fe518 100644 --- a/java/org/apache/el/parser/AstDotSuffix.java +++ b/java/org/apache/el/parser/AstDotSuffix.java @@ -33,16 +33,14 @@ public final class AstDotSuffix extends SimpleNode { } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { return this.image; } @Override public void setImage(String image) { if (!Validation.isIdentifier(image)) { - throw new ELException(MessageFactory.get("error.identifier.notjava", - image)); + throw new ELException(MessageFactory.get("error.identifier.notjava", image)); } this.image = image; } diff --git a/java/org/apache/el/parser/AstDynamicExpression.java b/java/org/apache/el/parser/AstDynamicExpression.java index 413880b067..f3b5d20834 100644 --- a/java/org/apache/el/parser/AstDynamicExpression.java +++ b/java/org/apache/el/parser/AstDynamicExpression.java @@ -31,26 +31,22 @@ public final class AstDynamicExpression extends SimpleNode { } @Override - public Class<?> getType(EvaluationContext ctx) - throws ELException { + public Class<?> getType(EvaluationContext ctx) throws ELException { return this.children[0].getType(ctx); } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { return this.children[0].getValue(ctx); } @Override - public boolean isReadOnly(EvaluationContext ctx) - throws ELException { + public boolean isReadOnly(EvaluationContext ctx) throws ELException { return this.children[0].isReadOnly(ctx); } @Override - public void setValue(EvaluationContext ctx, Object value) - throws ELException { + public void setValue(EvaluationContext ctx, Object value) throws ELException { this.children[0].setValue(ctx, value); } } diff --git a/java/org/apache/el/parser/AstEmpty.java b/java/org/apache/el/parser/AstEmpty.java index 323995b6b7..0fc73218ed 100644 --- a/java/org/apache/el/parser/AstEmpty.java +++ b/java/org/apache/el/parser/AstEmpty.java @@ -34,14 +34,12 @@ public final class AstEmpty extends SimpleNode { } @Override - public Class<?> getType(EvaluationContext ctx) - throws ELException { + public Class<?> getType(EvaluationContext ctx) throws ELException { return Boolean.class; } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { Object obj = this.children[0].getValue(ctx); if (obj == null) { return Boolean.TRUE; diff --git a/java/org/apache/el/parser/AstEqual.java b/java/org/apache/el/parser/AstEqual.java index 4a9b53ea96..b64688c779 100644 --- a/java/org/apache/el/parser/AstEqual.java +++ b/java/org/apache/el/parser/AstEqual.java @@ -32,8 +32,7 @@ public final class AstEqual extends BooleanNode { } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { Object obj0 = this.children[0].getValue(ctx); Object obj1 = this.children[1].getValue(ctx); return Boolean.valueOf(ELSupport.equals(ctx, obj0, obj1)); diff --git a/java/org/apache/el/parser/AstFalse.java b/java/org/apache/el/parser/AstFalse.java index 54ae49dd12..128783773b 100644 --- a/java/org/apache/el/parser/AstFalse.java +++ b/java/org/apache/el/parser/AstFalse.java @@ -31,8 +31,7 @@ public final class AstFalse extends BooleanNode { } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { return Boolean.FALSE; } } diff --git a/java/org/apache/el/parser/AstFloatingPoint.java b/java/org/apache/el/parser/AstFloatingPoint.java index 7715edcf7a..9f29118176 100644 --- a/java/org/apache/el/parser/AstFloatingPoint.java +++ b/java/org/apache/el/parser/AstFloatingPoint.java @@ -54,14 +54,12 @@ public final class AstFloatingPoint extends SimpleNode { } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { return this.getFloatingPoint(); } @Override - public Class<?> getType(EvaluationContext ctx) - throws ELException { + public Class<?> getType(EvaluationContext ctx) throws ELException { return this.getFloatingPoint().getClass(); } } diff --git a/java/org/apache/el/parser/AstFunction.java b/java/org/apache/el/parser/AstFunction.java index 78bc01ecc7..f2ba105247 100644 --- a/java/org/apache/el/parser/AstFunction.java +++ b/java/org/apache/el/parser/AstFunction.java @@ -163,7 +163,8 @@ public final class AstFunction extends SimpleNode { if (m.isVarArgs() && i == methodParameterCount - 1) { if (inputParameterCount < methodParameterCount) { params[i] = new Object[] { null }; - } else if (inputParameterCount == methodParameterCount && isArray(parameters.jjtGetChild(i).getValue(ctx))) { + } else if (inputParameterCount == methodParameterCount && + isArray(parameters.jjtGetChild(i).getValue(ctx))) { params[i] = parameters.jjtGetChild(i).getValue(ctx); } else { Object[] varargs = new Object[inputParameterCount - methodParameterCount + 1]; diff --git a/java/org/apache/el/parser/AstGreaterThan.java b/java/org/apache/el/parser/AstGreaterThan.java index 953947c14d..dac3161fb1 100644 --- a/java/org/apache/el/parser/AstGreaterThan.java +++ b/java/org/apache/el/parser/AstGreaterThan.java @@ -32,8 +32,7 @@ public final class AstGreaterThan extends BooleanNode { } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { Object obj0 = this.children[0].getValue(ctx); if (obj0 == null) { return Boolean.FALSE; diff --git a/java/org/apache/el/parser/AstGreaterThanEqual.java b/java/org/apache/el/parser/AstGreaterThanEqual.java index 3095546264..3f57c000a2 100644 --- a/java/org/apache/el/parser/AstGreaterThanEqual.java +++ b/java/org/apache/el/parser/AstGreaterThanEqual.java @@ -32,8 +32,7 @@ public final class AstGreaterThanEqual extends BooleanNode { } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { Object obj0 = this.children[0].getValue(ctx); Object obj1 = this.children[1].getValue(ctx); if (obj0 == obj1) { diff --git a/java/org/apache/el/parser/AstIdentifier.java b/java/org/apache/el/parser/AstIdentifier.java index 4565536faf..a1f9759932 100644 --- a/java/org/apache/el/parser/AstIdentifier.java +++ b/java/org/apache/el/parser/AstIdentifier.java @@ -53,8 +53,7 @@ public final class AstIdentifier extends SimpleNode { 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(MessageFactory.get("error.resolver.unhandled.null", this.image)); } return result; } @@ -78,12 +77,11 @@ public final class AstIdentifier extends SimpleNode { // EL Resolvers ctx.setPropertyResolved(false); Object result; - /* Putting the Boolean into the ELContext is part of a performance - * optimisation for ScopedAttributeELResolver. When looking up "foo", - * the resolver can't differentiate between ${ foo } and ${ foo.bar }. - * This is important because the expensive class lookup only needs to - * be performed in the later case. This flag tells the resolver if the - * lookup can be skipped. + /* + * Putting the Boolean into the ELContext is part of a performance optimisation for ScopedAttributeELResolver. + * When looking up "foo", the resolver can't differentiate between ${ foo } and ${ foo.bar }. This is important + * because the expensive class lookup only needs to be performed in the later case. This flag tells the resolver + * if the lookup can be skipped. */ if (parent instanceof AstValue) { ctx.putContext(this.getClass(), Boolean.FALSE); @@ -111,14 +109,12 @@ public final class AstIdentifier extends SimpleNode { if (result != null) { try { return ((Class<?>) result).getField(this.image).get(null); - } catch (IllegalArgumentException | IllegalAccessException - | NoSuchFieldException | SecurityException e) { + } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) { throw new ELException(e); } } - throw new PropertyNotFoundException(MessageFactory.get( - "error.resolver.unhandled.null", this.image)); + throw new PropertyNotFoundException(MessageFactory.get("error.resolver.unhandled.null", this.image)); } @Override @@ -133,15 +129,13 @@ public final class AstIdentifier extends SimpleNode { 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(MessageFactory.get("error.resolver.unhandled.null", this.image)); } return result; } @Override - public void setValue(EvaluationContext ctx, Object value) - throws ELException { + public void setValue(EvaluationContext ctx, Object value) throws ELException { VariableMapper varMapper = ctx.getVariableMapper(); if (varMapper != null) { ValueExpression expr = varMapper.resolveVariable(this.image); @@ -153,21 +147,18 @@ public final class AstIdentifier extends SimpleNode { 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(MessageFactory.get("error.resolver.unhandled.null", this.image)); } } @Override - public Object invoke(EvaluationContext ctx, Class<?>[] paramTypes, - Object[] paramValues) throws ELException { + public Object invoke(EvaluationContext ctx, Class<?>[] paramTypes, Object[] paramValues) throws ELException { return this.getMethodExpression(ctx).invoke(ctx.getELContext(), paramValues); } @Override - public MethodInfo getMethodInfo(EvaluationContext ctx, - Class<?>[] paramTypes) throws ELException { + public MethodInfo getMethodInfo(EvaluationContext ctx, Class<?>[] paramTypes) throws ELException { return this.getMethodExpression(ctx).getMethodInfo(ctx.getELContext()); } @@ -179,8 +170,7 @@ public final class AstIdentifier extends SimpleNode { @Override public void setImage(String image) { if (!Validation.isIdentifier(image)) { - throw new ELException(MessageFactory.get("error.identifier.notjava", - image)); + throw new ELException(MessageFactory.get("error.identifier.notjava", image)); } this.image = image; } @@ -204,8 +194,7 @@ public final class AstIdentifier extends SimpleNode { } - private MethodExpression getMethodExpression(EvaluationContext ctx) - throws ELException { + private MethodExpression getMethodExpression(EvaluationContext ctx) throws ELException { Object obj = null; // case A: ValueExpression exists, getValue which must @@ -232,7 +221,8 @@ public final class AstIdentifier extends SimpleNode { } else if (obj == null) { throw new MethodNotFoundException(MessageFactory.get("error.identifier.noMethod", this.image)); } else { - throw new ELException(MessageFactory.get("error.identifier.notMethodExpression", this.image, obj.getClass().getName())); + throw new ELException( + MessageFactory.get("error.identifier.notMethodExpression", this.image, obj.getClass().getName())); } } } diff --git a/java/org/apache/el/parser/AstInteger.java b/java/org/apache/el/parser/AstInteger.java index f30c131993..0e3114fa49 100644 --- a/java/org/apache/el/parser/AstInteger.java +++ b/java/org/apache/el/parser/AstInteger.java @@ -55,14 +55,12 @@ public final class AstInteger extends SimpleNode { } @Override - public Class<?> getType(EvaluationContext ctx) - throws ELException { + public Class<?> getType(EvaluationContext ctx) throws ELException { return this.getInteger().getClass(); } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { return this.getInteger(); } } diff --git a/java/org/apache/el/parser/AstLambdaExpression.java b/java/org/apache/el/parser/AstLambdaExpression.java index 6bf58d6952..b740d02876 100644 --- a/java/org/apache/el/parser/AstLambdaExpression.java +++ b/java/org/apache/el/parser/AstLambdaExpression.java @@ -52,18 +52,16 @@ public class AstLambdaExpression extends SimpleNode { // nested expressions. int methodParameterSetCount = jjtGetNumChildren() - 2; if (methodParameterSetCount > state.getNestingCount()) { - throw new ELException(MessageFactory.get( - "error.lambda.tooManyMethodParameterSets")); + throw new ELException(MessageFactory.get("error.lambda.tooManyMethodParameterSets")); } // First child is always parameters even if there aren't any - AstLambdaParameters formalParametersNode = - (AstLambdaParameters) children[0]; + AstLambdaParameters formalParametersNode = (AstLambdaParameters) children[0]; Node[] formalParamNodes = formalParametersNode.children; // Second child is a value expression - ValueExpressionImpl ve = new ValueExpressionImpl("", children[1], - ctx.getFunctionMapper(), ctx.getVariableMapper(), null); + ValueExpressionImpl ve = + new ValueExpressionImpl("", children[1], ctx.getFunctionMapper(), ctx.getVariableMapper(), null); // Build a LambdaExpression List<String> formalParameters = new ArrayList<>(); @@ -87,27 +85,22 @@ public class AstLambdaExpression extends SimpleNode { } /* - * This is a (possibly nested) lambda expression with one or more sets - * of parameters provided. + * This is a (possibly nested) lambda expression with one or more sets of parameters provided. * - * If there are more nested expressions than sets of parameters this may - * return a LambdaExpression. + * If there are more nested expressions than sets of parameters this may return a LambdaExpression. * - * If there are more sets of parameters than nested expressions an - * ELException will have been thrown by the check at the start of this - * method. + * If there are more sets of parameters than nested expressions an ELException will have been thrown by the + * check at the start of this method. */ // Always have to invoke the outer-most expression int methodParameterIndex = 2; - Object result = le.invoke(((AstMethodParameters) - children[methodParameterIndex]).getParameters(ctx)); + Object result = le.invoke(((AstMethodParameters) children[methodParameterIndex]).getParameters(ctx)); methodParameterIndex++; - while (result instanceof LambdaExpression && - methodParameterIndex < jjtGetNumChildren()) { - result = ((LambdaExpression) result).invoke(((AstMethodParameters) - children[methodParameterIndex]).getParameters(ctx)); + while (result instanceof LambdaExpression && methodParameterIndex < jjtGetNumChildren()) { + result = ((LambdaExpression) result) + .invoke(((AstMethodParameters) children[methodParameterIndex]).getParameters(ctx)); methodParameterIndex++; } diff --git a/java/org/apache/el/parser/AstLessThan.java b/java/org/apache/el/parser/AstLessThan.java index f7882dd702..e661da7cab 100644 --- a/java/org/apache/el/parser/AstLessThan.java +++ b/java/org/apache/el/parser/AstLessThan.java @@ -32,8 +32,7 @@ public final class AstLessThan extends BooleanNode { } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { Object obj0 = this.children[0].getValue(ctx); if (obj0 == null) { return Boolean.FALSE; diff --git a/java/org/apache/el/parser/AstLessThanEqual.java b/java/org/apache/el/parser/AstLessThanEqual.java index 2baadb6e4f..50a138123e 100644 --- a/java/org/apache/el/parser/AstLessThanEqual.java +++ b/java/org/apache/el/parser/AstLessThanEqual.java @@ -32,8 +32,7 @@ public final class AstLessThanEqual extends BooleanNode { } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { Object obj0 = this.children[0].getValue(ctx); Object obj1 = this.children[1].getValue(ctx); if (obj0 == obj1) { diff --git a/java/org/apache/el/parser/AstLiteralExpression.java b/java/org/apache/el/parser/AstLiteralExpression.java index 7fe65c17a1..102d5da761 100644 --- a/java/org/apache/el/parser/AstLiteralExpression.java +++ b/java/org/apache/el/parser/AstLiteralExpression.java @@ -53,7 +53,7 @@ public final class AstLiteralExpression extends SimpleNode { if (c == '\\' && i + 2 < size) { char c1 = image.charAt(i + 1); char c2 = image.charAt(i + 2); - if ((c1 == '#' || c1 == '$') && c2 == '{') { + if ((c1 == '#' || c1 == '$') && c2 == '{') { c = c1; i++; } diff --git a/java/org/apache/el/parser/AstMapEntry.java b/java/org/apache/el/parser/AstMapEntry.java index 5a897dc097..c18874d6ac 100644 --- a/java/org/apache/el/parser/AstMapEntry.java +++ b/java/org/apache/el/parser/AstMapEntry.java @@ -17,10 +17,9 @@ /* Generated By:JJTree: Do not edit this line. AstMapEntry.java Version 4.3 */ package org.apache.el.parser; -public -class AstMapEntry extends SimpleNode { - public AstMapEntry(int id) { - super(id); - } +public class AstMapEntry extends SimpleNode { + public AstMapEntry(int id) { + super(id); + } } /* JavaCC - OriginalChecksum=6a7910e58a583371769800554113a8d3 (do not edit this line) */ diff --git a/java/org/apache/el/parser/AstMinus.java b/java/org/apache/el/parser/AstMinus.java index c31f93624d..10424a5d53 100644 --- a/java/org/apache/el/parser/AstMinus.java +++ b/java/org/apache/el/parser/AstMinus.java @@ -32,8 +32,7 @@ public final class AstMinus extends ArithmeticNode { } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { Object obj0 = this.children[0].getValue(ctx); Object obj1 = this.children[1].getValue(ctx); return ELArithmetic.subtract(obj0, obj1); diff --git a/java/org/apache/el/parser/AstMod.java b/java/org/apache/el/parser/AstMod.java index ee2f6267f6..22f3cdae3b 100644 --- a/java/org/apache/el/parser/AstMod.java +++ b/java/org/apache/el/parser/AstMod.java @@ -32,8 +32,7 @@ public final class AstMod extends ArithmeticNode { } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { Object obj0 = this.children[0].getValue(ctx); Object obj1 = this.children[1].getValue(ctx); return ELArithmetic.mod(obj0, obj1); diff --git a/java/org/apache/el/parser/AstMult.java b/java/org/apache/el/parser/AstMult.java index 2b5f860738..241c3365a8 100644 --- a/java/org/apache/el/parser/AstMult.java +++ b/java/org/apache/el/parser/AstMult.java @@ -32,8 +32,7 @@ public final class AstMult extends ArithmeticNode { } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { Object obj0 = this.children[0].getValue(ctx); Object obj1 = this.children[1].getValue(ctx); return ELArithmetic.multiply(obj0, obj1); diff --git a/java/org/apache/el/parser/AstNegative.java b/java/org/apache/el/parser/AstNegative.java index c2a540c7aa..0e8dfa3b1a 100644 --- a/java/org/apache/el/parser/AstNegative.java +++ b/java/org/apache/el/parser/AstNegative.java @@ -35,14 +35,12 @@ public final class AstNegative extends SimpleNode { } @Override - public Class<?> getType(EvaluationContext ctx) - throws ELException { + public Class<?> getType(EvaluationContext ctx) throws ELException { return Number.class; } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { Object obj = this.children[0].getValue(ctx); if (obj == null) { diff --git a/java/org/apache/el/parser/AstNot.java b/java/org/apache/el/parser/AstNot.java index 1a16180b4e..18a57d6df4 100644 --- a/java/org/apache/el/parser/AstNot.java +++ b/java/org/apache/el/parser/AstNot.java @@ -32,14 +32,12 @@ public final class AstNot extends SimpleNode { } @Override - public Class<?> getType(EvaluationContext ctx) - throws ELException { + public Class<?> getType(EvaluationContext ctx) throws ELException { return Boolean.class; } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { Object obj = this.children[0].getValue(ctx); Boolean b = ELSupport.coerceToBoolean(ctx, obj, true); return Boolean.valueOf(!b.booleanValue()); diff --git a/java/org/apache/el/parser/AstNotEqual.java b/java/org/apache/el/parser/AstNotEqual.java index 5f19904d24..c2211f33e8 100644 --- a/java/org/apache/el/parser/AstNotEqual.java +++ b/java/org/apache/el/parser/AstNotEqual.java @@ -32,8 +32,7 @@ public final class AstNotEqual extends BooleanNode { } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { Object obj0 = this.children[0].getValue(ctx); Object obj1 = this.children[1].getValue(ctx); return Boolean.valueOf(!ELSupport.equals(ctx, obj0, obj1)); diff --git a/java/org/apache/el/parser/AstNull.java b/java/org/apache/el/parser/AstNull.java index b9b28d95b1..4e5f456e7a 100644 --- a/java/org/apache/el/parser/AstNull.java +++ b/java/org/apache/el/parser/AstNull.java @@ -31,14 +31,12 @@ public final class AstNull extends SimpleNode { } @Override - public Class<?> getType(EvaluationContext ctx) - throws ELException { + public Class<?> getType(EvaluationContext ctx) throws ELException { return null; } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { return null; } } diff --git a/java/org/apache/el/parser/AstOr.java b/java/org/apache/el/parser/AstOr.java index a16a04cf40..d5e7d40120 100644 --- a/java/org/apache/el/parser/AstOr.java +++ b/java/org/apache/el/parser/AstOr.java @@ -32,8 +32,7 @@ public final class AstOr extends BooleanNode { } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { Object obj = this.children[0].getValue(ctx); Boolean b = ELSupport.coerceToBoolean(ctx, obj, true); if (b.booleanValue()) { diff --git a/java/org/apache/el/parser/AstPlus.java b/java/org/apache/el/parser/AstPlus.java index 06510fdeb2..7c5a60a181 100644 --- a/java/org/apache/el/parser/AstPlus.java +++ b/java/org/apache/el/parser/AstPlus.java @@ -32,8 +32,7 @@ public final class AstPlus extends ArithmeticNode { } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { Object obj0 = this.children[0].getValue(ctx); Object obj1 = this.children[1].getValue(ctx); return ELArithmetic.add(obj0, obj1); diff --git a/java/org/apache/el/parser/AstString.java b/java/org/apache/el/parser/AstString.java index f701a17f77..5f7be26487 100644 --- a/java/org/apache/el/parser/AstString.java +++ b/java/org/apache/el/parser/AstString.java @@ -40,14 +40,12 @@ public final class AstString extends SimpleNode { } @Override - public Class<?> getType(EvaluationContext ctx) - throws ELException { + public Class<?> getType(EvaluationContext ctx) throws ELException { return String.class; } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { return this.getString(); } diff --git a/java/org/apache/el/parser/AstTrue.java b/java/org/apache/el/parser/AstTrue.java index 70543d98cd..7a5d7d4a06 100644 --- a/java/org/apache/el/parser/AstTrue.java +++ b/java/org/apache/el/parser/AstTrue.java @@ -31,8 +31,7 @@ public final class AstTrue extends BooleanNode { } @Override - public Object getValue(EvaluationContext ctx) - throws ELException { + public Object getValue(EvaluationContext ctx) throws ELException { return Boolean.TRUE; } } diff --git a/java/org/apache/el/parser/AstValue.java b/java/org/apache/el/parser/AstValue.java index e244eedb43..319da40cc0 100644 --- a/java/org/apache/el/parser/AstValue.java +++ b/java/org/apache/el/parser/AstValue.java @@ -59,8 +59,7 @@ public final class AstValue extends SimpleNode { 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(MessageFactory.get("error.resolver.unhandled", t.base, t.property)); } return result; } @@ -71,8 +70,8 @@ public final class AstValue extends SimpleNode { // 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( + MessageFactory.get("error.unreachable.base", this.children[0].getImage())); } // set up our start/end @@ -83,24 +82,19 @@ public final class AstValue extends SimpleNode { // Evaluate any properties or methods before our target ELResolver resolver = ctx.getELResolver(); while (i < propCount) { - if (i + 2 < propCount && - this.children[i + 1] instanceof AstMethodParameters) { + if (i + 2 < propCount && this.children[i + 1] instanceof AstMethodParameters) { // Method call not at end of expression - base = resolver.invoke(ctx, base, - this.children[i].getValue(ctx), null, - ((AstMethodParameters) - this.children[i + 1]).getParameters(ctx)); + base = resolver.invoke(ctx, base, this.children[i].getValue(ctx), null, + ((AstMethodParameters) this.children[i + 1]).getParameters(ctx)); i += 2; - } else if (i + 2 == propCount && - this.children[i + 1] instanceof AstMethodParameters) { + } else if (i + 2 == propCount && this.children[i + 1] instanceof AstMethodParameters) { // Method call at end of expression ctx.setPropertyResolved(false); property = this.children[i].getValue(ctx); i += 2; if (property == null) { - throw new PropertyNotFoundException(MessageFactory.get( - "error.unreachable.property", property)); + throw new PropertyNotFoundException(MessageFactory.get("error.unreachable.property", property)); } } else if (i + 1 < propCount) { // Object with property not at end of expression @@ -116,13 +110,11 @@ public final class AstValue extends SimpleNode { i++; if (property == null) { - throw new PropertyNotFoundException(MessageFactory.get( - "error.unreachable.property", property)); + throw new PropertyNotFoundException(MessageFactory.get("error.unreachable.property", property)); } } if (base == null) { - throw new PropertyNotFoundException(MessageFactory.get( - "error.unreachable.property", property)); + throw new PropertyNotFoundException(MessageFactory.get("error.unreachable.property", property)); } } @@ -141,24 +133,19 @@ public final class AstValue extends SimpleNode { ELResolver resolver = ctx.getELResolver(); while (base != null && i < propCount) { suffix = this.children[i].getValue(ctx); - if (i + 1 < propCount && - (this.children[i+1] instanceof AstMethodParameters)) { - AstMethodParameters mps = - (AstMethodParameters) this.children[i+1]; - if (base instanceof Optional && "orElseGet".equals(suffix) && - mps.jjtGetNumChildren() == 1) { + if (i + 1 < propCount && (this.children[i + 1] instanceof AstMethodParameters)) { + AstMethodParameters mps = (AstMethodParameters) this.children[i + 1]; + if (base instanceof Optional && "orElseGet".equals(suffix) && mps.jjtGetNumChildren() == 1) { Node paramFoOptional = mps.jjtGetChild(0); if (!(paramFoOptional instanceof AstLambdaExpression || paramFoOptional instanceof LambdaExpression)) { - throw new ELException(MessageFactory.get( - "stream.optional.paramNotLambda", suffix)); + throw new ELException(MessageFactory.get("stream.optional.paramNotLambda", suffix)); } } // This is a method Object[] paramValues = mps.getParameters(ctx); - base = resolver.invoke(ctx, base, suffix, - getTypesFromValues(paramValues), paramValues); - i+=2; + base = resolver.invoke(ctx, base, suffix, getTypesFromValues(paramValues), paramValues); + i += 2; } else { // This is a property if (suffix == null) { @@ -171,8 +158,7 @@ public final class AstValue extends SimpleNode { } } if (!ctx.isPropertyResolved()) { - throw new PropertyNotFoundException(MessageFactory.get( - "error.resolver.unhandled", base, suffix)); + throw new PropertyNotFoundException(MessageFactory.get("error.resolver.unhandled", base, suffix)); } return base; } @@ -181,42 +167,35 @@ public final class AstValue extends SimpleNode { public boolean isReadOnly(EvaluationContext ctx) throws ELException { Target t = getTarget(ctx); ctx.setPropertyResolved(false); - boolean result = - ctx.getELResolver().isReadOnly(ctx, t.base, t.property); + 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(MessageFactory.get("error.resolver.unhandled", t.base, t.property)); } return result; } @Override - public void setValue(EvaluationContext ctx, Object value) - throws ELException { + public void setValue(EvaluationContext ctx, Object value) throws ELException { Target t = getTarget(ctx); ctx.setPropertyResolved(false); ELResolver resolver = ctx.getELResolver(); // coerce to the expected type Class<?> targetClass = resolver.getType(ctx, t.base, t.property); - resolver.setValue(ctx, t.base, t.property, - ELSupport.coerceToType(ctx, value, targetClass)); + resolver.setValue(ctx, t.base, t.property, ELSupport.coerceToType(ctx, value, targetClass)); if (!ctx.isPropertyResolved()) { - throw new PropertyNotFoundException(MessageFactory.get( - "error.resolver.unhandled", t.base, t.property)); + throw new PropertyNotFoundException(MessageFactory.get("error.resolver.unhandled", t.base, t.property)); } } @Override // Interface el.parser.Node uses raw types (and is auto-generated) - public MethodInfo getMethodInfo(EvaluationContext ctx, - @SuppressWarnings("rawtypes") Class[] paramTypes) + public MethodInfo getMethodInfo(EvaluationContext ctx, @SuppressWarnings("rawtypes") Class[] paramTypes) throws ELException { Target t = getTarget(ctx); Class<?>[] types = null; if (isParametersProvided()) { - Object[] values = ((AstMethodParameters) this.jjtGetChild( - this.jjtGetNumChildren() - 1)).getParameters(ctx); + Object[] values = ((AstMethodParameters) this.jjtGetChild(this.jjtGetNumChildren() - 1)).getParameters(ctx); types = getTypesFromValues(values); } else { types = paramTypes; @@ -227,17 +206,15 @@ public final class AstValue extends SimpleNode { @Override // Interface el.parser.Node uses a raw type (and is auto-generated) - public Object invoke(EvaluationContext ctx, - @SuppressWarnings("rawtypes") Class[] paramTypes, - Object[] paramValues) throws ELException { + public Object invoke(EvaluationContext ctx, @SuppressWarnings("rawtypes") Class[] paramTypes, Object[] paramValues) + throws ELException { Target t = getTarget(ctx); Method m = null; Object[] values = null; Class<?>[] types = null; if (isParametersProvided()) { - values = ((AstMethodParameters) this.jjtGetChild( - this.jjtGetNumChildren() - 1)).getParameters(ctx); + values = ((AstMethodParameters) this.jjtGetChild(this.jjtGetNumChildren() - 1)).getParameters(ctx); types = getTypesFromValues(values); } else { values = paramValues; @@ -270,8 +247,7 @@ public final class AstValue extends SimpleNode { Object[] values = null; Class<?>[] types = null; if (isParametersProvided()) { - values = ((AstMethodParameters) this.jjtGetChild( - this.jjtGetNumChildren() - 1)).getParameters(ctx); + values = ((AstMethodParameters) this.jjtGetChild(this.jjtGetNumChildren() - 1)).getParameters(ctx); types = getTypesFromValues(values); } m = ReflectionUtil.getMethod(ctx, t.base, t.property, types, values); @@ -292,19 +268,18 @@ public final class AstValue extends SimpleNode { int paramCount = types.length; if (m.isVarArgs() && paramCount > 1 && (src == null || paramCount > src.length) || - !m.isVarArgs() && (paramCount > 0 && src == null || - src != null && src.length != paramCount)) { + !m.isVarArgs() && (paramCount > 0 && src == null || src != null && src.length != paramCount)) { String srcCount = null; if (src != null) { srcCount = Integer.toString(src.length); } String msg; if (m.isVarArgs()) { - msg = MessageFactory.get("error.invoke.tooFewParams", - m.getName(), srcCount, Integer.toString(paramCount)); + msg = MessageFactory.get("error.invoke.tooFewParams", m.getName(), srcCount, + Integer.toString(paramCount)); } else { - msg = MessageFactory.get("error.invoke.wrongParams", - m.getName(), srcCount, Integer.toString(paramCount)); + msg = MessageFactory.get("error.invoke.wrongParams", m.getName(), srcCount, + Integer.toString(paramCount)); } throw new IllegalArgumentException(msg); } @@ -324,15 +299,13 @@ public final class AstValue extends SimpleNode { if (m.isVarArgs()) { Class<?> varArgType = m.getParameterTypes()[paramCount - 1].getComponentType(); - Object[] varArgs = - (Object[]) Array.newInstance(varArgType, src.length - (paramCount - 1)); - for (int i = 0; i < src.length - (paramCount - 1); i ++) { + Object[] varArgs = (Object[]) Array.newInstance(varArgType, src.length - (paramCount - 1)); + for (int i = 0; i < src.length - (paramCount - 1); i++) { varArgs[i] = ELSupport.coerceToType(ctx, src[paramCount - 1 + i], varArgType); } dest[paramCount - 1] = varArgs; } else { - dest[paramCount - 1] = ELSupport.coerceToType( - ctx, src[paramCount - 1], types[paramCount - 1]); + dest[paramCount - 1] = ELSupport.coerceToType(ctx, src[paramCount - 1], types[paramCount - 1]); } return dest; @@ -361,8 +334,7 @@ public final class AstValue extends SimpleNode { @Override public ValueReference getValueReference(EvaluationContext ctx) { // Check this is a reference to a base and a property - if (this.children.length > 2 && - this.jjtGetChild(2) instanceof AstMethodParameters) { + if (this.children.length > 2 && this.jjtGetChild(2) instanceof AstMethodParameters) { // This is a method call return null; } diff --git a/java/org/apache/el/parser/BooleanNode.java b/java/org/apache/el/parser/BooleanNode.java index 3cd042ada3..30cb5492a7 100644 --- a/java/org/apache/el/parser/BooleanNode.java +++ b/java/org/apache/el/parser/BooleanNode.java @@ -30,8 +30,7 @@ public abstract class BooleanNode extends SimpleNode { } @Override - public Class<?> getType(EvaluationContext ctx) - throws ELException { + public Class<?> getType(EvaluationContext ctx) throws ELException { return Boolean.class; } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org