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 69a171c68eba3367ea6982e7e17847054c93c6d2
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Aug 9 15:13:03 2024 +0100

    Code clean-up - formatting. No functional change.
---
 java/org/apache/el/lang/ELArithmetic.java          |  20 +-
 java/org/apache/el/lang/ELSupport.java             | 206 +++++++++------------
 java/org/apache/el/lang/EvaluationContext.java     |  15 +-
 java/org/apache/el/lang/ExpressionBuilder.java     |  61 +++---
 java/org/apache/el/lang/FunctionMapperImpl.java    |  13 +-
 .../el/lang/LambdaExpressionNestedState.java       |  13 +-
 java/org/apache/el/lang/VariableMapperImpl.java    |  10 +-
 7 files changed, 136 insertions(+), 202 deletions(-)

diff --git a/java/org/apache/el/lang/ELArithmetic.java 
b/java/org/apache/el/lang/ELArithmetic.java
index de7dacae1b..17182c1fe3 100644
--- a/java/org/apache/el/lang/ELArithmetic.java
+++ b/java/org/apache/el/lang/ELArithmetic.java
@@ -27,6 +27,7 @@ import org.apache.el.util.MessageFactory;
 
 /**
  * A helper class of Arithmetic defined by the EL Specification
+ *
  * @author Jacob Hookom [ja...@hookom.net]
  */
 public abstract class ELArithmetic {
@@ -56,8 +57,7 @@ public abstract class ELArithmetic {
 
         @Override
         protected Number divide(Number num0, Number num1) {
-            return ((BigDecimal) num0).divide((BigDecimal) num1,
-                    RoundingMode.HALF_UP);
+            return ((BigDecimal) num0).divide((BigDecimal) num1, 
RoundingMode.HALF_UP);
         }
 
         @Override
@@ -190,13 +190,9 @@ public abstract class ELArithmetic {
 
         @Override
         public boolean matches(Object obj0, Object obj1) {
-            return (obj0 instanceof Double
-                    || obj1 instanceof Double
-                    || obj0 instanceof Float
-                    || obj1 instanceof Float
-                    || (obj0 instanceof String && ELSupport
-                            .isStringFloat((String) obj0)) || (obj1 instanceof 
String && ELSupport
-                    .isStringFloat((String) obj1)));
+            return (obj0 instanceof Double || obj1 instanceof Double || obj0 
instanceof Float ||
+                    obj1 instanceof Float || (obj0 instanceof String && 
ELSupport.isStringFloat((String) obj0)) ||
+                    (obj1 instanceof String && 
ELSupport.isStringFloat((String) obj1)));
         }
     }
 
@@ -359,10 +355,8 @@ public abstract class ELArithmetic {
     }
 
     public static final boolean isNumberType(final Class<?> type) {
-        return type == Long.TYPE || type == Double.TYPE ||
-            type == Byte.TYPE || type == Short.TYPE ||
-            type == Integer.TYPE || type == Float.TYPE ||
-            Number.class.isAssignableFrom(type);
+        return type == Long.TYPE || type == Double.TYPE || type == Byte.TYPE 
|| type == Short.TYPE ||
+                type == Integer.TYPE || type == Float.TYPE || 
Number.class.isAssignableFrom(type);
     }
 
     protected ELArithmetic() {
diff --git a/java/org/apache/el/lang/ELSupport.java 
b/java/org/apache/el/lang/ELSupport.java
index d03fd39aed..8ab1c57e7a 100644
--- a/java/org/apache/el/lang/ELSupport.java
+++ b/java/org/apache/el/lang/ELSupport.java
@@ -52,18 +52,17 @@ public class ELSupport {
     /**
      * Compare two objects, after coercing to the same type if appropriate.
      * <p>
-     * If the objects are identical, or they are equal according to
-     * {@link #equals(ELContext, Object, Object)} then return 0.
+     * If the objects are identical, or they are equal according to {@link 
#equals(ELContext, Object, Object)} then
+     * return 0.
      * <p>
-     * If either object is a BigDecimal, then coerce both to BigDecimal first.
-     * Similarly for Double(Float), BigInteger, and Long(Integer, Char, Short, 
Byte).
+     * If either object is a BigDecimal, then coerce both to BigDecimal first. 
Similarly for Double(Float), BigInteger,
+     * and Long(Integer, Char, Short, Byte).
      * <p>
-     * Otherwise, check that the first object is an instance of Comparable, 
and compare
-     * against the second object. If that is null, return 1, otherwise
-     * return the result of comparing against the second object.
+     * Otherwise, check that the first object is an instance of Comparable, 
and compare against the second object. If
+     * that is null, return 1, otherwise return the result of comparing 
against the second object.
      * <p>
-     * Similarly, if the second object is Comparable, if the first is null, 
return -1,
-     * else return the result of comparing against the first object.
+     * Similarly, if the second object is Comparable, if the first is null, 
return -1, else return the result of
+     * comparing against the first object.
      * <p>
      * A null object is considered as:
      * <ul>
@@ -72,15 +71,16 @@ public class ELSupport {
      * <li>Otherwise null is considered to be lower than anything else.</li>
      * </ul>
      *
-     * @param ctx the context in which this comparison is taking place
+     * @param ctx  the context in which this comparison is taking place
      * @param obj0 first object
      * @param obj1 second object
+     *
      * @return -1, 0, or 1 if this object is less than, equal to, or greater 
than val.
-     * @throws ELException if neither object is Comparable
+     *
+     * @throws ELException        if neither object is Comparable
      * @throws ClassCastException if the objects are not mutually comparable
      */
-    public static final int compare(final ELContext ctx, final Object obj0, 
final Object obj1)
-            throws ELException {
+    public static final int compare(final ELContext ctx, final Object obj0, 
final Object obj1) throws ELException {
         if (obj0 == obj1 || equals(ctx, obj0, obj1)) {
             return 0;
         }
@@ -133,14 +133,15 @@ public class ELSupport {
      * <p>
      * Otherwise default to using Object.equals().
      *
-     * @param ctx the context in which this equality test is taking place
+     * @param ctx  the context in which this equality test is taking place
      * @param obj0 the first object
      * @param obj1 the second object
+     *
      * @return true if the objects are equal
+     *
      * @throws ELException if one of the coercion fails
      */
-    public static final boolean equals(final ELContext ctx, final Object obj0, 
final Object obj1)
-            throws ELException {
+    public static final boolean equals(final ELContext ctx, final Object obj0, 
final Object obj1) throws ELException {
         if (obj0 == obj1) {
             return true;
         } else if (obj0 == null || obj1 == null) {
@@ -157,7 +158,7 @@ public class ELSupport {
             BigInteger bi0 = (BigInteger) coerceToNumber(ctx, obj0, 
BigInteger.class);
             BigInteger bi1 = (BigInteger) coerceToNumber(ctx, obj1, 
BigInteger.class);
             return bi0.equals(bi1);
-        } else         if (isLongOp(obj0, obj1)) {
+        } else if (isLongOp(obj0, obj1)) {
             Long l0 = (Long) coerceToNumber(ctx, obj0, Long.class);
             Long l1 = (Long) coerceToNumber(ctx, obj1, Long.class);
             return l0.equals(l1);
@@ -176,8 +177,8 @@ public class ELSupport {
     }
 
     /*
-     *  Going to have to have some casts /raw types somewhere so doing it here 
keeps them all in one place. There might
-     *  be a neater / better solution but I couldn't find it.
+     * Going to have to have some casts /raw types somewhere so doing it here 
keeps them all in one place. There might
+     * be a neater / better solution but I couldn't find it.
      */
     @SuppressWarnings("unchecked")
     public static final Enum<?> coerceToEnum(final ELContext ctx, final Object 
obj,
@@ -203,32 +204,31 @@ public class ELSupport {
         }
 
         if (!(obj instanceof String)) {
-            throw new ELException(MessageFactory.get("error.convert",
-                    obj, obj.getClass(), type));
+            throw new ELException(MessageFactory.get("error.convert", obj, 
obj.getClass(), type));
         }
 
         Enum<?> result;
         try {
-             result = Enum.valueOf(type, (String) obj);
+            result = Enum.valueOf(type, (String) obj);
         } catch (IllegalArgumentException iae) {
-            throw new ELException(MessageFactory.get("error.convert",
-                    obj, obj.getClass(), type));
+            throw new ELException(MessageFactory.get("error.convert", obj, 
obj.getClass(), type));
         }
         return result;
     }
 
     /**
-     * Convert an object to Boolean.
-     * Null and empty string are false.
-     * @param ctx the context in which this conversion is taking place
-     * @param obj the object to convert
-     * @param primitive is the target a primitive in which case coercion to 
null
-     *                  is not permitted
+     * Convert an object to Boolean. Null and empty string are false.
+     *
+     * @param ctx       the context in which this conversion is taking place
+     * @param obj       the object to convert
+     * @param primitive is the target a primitive in which case coercion to 
null is not permitted
+     *
      * @return the Boolean value of the object
+     *
      * @throws ELException if object is not Boolean or String
      */
-    public static final Boolean coerceToBoolean(final ELContext ctx, final 
Object obj,
-            boolean primitive) throws ELException {
+    public static final Boolean coerceToBoolean(final ELContext ctx, final 
Object obj, boolean primitive)
+            throws ELException {
 
         if (ctx != null) {
             boolean originalIsPropertyResolved = ctx.isPropertyResolved();
@@ -258,12 +258,10 @@ public class ELSupport {
             return Boolean.valueOf((String) obj);
         }
 
-        throw new ELException(MessageFactory.get("error.convert",
-                obj, obj.getClass(), Boolean.class));
+        throw new ELException(MessageFactory.get("error.convert", obj, 
obj.getClass(), Boolean.class));
     }
 
-    private static Character coerceToCharacter(final ELContext ctx, final 
Object obj)
-            throws ELException {
+    private static Character coerceToCharacter(final ELContext ctx, final 
Object obj) throws ELException {
 
         if (ctx != null) {
             boolean originalIsPropertyResolved = ctx.isPropertyResolved();
@@ -291,12 +289,10 @@ public class ELSupport {
             return (Character) obj;
         }
 
-        throw new ELException(MessageFactory.get("error.convert",
-                obj, objType, Character.class));
+        throw new ELException(MessageFactory.get("error.convert", obj, 
objType, Character.class));
     }
 
-    protected static final Number coerceToNumber(final Number number,
-            final Class<?> type) throws ELException {
+    protected static final Number coerceToNumber(final Number number, final 
Class<?> type) throws ELException {
         if (Long.TYPE == type || Long.class.equals(type)) {
             return Long.valueOf(number.longValue());
         }
@@ -337,12 +333,11 @@ public class ELSupport {
             return number;
         }
 
-        throw new ELException(MessageFactory.get("error.convert",
-                number, number.getClass(), type));
+        throw new ELException(MessageFactory.get("error.convert", number, 
number.getClass(), type));
     }
 
-    public static final Number coerceToNumber(final ELContext ctx, final 
Object obj,
-            final Class<?> type) throws ELException {
+    public static final Number coerceToNumber(final ELContext ctx, final 
Object obj, final Class<?> type)
+            throws ELException {
 
         if (ctx != null) {
             boolean originalIsPropertyResolved = ctx.isPropertyResolved();
@@ -373,89 +368,79 @@ public class ELSupport {
         }
 
         if (obj instanceof Character) {
-            return coerceToNumber(Short.valueOf((short) ((Character) obj)
-                    .charValue()), type);
+            return coerceToNumber(Short.valueOf((short) ((Character) 
obj).charValue()), type);
         }
 
-        throw new ELException(MessageFactory.get("error.convert",
-                obj, obj.getClass(), type));
+        throw new ELException(MessageFactory.get("error.convert", obj, 
obj.getClass(), type));
     }
 
-    protected static final Number coerceToNumber(final String val,
-            final Class<?> type) throws ELException {
+    protected static final Number coerceToNumber(final String val, final 
Class<?> type) throws ELException {
         if (Long.TYPE == type || Long.class.equals(type)) {
             try {
                 return Long.valueOf(val);
             } catch (NumberFormatException nfe) {
-                throw new ELException(MessageFactory.get("error.convert",
-                        val, String.class, type));
+                throw new ELException(MessageFactory.get("error.convert", 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(MessageFactory.get("error.convert", 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(MessageFactory.get("error.convert", 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(MessageFactory.get("error.convert", 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(MessageFactory.get("error.convert", 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(MessageFactory.get("error.convert", 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(MessageFactory.get("error.convert", 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(MessageFactory.get("error.convert", val, 
String.class, type));
             }
         }
 
-        throw new ELException(MessageFactory.get("error.convert",
-                val, String.class, type));
+        throw new ELException(MessageFactory.get("error.convert", val, 
String.class, type));
     }
 
     /**
      * Coerce an object to a string.
+     *
      * @param ctx the context in which this conversion is taking place
      * @param obj the object to convert
+     *
      * @return the String value of the object
      */
     public static final String coerceToString(final ELContext ctx, final 
Object obj) {
@@ -491,8 +476,8 @@ public class ELSupport {
         }
     }
 
-    public static final <T> T coerceToType(final ELContext ctx, final Object 
obj,
-            final Class<T> type) throws ELException {
+    public static final <T> T coerceToType(final ELContext ctx, final Object 
obj, final Class<T> type)
+            throws ELException {
 
         if (ctx != null) {
             boolean originalIsPropertyResolved = ctx.isPropertyResolved();
@@ -506,16 +491,14 @@ public class ELSupport {
             }
         }
 
-        if (type == null || Object.class.equals(type) ||
-                (obj != null && type.isAssignableFrom(obj.getClass()))) {
+        if (type == null || Object.class.equals(type) || (obj != null && 
type.isAssignableFrom(obj.getClass()))) {
             @SuppressWarnings("unchecked")
             T result = (T) obj;
             return result;
         }
 
         if (!COERCE_TO_ZERO) {
-            if (obj == null && !type.isPrimitive() &&
-                    !String.class.isAssignableFrom(type)) {
+            if (obj == null && !type.isPrimitive() && 
!String.class.isAssignableFrom(type)) {
                 return null;
             }
         }
@@ -557,8 +540,7 @@ public class ELSupport {
                 if (str.isEmpty()) {
                     return null;
                 }
-                throw new ELException(MessageFactory.get("error.convert", obj,
-                        obj.getClass(), type));
+                throw new ELException(MessageFactory.get("error.convert", obj, 
obj.getClass(), type));
             } else {
                 try {
                     editor.setAsText(str);
@@ -569,16 +551,14 @@ public class ELSupport {
                     if (str.isEmpty()) {
                         return null;
                     }
-                    throw new ELException(MessageFactory.get("error.convert",
-                            obj, obj.getClass(), type), e);
+                    throw new ELException(MessageFactory.get("error.convert", 
obj, obj.getClass(), type), e);
                 }
             }
         }
 
         // Handle special case because the syntax for the empty set is the same
         // for an empty map. The parser will always parse {} as an empty set.
-        if (obj instanceof Set && type == Map.class &&
-                ((Set<?>) obj).isEmpty()) {
+        if (obj instanceof Set && type == Map.class && ((Set<?>) 
obj).isEmpty()) {
             @SuppressWarnings("unchecked")
             T result = (T) Collections.EMPTY_MAP;
             return result;
@@ -596,12 +576,10 @@ public class ELSupport {
             return result;
         }
 
-        throw new ELException(MessageFactory.get("error.convert",
-                obj, obj.getClass(), type));
+        throw new ELException(MessageFactory.get("error.convert", obj, 
obj.getClass(), type));
     }
 
-    private static Object coerceToArray(final ELContext ctx, final Object obj,
-            final Class<?> type) {
+    private static Object coerceToArray(final ELContext ctx, final Object obj, 
final Class<?> type) {
         // Note: Nested arrays will result in nested calls to this method.
 
         // Note: Calling method has checked the obj is an array.
@@ -627,52 +605,40 @@ public class ELSupport {
         Supplier<T> proxy = () -> {
             // Create a dynamic proxy for the functional interface
             @SuppressWarnings("unchecked")
-            T result = (T) Proxy.newProxyInstance(type.getClassLoader(), new 
Class[]{type},
-                (Object obj, Method method, Object[] args) -> {
-                    // Functional interfaces have a single, abstract method
-                    if (!Modifier.isAbstract(method.getModifiers())) {
-                        throw new 
ELException(MessageFactory.get("elSupport.coerce.nonAbstract", type, method));
-                    }
-                    if (ctx == null) {
-                        return lambdaExpression.invoke(args);
-                    } else {
-                        return lambdaExpression.invoke(ctx, args);
-                    }
-                });
+            T result = (T) Proxy.newProxyInstance(type.getClassLoader(), new 
Class[] { type },
+                    (Object obj, Method method, Object[] args) -> {
+                        // Functional interfaces have a single, abstract method
+                        if (!Modifier.isAbstract(method.getModifiers())) {
+                            throw new 
ELException(MessageFactory.get("elSupport.coerce.nonAbstract", type, method));
+                        }
+                        if (ctx == null) {
+                            return lambdaExpression.invoke(args);
+                        } else {
+                            return lambdaExpression.invoke(ctx, args);
+                        }
+                    });
             return result;
         };
         return proxy.get();
     }
 
 
-    public static final boolean isBigDecimalOp(final Object obj0,
-            final Object obj1) {
+    public static final boolean isBigDecimalOp(final Object obj0, final Object 
obj1) {
         return (obj0 instanceof BigDecimal || obj1 instanceof BigDecimal);
     }
 
-    public static final boolean isBigIntegerOp(final Object obj0,
-            final Object obj1) {
+    public static final boolean isBigIntegerOp(final Object obj0, final Object 
obj1) {
         return (obj0 instanceof BigInteger || obj1 instanceof BigInteger);
     }
 
     public static final boolean isDoubleOp(final Object obj0, final Object 
obj1) {
-        return (obj0 instanceof Double
-                || obj1 instanceof Double
-                || obj0 instanceof Float
-                || obj1 instanceof Float);
+        return (obj0 instanceof Double || obj1 instanceof Double || obj0 
instanceof Float || obj1 instanceof Float);
     }
 
     public static final boolean isLongOp(final Object obj0, final Object obj1) 
{
-        return (obj0 instanceof Long
-                || obj1 instanceof Long
-                || obj0 instanceof Integer
-                || obj1 instanceof Integer
-                || obj0 instanceof Character
-                || obj1 instanceof Character
-                || obj0 instanceof Short
-                || obj1 instanceof Short
-                || obj0 instanceof Byte
-                || obj1 instanceof Byte);
+        return (obj0 instanceof Long || obj1 instanceof Long || obj0 
instanceof Integer || obj1 instanceof Integer ||
+                obj0 instanceof Character || obj1 instanceof Character || obj0 
instanceof Short ||
+                obj1 instanceof Short || obj0 instanceof Byte || obj1 
instanceof Byte);
     }
 
     public static final boolean isStringFloat(final String str) {
@@ -680,12 +646,12 @@ public class ELSupport {
         if (len > 1) {
             for (int i = 0; i < len; i++) {
                 switch (str.charAt(i)) {
-                case 'E':
-                    return true;
-                case 'e':
-                    return true;
-                case '.':
-                    return true;
+                    case 'E':
+                        return true;
+                    case 'e':
+                        return true;
+                    case '.':
+                        return true;
                 }
             }
         }
diff --git a/java/org/apache/el/lang/EvaluationContext.java 
b/java/org/apache/el/lang/EvaluationContext.java
index 1c354b2965..79b26c5c2d 100644
--- a/java/org/apache/el/lang/EvaluationContext.java
+++ b/java/org/apache/el/lang/EvaluationContext.java
@@ -39,8 +39,7 @@ public final class EvaluationContext extends ELContext {
 
     private LambdaExpressionNestedState lambdaExpressionNestedState;
 
-    public EvaluationContext(ELContext elContext, FunctionMapper fnMapper,
-            VariableMapper varMapper) {
+    public EvaluationContext(ELContext elContext, FunctionMapper fnMapper, 
VariableMapper varMapper) {
         this.elContext = elContext;
         this.fnMapper = fnMapper;
         this.varMapper = varMapper;
@@ -88,7 +87,7 @@ public final class EvaluationContext extends ELContext {
     @Override
     public Locale getLocale() {
         return elContext.getLocale();
-        }
+    }
 
     @Override
     public void setLocale(Locale locale) {
@@ -141,7 +140,7 @@ public final class EvaluationContext extends ELContext {
     }
 
     @Override
-    public void enterLambdaScope(Map<String, Object> arguments) {
+    public void enterLambdaScope(Map<String,Object> arguments) {
         elContext.enterLambdaScope(arguments);
     }
 
@@ -178,10 +177,10 @@ public final class EvaluationContext extends ELContext {
 
 
     public void setLambdaExpressionNestedState(LambdaExpressionNestedState 
lambdaExpressionNestedState) {
-      if (this.lambdaExpressionNestedState != null) {
-          // Should never happen
-          throw new 
IllegalStateException(MessageFactory.get("error.lambda.wrongNestedState"));
-      }
+        if (this.lambdaExpressionNestedState != null) {
+            // Should never happen
+            throw new 
IllegalStateException(MessageFactory.get("error.lambda.wrongNestedState"));
+        }
 
         this.lambdaExpressionNestedState = lambdaExpressionNestedState;
     }
diff --git a/java/org/apache/el/lang/ExpressionBuilder.java 
b/java/org/apache/el/lang/ExpressionBuilder.java
index ec527b8f40..11f208652f 100644
--- a/java/org/apache/el/lang/ExpressionBuilder.java
+++ b/java/org/apache/el/lang/ExpressionBuilder.java
@@ -50,16 +50,14 @@ public final class ExpressionBuilder implements NodeVisitor 
{
     private static final SynchronizedStack<ELParser> parserCache = new 
SynchronizedStack<>();
 
     private static final int CACHE_SIZE;
-    private static final String CACHE_SIZE_PROP =
-        "org.apache.el.ExpressionBuilder.CACHE_SIZE";
+    private static final String CACHE_SIZE_PROP = 
"org.apache.el.ExpressionBuilder.CACHE_SIZE";
 
     static {
         String cacheSizeStr = System.getProperty(CACHE_SIZE_PROP, "5000");
         CACHE_SIZE = Integer.parseInt(cacheSizeStr);
     }
 
-    private static final ConcurrentCache<String, Node> expressionCache =
-            new ConcurrentCache<>(CACHE_SIZE);
+    private static final ConcurrentCache<String,Node> expressionCache = new 
ConcurrentCache<>(CACHE_SIZE);
 
     private FunctionMapper fnMapper;
 
@@ -67,8 +65,7 @@ public final class ExpressionBuilder implements NodeVisitor {
 
     private final String expression;
 
-    public ExpressionBuilder(String expression, ELContext ctx)
-            throws ELException {
+    public ExpressionBuilder(String expression, ELContext ctx) throws 
ELException {
         this.expression = expression;
 
         FunctionMapper ctxFn = ctx.getFunctionMapper();
@@ -87,8 +84,7 @@ public final class ExpressionBuilder implements NodeVisitor {
         return n;
     }
 
-    private static Node createNodeInternal(String expr)
-            throws ELException {
+    private static Node createNodeInternal(String expr) throws ELException {
         if (expr == null) {
             throw new ELException(MessageFactory.get("error.null"));
         }
@@ -120,22 +116,19 @@ public final class ExpressionBuilder implements 
NodeVisitor {
                             type = child.getClass();
                         } else {
                             if (!type.equals(child.getClass())) {
-                                throw new ELException(MessageFactory.get(
-                                        "error.mixed", expr));
+                                throw new 
ELException(MessageFactory.get("error.mixed", expr));
                             }
                         }
                     }
                 }
 
-                if (n instanceof AstDeferredExpression
-                        || n instanceof AstDynamicExpression) {
+                if (n instanceof AstDeferredExpression || n instanceof 
AstDynamicExpression) {
                     n = n.jjtGetChild(0);
                 }
                 expressionCache.put(expr, n);
             } catch (Throwable t) {
                 ExceptionUtils.handleThrowable(t);
-                throw new ELException(
-                        MessageFactory.get("error.parseFail", expr), t);
+                throw new ELException(MessageFactory.get("error.parseFail", 
expr), t);
             } finally {
                 if (parser != null) {
                     parserCache.push(parser);
@@ -166,8 +159,7 @@ public final class ExpressionBuilder implements NodeVisitor 
{
     private Node build() throws ELException {
         Node n = createNodeInternal(this.expression);
         this.prepare(n);
-        if (n instanceof AstDeferredExpression
-                || n instanceof AstDynamicExpression) {
+        if (n instanceof AstDeferredExpression || n instanceof 
AstDynamicExpression) {
             n = n.jjtGetChild(0);
         }
         return n;
@@ -182,15 +174,13 @@ public final class ExpressionBuilder implements 
NodeVisitor {
             Method m = null;
 
             if (this.fnMapper != null) {
-                m = fnMapper.resolveFunction(funcNode.getPrefix(), funcNode
-                        .getLocalName());
+                m = fnMapper.resolveFunction(funcNode.getPrefix(), 
funcNode.getLocalName());
             }
 
             // References to variables that refer to lambda expressions will be
             // parsed as functions. This is handled at runtime but at this 
point
             // need to treat it as a variable rather than a function.
-            if (m == null && this.varMapper != null &&
-                    funcNode.getPrefix().length() == 0) {
+            if (m == null && this.varMapper != null && 
funcNode.getPrefix().length() == 0) {
                 this.varMapper.resolveVariable(funcNode.getLocalName());
                 return;
             }
@@ -200,8 +190,7 @@ public final class ExpressionBuilder implements NodeVisitor 
{
             }
 
             if (m == null) {
-                throw new ELException(MessageFactory.get(
-                        "error.fnMapper.method", funcNode.getOutputName()));
+                throw new 
ELException(MessageFactory.get("error.fnMapper.method", 
funcNode.getOutputName()));
             }
 
             int methodParameterCount = m.getParameterTypes().length;
@@ -209,8 +198,7 @@ public final class ExpressionBuilder implements NodeVisitor 
{
             int inputParameterCount = node.jjtGetChild(0).jjtGetNumChildren();
             if (m.isVarArgs() && inputParameterCount < methodParameterCount - 
1 ||
                     !m.isVarArgs() && inputParameterCount != 
methodParameterCount) {
-                throw new ELException(MessageFactory.get(
-                        "error.fnMapper.paramcount", funcNode.getOutputName(),
+                throw new 
ELException(MessageFactory.get("error.fnMapper.paramcount", 
funcNode.getOutputName(),
                         "" + methodParameterCount, "" + 
node.jjtGetChild(0).jjtGetNumChildren()));
             }
         } else if (node instanceof AstIdentifier && this.varMapper != null) {
@@ -221,35 +209,30 @@ public final class ExpressionBuilder implements 
NodeVisitor {
         }
     }
 
-    public ValueExpression createValueExpression(Class<?> expectedType)
-            throws ELException {
+    public ValueExpression createValueExpression(Class<?> expectedType) throws 
ELException {
         Node n = this.build();
-        return new ValueExpressionImpl(this.expression, n, this.fnMapper,
-                this.varMapper, expectedType);
+        return new ValueExpressionImpl(this.expression, n, this.fnMapper, 
this.varMapper, expectedType);
     }
 
-    public MethodExpression createMethodExpression(Class<?> expectedReturnType,
-            Class<?>[] expectedParamTypes) throws ELException {
+    public MethodExpression createMethodExpression(Class<?> 
expectedReturnType, Class<?>[] expectedParamTypes)
+            throws ELException {
         Node n = this.build();
         if (!n.isParametersProvided() && expectedParamTypes == null) {
-            throw new NullPointerException(MessageFactory
-                    .get("error.method.nullParms"));
+            throw new 
NullPointerException(MessageFactory.get("error.method.nullParms"));
         }
         if (n instanceof AstValue || n instanceof AstIdentifier) {
-            return new MethodExpressionImpl(expression, n, this.fnMapper,
-                    this.varMapper, expectedReturnType, expectedParamTypes);
-        } else if (n instanceof AstLiteralExpression) {
-            return new MethodExpressionLiteral(expression, expectedReturnType,
+            return new MethodExpressionImpl(expression, n, this.fnMapper, 
this.varMapper, expectedReturnType,
                     expectedParamTypes);
+        } else if (n instanceof AstLiteralExpression) {
+            return new MethodExpressionLiteral(expression, expectedReturnType, 
expectedParamTypes);
         } else {
             throw new 
ELException(MessageFactory.get("error.invalidMethodExpression", expression));
         }
     }
 
     /*
-     * Copied from org.apache.tomcat.util.collections.SynchronizedStack since
-     * we don't want the EL implementation to depend on the JAR where that
-     * class resides.
+     * Copied from org.apache.tomcat.util.collections.SynchronizedStack since 
we don't want the EL implementation to
+     * depend on the JAR where that class resides.
      */
     private static class SynchronizedStack<T> {
 
diff --git a/java/org/apache/el/lang/FunctionMapperImpl.java 
b/java/org/apache/el/lang/FunctionMapperImpl.java
index 23460c160c..ba35e56b4b 100644
--- a/java/org/apache/el/lang/FunctionMapperImpl.java
+++ b/java/org/apache/el/lang/FunctionMapperImpl.java
@@ -33,12 +33,11 @@ import org.apache.el.util.ReflectionUtil;
 /**
  * @author Jacob Hookom [ja...@hookom.net]
  */
-public class FunctionMapperImpl extends FunctionMapper implements
-        Externalizable {
+public class FunctionMapperImpl extends FunctionMapper implements 
Externalizable {
 
     private static final long serialVersionUID = 1L;
 
-    protected ConcurrentMap<String, Function> functions = new 
ConcurrentHashMap<>();
+    protected ConcurrentMap<String,Function> functions = new 
ConcurrentHashMap<>();
 
     @Override
     public Method resolveFunction(String prefix, String localName) {
@@ -67,9 +66,8 @@ public class FunctionMapperImpl extends FunctionMapper 
implements
 
     @SuppressWarnings("unchecked")
     @Override
-    public void readExternal(ObjectInput in) throws IOException,
-            ClassNotFoundException {
-        this.functions = (ConcurrentMap<String, Function>) in.readObject();
+    public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
+        this.functions = (ConcurrentMap<String,Function>) in.readObject();
     }
 
     public static class Function implements Externalizable {
@@ -113,8 +111,7 @@ public class FunctionMapperImpl extends FunctionMapper 
implements
         }
 
         @Override
-        public void readExternal(ObjectInput in) throws IOException,
-                ClassNotFoundException {
+        public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
 
             this.prefix = in.readUTF();
             if (this.prefix.isEmpty()) {
diff --git a/java/org/apache/el/lang/LambdaExpressionNestedState.java 
b/java/org/apache/el/lang/LambdaExpressionNestedState.java
index f4a4d47c70..ebadaa472f 100644
--- a/java/org/apache/el/lang/LambdaExpressionNestedState.java
+++ b/java/org/apache/el/lang/LambdaExpressionNestedState.java
@@ -17,16 +17,13 @@
 package org.apache.el.lang;
 
 /**
- * Stores the state required for correct evaluation of lambda expressions.
- * Lambda expressions may be nested. Correct evaluation requires knowledge not
- * just of the current lambda expression, but also of any nested and nesting
+ * Stores the state required for correct evaluation of lambda expressions. 
Lambda expressions may be nested. Correct
+ * evaluation requires knowledge not just of the current lambda expression, 
but also of any nested and nesting
  * expressions.
  * <p>
- * The sets of nodes for parsed expressions are cached and, as a result, a set
- * of nodes may be being used by multiple concurrent threads. This means any
- * state relating to evaluation cannot be stored in the nodes. State is
- * therefore stored in the {@link EvaluationContext} which is created, used for
- * a single evaluation and then discarded.
+ * The sets of nodes for parsed expressions are cached and, as a result, a set 
of nodes may be being used by multiple
+ * concurrent threads. This means any state relating to evaluation cannot be 
stored in the nodes. State is therefore
+ * stored in the {@link EvaluationContext} which is created, used for a single 
evaluation and then discarded.
  */
 public final class LambdaExpressionNestedState {
 
diff --git a/java/org/apache/el/lang/VariableMapperImpl.java 
b/java/org/apache/el/lang/VariableMapperImpl.java
index 01dbb4a021..f20d1a8955 100644
--- a/java/org/apache/el/lang/VariableMapperImpl.java
+++ b/java/org/apache/el/lang/VariableMapperImpl.java
@@ -30,7 +30,7 @@ public class VariableMapperImpl extends VariableMapper 
implements Externalizable
 
     private static final long serialVersionUID = 1L;
 
-    private Map<String, ValueExpression> vars = new HashMap<>();
+    private Map<String,ValueExpression> vars = new HashMap<>();
 
     public VariableMapperImpl() {
         super();
@@ -42,8 +42,7 @@ public class VariableMapperImpl extends VariableMapper 
implements Externalizable
     }
 
     @Override
-    public ValueExpression setVariable(String variable,
-            ValueExpression expression) {
+    public ValueExpression setVariable(String variable, ValueExpression 
expression) {
         if (expression == null) {
             return vars.remove(variable);
         } else {
@@ -53,9 +52,8 @@ public class VariableMapperImpl extends VariableMapper 
implements Externalizable
 
     @SuppressWarnings("unchecked")
     @Override
-    public void readExternal(ObjectInput in) throws IOException,
-            ClassNotFoundException {
-        this.vars = (Map<String, ValueExpression>) in.readObject();
+    public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
+        this.vars = (Map<String,ValueExpression>) in.readObject();
     }
 
     @Override


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org


Reply via email to