This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 16af3080f7 Cleanups
16af3080f7 is described below

commit 16af3080f786203eab322f48a4d5e3aa6781532a
Author: remm <r...@apache.org>
AuthorDate: Wed Mar 19 00:10:54 2025 +0100

    Cleanups
---
 java/org/apache/el/lang/ELArithmetic.java          |  14 +--
 java/org/apache/el/lang/ELSupport.java             |  26 ++---
 java/org/apache/el/lang/ExpressionBuilder.java     |   7 +-
 java/org/apache/el/parser/AstAbstractEmpty.java    |   2 +-
 .../apache/el/parser/AstCompositeExpression.java   |   2 +-
 java/org/apache/el/parser/AstFunction.java         |  10 +-
 java/org/apache/el/parser/AstValue.java            |  20 ++--
 java/org/apache/el/parser/SimpleNode.java          |   9 +-
 java/org/apache/el/stream/Stream.java              |   5 +-
 java/org/apache/el/util/ReflectionUtil.java        |   2 +-
 java/org/apache/el/util/Validation.java            |  10 +-
 java/org/apache/jasper/EmbeddedServletOptions.java |   4 +-
 java/org/apache/jasper/JspC.java                   |  29 ++----
 java/org/apache/jasper/JspCompilationContext.java  |  12 +--
 java/org/apache/jasper/compiler/AntCompiler.java   |  22 ++--
 .../org/apache/jasper/compiler/BeanRepository.java |   2 +-
 java/org/apache/jasper/compiler/Compiler.java      |   6 +-
 .../jasper/compiler/DefaultErrorHandler.java       |   2 +-
 .../apache/jasper/compiler/ELFunctionMapper.java   |  23 +++--
 java/org/apache/jasper/compiler/ELNode.java        |   2 +-
 java/org/apache/jasper/compiler/ELParser.java      |  16 +--
 .../apache/jasper/compiler/ErrorDispatcher.java    |   6 +-
 java/org/apache/jasper/compiler/Generator.java     | 111 ++++++++++-----------
 .../jasper/compiler/ImplicitTagLibraryInfo.java    |   2 +-
 java/org/apache/jasper/compiler/JspConfig.java     |   6 +-
 .../apache/jasper/compiler/JspDocumentParser.java  |  16 +--
 java/org/apache/jasper/compiler/JspReader.java     |   8 +-
 .../apache/jasper/compiler/JspRuntimeContext.java  |   6 +-
 java/org/apache/jasper/compiler/JspUtil.java       |  55 +++++-----
 java/org/apache/jasper/compiler/Localizer.java     |   1 +
 java/org/apache/jasper/compiler/Node.java          |  16 +--
 java/org/apache/jasper/compiler/PageDataImpl.java  |   9 +-
 java/org/apache/jasper/compiler/PageInfo.java      |   4 +-
 java/org/apache/jasper/compiler/Parser.java        |  14 +--
 .../apache/jasper/compiler/ParserController.java   |  22 ++--
 .../apache/jasper/compiler/ScriptingVariabler.java |   2 +-
 java/org/apache/jasper/compiler/SmapStratum.java   |  16 +--
 java/org/apache/jasper/compiler/SmapUtil.java      |   8 +-
 .../apache/jasper/compiler/TagFileProcessor.java   |  44 ++++----
 .../apache/jasper/compiler/TagLibraryInfoImpl.java |   4 +-
 java/org/apache/jasper/compiler/TldCache.java      |   4 +-
 java/org/apache/jasper/compiler/Validator.java     |  18 ++--
 java/org/apache/jasper/el/JasperELResolver.java    |  18 ++--
 .../org/apache/jasper/runtime/BodyContentImpl.java |   2 +-
 .../jasper/runtime/JspApplicationContextImpl.java  |   4 +-
 .../apache/jasper/runtime/JspRuntimeLibrary.java   |  80 +++++++--------
 java/org/apache/jasper/runtime/JspWriterImpl.java  |  15 ++-
 .../org/apache/jasper/runtime/PageContextImpl.java |  15 ++-
 .../runtime/ServletResponseWrapperInclude.java     |   1 +
 java/org/apache/jasper/runtime/TagHandlerPool.java |   3 +-
 java/org/apache/jasper/servlet/JasperLoader.java   |   2 +-
 .../apache/jasper/servlet/JspCServletContext.java  |   8 +-
 java/org/apache/jasper/servlet/JspServlet.java     |   6 +-
 .../apache/jasper/servlet/JspServletWrapper.java   |  12 +--
 java/org/apache/jasper/servlet/TldScanner.java     |   1 -
 java/org/apache/jasper/tagplugins/jstl/Util.java   |   2 +-
 .../jasper/tagplugins/jstl/core/ForEach.java       |   2 +-
 .../apache/jasper/tagplugins/jstl/core/Out.java    |   5 +-
 .../apache/jasper/tagplugins/jstl/core/Set.java    |  13 +--
 59 files changed, 367 insertions(+), 419 deletions(-)

diff --git a/java/org/apache/el/lang/ELArithmetic.java 
b/java/org/apache/el/lang/ELArithmetic.java
index 9cf2c9cde7..47fa9c9ab5 100644
--- a/java/org/apache/el/lang/ELArithmetic.java
+++ b/java/org/apache/el/lang/ELArithmetic.java
@@ -252,7 +252,7 @@ public abstract class ELArithmetic {
 
     private static final Long ZERO = Long.valueOf(0);
 
-    public static final Number add(final Object obj0, final Object obj1) {
+    public static Number add(final Object obj0, final Object obj1) {
         final ELArithmetic delegate = findDelegate(obj0, obj1);
         if (delegate == null) {
             return Long.valueOf(0);
@@ -264,7 +264,7 @@ public abstract class ELArithmetic {
         return delegate.add(num0, num1);
     }
 
-    public static final Number mod(final Object obj0, final Object obj1) {
+    public static Number mod(final Object obj0, final Object obj1) {
         if (obj0 == null && obj1 == null) {
             return Long.valueOf(0);
         }
@@ -286,7 +286,7 @@ public abstract class ELArithmetic {
         return delegate.mod(num0, num1);
     }
 
-    public static final Number subtract(final Object obj0, final Object obj1) {
+    public static Number subtract(final Object obj0, final Object obj1) {
         final ELArithmetic delegate = findDelegate(obj0, obj1);
         if (delegate == null) {
             return Long.valueOf(0);
@@ -298,7 +298,7 @@ public abstract class ELArithmetic {
         return delegate.subtract(num0, num1);
     }
 
-    public static final Number divide(final Object obj0, final Object obj1) {
+    public static Number divide(final Object obj0, final Object obj1) {
         if (obj0 == null && obj1 == null) {
             return ZERO;
         }
@@ -318,7 +318,7 @@ public abstract class ELArithmetic {
         return delegate.divide(num0, num1);
     }
 
-    public static final Number multiply(final Object obj0, final Object obj1) {
+    public static Number multiply(final Object obj0, final Object obj1) {
         final ELArithmetic delegate = findDelegate(obj0, obj1);
         if (delegate == null) {
             return Long.valueOf(0);
@@ -350,11 +350,11 @@ public abstract class ELArithmetic {
         }
     }
 
-    public static final boolean isNumber(final Object obj) {
+    public static boolean isNumber(final Object obj) {
         return (obj != null && isNumberType(obj.getClass()));
     }
 
-    public static final boolean isNumberType(final Class<?> type) {
+    public static 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);
     }
diff --git a/java/org/apache/el/lang/ELSupport.java 
b/java/org/apache/el/lang/ELSupport.java
index d16d33b376..61167eb527 100644
--- a/java/org/apache/el/lang/ELSupport.java
+++ b/java/org/apache/el/lang/ELSupport.java
@@ -88,7 +88,7 @@ public class ELSupport {
      * @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 int compare(final ELContext ctx, final Object obj0, final 
Object obj1) throws ELException {
         if (obj0 == obj1 || equals(ctx, obj0, obj1)) {
             return 0;
         }
@@ -149,7 +149,7 @@ public class ELSupport {
      *
      * @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 boolean equals(final ELContext ctx, final Object obj0, final 
Object obj1) throws ELException {
         if (obj0 == obj1) {
             return true;
         } else if (obj0 == null || obj1 == null) {
@@ -178,7 +178,7 @@ public class ELSupport {
             return obj1.equals(coerceToEnum(ctx, obj0, obj1.getClass()));
         } else if (obj0 instanceof String || obj1 instanceof String) {
             int lexCompare = coerceToString(ctx, 
obj0).compareTo(coerceToString(ctx, obj1));
-            return (lexCompare == 0) ? true : false;
+            return lexCompare == 0;
         } else {
             return obj0.equals(obj1);
         }
@@ -189,7 +189,7 @@ public class ELSupport {
      * be a neater / better solution but I couldn't find it.
      */
     @SuppressWarnings("unchecked")
-    public static final Enum<?> coerceToEnum(final ELContext ctx, final Object 
obj,
+    public static Enum<?> coerceToEnum(final ELContext ctx, final Object obj,
             @SuppressWarnings("rawtypes") Class type) {
 
         if (ctx != null) {
@@ -235,7 +235,7 @@ public class ELSupport {
      *
      * @throws ELException if object is not Boolean or String
      */
-    public static final Boolean coerceToBoolean(final ELContext ctx, final 
Object obj, boolean primitive)
+    public static Boolean coerceToBoolean(final ELContext ctx, final Object 
obj, boolean primitive)
             throws ELException {
 
         if (ctx != null) {
@@ -300,7 +300,7 @@ public class ELSupport {
         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 Number coerceToNumber(final Number number, final Class<?> 
type) throws ELException {
         if (Long.TYPE == type || Long.class.equals(type)) {
             return Long.valueOf(number.longValue());
         }
@@ -344,7 +344,7 @@ public class ELSupport {
         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)
+    public static Number coerceToNumber(final ELContext ctx, final Object obj, 
final Class<?> type)
             throws ELException {
 
         if (ctx != null) {
@@ -382,7 +382,7 @@ public class ELSupport {
         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 Number coerceToNumber(final String val, final Class<?> 
type) throws ELException {
         if (Long.TYPE == type || Long.class.equals(type)) {
             try {
                 return Long.valueOf(val);
@@ -451,7 +451,7 @@ public class ELSupport {
      *
      * @return the String value of the object
      */
-    public static final String coerceToString(final ELContext ctx, final 
Object obj) {
+    public static String coerceToString(final ELContext ctx, final Object obj) 
{
 
         if (ctx != null) {
             boolean originalIsPropertyResolved = ctx.isPropertyResolved();
@@ -588,21 +588,21 @@ public class ELSupport {
         return (obj0 instanceof BigDecimal || obj1 instanceof BigDecimal);
     }
 
-    public static final boolean isBigIntegerOp(final Object obj0, final Object 
obj1) {
+    public static 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) {
+    public static boolean isDoubleOp(final Object obj0, final Object obj1) {
         return (obj0 instanceof Double || obj1 instanceof Double || obj0 
instanceof Float || obj1 instanceof Float);
     }
 
-    public static final boolean isLongOp(final Object obj0, final Object obj1) 
{
+    public static 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);
     }
 
-    public static final boolean isStringFloat(final String str) {
+    public static boolean isStringFloat(final String str) {
         int len = str.length();
         if (len > 1) {
             for (int i = 0; i < len; i++) {
diff --git a/java/org/apache/el/lang/ExpressionBuilder.java 
b/java/org/apache/el/lang/ExpressionBuilder.java
index f9eb10be72..45a5ae5d5e 100644
--- a/java/org/apache/el/lang/ExpressionBuilder.java
+++ b/java/org/apache/el/lang/ExpressionBuilder.java
@@ -88,8 +88,7 @@ public final class ExpressionBuilder implements NodeVisitor {
     }
 
     public static Node createNode(String expr) throws ELException {
-        Node n = createNodeInternal(expr);
-        return n;
+        return createNodeInternal(expr);
     }
 
     private static Node createNodeInternal(String expr) throws ELException {
@@ -114,7 +113,7 @@ public final class ExpressionBuilder implements NodeVisitor 
{
                     n = n.jjtGetChild(0);
                 } else {
                     Class<?> type = null;
-                    Node child = null;
+                    Node child;
                     for (int i = 0; i < numChildren; i++) {
                         child = n.jjtGetChild(i);
                         if (child instanceof AstLiteralExpression) {
@@ -188,7 +187,7 @@ public final class ExpressionBuilder implements NodeVisitor 
{
             // 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().isEmpty()) {
                 this.varMapper.resolveVariable(funcNode.getLocalName());
                 return;
             }
diff --git a/java/org/apache/el/parser/AstAbstractEmpty.java 
b/java/org/apache/el/parser/AstAbstractEmpty.java
index 844d183291..d2a5c7c73a 100644
--- a/java/org/apache/el/parser/AstAbstractEmpty.java
+++ b/java/org/apache/el/parser/AstAbstractEmpty.java
@@ -49,7 +49,7 @@ public abstract class AstAbstractEmpty extends SimpleNode {
     @Override
     public Object getValue(EvaluationContext ctx) throws ELException {
         Object obj = this.children[0].getValue(ctx);
-        if (obj == null || obj instanceof String && ((String) obj).length() == 
0 ||
+        if (obj == null || obj instanceof String && ((String) obj).isEmpty() ||
                 obj instanceof Object[] && ((Object[]) obj).length == 0 ||
                 obj instanceof Collection<?> && ((Collection<?>) 
obj).isEmpty() ||
                 obj instanceof Map<?,?> && ((Map<?,?>) obj).isEmpty()) {
diff --git a/java/org/apache/el/parser/AstCompositeExpression.java 
b/java/org/apache/el/parser/AstCompositeExpression.java
index 604013698f..ea8484740e 100644
--- a/java/org/apache/el/parser/AstCompositeExpression.java
+++ b/java/org/apache/el/parser/AstCompositeExpression.java
@@ -41,8 +41,8 @@ public final class AstCompositeExpression extends SimpleNode {
     @Override
     public Object getValue(EvaluationContext ctx) throws ELException {
         StringBuilder sb = new StringBuilder(16);
-        Object obj = null;
         if (this.children != null) {
+            Object obj;
             for (Node child : this.children) {
                 obj = child.getValue(ctx);
                 if (obj != null) {
diff --git a/java/org/apache/el/parser/AstFunction.java 
b/java/org/apache/el/parser/AstFunction.java
index 08eb45d593..995075934c 100644
--- a/java/org/apache/el/parser/AstFunction.java
+++ b/java/org/apache/el/parser/AstFunction.java
@@ -35,9 +35,9 @@ import org.apache.el.util.MessageFactory;
  */
 public final class AstFunction extends SimpleNode {
 
-    protected String localName = "";
+    private String localName = "";
 
-    protected String prefix = "";
+    private String prefix = "";
 
 
     public AstFunction(int id) {
@@ -92,7 +92,7 @@ public final class AstFunction extends SimpleNode {
         }
         Method m = fnMapper.resolveFunction(this.prefix, this.localName);
 
-        if (m == null && this.prefix.length() == 0) {
+        if (m == null && this.prefix.isEmpty()) {
             // TODO: Do we need to think about precedence of the various ways
             // a lambda expression may be obtained from something that
             // the parser thinks is a function?
@@ -104,7 +104,7 @@ public final class AstFunction extends SimpleNode {
                 VariableMapper varMapper = ctx.getVariableMapper();
                 if (varMapper != null) {
                     obj = varMapper.resolveVariable(this.localName);
-                    if (obj instanceof ValueExpression) {
+                    if (obj != null) {
                         // See if this returns a LambdaExpression
                         obj = ((ValueExpression) obj).getValue(ctx);
                     }
@@ -155,7 +155,6 @@ public final class AstFunction extends SimpleNode {
         Node parameters = jjtGetChild(0);
         Class<?>[] paramTypes = m.getParameterTypes();
         Object[] params = null;
-        Object result = null;
         int inputParameterCount = parameters.jjtGetNumChildren();
         int methodParameterCount = paramTypes.length;
         if (inputParameterCount == 0 && methodParameterCount == 1 && 
m.isVarArgs()) {
@@ -188,6 +187,7 @@ public final class AstFunction extends SimpleNode {
                 throw new ELException(MessageFactory.get("error.function", 
this.getOutputName()), ele);
             }
         }
+        Object result;
         try {
             result = m.invoke(null, params);
         } catch (IllegalAccessException iae) {
diff --git a/java/org/apache/el/parser/AstValue.java 
b/java/org/apache/el/parser/AstValue.java
index cb58b4034e..66e16a4112 100644
--- a/java/org/apache/el/parser/AstValue.java
+++ b/java/org/apache/el/parser/AstValue.java
@@ -200,7 +200,7 @@ public final class AstValue extends SimpleNode {
     public MethodInfo getMethodInfo(EvaluationContext ctx, 
@SuppressWarnings("rawtypes") Class[] paramTypes)
             throws ELException {
         Target t = getTarget(ctx);
-        Class<?>[] types = null;
+        Class<?>[] types;
         if (isParametersProvided()) {
             Object[] values = ((AstMethodParameters) 
this.jjtGetChild(this.jjtGetNumChildren() - 1)).getParameters(ctx);
             types = getTypesFromValues(values);
@@ -218,9 +218,9 @@ public final class AstValue extends SimpleNode {
             throws ELException {
 
         Target t = getTarget(ctx);
-        Method m = null;
-        Object[] values = null;
-        Class<?>[] types = null;
+        Method m;
+        Object[] values;
+        Class<?>[] types;
         if (isParametersProvided()) {
             values = ((AstMethodParameters) 
this.jjtGetChild(this.jjtGetNumChildren() - 1)).getParameters(ctx);
             types = getTypesFromValues(values);
@@ -233,7 +233,7 @@ public final class AstValue extends SimpleNode {
         // Handle varArgs and any coercion required
         values = convertArgs(ctx, values, m);
 
-        Object result = null;
+        Object result;
         try {
             result = m.invoke(t.base, values);
         } catch (IllegalAccessException | IllegalArgumentException e) {
@@ -261,8 +261,8 @@ 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)) {
+        if (m.isVarArgs() && paramCount > 1 && (src == null || paramCount > 
src.length) || !m.isVarArgs() &&
+            (src == null || src.length != paramCount)) {
             String srcCount = null;
             if (src != null) {
                 srcCount = Integer.toString(src.length);
@@ -311,7 +311,7 @@ public final class AstValue extends SimpleNode {
             return null;
         }
 
-        Class<?> result[] = new Class<?>[values.length];
+        Class<?>[] result = new Class<?>[values.length];
         for (int i = 0; i < values.length; i++) {
             if (values[i] == null) {
                 result[i] = null;
@@ -347,9 +347,7 @@ public final class AstValue extends SimpleNode {
         // child
         int len = children.length;
         if (len > 2) {
-            if (this.jjtGetChild(len - 1) instanceof AstMethodParameters) {
-                return true;
-            }
+            return this.jjtGetChild(len - 1) instanceof AstMethodParameters;
         }
         return false;
     }
diff --git a/java/org/apache/el/parser/SimpleNode.java 
b/java/org/apache/el/parser/SimpleNode.java
index c07e9a66c7..15ae91addd 100644
--- a/java/org/apache/el/parser/SimpleNode.java
+++ b/java/org/apache/el/parser/SimpleNode.java
@@ -81,7 +81,7 @@ public abstract class SimpleNode extends ELSupport implements 
Node {
         if (children == null) {
             children = new SimpleNode[i + 1];
         } else if (i >= children.length) {
-            SimpleNode c[] = new SimpleNode[i + 1];
+            SimpleNode[] c = new SimpleNode[i + 1];
             System.arraycopy(children, 0, c, 0, children.length);
             children = c;
         }
@@ -154,7 +154,7 @@ public abstract class SimpleNode extends ELSupport 
implements Node {
     @Override
     public void accept(NodeVisitor visitor) throws Exception {
         visitor.visit(this);
-        if (this.children != null && this.children.length > 0) {
+        if (this.children != null) {
             for (Node child : this.children) {
                 child.accept(visitor);
             }
@@ -204,10 +204,7 @@ public abstract class SimpleNode extends ELSupport 
implements Node {
         } else if (!image.equals(other.image)) {
             return false;
         }
-        if (!Arrays.equals(children, other.children)) {
-            return false;
-        }
-        return true;
+        return Arrays.equals(children, other.children);
     }
 
 
diff --git a/java/org/apache/el/stream/Stream.java 
b/java/org/apache/el/stream/Stream.java
index 11d0acd329..067d14e7fd 100644
--- a/java/org/apache/el/stream/Stream.java
+++ b/java/org/apache/el/stream/Stream.java
@@ -102,7 +102,7 @@ public class Stream {
     public Stream distinct() {
         Iterator<Object> downStream = new OpIterator() {
 
-            private Set<Object> values = new HashSet<>();
+            private final Set<Object> values = new HashSet<>();
 
             @Override
             protected void findNext() {
@@ -440,8 +440,7 @@ public class Stream {
         Object result = null;
 
         if (iterator.hasNext()) {
-            Object obj = iterator.next();
-            result = obj;
+            result = iterator.next();
         }
 
         while (iterator.hasNext()) {
diff --git a/java/org/apache/el/util/ReflectionUtil.java 
b/java/org/apache/el/util/ReflectionUtil.java
index d92eba762b..baf32a1fef 100644
--- a/java/org/apache/el/util/ReflectionUtil.java
+++ b/java/org/apache/el/util/ReflectionUtil.java
@@ -449,7 +449,7 @@ public class ReflectionUtil {
             return m;
         }
         Class<?>[] interfaces = type.getInterfaces();
-        Method mp = null;
+        Method mp;
         for (Class<?> iface : interfaces) {
             try {
                 mp = iface.getMethod(m.getName(), m.getParameterTypes());
diff --git a/java/org/apache/el/util/Validation.java 
b/java/org/apache/el/util/Validation.java
index ed40dbc570..db05b790e4 100644
--- a/java/org/apache/el/util/Validation.java
+++ b/java/org/apache/el/util/Validation.java
@@ -22,7 +22,7 @@ import java.security.PrivilegedAction;
 public class Validation {
 
     // Java keywords, boolean literals & the null literal in alphabetical order
-    private static final String invalidIdentifiers[] = { "abstract", "assert", 
"boolean", "break", "byte", "case",
+    private static final String[] invalidIdentifiers = { "abstract", "assert", 
"boolean", "break", "byte", "case",
             "catch", "char", "class", "const", "continue", "default", "do", 
"double", "else", "enum", "extends",
             "false", "final", "finally", "float", "for", "goto", "if", 
"implements", "import", "instanceof", "int",
             "interface", "long", "native", "new", "null", "package", 
"private", "protected", "public", "return",
@@ -64,7 +64,7 @@ public class Validation {
         }
 
         // Should not be the case but check to be sure
-        if (key == null || key.length() == 0) {
+        if (key == null || key.isEmpty()) {
             return false;
         }
 
@@ -88,10 +88,6 @@ public class Validation {
          * The parser checks Character.isJavaIdentifierStart() and 
Character.isJavaIdentifierPart() so no need to check
          * them again here. However, we do need to check that '#' hasn't been 
used at the start of the identifier.
          */
-        if (key.charAt(0) == '#') {
-            return false;
-        }
-
-        return true;
+        return key.charAt(0) != '#';
     }
 }
diff --git a/java/org/apache/jasper/EmbeddedServletOptions.java 
b/java/org/apache/jasper/EmbeddedServletOptions.java
index f0ac9fb79c..fa00c6f3e9 100644
--- a/java/org/apache/jasper/EmbeddedServletOptions.java
+++ b/java/org/apache/jasper/EmbeddedServletOptions.java
@@ -45,7 +45,7 @@ public final class EmbeddedServletOptions implements Options {
     // Logger
     private final Log log = LogFactory.getLog(EmbeddedServletOptions.class); 
// must not be static
 
-    private Properties settings = new Properties();
+    private final Properties settings = new Properties();
 
     /**
      * Is Jasper being used in development mode?
@@ -110,7 +110,7 @@ public final class EmbeddedServletOptions implements 
Options {
      * I want to see my generated servlets. Which directory are they
      * in?
      */
-    private File scratchDir;
+    private final File scratchDir;
 
     /**
      * Need to have this as is for versions 4 and 5 of IE. Can be set from
diff --git a/java/org/apache/jasper/JspC.java b/java/org/apache/jasper/JspC.java
index 71f138526a..166ba89399 100644
--- a/java/org/apache/jasper/JspC.java
+++ b/java/org/apache/jasper/JspC.java
@@ -280,9 +280,9 @@ public class JspC extends Task implements Options {
     protected boolean showSuccess = false;
     protected int argPos;
     protected boolean fullstop = false;
-    protected String args[];
+    protected String[] args;
 
-    public static void main(String arg[]) {
+    public static void main(String[] arg) {
         if (arg.length == 0) {
             System.out.println(Localizer.getMessage("jspc.usage"));
         } else {
@@ -373,11 +373,7 @@ public class JspC extends Task implements Options {
                 }
             } else if (tok.equals(SWITCH_CACHE)) {
                 tok = nextArg();
-                if ("false".equals(tok)) {
-                    caching = false;
-                } else {
-                    caching = true;
-                }
+                caching = !"false".equals(tok);
             } else if (tok.equals(SWITCH_CLASSPATH)) {
                 setClassPath(nextArg());
             } else if (tok.startsWith(SWITCH_DIE)) {
@@ -391,11 +387,7 @@ public class JspC extends Task implements Options {
                 helpNeeded = true;
             } else if (tok.equals(SWITCH_POOLING)) {
                 tok = nextArg();
-                if ("false".equals(tok)) {
-                    poolingEnabled = false;
-                } else {
-                    poolingEnabled = true;
-                }
+                poolingEnabled = !"false".equals(tok);
             } else if (tok.equals(SWITCH_ENCODING)) {
                 setJavaEncoding(nextArg());
             } else if (tok.equals(SWITCH_SOURCE)) {
@@ -1189,10 +1181,9 @@ public class JspC extends Task implements Options {
                                 }
                             }
                         }
-                        current = reader.read();
-                        while (current == '\n' || current == '\r') {
+                        do {
                             current = reader.read();
-                        }
+                        } while (current == '\n' || current == '\r');
                         continue;
                     } else {
                         writer.write(element);
@@ -1207,7 +1198,7 @@ public class JspC extends Task implements Options {
         try (FileInputStream fis = new FileInputStream(webXml2);
                 FileOutputStream fos = new FileOutputStream(webXml)) {
 
-            byte buf[] = new byte[512];
+            byte[] buf = new byte[512];
             while (true) {
                 int n = fis.read(buf);
                 if (n < 0) {
@@ -1287,7 +1278,7 @@ public class JspC extends Task implements Options {
                 ( jspUri, this, context, null, rctxt );
 
             /* Override the defaults */
-            if ((targetClassName != null) && (targetClassName.length() > 0)) {
+            if ((targetClassName != null) && (!targetClassName.isEmpty())) {
                 clctxt.setServletClassName(targetClassName);
                 targetClassName = null;
             }
@@ -1403,7 +1394,7 @@ public class JspC extends Task implements Options {
 
         try {
             if (uriRoot == null) {
-                if (pages.size() == 0) {
+                if (pages.isEmpty()) {
                     throw new 
JasperException(Localizer.getMessage("jsp.error.jspc.missingTarget"));
                 }
                 String firstJsp = pages.get(0);
@@ -1432,7 +1423,7 @@ public class JspC extends Task implements Options {
             }
 
             // No explicit pages, we'll process all .jsp in the webapp
-            if (pages.size() == 0) {
+            if (pages.isEmpty()) {
                 scanFiles();
             } else {
                 // Ensure pages are all relative to the uriRoot.
diff --git a/java/org/apache/jasper/JspCompilationContext.java 
b/java/org/apache/jasper/JspCompilationContext.java
index d8f926cb4c..d7c2ab2e50 100644
--- a/java/org/apache/jasper/JspCompilationContext.java
+++ b/java/org/apache/jasper/JspCompilationContext.java
@@ -215,7 +215,6 @@ public class JspCompilationContext {
         if (jspCompiler != null ) {
             return jspCompiler;
         }
-        jspCompiler = null;
         if (options.getCompilerClassName() != null) {
             jspCompiler = createCompiler(options.getCompilerClassName());
         } else {
@@ -401,7 +400,6 @@ public class JspCompilationContext {
                 log.debug(Localizer.getMessage(
                         "jsp.error.lastModified", getJspFile()), e);
             }
-            result = -1;
         } finally {
             if (uc != null) {
                 try {
@@ -461,7 +459,7 @@ public class JspCompilationContext {
             return packageName;
         } else {
             String dPackageName = getDerivedPackageName();
-            if (dPackageName.length() == 0) {
+            if (dPackageName.isEmpty()) {
                 return basePackageName;
             }
             return basePackageName + '.' + getDerivedPackageName();
@@ -579,7 +577,7 @@ public class JspCompilationContext {
     // ==================== Removal ====================
 
     public void incrementRemoved() {
-        if (removed == false && rctxt != null) {
+        if (!removed && rctxt != null) {
             rctxt.removeWrapper(jspUri);
         }
         removed = true;
@@ -676,7 +674,7 @@ public class JspCompilationContext {
     }
 
     protected void createOutputDir() {
-        String path = null;
+        String path;
         if (isTagFile()) {
             String tagName = tagInfo.getTagClassName();
             path = tagName.replace('.', File.separatorChar);
@@ -699,11 +697,11 @@ public class JspCompilationContext {
         }
     }
 
-    protected static final boolean isPathSeparator(char c) {
+    protected static boolean isPathSeparator(char c) {
         return (c == '/' || c == '\\');
     }
 
-    protected static final String canonicalURI(String s) {
+    protected static String canonicalURI(String s) {
         if (s == null) {
             return null;
         }
diff --git a/java/org/apache/jasper/compiler/AntCompiler.java 
b/java/org/apache/jasper/compiler/AntCompiler.java
index 06f6f3596f..7a76aeefa0 100644
--- a/java/org/apache/jasper/compiler/AntCompiler.java
+++ b/java/org/apache/jasper/compiler/AntCompiler.java
@@ -130,8 +130,8 @@ public class AntCompiler extends Compiler {
         StringBuilder errorReport = new StringBuilder();
 
         StringBuilder info = new StringBuilder();
-        info.append("Compile: javaFileName=" + javaFileName + "\n");
-        info.append("    classpath=" + classpath + "\n");
+        info.append("Compile: 
javaFileName=").append(javaFileName).append("\n");
+        info.append("    classpath=").append(classpath).append("\n");
 
         // Start capturing the System.err output for this thread
         SystemLogHandler.setThread();
@@ -143,13 +143,13 @@ public class AntCompiler extends Compiler {
         // Initializing classpath
         Path path = new Path(project);
         path.setPath(System.getProperty("java.class.path"));
-        info.append("    cp=" + System.getProperty("java.class.path") + "\n");
+        info.append("    
cp=").append(System.getProperty("java.class.path")).append("\n");
         StringTokenizer tokenizer = new StringTokenizer(classpath, 
File.pathSeparator);
         while (tokenizer.hasMoreElements()) {
             String pathElement = tokenizer.nextToken();
             File repository = new File(pathElement);
             path.setLocation(repository);
-            info.append("    cp=" + repository + "\n");
+            info.append("    cp=").append(repository).append("\n");
         }
 
         if (log.isTraceEnabled()) {
@@ -160,7 +160,7 @@ public class AntCompiler extends Compiler {
         Path srcPath = new Path(project);
         srcPath.setLocation(options.getScratchDir());
 
-        info.append("    work dir=" + options.getScratchDir() + "\n");
+        info.append("    work 
dir=").append(options.getScratchDir()).append("\n");
 
         // Initialize and set java extensions
         String exts = System.getProperty("java.ext.dirs");
@@ -168,7 +168,7 @@ public class AntCompiler extends Compiler {
             Path extdirs = new Path(project);
             extdirs.setPath(exts);
             javac.setExtdirs(extdirs);
-            info.append("    extension dir=" + exts + "\n");
+            info.append("    extension dir=").append(exts).append("\n");
         }
 
         // Add endorsed directories if any are specified and we're forking
@@ -191,29 +191,29 @@ public class AntCompiler extends Compiler {
         javac.setSrcdir(srcPath);
         javac.setTempdir(options.getScratchDir());
         javac.setFork(ctxt.getOptions().getFork());
-        info.append("    srcDir=" + srcPath + "\n");
+        info.append("    srcDir=").append(srcPath).append("\n");
 
         // Set the Java compiler to use
         if (options.getCompiler() != null) {
             javac.setCompiler(options.getCompiler());
-            info.append("    compiler=" + options.getCompiler() + "\n");
+            info.append("    
compiler=").append(options.getCompiler()).append("\n");
         }
 
         if (options.getCompilerTargetVM() != null) {
             javac.setTarget(options.getCompilerTargetVM());
-            info.append("   compilerTargetVM=" + options.getCompilerTargetVM() 
+ "\n");
+            info.append("   
compilerTargetVM=").append(options.getCompilerTargetVM()).append("\n");
         }
 
         if (options.getCompilerSourceVM() != null) {
             javac.setSource(options.getCompilerSourceVM());
-            info.append("   compilerSourceVM=" + options.getCompilerSourceVM() 
+ "\n");
+            info.append("   
compilerSourceVM=").append(options.getCompilerSourceVM()).append("\n");
         }
 
         // Build includes path
         PatternSet.NameEntry includes = javac.createInclude();
 
         includes.setName(ctxt.getJavaPath());
-        info.append("    include=" + ctxt.getJavaPath() + "\n");
+        info.append("    include=").append(ctxt.getJavaPath()).append("\n");
 
         BuildException be = null;
 
diff --git a/java/org/apache/jasper/compiler/BeanRepository.java 
b/java/org/apache/jasper/compiler/BeanRepository.java
index 3991773f6e..a1dbf7f895 100644
--- a/java/org/apache/jasper/compiler/BeanRepository.java
+++ b/java/org/apache/jasper/compiler/BeanRepository.java
@@ -56,7 +56,7 @@ public class BeanRepository {
     }
 
     public Class<?> getBeanType(String bean) throws JasperException {
-        Class<?> clazz = null;
+        Class<?> clazz;
         try {
             clazz = loader.loadClass(beanTypes.get(bean));
         } catch (ClassNotFoundException ex) {
diff --git a/java/org/apache/jasper/compiler/Compiler.java 
b/java/org/apache/jasper/compiler/Compiler.java
index 31fa1ef968..e3ef2d3b69 100644
--- a/java/org/apache/jasper/compiler/Compiler.java
+++ b/java/org/apache/jasper/compiler/Compiler.java
@@ -424,8 +424,8 @@ public abstract class Compiler {
 
         if (jsw != null && (ctxt.getOptions().getModificationTestInterval() > 
0)) {
 
-            if (jsw.getLastModificationTest() + 
(ctxt.getOptions().getModificationTestInterval() * 1000) > System
-                    .currentTimeMillis()) {
+            if (jsw.getLastModificationTest() +
+                (ctxt.getOptions().getModificationTestInterval() * 1000L) > 
System.currentTimeMillis()) {
                 return false;
             }
             jsw.setLastModificationTest(System.currentTimeMillis());
@@ -477,7 +477,7 @@ public abstract class Compiler {
             try {
                 String key = include.getKey();
                 URL includeUrl;
-                long includeLastModified = 0;
+                long includeLastModified;
                 if (key.startsWith("jar:jar:")) {
                     // Assume we constructed this correctly
                     int entryStart = key.lastIndexOf("!/");
diff --git a/java/org/apache/jasper/compiler/DefaultErrorHandler.java 
b/java/org/apache/jasper/compiler/DefaultErrorHandler.java
index 400867f5ca..2b47513948 100644
--- a/java/org/apache/jasper/compiler/DefaultErrorHandler.java
+++ b/java/org/apache/jasper/compiler/DefaultErrorHandler.java
@@ -44,7 +44,7 @@ class DefaultErrorHandler implements ErrorHandler {
             return;
         }
 
-        Object[] args = null;
+        Object[] args;
         StringBuilder buf = new StringBuilder();
 
         for (JavacErrorDetail detail : details) {
diff --git a/java/org/apache/jasper/compiler/ELFunctionMapper.java 
b/java/org/apache/jasper/compiler/ELFunctionMapper.java
index e6ec970198..795ad18e49 100644
--- a/java/org/apache/jasper/compiler/ELFunctionMapper.java
+++ b/java/org/apache/jasper/compiler/ELFunctionMapper.java
@@ -60,7 +60,7 @@ public class ELFunctionMapper {
 
         // Append the declarations to the root node
         String ds = map.ds.toString();
-        if (ds.length() > 0) {
+        if (!ds.isEmpty()) {
             Node root = page.getRoot();
             @SuppressWarnings("unused")
             Node unused = new Node.Declaration(map.ss.toString(), null, root);
@@ -185,7 +185,7 @@ public class ELFunctionMapper {
             el.visit(fv);
             List<ELNode.Function> functions = fv.funcs;
 
-            if (functions.size() == 0) {
+            if (functions.isEmpty()) {
                 return;
             }
 
@@ -198,13 +198,13 @@ public class ELFunctionMapper {
 
             // Generate declaration for the map statically
             decName = getMapName();
-            ss.append("private static 
org.apache.jasper.runtime.ProtectedFunctionMapper " + decName + ";\n");
+            ss.append("private static 
org.apache.jasper.runtime.ProtectedFunctionMapper 
").append(decName).append(";\n");
 
-            ds.append("  " + decName + "= ");
+            ds.append("  ").append(decName).append("= ");
             ds.append("org.apache.jasper.runtime.ProtectedFunctionMapper");
 
             // Special case if there is only one function in the map
-            String funcMethod = null;
+            String funcMethod;
             if (functions.size() == 1) {
                 funcMethod = ".getMapForFunction";
             } else {
@@ -219,18 +219,19 @@ public class ELFunctionMapper {
                 if (funcInfo == null) {
                     // Added via Lambda or ImportHandler. EL will expect a
                     // function mapper even if one isn't used so just pass null
-                    ds.append(funcMethod + "(null, null, null, null);\n");
+                    ds.append(funcMethod).append("(null, null, null, 
null);\n");
                 } else {
-                    ds.append(funcMethod + "(\"" + fnQName + "\", " + 
getCanonicalName(funcInfo.getFunctionClass()) +
-                            ".class, " + '\"' + f.getMethodName() + "\", " + 
"new Class[] {");
-                    String params[] = f.getParameters();
+                    
ds.append(funcMethod).append("(\"").append(fnQName).append("\", ");
+                    
ds.append(getCanonicalName(funcInfo.getFunctionClass())).append(".class, 
").append('\"');
+                    ds.append(f.getMethodName()).append("\", ").append("new 
Class[] {");
+                    String[] params = f.getParameters();
                     for (int k = 0; k < params.length; k++) {
                         if (k != 0) {
                             ds.append(", ");
                         }
                         int iArray = params[k].indexOf('[');
                         if (iArray < 0) {
-                            ds.append(params[k] + ".class");
+                            ds.append(params[k]).append(".class");
                         } else {
                             String baseType = params[k].substring(0, iArray);
                             ds.append("java.lang.reflect.Array.newInstance(");
@@ -247,7 +248,7 @@ public class ELFunctionMapper {
                             if (aCount == 1) {
                                 ds.append("0).getClass()");
                             } else {
-                                ds.append("new int[" + aCount + 
"]).getClass()");
+                                ds.append("new 
int[").append(aCount).append("]).getClass()");
                             }
                         }
                     }
diff --git a/java/org/apache/jasper/compiler/ELNode.java 
b/java/org/apache/jasper/compiler/ELNode.java
index d9f936dc7d..9012a8fec5 100644
--- a/java/org/apache/jasper/compiler/ELNode.java
+++ b/java/org/apache/jasper/compiler/ELNode.java
@@ -211,7 +211,7 @@ abstract class ELNode {
         }
 
         public boolean isEmpty() {
-            return list.size() == 0;
+            return list.isEmpty();
         }
 
         /**
diff --git a/java/org/apache/jasper/compiler/ELParser.java 
b/java/org/apache/jasper/compiler/ELParser.java
index f072a7035e..fed10bf8db 100644
--- a/java/org/apache/jasper/compiler/ELParser.java
+++ b/java/org/apache/jasper/compiler/ELParser.java
@@ -47,7 +47,7 @@ public class ELParser {
 
     private final boolean isDeferredSyntaxAllowedAsLiteral;
 
-    private static final String reservedWords[] = { "and", "div", "empty", 
"eq", "false", "ge", "gt", "instanceof",
+    private static final String[] reservedWords = { "and", "div", "empty", 
"eq", "false", "ge", "gt", "instanceof",
             "le", "lt", "mod", "ne", "not", "null", "or", "true" };
 
     public ELParser(String expression, boolean 
isDeferredSyntaxAllowedAsLiteral) {
@@ -69,7 +69,7 @@ public class ELParser {
         ELParser parser = new ELParser(expression, 
isDeferredSyntaxAllowedAsLiteral);
         while (parser.hasNextChar()) {
             String text = parser.skipUntilEL();
-            if (text.length() > 0) {
+            if (!text.isEmpty()) {
                 parser.expr.add(new ELNode.Text(text));
             }
             ELNode.Nodes elexpr = parser.parseEL();
@@ -234,7 +234,7 @@ public class ELParser {
                     if (output == null) {
                         output = new StringBuilder(len + 20);
                     }
-                    output.append(input.substring(lastAppend, i));
+                    output.append(input, lastAppend, i);
                     lastAppend = i + 1;
                     output.append('\\');
                     output.append(ch);
@@ -244,7 +244,7 @@ public class ELParser {
         if (output == null) {
             return input;
         } else {
-            output.append(input.substring(lastAppend, len));
+            output.append(input, lastAppend, len);
             return output.toString();
         }
     }
@@ -289,7 +289,7 @@ public class ELParser {
                 if (output == null) {
                     output = new StringBuilder(len + 20);
                 }
-                output.append(input.substring(lastAppend, i));
+                output.append(input, lastAppend, i);
                 lastAppend = i + 1;
                 output.append('\\');
                 output.append(ch);
@@ -298,7 +298,7 @@ public class ELParser {
         if (output == null) {
             return input;
         } else {
-            output.append(input.substring(lastAppend, len));
+            output.append(input, lastAppend, len);
             return output.toString();
         }
     }
@@ -471,7 +471,7 @@ public class ELParser {
      */
     private static class Char extends Token {
 
-        private char ch;
+        private final char ch;
 
         Char(String whiteSpace, char ch) {
             super(whiteSpace);
@@ -499,7 +499,7 @@ public class ELParser {
      */
     private static class QuotedString extends Token {
 
-        private String value;
+        private final String value;
 
         QuotedString(String whiteSpace, String v) {
             super(whiteSpace);
diff --git a/java/org/apache/jasper/compiler/ErrorDispatcher.java 
b/java/org/apache/jasper/compiler/ErrorDispatcher.java
index 9de7018f02..436ae5354a 100644
--- a/java/org/apache/jasper/compiler/ErrorDispatcher.java
+++ b/java/org/apache/jasper/compiler/ErrorDispatcher.java
@@ -291,7 +291,7 @@ public class ErrorDispatcher {
 
         List<JavacErrorDetail> errors = new ArrayList<>();
         StringBuilder errMsgBuf = null;
-        int lineNum = -1;
+        int lineNum;
         JavacErrorDetail javacError = null;
 
         BufferedReader reader = new BufferedReader(new StringReader(errMsg));
@@ -300,7 +300,7 @@ public class ErrorDispatcher {
          * Parse compilation errors. Each compilation error consists of a file 
path and error line number, followed by a
          * number of lines describing the error.
          */
-        String line = null;
+        String line;
         while ((line = reader.readLine()) != null) {
 
             /*
@@ -344,7 +344,7 @@ public class ErrorDispatcher {
         reader.close();
 
         JavacErrorDetail[] errDetails = null;
-        if (errors.size() > 0) {
+        if (!errors.isEmpty()) {
             errDetails = errors.toArray(new JavacErrorDetail[0]);
         }
 
diff --git a/java/org/apache/jasper/compiler/Generator.java 
b/java/org/apache/jasper/compiler/Generator.java
index b35daa9134..afaee44bbf 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -481,8 +481,8 @@ class Generator {
 
         out.pushIndent();
         if (isPoolingEnabled) {
-            for (int i = 0; i < tagHandlerPoolNames.size(); i++) {
-                out.printin(tagHandlerPoolNames.get(i));
+            for (String tagHandlerPoolName : tagHandlerPoolNames) {
+                out.printin(tagHandlerPoolName);
                 out.print(" = 
org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(");
                 if (ctxt.isTagFile()) {
                     out.print("config");
@@ -517,8 +517,8 @@ class Generator {
         out.pushIndent();
 
         if (isPoolingEnabled) {
-            for (int i = 0; i < tagHandlerPoolNames.size(); i++) {
-                out.printin(tagHandlerPoolNames.get(i));
+            for (String tagHandlerPoolName : tagHandlerPoolNames) {
+                out.printin(tagHandlerPoolName);
                 out.println(".release();");
             }
         }
@@ -612,7 +612,7 @@ class Generator {
             out.println("\");");
         }
         // classes however, may be empty depending on the import declarations
-        if (classes.size() == 0) {
+        if (classes.isEmpty()) {
             out.printin("_jspx_imports_classes = null;");
             out.println();
         } else {
@@ -639,8 +639,8 @@ class Generator {
      */
     private void genPreambleClassVariableDeclarations() {
         if (isPoolingEnabled && !tagHandlerPoolNames.isEmpty()) {
-            for (int i = 0; i < tagHandlerPoolNames.size(); i++) {
-                out.printil("private org.apache.jasper.runtime.TagHandlerPool 
" + tagHandlerPoolNames.get(i) + ";");
+            for (String tagHandlerPoolName : tagHandlerPoolNames) {
+                out.printil("private org.apache.jasper.runtime.TagHandlerPool 
" + tagHandlerPoolName + ";");
             }
             out.println();
         }
@@ -1315,7 +1315,7 @@ class Generator {
                         canonicalName = klass;
                     }
                     // Check that there is a 0 arg constructor
-                    Constructor<?> constructor = bean.getConstructor(new 
Class[] {});
+                    Constructor<?> constructor = bean.getConstructor();
                     // Check the bean is public, not an interface, not abstract
                     // and (for Java 9+) in an exported module
                     int modifiers = bean.getModifiers();
@@ -1807,26 +1807,22 @@ class Generator {
             VariableInfo[] infos = n.getVariableInfos();
             // The Validator always calls setTagData() which ensures infos is
             // non-null
-            if (infos.length > 0) {
-                for (VariableInfo info : infos) {
-                    // A null variable name will trigger multiple compilation
-                    // failures so assume non-null here
-                    pageInfo.getVarInfoNames().add(info.getVarName());
-                }
+            for (VariableInfo info : infos) {
+                // A null variable name will trigger multiple compilation
+                // failures so assume non-null here
+                pageInfo.getVarInfoNames().add(info.getVarName());
             }
             TagVariableInfo[] tagInfos = n.getTagVariableInfos();
             // The way Tomcat constructs the TagInfo, getTagVariableInfos()
             // will never return null.
-            if (tagInfos.length > 0) {
-                for (TagVariableInfo tagInfo : tagInfos) {
-                    // tagInfo is always non-null
-                    String name = tagInfo.getNameGiven();
-                    if (name == null) {
-                        String nameFromAttribute = 
tagInfo.getNameFromAttribute();
-                        name = n.getAttributeValue(nameFromAttribute);
-                    }
-                    pageInfo.getVarInfoNames().add(name);
+            for (TagVariableInfo tagInfo : tagInfos) {
+                // tagInfo is always non-null
+                String name = tagInfo.getNameGiven();
+                if (name == null) {
+                    String nameFromAttribute = tagInfo.getNameFromAttribute();
+                    name = n.getAttributeValue(nameFromAttribute);
                 }
+                pageInfo.getVarInfoNames().add(name);
             }
 
 
@@ -1952,11 +1948,11 @@ class Generator {
             Map<String,String> map = new HashMap<>();
             // Validator ensures this is non-null
             Node.JspAttribute[] attrs = n.getJspAttributes();
-            for (int i = 0; i < attrs.length; i++) {
-                String value = null;
-                String nvp = null;
-                if (attrs[i].isNamedAttribute()) {
-                    NamedAttribute attr = attrs[i].getNamedAttributeNode();
+            for (Node.JspAttribute jspAttribute : attrs) {
+                String value;
+                String nvp;
+                if (jspAttribute.isNamedAttribute()) {
+                    NamedAttribute attr = jspAttribute.getNamedAttributeNode();
                     Node.JspAttribute omitAttr = attr.getOmit();
                     String omit;
                     if (omitAttr == null) {
@@ -1969,18 +1965,18 @@ class Generator {
                             continue;
                         }
                     }
-                    value = 
generateNamedAttributeValue(attrs[i].getNamedAttributeNode());
+                    value = 
generateNamedAttributeValue(jspAttribute.getNamedAttributeNode());
                     if ("\"false\"".equals(omit)) {
-                        nvp = " + \" " + attrs[i].getName() + "=\\\"\" + " + 
value + " + \"\\\"\"";
+                        nvp = " + \" " + jspAttribute.getName() + "=\\\"\" + " 
+ value + " + \"\\\"\"";
                     } else {
-                        nvp = " + (java.lang.Boolean.valueOf(" + omit + 
")?\"\":\" " + attrs[i].getName() +
-                                "=\\\"\" + " + value + " + \"\\\"\")";
+                        nvp = " + (java.lang.Boolean.valueOf(" + omit + 
")?\"\":\" " + jspAttribute.getName() +
+                            "=\\\"\" + " + value + " + \"\\\"\")";
                     }
                 } else {
-                    value = attributeValue(attrs[i], false, Object.class);
-                    nvp = " + \" " + attrs[i].getName() + "=\\\"\" + " + value 
+ " + \"\\\"\"";
+                    value = attributeValue(jspAttribute, false, Object.class);
+                    nvp = " + \" " + jspAttribute.getName() + "=\\\"\" + " + 
value + " + \"\\\"\"";
                 }
-                map.put(attrs[i].getName(), nvp);
+                map.put(jspAttribute.getName(), nvp);
             }
 
             // Write begin tag, using XML-style 'name' attribute as the
@@ -2085,12 +2081,7 @@ class Generator {
                 int textIndex = 0;
                 int textLength = text.length();
                 while (textIndex < textLength) {
-                    int len = 0;
-                    if (textLength - textIndex > 16384) {
-                        len = 16384;
-                    } else {
-                        len = textLength - textIndex;
-                    }
+                    int len = Math.min(textLength - textIndex, 16384);
                     String output = text.substring(textIndex, textIndex + len);
                     String charArrayName = textMap.get(output);
                     if (charArrayName == null) {
@@ -2275,9 +2266,9 @@ class Generator {
             Node.JspAttribute[] attrs = tag.getJspAttributes();
             // The TagPluginManager only creates AttributeGenerator nodes for
             // attributes that are present.
-            for (int i = 0; i < attrs.length; i++) {
-                if (attrs[i].getName().equals(n.getName())) {
-                    out.print(evaluateAttribute(getTagHandlerInfo(tag), 
attrs[i], tag, null));
+            for (Node.JspAttribute attr : attrs) {
+                if (attr.getName().equals(n.getName())) {
+                    out.print(evaluateAttribute(getTagHandlerInfo(tag), attr, 
tag, null));
                     break;
                 }
             }
@@ -2894,8 +2885,8 @@ class Generator {
 
             String localName = attr.getLocalName();
 
-            Method m = null;
-            Class<?>[] c = null;
+            Method m;
+            Class<?>[] c;
             if (attr.isDynamic()) {
                 c = OBJECT_CLASS;
             } else {
@@ -2964,10 +2955,8 @@ class Generator {
                     sb.append("))");
                     // should the expression be evaluated before passing to
                     // the setter?
-                    boolean evaluate = false;
-                    if (tai.canBeRequestTime()) {
-                        evaluate = true; // JSP.2.3.2
-                    }
+                    boolean evaluate = tai.canBeRequestTime();
+                    // JSP.2.3.2
                     if (attr.isDeferredInput()) {
                         evaluate = false; // JSP.2.3.3
                     }
@@ -3879,11 +3868,11 @@ class Generator {
      */
     private static class TagHandlerInfo {
 
-        private Map<String,Method> methodMaps;
+        private final Map<String,Method> methodMaps;
 
-        private Map<String,Class<?>> propertyEditorMaps;
+        private final Map<String,Class<?>> propertyEditorMaps;
 
-        private Class<?> tagHandlerClass;
+        private final Class<?> tagHandlerClass;
 
         /**
          * Constructor.
@@ -3946,11 +3935,11 @@ class Generator {
          * those for the body of the tag. Two fields are used here to keep 
this straight. For codes that do not
          * corresponds to any JSP lines, they should be null.
          */
-        private Node node;
+        private final Node node;
 
-        private Node.Nodes body;
+        private final Node.Nodes body;
 
-        private java.io.CharArrayWriter charWriter;
+        private final java.io.CharArrayWriter charWriter;
 
         protected ServletWriter out;
 
@@ -4029,9 +4018,9 @@ class Generator {
     private static class FragmentHelperClass {
 
         private static class Fragment {
-            private GenBuffer genBuffer;
+            private final GenBuffer genBuffer;
 
-            private int id;
+            private final int id;
 
             Fragment(int id, Node node) {
                 this.id = id;
@@ -4050,12 +4039,12 @@ class Generator {
         // True if the helper class should be generated.
         private boolean used = false;
 
-        private List<Fragment> fragments = new ArrayList<>();
+        private final List<Fragment> fragments = new ArrayList<>();
 
-        private String className;
+        private final String className;
 
         // Buffer for entire helper class
-        private GenBuffer classBuffer = new GenBuffer();
+        private final GenBuffer classBuffer = new GenBuffer();
 
         FragmentHelperClass(String className) {
             this.className = className;
diff --git a/java/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java 
b/java/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java
index d8a2e7c23c..72fca195e7 100644
--- a/java/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java
+++ b/java/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java
@@ -165,7 +165,7 @@ class ImplicitTagLibraryInfo extends TagLibraryInfo {
                 return null;
             }
 
-            TagInfo tagInfo = null;
+            TagInfo tagInfo;
             try {
                 tagInfo = TagFileProcessor.parseTagFileDirectives(pc, 
shortName, path, null, this);
             } catch (JasperException je) {
diff --git a/java/org/apache/jasper/compiler/JspConfig.java 
b/java/org/apache/jasper/compiler/JspConfig.java
index b9012fe3e8..762c26dde5 100644
--- a/java/org/apache/jasper/compiler/JspConfig.java
+++ b/java/org/apache/jasper/compiler/JspConfig.java
@@ -89,7 +89,7 @@ public class JspConfig {
 
             Collection<String> urlPatterns = jspPropertyGroup.getUrlPatterns();
 
-            if (urlPatterns.size() == 0) {
+            if (urlPatterns.isEmpty()) {
                 continue;
             }
 
@@ -183,10 +183,10 @@ public class JspConfig {
             // Both specifies a *.ext, keep the first one
             return prev;
         }
-        if (prevPath == null && currPath != null) {
+        if (prevPath == null) {
             return curr;
         }
-        if (prevPath != null && currPath == null) {
+        if (currPath == null) {
             return prev;
         }
         if (prevPath.length() >= currPath.length()) {
diff --git a/java/org/apache/jasper/compiler/JspDocumentParser.java 
b/java/org/apache/jasper/compiler/JspDocumentParser.java
index 32b2638337..c94ce1f18e 100644
--- a/java/org/apache/jasper/compiler/JspDocumentParser.java
+++ b/java/org/apache/jasper/compiler/JspDocumentParser.java
@@ -276,9 +276,7 @@ class JspDocumentParser extends DefaultHandler2 implements 
TagConstants {
         /*
          * Notice that due to a bug in the underlying SAX parser, the 
attributes must be enumerated in descending order.
          */
-        boolean isTaglib = false;
         for (int i = attrs.getLength() - 1; i >= 0; i--) {
-            isTaglib = false;
             String attrQName = attrs.getQName(i);
             if (!attrQName.startsWith("xmlns")) {
                 if (nonTaglibAttrs == null) {
@@ -287,6 +285,7 @@ class JspDocumentParser extends DefaultHandler2 implements 
TagConstants {
                 nonTaglibAttrs.addAttribute(attrs.getURI(i), 
attrs.getLocalName(i), attrs.getQName(i), attrs.getType(i),
                         attrs.getValue(i));
             } else {
+                boolean isTaglib;
                 if (attrQName.startsWith("xmlns:jsp")) {
                     isTaglib = true;
                 } else {
@@ -311,7 +310,7 @@ class JspDocumentParser extends DefaultHandler2 implements 
TagConstants {
             }
         }
 
-        Node node = null;
+        Node node;
 
         if (tagDependentPending && JSP_URI.equals(uri) && 
localName.equals(BODY_ACTION)) {
             tagDependentPending = false;
@@ -427,7 +426,8 @@ class JspDocumentParser extends DefaultHandler2 implements 
TagConstants {
             int column = startMark.getColumnNumber();
 
             CharArrayWriter ttext = new CharArrayWriter();
-            int lastCh = 0, elType = 0;
+            int lastCh = 0;
+            int elType;
             for (int i = 0; i < charBuffer.length(); i++) {
 
                 int ch = charBuffer.charAt(i);
@@ -563,7 +563,7 @@ class JspDocumentParser extends DefaultHandler2 implements 
TagConstants {
             tagDependentNesting--;
         }
 
-        if (scriptlessBodyNode != null && current.equals(scriptlessBodyNode)) {
+        if (current.equals(scriptlessBodyNode)) {
             scriptlessBodyNode = null;
         }
 
@@ -717,7 +717,7 @@ class JspDocumentParser extends DefaultHandler2 implements 
TagConstants {
     private Node parseStandardAction(String qName, String localName, 
Attributes nonTaglibAttrs,
             Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs, Mark 
start) throws SAXException {
 
-        Node node = null;
+        Node node;
 
         if (localName.equals(ROOT_ACTION)) {
             if (!(current instanceof Node.Root)) {
@@ -856,7 +856,7 @@ class JspDocumentParser extends DefaultHandler2 implements 
TagConstants {
 
         String prefix = getPrefix(qName);
 
-        Node.CustomTag ret = null;
+        Node.CustomTag ret;
         if (tagInfo != null) {
             ret = new Node.CustomTag(qName, prefix, localName, uri, 
nonTaglibAttrs, nonTaglibXmlnsAttrs, taglibAttrs,
                     start, parent, tagInfo, tagHandlerClass);
@@ -998,7 +998,7 @@ class JspDocumentParser extends DefaultHandler2 implements 
TagConstants {
     private void checkPrefix(String uri, String qName) {
 
         String prefix = getPrefix(qName);
-        if (prefix.length() > 0) {
+        if (!prefix.isEmpty()) {
             pageInfo.addPrefix(prefix);
             if ("jsp".equals(prefix) && !JSP_URI.equals(uri)) {
                 pageInfo.setIsJspPrefixHijacked(true);
diff --git a/java/org/apache/jasper/compiler/JspReader.java 
b/java/org/apache/jasper/compiler/JspReader.java
index 7681a9b446..95e20ad5c5 100644
--- a/java/org/apache/jasper/compiler/JspReader.java
+++ b/java/org/apache/jasper/compiler/JspReader.java
@@ -102,8 +102,8 @@ class JspReader {
 
         try {
             CharArrayWriter caw = new CharArrayWriter();
-            char buf[] = new char[1024];
-            for (int i = 0; (i = reader.read(buf)) != -1;) {
+            char[] buf = new char[1024];
+            for (int i; (i = reader.read(buf)) != -1;) {
                 caw.write(buf, 0, i);
             }
             caw.close();
@@ -319,7 +319,7 @@ class JspReader {
             current.update(i + cursor, line, col);
         } else {
             Mark mark = mark();
-            int ch = 0;
+            int ch;
             int i = 0;
             do {
                 ch = nextChar();
@@ -402,7 +402,7 @@ class JspReader {
         Mark ret = mark();
         int limlen = limit.length();
         char firstChar = limit.charAt(0);
-        Boolean result = null;
+        Boolean result;
         Mark restart = null;
 
         skip: while ((result = indexOf(firstChar, ret)) != null) {
diff --git a/java/org/apache/jasper/compiler/JspRuntimeContext.java 
b/java/org/apache/jasper/compiler/JspRuntimeContext.java
index 5a0760c1e8..023a494f0c 100644
--- a/java/org/apache/jasper/compiler/JspRuntimeContext.java
+++ b/java/org/apache/jasper/compiler/JspRuntimeContext.java
@@ -132,7 +132,7 @@ public final class JspRuntimeContext {
         }
 
         /* Init parameter is in seconds, locally we use milliseconds */
-        jspIdleTimeout = options.getJspIdleTimeout() * 1000;
+        jspIdleTimeout = options.getJspIdleTimeout() * 1000L;
     }
 
     // ----------------------------------------------------- Instance Variables
@@ -449,7 +449,7 @@ public final class JspRuntimeContext {
                         // Need to decode the URL, primarily to convert %20
                         // sequences back to spaces
                         String decoded = url.toURI().getPath();
-                        cpath.append(decoded + File.pathSeparator);
+                        cpath.append(decoded).append(File.pathSeparator);
                     } catch (URISyntaxException e) {
                         
log.warn(Localizer.getMessage("jsp.warning.classpathUrl"), e);
                     }
@@ -457,7 +457,7 @@ public final class JspRuntimeContext {
             }
         }
 
-        cpath.append(options.getScratchDir() + File.pathSeparator);
+        cpath.append(options.getScratchDir()).append(File.pathSeparator);
 
         String cp = (String) context.getAttribute(Constants.SERVLET_CLASSPATH);
         if (cp == null || cp.equals("")) {
diff --git a/java/org/apache/jasper/compiler/JspUtil.java 
b/java/org/apache/jasper/compiler/JspUtil.java
index 77103db6bc..5063c6d7fa 100644
--- a/java/org/apache/jasper/compiler/JspUtil.java
+++ b/java/org/apache/jasper/compiler/JspUtil.java
@@ -51,7 +51,7 @@ public class JspUtil {
     private static final String OPEN_EXPR = "<%=";
     private static final String CLOSE_EXPR = "%>";
 
-    private static final String javaKeywords[] =
+    private static final String[] javaKeywords =
             { "abstract", "assert", "boolean", "break", "byte", "case", 
"catch", "char", "class", "const", "continue",
                     "default", "do", "double", "else", "enum", "extends", 
"final", "finally", "float", "for", "goto",
                     "if", "implements", "import", "instanceof", "int", 
"interface", "long", "native", "new", "package",
@@ -160,7 +160,6 @@ public class JspUtil {
                 attrPos = temp.indexOf(validAttribute.name);
                 if (attrPos != -1) {
                     temp.remove(attrPos);
-                    valid = true;
                 } else {
                     valid = false;
                     missingAttribute = validAttribute.name;
@@ -247,7 +246,6 @@ public class JspUtil {
      */
     public static Class<?> toClass(String type, ClassLoader loader) throws 
ClassNotFoundException {
 
-        Class<?> c = null;
         int i0 = type.indexOf('[');
         int dims = 0;
         if (i0 > 0) {
@@ -260,6 +258,7 @@ public class JspUtil {
             type = type.substring(0, i0);
         }
 
+        Class<?> c = null;
         if ("boolean".equals(type)) {
             c = boolean.class;
         } else if ("char".equals(type)) {
@@ -308,7 +307,7 @@ public class JspUtil {
         /*
          * Determine which context object to use.
          */
-        String jspCtxt = null;
+        String jspCtxt;
         if (isTagFile) {
             jspCtxt = "this.getJspContext()";
         } else {
@@ -363,7 +362,7 @@ public class JspUtil {
          */
         if (primitiveConverterMethod != null) {
             call.insert(0, "(");
-            call.append(")." + primitiveConverterMethod + "()");
+            call.append(").").append(primitiveConverterMethod).append("()");
         }
 
         return call.toString();
@@ -373,7 +372,7 @@ public class JspUtil {
         if (isNamedAttribute) {
             return 
"org.apache.jasper.runtime.JspRuntimeLibrary.coerceToBoolean(" + s + ")";
         } else {
-            if (s == null || s.length() == 0) {
+            if (s == null || s.isEmpty()) {
                 return "false";
             } else {
                 return Boolean.valueOf(s).toString();
@@ -386,7 +385,7 @@ public class JspUtil {
             return "(java.lang.Boolean) 
org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" + s +
                     ", java.lang.Boolean.class)";
         } else {
-            if (s == null || s.length() == 0) {
+            if (s == null || s.isEmpty()) {
                 return "java.lang.Boolean.FALSE";
             } else {
                 // Detect format error at translation time
@@ -399,7 +398,7 @@ public class JspUtil {
         if (isNamedAttribute) {
             return "org.apache.jasper.runtime.JspRuntimeLibrary.coerceToByte(" 
+ s + ")";
         } else {
-            if (s == null || s.length() == 0) {
+            if (s == null || s.isEmpty()) {
                 return "(byte) 0";
             } else {
                 return "((byte)" + Byte.valueOf(s).toString() + ")";
@@ -412,7 +411,7 @@ public class JspUtil {
             return "(java.lang.Byte) 
org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" + s +
                     ", java.lang.Byte.class)";
         } else {
-            if (s == null || s.length() == 0) {
+            if (s == null || s.isEmpty()) {
                 return "java.lang.Byte.valueOf((byte) 0)";
             } else {
                 // Detect format error at translation time
@@ -425,7 +424,7 @@ public class JspUtil {
         if (isNamedAttribute) {
             return "org.apache.jasper.runtime.JspRuntimeLibrary.coerceToChar(" 
+ s + ")";
         } else {
-            if (s == null || s.length() == 0) {
+            if (s == null || s.isEmpty()) {
                 return "(char) 0";
             } else {
                 char ch = s.charAt(0);
@@ -440,7 +439,7 @@ public class JspUtil {
             return "(java.lang.Character) 
org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" + s +
                     ", java.lang.Character.class)";
         } else {
-            if (s == null || s.length() == 0) {
+            if (s == null || s.isEmpty()) {
                 return "java.lang.Character.valueOf((char) 0)";
             } else {
                 char ch = s.charAt(0);
@@ -454,7 +453,7 @@ public class JspUtil {
         if (isNamedAttribute) {
             return 
"org.apache.jasper.runtime.JspRuntimeLibrary.coerceToDouble(" + s + ")";
         } else {
-            if (s == null || s.length() == 0) {
+            if (s == null || s.isEmpty()) {
                 return "(double) 0";
             } else {
                 return Double.valueOf(s).toString();
@@ -466,7 +465,7 @@ public class JspUtil {
         if (isNamedAttribute) {
             return "(java.lang.Double) 
org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" + s + ", Double.class)";
         } else {
-            if (s == null || s.length() == 0) {
+            if (s == null || s.isEmpty()) {
                 return "java.lang.Double.valueOf(0)";
             } else {
                 // Detect format error at translation time
@@ -479,7 +478,7 @@ public class JspUtil {
         if (isNamedAttribute) {
             return 
"org.apache.jasper.runtime.JspRuntimeLibrary.coerceToFloat(" + s + ")";
         } else {
-            if (s == null || s.length() == 0) {
+            if (s == null || s.isEmpty()) {
                 return "(float) 0";
             } else {
                 return Float.valueOf(s).toString() + "f";
@@ -492,7 +491,7 @@ public class JspUtil {
             return "(java.lang.Float) 
org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" + s +
                     ", java.lang.Float.class)";
         } else {
-            if (s == null || s.length() == 0) {
+            if (s == null || s.isEmpty()) {
                 return "java.lang.Float.valueOf(0)";
             } else {
                 // Detect format error at translation time
@@ -505,7 +504,7 @@ public class JspUtil {
         if (isNamedAttribute) {
             return "org.apache.jasper.runtime.JspRuntimeLibrary.coerceToInt(" 
+ s + ")";
         } else {
-            if (s == null || s.length() == 0) {
+            if (s == null || s.isEmpty()) {
                 return "0";
             } else {
                 return Integer.valueOf(s).toString();
@@ -518,7 +517,7 @@ public class JspUtil {
             return "(java.lang.Integer) 
org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" + s +
                     ", java.lang.Integer.class)";
         } else {
-            if (s == null || s.length() == 0) {
+            if (s == null || s.isEmpty()) {
                 return "java.lang.Integer.valueOf(0)";
             } else {
                 // Detect format error at translation time
@@ -531,7 +530,7 @@ public class JspUtil {
         if (isNamedAttribute) {
             return 
"org.apache.jasper.runtime.JspRuntimeLibrary.coerceToShort(" + s + ")";
         } else {
-            if (s == null || s.length() == 0) {
+            if (s == null || s.isEmpty()) {
                 return "(short) 0";
             } else {
                 return "((short) " + Short.valueOf(s).toString() + ")";
@@ -544,7 +543,7 @@ public class JspUtil {
             return "(java.lang.Short) 
org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" + s +
                     ", java.lang.Short.class)";
         } else {
-            if (s == null || s.length() == 0) {
+            if (s == null || s.isEmpty()) {
                 return "java.lang.Short.valueOf((short) 0)";
             } else {
                 // Detect format error at translation time
@@ -557,7 +556,7 @@ public class JspUtil {
         if (isNamedAttribute) {
             return "org.apache.jasper.runtime.JspRuntimeLibrary.coerceToLong(" 
+ s + ")";
         } else {
-            if (s == null || s.length() == 0) {
+            if (s == null || s.isEmpty()) {
                 return "(long) 0";
             } else {
                 return Long.valueOf(s).toString() + "l";
@@ -570,7 +569,7 @@ public class JspUtil {
             return "(java.lang.Long) 
org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" + s +
                     ", java.lang.Long.class)";
         } else {
-            if (s == null || s.length() == 0) {
+            if (s == null || s.isEmpty()) {
                 return "java.lang.Long.valueOf(0)";
             } else {
                 // Detect format error at translation time
@@ -582,7 +581,7 @@ public class JspUtil {
     public static BufferedInputStream getInputStream(String fname, Jar jar, 
JspCompilationContext ctxt)
             throws IOException {
 
-        InputStream in = null;
+        InputStream in;
 
         if (jar != null) {
             String jarEntryName = fname.substring(1);
@@ -679,11 +678,11 @@ public class JspUtil {
      *
      * @return Java package corresponding to the given path
      */
-    public static final String makeJavaPackage(String path) {
-        String classNameComponents[] = path.split("/");
+    public static String makeJavaPackage(String path) {
+        String[] classNameComponents = path.split("/");
         StringBuilder legalClassNames = new StringBuilder();
         for (String classNameComponent : classNameComponents) {
-            if (classNameComponent.length() > 0) {
+            if (!classNameComponent.isEmpty()) {
                 if (legalClassNames.length() > 0) {
                     legalClassNames.append('.');
                 }
@@ -700,7 +699,7 @@ public class JspUtil {
      *
      * @return Legal Java identifier corresponding to the given identifier
      */
-    public static final String makeJavaIdentifier(String identifier) {
+    public static String makeJavaIdentifier(String identifier) {
         return makeJavaIdentifier(identifier, true);
     }
 
@@ -711,7 +710,7 @@ public class JspUtil {
      *
      * @return Legal Java identifier corresponding to the given identifier
      */
-    public static final String makeJavaIdentifierForAttribute(String 
identifier) {
+    public static String makeJavaIdentifierForAttribute(String identifier) {
         return makeJavaIdentifier(identifier, false);
     }
 
@@ -750,7 +749,7 @@ public class JspUtil {
      *
      * @return the replacement character as a string
      */
-    public static final String mangleChar(char ch) {
+    public static String mangleChar(char ch) {
         char[] result = new char[5];
         result[0] = '_';
         result[1] = Character.forDigit((ch >> 12) & 0xf, 16);
diff --git a/java/org/apache/jasper/compiler/Localizer.java 
b/java/org/apache/jasper/compiler/Localizer.java
index d0645338df..fa0e8fc768 100644
--- a/java/org/apache/jasper/compiler/Localizer.java
+++ b/java/org/apache/jasper/compiler/Localizer.java
@@ -56,6 +56,7 @@ public class Localizer {
                 errMsg = bundle.getString(errCode);
             }
         } catch (MissingResourceException e) {
+            // Ignore
         }
         return errMsg;
     }
diff --git a/java/org/apache/jasper/compiler/Node.java 
b/java/org/apache/jasper/compiler/Node.java
index 15f88986d7..a2c2296d16 100644
--- a/java/org/apache/jasper/compiler/Node.java
+++ b/java/org/apache/jasper/compiler/Node.java
@@ -243,7 +243,7 @@ abstract class Node implements TagConstants {
         int numChildNodes = nodes.size();
         for (int i = 0; i < numChildNodes; i++) {
             NamedAttribute na = (NamedAttribute) nodes.getNode(i);
-            boolean found = false;
+            boolean found;
             int index = name.indexOf(':');
             if (index != -1) {
                 // qualified name
@@ -1674,7 +1674,7 @@ abstract class Node implements TagConstants {
             int n = 0;
             Node p = parent;
             while (p != null) {
-                if ((p instanceof Node.CustomTag) && 
qName.equals(((Node.CustomTag) p).qName)) {
+                if ((p instanceof Node.CustomTag) && qName.equals(p.qName)) {
                     n++;
                 }
                 p = p.parent;
@@ -1719,9 +1719,9 @@ abstract class Node implements TagConstants {
      * only).
      */
     public static class AttributeGenerator extends Node {
-        private String name; // name of the attribute
+        private final String name; // name of the attribute
 
-        private CustomTag tag; // The tag this attribute belongs to
+        private final CustomTag tag; // The tag this attribute belongs to
 
         AttributeGenerator(Mark start, String name, CustomTag tag) {
             super(start, null);
@@ -1873,6 +1873,7 @@ abstract class Node implements TagConstants {
                 try {
                     getBody().visit(attributeVisitor);
                 } catch (JasperException e) {
+                    // Ignore
                 }
                 text = attributeVisitor.getAttrValue();
             }
@@ -2079,14 +2080,14 @@ abstract class Node implements TagConstants {
          * @return return true if there's TagAttributeInfo meaning we need to 
assign a ValueExpression
          */
         public boolean isDeferredInput() {
-            return (this.tai != null) ? this.tai.isDeferredValue() : false;
+            return this.tai != null && this.tai.isDeferredValue();
         }
 
         /**
          * @return return true if there's TagAttributeInfo meaning we need to 
assign a MethodExpression
          */
         public boolean isDeferredMethodInput() {
-            return (this.tai != null) ? this.tai.isDeferredMethod() : false;
+            return this.tai != null && this.tai.isDeferredMethod();
         }
 
         public String getExpectedTypeName() {
@@ -2114,7 +2115,7 @@ abstract class Node implements TagConstants {
                         m = m.trim();
                         m = m.substring(m.indexOf('(') + 1);
                         m = m.substring(0, m.length() - 1);
-                        if (m.trim().length() > 0) {
+                        if (!m.trim().isEmpty()) {
                             String[] p = m.split(",");
                             for (int i = 0; i < p.length; i++) {
                                 p[i] = p[i].trim();
@@ -2250,6 +2251,7 @@ abstract class Node implements TagConstants {
             try {
                 n = list.get(index);
             } catch (ArrayIndexOutOfBoundsException e) {
+                // Ignore
             }
             return n;
         }
diff --git a/java/org/apache/jasper/compiler/PageDataImpl.java 
b/java/org/apache/jasper/compiler/PageDataImpl.java
index 6ffc698154..5019e2afe6 100644
--- a/java/org/apache/jasper/compiler/PageDataImpl.java
+++ b/java/org/apache/jasper/compiler/PageDataImpl.java
@@ -124,10 +124,9 @@ class PageDataImpl extends PageData implements 
TagConstants {
                      * Therefore, create a new prefix (one that is unique 
across the translation unit) for use by the
                      * 'id' attribute, and bind it to the JSP namespace
                      */
-                    jspIdPrefix += "jsp";
-                    while (pageInfo.containsPrefix(jspIdPrefix)) {
+                    do {
                         jspIdPrefix += "jsp";
-                    }
+                    } while (pageInfo.containsPrefix(jspIdPrefix));
                     rootAttrs.addAttribute("", "", "xmlns:" + jspIdPrefix, 
"CDATA", JSP_URI);
                 }
 
@@ -449,7 +448,7 @@ class PageDataImpl extends PageData implements TagConstants 
{
                 } else {
                     appendText(text, false);
                 }
-                buf.append("</" + n.getQName() + ">\n");
+                buf.append("</").append(n.getQName()).append(">\n");
             } else {
                 buf.append("/>\n");
             }
@@ -504,7 +503,7 @@ class PageDataImpl extends PageData implements TagConstants 
{
                 buf.append("  ").append(attrName).append("=\"");
                 buf.append(JspUtil.getExprInXml(value)).append("\"\n");
             }
-            if (n.getImports().size() > 0) {
+            if (!n.getImports().isEmpty()) {
                 // Concatenate names of imported classes/packages
                 boolean first = true;
                 for (String i : n.getImports()) {
diff --git a/java/org/apache/jasper/compiler/PageInfo.java 
b/java/org/apache/jasper/compiler/PageInfo.java
index 2ecf8d6e7c..d409291774 100644
--- a/java/org/apache/jasper/compiler/PageInfo.java
+++ b/java/org/apache/jasper/compiler/PageInfo.java
@@ -353,10 +353,10 @@ class PageInfo {
      */
     public String getURI(String prefix) {
 
-        String uri = null;
+        String uri;
 
         Deque<String> stack = xmlPrefixMapper.get(prefix);
-        if (stack == null || stack.size() == 0) {
+        if (stack == null || stack.isEmpty()) {
             uri = jspPrefixMapper.get(prefix);
         } else {
             uri = stack.getFirst();
diff --git a/java/org/apache/jasper/compiler/Parser.java 
b/java/org/apache/jasper/compiler/Parser.java
index 5d9311d247..f308f0df25 100644
--- a/java/org/apache/jasper/compiler/Parser.java
+++ b/java/org/apache/jasper/compiler/Parser.java
@@ -141,8 +141,7 @@ class Parser implements TagConstants {
             parser.addInclude(root, pageInfo.getIncludeCoda());
         }
 
-        Node.Nodes page = new Node.Nodes(root);
-        return page;
+        return new Node.Nodes(root);
     }
 
     /**
@@ -249,15 +248,12 @@ class Parser implements TagConstants {
         char ch = (char) reader.peekChar();
         if (Character.isLetter(ch) || ch == '_' || ch == ':') {
             StringBuilder buf = new StringBuilder();
-            buf.append(ch);
-            reader.nextChar();
-            ch = (char) reader.peekChar();
-            while (Character.isLetter(ch) || Character.isDigit(ch) || ch == 
'.' || ch == '_' || ch == '-' ||
-                    ch == ':') {
+            do {
                 buf.append(ch);
                 reader.nextChar();
                 ch = (char) reader.peekChar();
-            }
+            } while (Character.isLetter(ch) || Character.isDigit(ch) ||
+                ch == '.' || ch == '_' || ch == '-' || ch == ':');
             return buf.toString();
         }
         return null;
@@ -1207,7 +1203,7 @@ class Parser implements TagConstants {
             bc = tagFileInfo.getTagInfo().getBodyContent();
         }
 
-        Node tagNode = null;
+        Node tagNode;
         if (tagInfo != null) {
             tagNode = new Node.CustomTag(tagName, prefix, shortTagName, uri, 
attrs, start, parent, tagInfo,
                     tagHandlerClass);
diff --git a/java/org/apache/jasper/compiler/ParserController.java 
b/java/org/apache/jasper/compiler/ParserController.java
index d3f6b69bc8..6fefdbcfdc 100644
--- a/java/org/apache/jasper/compiler/ParserController.java
+++ b/java/org/apache/jasper/compiler/ParserController.java
@@ -180,7 +180,7 @@ class ParserController implements TagConstants {
     private Node.Nodes doParse(String inFileName, Node parent, Jar jar)
             throws FileNotFoundException, JasperException, IOException {
 
-        Node.Nodes parsedPage = null;
+        Node.Nodes parsedPage;
         isEncodingSpecifiedInProlog = false;
         isBomPresent = false;
         isDefaultPageEncoding = false;
@@ -347,7 +347,7 @@ class ParserController implements TagConstants {
          * is TRUE and 'isXml' is FALSE). No check for XML prolog, since 
nothing prevents a page from outputting XML and
          * still using JSP syntax (in this case, the XML prolog is treated as 
template text).
          */
-        JspReader jspReader = null;
+        JspReader jspReader;
         try {
             jspReader = new JspReader(ctxt, absFileName, sourceEnc, jar, err);
         } catch (FileNotFoundException ex) {
@@ -469,12 +469,11 @@ class ParserController implements TagConstants {
         }
 
         // attrName = contentType
-        String contentType = value;
         String encoding = null;
-        if (contentType != null) {
-            int loc = contentType.indexOf(CHARSET);
+        if (value != null) {
+            int loc = value.indexOf(CHARSET);
             if (loc != -1) {
-                encoding = contentType.substring(loc + CHARSET.length());
+                encoding = value.substring(loc + CHARSET.length());
             }
         }
 
@@ -511,7 +510,7 @@ class ParserController implements TagConstants {
     private boolean hasJspRoot(JspReader reader) {
 
         // <prefix>:root must be the first element
-        Mark start = null;
+        Mark start;
         while ((start = reader.skipUntil("<")) != null) {
             int c = reader.nextChar();
             if (c != '!' && c != '?') {
@@ -546,15 +545,12 @@ class ParserController implements TagConstants {
             index++;
         }
         if (index < root.length() && root.charAt(index) == '=') {
-            index++;
-            while (index < root.length() && 
Character.isWhitespace(root.charAt(index))) {
+            do {
                 index++;
-            }
+            } while (index < root.length() && 
Character.isWhitespace(root.charAt(index)));
             if (index < root.length() && (root.charAt(index) == '"' || 
root.charAt(index) == '\'')) {
                 index++;
-                if (root.regionMatches(index, JSP_URI, 0, JSP_URI.length())) {
-                    return true;
-                }
+                return root.regionMatches(index, JSP_URI, 0, JSP_URI.length());
             }
         }
 
diff --git a/java/org/apache/jasper/compiler/ScriptingVariabler.java 
b/java/org/apache/jasper/compiler/ScriptingVariabler.java
index cce11ecd05..23b2280e6e 100644
--- a/java/org/apache/jasper/compiler/ScriptingVariabler.java
+++ b/java/org/apache/jasper/compiler/ScriptingVariabler.java
@@ -86,7 +86,7 @@ class ScriptingVariabler {
 
             List<Object> vec = new ArrayList<>();
 
-            Integer ownRange = null;
+            Integer ownRange;
             Node.CustomTag parent = n.getCustomTagParent();
             if (scope == VariableInfo.AT_BEGIN || scope == 
VariableInfo.AT_END) {
                 if (parent == null) {
diff --git a/java/org/apache/jasper/compiler/SmapStratum.java 
b/java/org/apache/jasper/compiler/SmapStratum.java
index f2c5da089a..8eab419f9e 100644
--- a/java/org/apache/jasper/compiler/SmapStratum.java
+++ b/java/org/apache/jasper/compiler/SmapStratum.java
@@ -101,14 +101,14 @@ public class SmapStratum {
             StringBuilder out = new StringBuilder();
             out.append(inputStartLine);
             if (lineFileIDSet) {
-                out.append("#" + lineFileID);
+                out.append("#").append(lineFileID);
             }
             if (inputLineCount != 1) {
-                out.append("," + inputLineCount);
+                out.append(",").append(inputLineCount);
             }
-            out.append(":" + outputStartLine);
+            out.append(":").append(outputStartLine);
             if (outputLineIncrement != 1) {
-                out.append("," + outputLineIncrement);
+                out.append(",").append(outputLineIncrement);
             }
             out.append('\n');
             return out.toString();
@@ -281,7 +281,7 @@ public class SmapStratum {
 
         // start the SMAP
         out.append("SMAP\n");
-        out.append(outputFileName + '\n');
+        out.append(outputFileName).append('\n');
         out.append("JSP\n");
 
         // print StratumSection
@@ -292,16 +292,16 @@ public class SmapStratum {
         int bound = fileNameList.size();
         for (int i = 0; i < bound; i++) {
             if (filePathList.get(i) != null) {
-                out.append("+ " + i + " " + fileNameList.get(i) + "\n");
+                out.append("+ ").append(i).append(" 
").append(fileNameList.get(i)).append("\n");
                 // Source paths must be relative, not absolute, so we
                 // remove the leading "/", if one exists.
                 String filePath = filePathList.get(i);
                 if (filePath.startsWith("/")) {
                     filePath = filePath.substring(1);
                 }
-                out.append(filePath + "\n");
+                out.append(filePath).append("\n");
             } else {
-                out.append(i + " " + fileNameList.get(i) + "\n");
+                out.append(i).append(" 
").append(fileNameList.get(i)).append("\n");
             }
         }
 
diff --git a/java/org/apache/jasper/compiler/SmapUtil.java 
b/java/org/apache/jasper/compiler/SmapUtil.java
index b30b99c025..f6bbdc327b 100644
--- a/java/org/apache/jasper/compiler/SmapUtil.java
+++ b/java/org/apache/jasper/compiler/SmapUtil.java
@@ -71,6 +71,7 @@ public class SmapUtil {
         try {
             pageNodes.visit(psVisitor);
         } catch (JasperException ex) {
+            // Ignore
         }
         HashMap<String,SmapStratum> map = psVisitor.getMap();
 
@@ -401,7 +402,7 @@ public class SmapUtil {
                         int len = readU2();
                         writeU2(len);
                         byte[] utf8 = readBytes(len);
-                        String str = new String(utf8, "UTF-8");
+                        String str = new String(utf8, StandardCharsets.UTF_8);
                         if (log.isTraceEnabled()) {
                             log.trace(i + " read class attr -- '" + str + "'");
                         }
@@ -432,6 +433,7 @@ public class SmapUtil {
         try {
             nodes.visit(new SmapGenVisitor(s, breakAtLF, innerClassMap));
         } catch (JasperException ex) {
+            // Ignore
         }
     }
 
@@ -609,7 +611,7 @@ public class SmapUtil {
         private void doSmapText(Node n) {
             String text = n.getText();
             int index = 0;
-            int next = 0;
+            int next;
             int lineCount = 1;
             int skippedLines = 0;
             boolean slashStarSeen = false;
@@ -635,7 +637,7 @@ public class SmapUtil {
                                 beginning = false;
                             }
                         }
-                    } else if (line.length() == 0 || line.startsWith("//")) {
+                    } else if (line.isEmpty() || line.startsWith("//")) {
                         skippedLines++;
                     } else {
                         beginning = false;
diff --git a/java/org/apache/jasper/compiler/TagFileProcessor.java 
b/java/org/apache/jasper/compiler/TagFileProcessor.java
index 208f0c879d..0767521162 100644
--- a/java/org/apache/jasper/compiler/TagFileProcessor.java
+++ b/java/org/apache/jasper/compiler/TagFileProcessor.java
@@ -76,15 +76,15 @@ class TagFileProcessor {
                         new JspUtil.ValidAttribute("scope"), new 
JspUtil.ValidAttribute("declare"),
                         new JspUtil.ValidAttribute("description") };
 
-        private ErrorDispatcher err;
+        private final ErrorDispatcher err;
 
-        private TagLibraryInfo tagLibInfo;
+        private final TagLibraryInfo tagLibInfo;
 
-        private String name = null;
+        private final String name;
 
-        private String path = null;
+        private final String path;
 
-        private String bodycontent = null;
+        private String bodyContent = null;
 
         private String description = null;
 
@@ -98,9 +98,9 @@ class TagFileProcessor {
 
         private String example = null;
 
-        private List<TagAttributeInfo> attributeList;
+        private final List<TagAttributeInfo> attributeList;
 
-        private List<TagVariableInfo> variableList;
+        private final List<TagVariableInfo> variableList;
 
         private static final String ATTR_NAME = "the name attribute of the 
attribute directive";
 
@@ -112,9 +112,9 @@ class TagFileProcessor {
 
         private static final String TAG_DYNAMIC = "the dynamic-attributes 
attribute of the tag directive";
 
-        private Map<String,NameEntry> nameTable = new HashMap<>();
+        private final Map<String,NameEntry> nameTable = new HashMap<>();
 
-        private Map<String,NameEntry> nameFromTable = new HashMap<>();
+        private final Map<String,NameEntry> nameFromTable = new HashMap<>();
 
         TagFileDirectiveVisitor(Compiler compiler, TagLibraryInfo tagLibInfo, 
String name, String path) {
             err = compiler.getErrorDispatcher();
@@ -130,11 +130,11 @@ class TagFileProcessor {
 
             JspUtil.checkAttributes("Tag directive", n, tagDirectiveAttrs, 
err);
 
-            bodycontent = checkConflict(n, bodycontent, "body-content");
-            if (bodycontent != null && 
!bodycontent.equalsIgnoreCase(TagInfo.BODY_CONTENT_EMPTY) &&
-                    
!bodycontent.equalsIgnoreCase(TagInfo.BODY_CONTENT_TAG_DEPENDENT) &&
-                    
!bodycontent.equalsIgnoreCase(TagInfo.BODY_CONTENT_SCRIPTLESS)) {
-                err.jspError(n, "jsp.error.tagdirective.badbodycontent", 
bodycontent);
+            bodyContent = checkConflict(n, bodyContent, "body-content");
+            if (bodyContent != null && 
!bodyContent.equalsIgnoreCase(TagInfo.BODY_CONTENT_EMPTY) &&
+                    
!bodyContent.equalsIgnoreCase(TagInfo.BODY_CONTENT_TAG_DEPENDENT) &&
+                    
!bodyContent.equalsIgnoreCase(TagInfo.BODY_CONTENT_SCRIPTLESS)) {
+                err.jspError(n, "jsp.error.tagdirective.badbodycontent", 
bodyContent);
             }
             dynamicAttrsMapName = checkConflict(n, dynamicAttrsMapName, 
"dynamic-attributes");
             if (dynamicAttrsMapName != null) {
@@ -321,8 +321,8 @@ class TagFileProcessor {
                 // XXX Get it from tag file name
             }
 
-            if (bodycontent == null) {
-                bodycontent = TagInfo.BODY_CONTENT_SCRIPTLESS;
+            if (bodyContent == null) {
+                bodyContent = TagInfo.BODY_CONTENT_SCRIPTLESS;
             }
 
             String tagClassName = JspUtil.getTagHandlerClassName(path, 
tagLibInfo.getReliableURN(), err);
@@ -330,16 +330,16 @@ class TagFileProcessor {
             TagVariableInfo[] tagVariableInfos = variableList.toArray(new 
TagVariableInfo[0]);
             TagAttributeInfo[] tagAttributeInfo = attributeList.toArray(new 
TagAttributeInfo[0]);
 
-            return new JasperTagInfo(name, tagClassName, bodycontent, 
description, tagLibInfo, null, tagAttributeInfo,
+            return new JasperTagInfo(name, tagClassName, bodyContent, 
description, tagLibInfo, null, tagAttributeInfo,
                     displayName, smallIcon, largeIcon, tagVariableInfos, 
dynamicAttrsMapName);
         }
 
         static class NameEntry {
-            private String type;
+            private final String type;
 
-            private Node node;
+            private final Node node;
 
-            private TagAttributeInfo attr;
+            private final TagAttributeInfo attr;
 
             NameEntry(String type, Node node, TagAttributeInfo attr) {
                 this.type = type;
@@ -559,9 +559,9 @@ class TagFileProcessor {
      */
     private class TagFileLoaderVisitor extends Node.Visitor {
 
-        private Compiler compiler;
+        private final Compiler compiler;
 
-        private PageInfo pageInfo;
+        private final PageInfo pageInfo;
 
         TagFileLoaderVisitor(Compiler compiler) {
 
diff --git a/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java 
b/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java
index 635fb8a3e3..96e2a0f2da 100644
--- a/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java
+++ b/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java
@@ -141,7 +141,7 @@ class TagLibraryInfoImpl extends TagLibraryInfo implements 
TagConstants {
                     if (path == null) {
                         // JAR not in the web application so add it directly
                         URL jarUrl = jar.getJarFileURL();
-                        long lastMod = -1;
+                        long lastMod;
                         URLConnection urlConn = null;
                         try {
                             urlConn = jarUrl.openConnection();
@@ -393,5 +393,5 @@ class TagLibraryInfoImpl extends TagLibraryInfo implements 
TagConstants {
         return tlv.validate(getPrefixString(), uri, thePage);
     }
 
-    private TagLibraryValidator tagLibraryValidator;
+    private final TagLibraryValidator tagLibraryValidator;
 }
diff --git a/java/org/apache/jasper/compiler/TldCache.java 
b/java/org/apache/jasper/compiler/TldCache.java
index 47df974728..869173d598 100644
--- a/java/org/apache/jasper/compiler/TldCache.java
+++ b/java/org/apache/jasper/compiler/TldCache.java
@@ -63,7 +63,7 @@ public class TldCache {
         this.uriTldResourcePathMap.putAll(uriTldResourcePathMap);
         for (Entry<TldResourcePath,TaglibXml> entry : 
tldResourcePathTaglibXmlMap.entrySet()) {
             TldResourcePath tldResourcePath = entry.getKey();
-            long lastModified[] = getLastModified(tldResourcePath);
+            long[] lastModified = getLastModified(tldResourcePath);
             TaglibXmlCacheEntry cacheEntry =
                     new TaglibXmlCacheEntry(entry.getValue(), lastModified[0], 
lastModified[1]);
             this.tldResourcePathTaglibXmlMap.put(tldResourcePath, cacheEntry);
@@ -91,7 +91,7 @@ public class TldCache {
         if (cacheEntry == null) {
             return null;
         }
-        long lastModified[] = getLastModified(tldResourcePath);
+        long[] lastModified = getLastModified(tldResourcePath);
         if (lastModified[0] != cacheEntry.getWebAppPathLastModified() ||
                 lastModified[1] != cacheEntry.getEntryLastModified()) {
             synchronized (cacheEntry) {
diff --git a/java/org/apache/jasper/compiler/Validator.java 
b/java/org/apache/jasper/compiler/Validator.java
index 15c2280193..fab75f5861 100644
--- a/java/org/apache/jasper/compiler/Validator.java
+++ b/java/org/apache/jasper/compiler/Validator.java
@@ -715,10 +715,8 @@ class Validator {
                 char c = value.charAt(i);
                 if (c == '#' && (i + 1) < len && value.charAt(i + 1) == '{' && 
!prevCharIsEscape) {
                     return true;
-                } else if (c == '\\') {
-                    prevCharIsEscape = true;
                 } else {
-                    prevCharIsEscape = false;
+                    prevCharIsEscape = c == '\\';
                 }
                 i++;
             }
@@ -1020,7 +1018,7 @@ class Validator {
                 }
                 for (int j = 0; tldAttrs != null && j < tldAttrs.length; j++) {
                     if (attrs.getLocalName(i).equals(tldAttrs[j].getName()) && 
(attrs.getURI(i) == null ||
-                            attrs.getURI(i).length() == 0 || 
attrs.getURI(i).equals(n.getURI()))) {
+                        attrs.getURI(i).isEmpty() || 
attrs.getURI(i).equals(n.getURI()))) {
 
                         TagAttributeInfo tldAttr = tldAttrs[j];
                         if (tldAttr.canBeRequestTime() || 
tldAttr.isDeferredMethod() || tldAttr.isDeferredValue()) { // JSP
@@ -1149,7 +1147,7 @@ class Validator {
                      */
                     String attrPrefix = na.getPrefix();
                     if (na.getLocalName().equals(tldAttr.getName()) &&
-                            (attrPrefix == null || attrPrefix.length() == 0 || 
attrPrefix.equals(n.getPrefix()))) {
+                            (attrPrefix == null || attrPrefix.isEmpty() || 
attrPrefix.equals(n.getPrefix()))) {
                         jspAttrs[start + i] = new Node.JspAttribute(na, 
tldAttr, false);
                         NamedAttributeVisitor nav = null;
                         if (na.getBody() != null) {
@@ -1379,7 +1377,7 @@ class Validator {
 
             class FVVisitor extends ELNode.Visitor {
 
-                private Node n;
+                private final Node n;
 
                 FVVisitor(Node n) {
                     this.n = n;
@@ -1498,7 +1496,7 @@ class Validator {
 
             class ValidateFunctionMapper extends FunctionMapper {
 
-                private Map<String,Method> fnmap = new HashMap<>();
+                private final Map<String,Method> fnmap = new HashMap<>();
 
                 @Override
                 public void mapFunction(String prefix, String localName, 
Method method) {
@@ -1512,7 +1510,7 @@ class Validator {
             }
 
             class MapperELVisitor extends ELNode.Visitor {
-                private ValidateFunctionMapper fmapper;
+                private final ValidateFunctionMapper fmapper;
 
                 MapperELVisitor(ValidateFunctionMapper fmapper) {
                     this.fmapper = fmapper;
@@ -1535,9 +1533,9 @@ class Validator {
                         err.jspError("jsp.error.function.classnotfound", 
n.getFunctionInfo().getFunctionClass(),
                                 n.getPrefix() + ':' + n.getName(), 
e.getMessage());
                     }
-                    String paramTypes[] = n.getParameters();
+                    String[] paramTypes = n.getParameters();
                     int size = paramTypes.length;
-                    Class<?> params[] = new Class[size];
+                    Class<?>[] params = new Class[size];
                     int i = 0;
                     try {
                         for (i = 0; i < size; i++) {
diff --git a/java/org/apache/jasper/el/JasperELResolver.java 
b/java/org/apache/jasper/el/JasperELResolver.java
index e9a929163c..3f41faa0ff 100644
--- a/java/org/apache/jasper/el/JasperELResolver.java
+++ b/java/org/apache/jasper/el/JasperELResolver.java
@@ -47,7 +47,7 @@ public class JasperELResolver extends CompositeELResolver {
 
     private static final int STANDARD_RESOLVERS_COUNT = 9;
 
-    private AtomicInteger resolversSize = new AtomicInteger(0);
+    private final AtomicInteger resolversSize = new AtomicInteger(0);
     private volatile ELResolver[] resolvers;
     private final int appResolversSize;
 
@@ -96,7 +96,7 @@ public class JasperELResolver extends CompositeELResolver {
         context.setPropertyResolved(false);
 
         int start;
-        Object result = null;
+        Object result;
 
         if (base == null) {
             // call implicit and app resolvers
@@ -132,13 +132,13 @@ public class JasperELResolver extends CompositeELResolver 
{
     @Override
     public Object invoke(ELContext context, Object base, Object method, 
Class<?>[] paramTypes, Object[] params) {
         String targetMethod = coerceToString(method);
-        if (targetMethod.length() == 0) {
+        if (targetMethod.isEmpty()) {
             throw new ELException(new NoSuchMethodException());
         }
 
         context.setPropertyResolved(false);
 
-        Object result = null;
+        Object result;
 
         // skip implicit and call app resolvers, stream resolver and static
         // resolver
@@ -233,11 +233,11 @@ public class JasperELResolver extends CompositeELResolver 
{
             Class<?> beanClass = base.getClass();
             String prop = property.toString();
             Method readMethod = getReadMethod(beanClass, prop);
-            return readMethod == null || !(getWriteMethod(beanClass, prop, 
readMethod.getReturnType()) != null);
+            return readMethod == null || getWriteMethod(beanClass, prop, 
readMethod.getReturnType()) == null;
         }
 
         private static Method getReadMethod(Class<?> beanClass, String prop) {
-            Method methods[] = beanClass.getMethods();
+            Method[] methods = beanClass.getMethods();
             String isGetter = "is" + capitalize(prop);
             String getter = "get" + capitalize(prop);
             for (Method method : methods) {
@@ -254,7 +254,7 @@ public class JasperELResolver extends CompositeELResolver {
 
         private static Method getWriteMethod(Class<?> beanClass, String prop, 
Class<?> valueClass) {
             String setter = "set" + capitalize(prop);
-            Method methods[] = beanClass.getMethods();
+            Method[] methods = beanClass.getMethods();
             for (Method method : methods) {
                 if (method.getParameterCount() == 1 && 
setter.equals(method.getName()) &&
                         (valueClass == null || 
valueClass.isAssignableFrom(method.getParameterTypes()[0]))) {
@@ -265,10 +265,10 @@ public class JasperELResolver extends CompositeELResolver 
{
         }
 
         private static String capitalize(String name) {
-            if (name == null || name.length() == 0) {
+            if (name == null || name.isEmpty()) {
                 return name;
             }
-            char chars[] = name.toCharArray();
+            char[] chars = name.toCharArray();
             chars[0] = Character.toUpperCase(chars[0]);
             return new String(chars);
         }
diff --git a/java/org/apache/jasper/runtime/BodyContentImpl.java 
b/java/org/apache/jasper/runtime/BodyContentImpl.java
index 620005c51e..c7a7aa5f19 100644
--- a/java/org/apache/jasper/runtime/BodyContentImpl.java
+++ b/java/org/apache/jasper/runtime/BodyContentImpl.java
@@ -291,7 +291,7 @@ public class BodyContentImpl extends BodyContent {
     }
 
     @Override
-    public void println(char x[]) throws IOException {
+    public void println(char[] x) throws IOException {
         print(x);
         println();
     }
diff --git a/java/org/apache/jasper/runtime/JspApplicationContextImpl.java 
b/java/org/apache/jasper/runtime/JspApplicationContextImpl.java
index deffeaf10e..019ca9ab7e 100644
--- a/java/org/apache/jasper/runtime/JspApplicationContextImpl.java
+++ b/java/org/apache/jasper/runtime/JspApplicationContextImpl.java
@@ -21,7 +21,6 @@ import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.List;
 
-import javax.el.CompositeELResolver;
 import javax.el.ELContext;
 import javax.el.ELContextEvent;
 import javax.el.ELContextListener;
@@ -110,8 +109,7 @@ public class JspApplicationContextImpl implements 
JspApplicationContext {
     private ELResolver createELResolver() {
         this.instantiated = true;
         if (this.resolver == null) {
-            CompositeELResolver r = new JasperELResolver(this.resolvers, 
expressionFactory.getStreamELResolver());
-            this.resolver = r;
+            this.resolver = new JasperELResolver(this.resolvers, 
expressionFactory.getStreamELResolver());
         }
         return this.resolver;
     }
diff --git a/java/org/apache/jasper/runtime/JspRuntimeLibrary.java 
b/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
index 6898e0b93c..35261c5653 100644
--- a/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
+++ b/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
@@ -94,7 +94,7 @@ public class JspRuntimeLibrary {
     }
 
     public static boolean coerceToBoolean(String s) {
-        if (s == null || s.length() == 0) {
+        if (s == null || s.isEmpty()) {
             return false;
         } else {
             return Boolean.parseBoolean(s);
@@ -102,7 +102,7 @@ public class JspRuntimeLibrary {
     }
 
     public static byte coerceToByte(String s) {
-        if (s == null || s.length() == 0) {
+        if (s == null || s.isEmpty()) {
             return (byte) 0;
         } else {
             return Byte.parseByte(s);
@@ -110,7 +110,7 @@ public class JspRuntimeLibrary {
     }
 
     public static char coerceToChar(String s) {
-        if (s == null || s.length() == 0) {
+        if (s == null || s.isEmpty()) {
             return (char) 0;
         } else {
             return s.charAt(0);
@@ -118,7 +118,7 @@ public class JspRuntimeLibrary {
     }
 
     public static double coerceToDouble(String s) {
-        if (s == null || s.length() == 0) {
+        if (s == null || s.isEmpty()) {
             return 0;
         } else {
             return Double.parseDouble(s);
@@ -126,7 +126,7 @@ public class JspRuntimeLibrary {
     }
 
     public static float coerceToFloat(String s) {
-        if (s == null || s.length() == 0) {
+        if (s == null || s.isEmpty()) {
             return 0;
         } else {
             return Float.parseFloat(s);
@@ -134,7 +134,7 @@ public class JspRuntimeLibrary {
     }
 
     public static int coerceToInt(String s) {
-        if (s == null || s.length() == 0) {
+        if (s == null || s.isEmpty()) {
             return 0;
         } else {
             return Integer.parseInt(s);
@@ -142,7 +142,7 @@ public class JspRuntimeLibrary {
     }
 
     public static short coerceToShort(String s) {
-        if (s == null || s.length() == 0) {
+        if (s == null || s.isEmpty()) {
             return (short) 0;
         } else {
             return Short.parseShort(s);
@@ -150,7 +150,7 @@ public class JspRuntimeLibrary {
     }
 
     public static long coerceToLong(String s) {
-        if (s == null || s.length() == 0) {
+        if (s == null || s.isEmpty()) {
             return 0;
         } else {
             return Long.parseLong(s);
@@ -159,7 +159,7 @@ public class JspRuntimeLibrary {
 
     public static Object coerce(String s, Class<?> target) {
 
-        boolean isNullOrEmpty = (s == null || s.length() == 0);
+        boolean isNullOrEmpty = (s == null || s.isEmpty());
 
         if (target == Boolean.class) {
             if (isNullOrEmpty) {
@@ -231,43 +231,43 @@ public class JspRuntimeLibrary {
             } else if (t.equals(Boolean.class) || t.equals(Boolean.TYPE)) {
                 return Boolean.valueOf(s);
             } else if (t.equals(Byte.class) || t.equals(Byte.TYPE)) {
-                if (s.length() == 0) {
+                if (s.isEmpty()) {
                     return Byte.valueOf((byte) 0);
                 } else {
                     return Byte.valueOf(s);
                 }
             } else if (t.equals(Character.class) || t.equals(Character.TYPE)) {
-                if (s.length() == 0) {
+                if (s.isEmpty()) {
                     return Character.valueOf((char) 0);
                 } else {
                     return Character.valueOf(s.charAt(0));
                 }
             } else if (t.equals(Double.class) || t.equals(Double.TYPE)) {
-                if (s.length() == 0) {
+                if (s.isEmpty()) {
                     return Double.valueOf(0);
                 } else {
                     return Double.valueOf(s);
                 }
             } else if (t.equals(Integer.class) || t.equals(Integer.TYPE)) {
-                if (s.length() == 0) {
+                if (s.isEmpty()) {
                     return Integer.valueOf(0);
                 } else {
                     return Integer.valueOf(s);
                 }
             } else if (t.equals(Float.class) || t.equals(Float.TYPE)) {
-                if (s.length() == 0) {
+                if (s.isEmpty()) {
                     return Float.valueOf(0);
                 } else {
                     return Float.valueOf(s);
                 }
             } else if (t.equals(Long.class) || t.equals(Long.TYPE)) {
-                if (s.length() == 0) {
+                if (s.isEmpty()) {
                     return Long.valueOf(0);
                 } else {
                     return Long.valueOf(s);
                 }
             } else if (t.equals(Short.class) || t.equals(Short.TYPE)) {
-                if (s.length() == 0) {
+                if (s.isEmpty()) {
                     return Short.valueOf((short) 0);
                 } else {
                     return Short.valueOf(s);
@@ -309,7 +309,7 @@ public class JspRuntimeLibrary {
             } else {
                 java.beans.BeanInfo info = 
java.beans.Introspector.getBeanInfo(bean.getClass());
                 if (info != null) {
-                    java.beans.PropertyDescriptor pd[] = 
info.getPropertyDescriptors();
+                    java.beans.PropertyDescriptor[] pd = 
info.getPropertyDescriptors();
                     for (java.beans.PropertyDescriptor propertyDescriptor : 
pd) {
                         if (propertyDescriptor.getName().equals(prop)) {
                             method = propertyDescriptor.getWriteMethod();
@@ -337,12 +337,12 @@ public class JspRuntimeLibrary {
                         createTypedArray(prop, bean, method, values, t, 
propertyEditorClass);
                     }
                 } else {
-                    if (value == null || (param != null && value.equals(""))) {
+                    if (value == null || (param != null && value.isEmpty())) {
                         return;
                     }
                     Object oval = convert(prop, value, type, 
propertyEditorClass);
                     if (oval != null) {
-                        method.invoke(bean, new Object[] { oval });
+                        method.invoke(bean, oval);
                     }
                 }
             }
@@ -568,7 +568,7 @@ public class JspRuntimeLibrary {
         if (o == null) {
             throw new 
JasperException(Localizer.getMessage("jsp.error.beans.nullbean"));
         }
-        Object value = null;
+        Object value;
         try {
             Method method = getReadMethod(o.getClass(), prop);
             value = method.invoke(o, (Object[]) null);
@@ -585,8 +585,8 @@ public class JspRuntimeLibrary {
             ProtectedFunctionMapper functionMapper) throws JasperException {
         try {
             Method method = getWriteMethod(bean.getClass(), prop);
-            method.invoke(bean, new Object[] { 
PageContextImpl.proprietaryEvaluate(expression,
-                    method.getParameterTypes()[0], pageContext, 
functionMapper) });
+            method.invoke(bean, PageContextImpl.proprietaryEvaluate(expression,
+                    method.getParameterTypes()[0], pageContext, 
functionMapper));
         } catch (Exception ex) {
             Throwable thr = ExceptionUtils.unwrapInvocationTargetException(ex);
             ExceptionUtils.handleThrowable(thr);
@@ -597,7 +597,7 @@ public class JspRuntimeLibrary {
     public static void handleSetProperty(Object bean, String prop, Object 
value) throws JasperException {
         try {
             Method method = getWriteMethod(bean.getClass(), prop);
-            method.invoke(bean, new Object[] { value });
+            method.invoke(bean, value);
         } catch (Exception ex) {
             Throwable thr = ExceptionUtils.unwrapInvocationTargetException(ex);
             ExceptionUtils.handleThrowable(thr);
@@ -608,7 +608,7 @@ public class JspRuntimeLibrary {
     public static void handleSetProperty(Object bean, String prop, int value) 
throws JasperException {
         try {
             Method method = getWriteMethod(bean.getClass(), prop);
-            method.invoke(bean, new Object[] { Integer.valueOf(value) });
+            method.invoke(bean, Integer.valueOf(value));
         } catch (Exception ex) {
             Throwable thr = ExceptionUtils.unwrapInvocationTargetException(ex);
             ExceptionUtils.handleThrowable(thr);
@@ -619,7 +619,7 @@ public class JspRuntimeLibrary {
     public static void handleSetProperty(Object bean, String prop, short 
value) throws JasperException {
         try {
             Method method = getWriteMethod(bean.getClass(), prop);
-            method.invoke(bean, new Object[] { Short.valueOf(value) });
+            method.invoke(bean, Short.valueOf(value));
         } catch (Exception ex) {
             Throwable thr = ExceptionUtils.unwrapInvocationTargetException(ex);
             ExceptionUtils.handleThrowable(thr);
@@ -630,7 +630,7 @@ public class JspRuntimeLibrary {
     public static void handleSetProperty(Object bean, String prop, long value) 
throws JasperException {
         try {
             Method method = getWriteMethod(bean.getClass(), prop);
-            method.invoke(bean, new Object[] { Long.valueOf(value) });
+            method.invoke(bean, Long.valueOf(value));
         } catch (Exception ex) {
             Throwable thr = ExceptionUtils.unwrapInvocationTargetException(ex);
             ExceptionUtils.handleThrowable(thr);
@@ -641,7 +641,7 @@ public class JspRuntimeLibrary {
     public static void handleSetProperty(Object bean, String prop, double 
value) throws JasperException {
         try {
             Method method = getWriteMethod(bean.getClass(), prop);
-            method.invoke(bean, new Object[] { Double.valueOf(value) });
+            method.invoke(bean, Double.valueOf(value));
         } catch (Exception ex) {
             Throwable thr = ExceptionUtils.unwrapInvocationTargetException(ex);
             ExceptionUtils.handleThrowable(thr);
@@ -652,7 +652,7 @@ public class JspRuntimeLibrary {
     public static void handleSetProperty(Object bean, String prop, float 
value) throws JasperException {
         try {
             Method method = getWriteMethod(bean.getClass(), prop);
-            method.invoke(bean, new Object[] { Float.valueOf(value) });
+            method.invoke(bean, Float.valueOf(value));
         } catch (Exception ex) {
             Throwable thr = ExceptionUtils.unwrapInvocationTargetException(ex);
             ExceptionUtils.handleThrowable(thr);
@@ -663,7 +663,7 @@ public class JspRuntimeLibrary {
     public static void handleSetProperty(Object bean, String prop, char value) 
throws JasperException {
         try {
             Method method = getWriteMethod(bean.getClass(), prop);
-            method.invoke(bean, new Object[] { Character.valueOf(value) });
+            method.invoke(bean, Character.valueOf(value));
         } catch (Exception ex) {
             Throwable thr = ExceptionUtils.unwrapInvocationTargetException(ex);
             ExceptionUtils.handleThrowable(thr);
@@ -674,7 +674,7 @@ public class JspRuntimeLibrary {
     public static void handleSetProperty(Object bean, String prop, byte value) 
throws JasperException {
         try {
             Method method = getWriteMethod(bean.getClass(), prop);
-            method.invoke(bean, new Object[] { Byte.valueOf(value) });
+            method.invoke(bean, Byte.valueOf(value));
         } catch (Exception ex) {
             Throwable thr = ExceptionUtils.unwrapInvocationTargetException(ex);
             ExceptionUtils.handleThrowable(thr);
@@ -685,7 +685,7 @@ public class JspRuntimeLibrary {
     public static void handleSetProperty(Object bean, String prop, boolean 
value) throws JasperException {
         try {
             Method method = getWriteMethod(bean.getClass(), prop);
-            method.invoke(bean, new Object[] { Boolean.valueOf(value) });
+            method.invoke(bean, Boolean.valueOf(value));
         } catch (Exception ex) {
             Throwable thr = ExceptionUtils.unwrapInvocationTargetException(ex);
             ExceptionUtils.handleThrowable(thr);
@@ -701,10 +701,10 @@ public class JspRuntimeLibrary {
      * @return the capitalized string
      */
     public static String capitalize(String name) {
-        if (name == null || name.length() == 0) {
+        if (name == null || name.isEmpty()) {
             return name;
         }
-        char chars[] = name.toCharArray();
+        char[] chars = name.toCharArray();
         chars[0] = Character.toUpperCase(chars[0]);
         return new String(chars);
     }
@@ -714,7 +714,7 @@ public class JspRuntimeLibrary {
         Class<?> type = null;
         if (GRAAL) {
             String setter = "set" + capitalize(prop);
-            Method methods[] = beanClass.getMethods();
+            Method[] methods = beanClass.getMethods();
             for (Method method : methods) {
                 if (setter.equals(method.getName())) {
                     return method;
@@ -723,7 +723,7 @@ public class JspRuntimeLibrary {
         } else {
             try {
                 java.beans.BeanInfo info = 
java.beans.Introspector.getBeanInfo(beanClass);
-                java.beans.PropertyDescriptor pd[] = 
info.getPropertyDescriptors();
+                java.beans.PropertyDescriptor[] pd = 
info.getPropertyDescriptors();
                 for (java.beans.PropertyDescriptor propertyDescriptor : pd) {
                     if (propertyDescriptor.getName().equals(prop)) {
                         result = propertyDescriptor.getWriteMethod();
@@ -752,7 +752,7 @@ public class JspRuntimeLibrary {
         Class<?> type = null;
         if (GRAAL) {
             String setter = "get" + capitalize(prop);
-            Method methods[] = beanClass.getMethods();
+            Method[] methods = beanClass.getMethods();
             for (Method method : methods) {
                 if (setter.equals(method.getName())) {
                     return method;
@@ -761,7 +761,7 @@ public class JspRuntimeLibrary {
         } else {
             try {
                 java.beans.BeanInfo info = 
java.beans.Introspector.getBeanInfo(beanClass);
-                java.beans.PropertyDescriptor pd[] = 
info.getPropertyDescriptors();
+                java.beans.PropertyDescriptor[] pd = 
info.getPropertyDescriptors();
                 for (java.beans.PropertyDescriptor propertyDescriptor : pd) {
                     if (propertyDescriptor.getName().equals(prop)) {
                         result = propertyDescriptor.getReadMethod();
@@ -794,7 +794,7 @@ public class JspRuntimeLibrary {
             pe.setAsText(attrValue);
             return pe.getValue();
         } catch (Exception ex) {
-            if (attrValue.length() == 0) {
+            if (attrValue.isEmpty()) {
                 return null;
             } else {
                 throw new 
JasperException(Localizer.getMessage("jsp.error.beans.property.conversion", 
attrValue,
@@ -810,14 +810,14 @@ public class JspRuntimeLibrary {
             if (propEditor != null) {
                 propEditor.setAsText(attrValue);
                 return propEditor.getValue();
-            } else if (attrValue.length() == 0) {
+            } else if (attrValue.isEmpty()) {
                 return null;
             } else {
                 throw new IllegalArgumentException(
                         
Localizer.getMessage("jsp.error.beans.propertyeditor.notregistered"));
             }
         } catch (IllegalArgumentException ex) {
-            if (attrValue.length() == 0) {
+            if (attrValue.isEmpty()) {
                 return null;
             } else {
                 throw new 
JasperException(Localizer.getMessage("jsp.error.beans.property.conversion", 
attrValue,
diff --git a/java/org/apache/jasper/runtime/JspWriterImpl.java 
b/java/org/apache/jasper/runtime/JspWriterImpl.java
index ca53a18b7f..9b34ac7023 100644
--- a/java/org/apache/jasper/runtime/JspWriterImpl.java
+++ b/java/org/apache/jasper/runtime/JspWriterImpl.java
@@ -37,7 +37,7 @@ public class JspWriterImpl extends JspWriter {
 
     private Writer out;
     private ServletResponse response;
-    private char cb[];
+    private char[] cb;
     private int nextChar;
     private boolean flushed = false;
     private boolean closed = false;
@@ -206,14 +206,11 @@ public class JspWriterImpl extends JspWriter {
      * to print a stack trace.
      */
     private static int min(int a, int b) {
-        if (a < b) {
-            return a;
-        }
-        return b;
+        return Math.min(a, b);
     }
 
     @Override
-    public void write(char cbuf[], int off, int len) throws IOException {
+    public void write(char[] cbuf, int off, int len) throws IOException {
         ensureOpen();
 
         if (bufferSize == 0) {
@@ -261,7 +258,7 @@ public class JspWriterImpl extends JspWriter {
     }
 
     @Override
-    public void write(char buf[]) throws IOException {
+    public void write(char[] buf) throws IOException {
         write(buf, 0, buf.length);
     }
 
@@ -329,7 +326,7 @@ public class JspWriterImpl extends JspWriter {
     }
 
     @Override
-    public void print(char s[]) throws IOException {
+    public void print(char[] s) throws IOException {
         write(s);
     }
 
@@ -390,7 +387,7 @@ public class JspWriterImpl extends JspWriter {
     }
 
     @Override
-    public void println(char x[]) throws IOException {
+    public void println(char[] x) throws IOException {
         print(x);
         println();
     }
diff --git a/java/org/apache/jasper/runtime/PageContextImpl.java 
b/java/org/apache/jasper/runtime/PageContextImpl.java
index 8724ef4641..1c266d0ccf 100644
--- a/java/org/apache/jasper/runtime/PageContextImpl.java
+++ b/java/org/apache/jasper/runtime/PageContextImpl.java
@@ -162,8 +162,7 @@ public class PageContextImpl extends PageContext {
         try {
             ((JspWriterImpl) out).flushBuffer();
         } catch (IOException ex) {
-            IllegalStateException ise = new 
IllegalStateException(Localizer.getMessage("jsp.error.flush"), ex);
-            throw ise;
+            throw new 
IllegalStateException(Localizer.getMessage("jsp.error.flush"), ex);
         } finally {
             servlet = null;
             config = null;
@@ -575,7 +574,7 @@ public class PageContextImpl extends PageContext {
             throw new 
NullPointerException(Localizer.getMessage("jsp.error.page.nullThrowable"));
         }
 
-        if (errorPageURL != null && !errorPageURL.equals("")) {
+        if (errorPageURL != null && !errorPageURL.isEmpty()) {
 
             /*
              * Set request attributes. Do not set the 
javax.servlet.error.exception attribute here (instead, set in the
@@ -619,20 +618,18 @@ public class PageContextImpl extends PageContext {
             if (t instanceof ServletException) {
                 throw (ServletException) t;
             }
-            if (t instanceof RuntimeException) {
-                throw (RuntimeException) t;
-            }
-
             Throwable rootCause = null;
             if (t instanceof JspException || t instanceof ELException ||
                     t instanceof javax.servlet.jsp.el.ELException) {
                 rootCause = t.getCause();
             }
-
             if (rootCause != null) {
                 throw new ServletException(t.getClass().getName() + ": " + 
t.getMessage(), rootCause);
             }
-
+            // ELException is a runtime exception
+            if (t instanceof RuntimeException) {
+                throw (RuntimeException) t;
+            }
             throw new ServletException(t);
         }
     }
diff --git a/java/org/apache/jasper/runtime/ServletResponseWrapperInclude.java 
b/java/org/apache/jasper/runtime/ServletResponseWrapperInclude.java
index 4708127dcc..046c90c45a 100644
--- a/java/org/apache/jasper/runtime/ServletResponseWrapperInclude.java
+++ b/java/org/apache/jasper/runtime/ServletResponseWrapperInclude.java
@@ -68,6 +68,7 @@ public class ServletResponseWrapperInclude extends 
HttpServletResponseWrapper {
         try {
             jspWriter.clearBuffer();
         } catch (IOException ioe) {
+            // Ignore
         }
     }
 }
diff --git a/java/org/apache/jasper/runtime/TagHandlerPool.java 
b/java/org/apache/jasper/runtime/TagHandlerPool.java
index f8a5e334ae..5b58a27de0 100644
--- a/java/org/apache/jasper/runtime/TagHandlerPool.java
+++ b/java/org/apache/jasper/runtime/TagHandlerPool.java
@@ -51,7 +51,6 @@ public class TagHandlerPool {
                 result = (TagHandlerPool) c.getConstructor().newInstance();
             } catch (Exception e) {
                 
LogFactory.getLog(TagHandlerPool.class).info(Localizer.getMessage("jsp.error.tagHandlerPool"),
 e);
-                result = null;
             }
         }
         if (result == null) {
@@ -69,7 +68,7 @@ public class TagHandlerPool {
             try {
                 maxSize = Integer.parseInt(maxSizeS);
             } catch (Exception ex) {
-                maxSize = -1;
+                // Ignore
             }
         }
         if (maxSize < 0) {
diff --git a/java/org/apache/jasper/servlet/JasperLoader.java 
b/java/org/apache/jasper/servlet/JasperLoader.java
index ec7e84d621..41660bdaf1 100644
--- a/java/org/apache/jasper/servlet/JasperLoader.java
+++ b/java/org/apache/jasper/servlet/JasperLoader.java
@@ -78,7 +78,7 @@ public class JasperLoader extends URLClassLoader {
     @Override
     public synchronized Class<?> loadClass(final String name, boolean resolve) 
throws ClassNotFoundException {
 
-        Class<?> clazz = null;
+        Class<?> clazz;
 
         // (0) Check our previously loaded class cache
         clazz = findLoadedClass(name);
diff --git a/java/org/apache/jasper/servlet/JspCServletContext.java 
b/java/org/apache/jasper/servlet/JspCServletContext.java
index c1a7b1d0c9..b92f40e981 100644
--- a/java/org/apache/jasper/servlet/JspCServletContext.java
+++ b/java/org/apache/jasper/servlet/JspCServletContext.java
@@ -104,13 +104,13 @@ public class JspCServletContext implements ServletContext 
{
     /**
      * Merged web.xml for the application.
      */
-    private WebXml webXml;
+    private final WebXml webXml;
 
 
     private List<URL> resourceJARs;
 
 
-    private JspConfigDescriptor jspConfigDescriptor;
+    private final JspConfigDescriptor jspConfigDescriptor;
 
 
     /**
@@ -325,7 +325,7 @@ public class JspCServletContext implements ServletContext {
         // Strip leading '/'
         path = path.substring(1);
 
-        URL url = null;
+        URL url;
         try {
             URI uri = new URI(myResourceBaseURL.toExternalForm() + path);
             url = uri.toURL();
@@ -380,7 +380,7 @@ public class JspCServletContext implements ServletContext {
         if (basePath != null) {
             File theBaseDir = new File(basePath);
             if (theBaseDir.isDirectory()) {
-                String theFiles[] = theBaseDir.list();
+                String[] theFiles = theBaseDir.list();
                 if (theFiles != null) {
                     for (String theFile : theFiles) {
                         File testFile = new File(basePath + File.separator + 
theFile);
diff --git a/java/org/apache/jasper/servlet/JspServlet.java 
b/java/org/apache/jasper/servlet/JspServlet.java
index 8f2b15f73b..1b9d7c8688 100644
--- a/java/org/apache/jasper/servlet/JspServlet.java
+++ b/java/org/apache/jasper/servlet/JspServlet.java
@@ -96,10 +96,10 @@ public class JspServlet extends HttpServlet implements 
PeriodicEventListener {
                 Object[] args = { config, context };
                 options = (Options) ctor.newInstance(args);
             } catch (Throwable e) {
-                e = ExceptionUtils.unwrapInvocationTargetException(e);
-                ExceptionUtils.handleThrowable(e);
+                Throwable throwable = 
ExceptionUtils.unwrapInvocationTargetException(e);
+                ExceptionUtils.handleThrowable(throwable);
                 // Need to localize this.
-                
log.warn(Localizer.getMessage("jsp.warning.engineOptionsClass", 
engineOptionsName), e);
+                
log.warn(Localizer.getMessage("jsp.warning.engineOptionsClass", 
engineOptionsName), throwable);
                 // Use the default Options implementation
                 options = new EmbeddedServletOptions(config, context);
             }
diff --git a/java/org/apache/jasper/servlet/JspServletWrapper.java 
b/java/org/apache/jasper/servlet/JspServletWrapper.java
index db5319f2da..076426f2c9 100644
--- a/java/org/apache/jasper/servlet/JspServletWrapper.java
+++ b/java/org/apache/jasper/servlet/JspServletWrapper.java
@@ -112,9 +112,9 @@ public class JspServletWrapper {
         this.config = config;
         this.options = options;
         this.jspUri = jspUri;
-        unloadByCount = options.getMaxLoadedJsps() > 0 ? true : false;
-        unloadByIdle = options.getJspIdleTimeout() > 0 ? true : false;
-        unloadAllowed = unloadByCount || unloadByIdle ? true : false;
+        unloadByCount = options.getMaxLoadedJsps() > 0;
+        unloadByIdle = options.getJspIdleTimeout() > 0;
+        unloadAllowed = unloadByCount || unloadByIdle;
         ctxt = new JspCompilationContext(jspUri, options, 
config.getServletContext(), this, rctxt);
     }
 
@@ -129,9 +129,9 @@ public class JspServletWrapper {
         this.options = options;
         this.jspUri = tagFilePath;
         this.tripCount = 0;
-        unloadByCount = options.getMaxLoadedJsps() > 0 ? true : false;
-        unloadByIdle = options.getJspIdleTimeout() > 0 ? true : false;
-        unloadAllowed = unloadByCount || unloadByIdle ? true : false;
+        unloadByCount = options.getMaxLoadedJsps() > 0;
+        unloadByIdle = options.getJspIdleTimeout() > 0;
+        unloadAllowed = unloadByCount || unloadByIdle;
         ctxt = new JspCompilationContext(jspUri, tagInfo, options, 
servletContext, this, rctxt, tagJar);
     }
 
diff --git a/java/org/apache/jasper/servlet/TldScanner.java 
b/java/org/apache/jasper/servlet/TldScanner.java
index 2379955ad8..8904de28ce 100644
--- a/java/org/apache/jasper/servlet/TldScanner.java
+++ b/java/org/apache/jasper/servlet/TldScanner.java
@@ -192,7 +192,6 @@ public class TldScanner {
                 }
             } else {
                 log.warn(Localizer.getMessage(MSG + 
".webxmlFailPathDoesNotExist", resourcePath, taglibURI));
-                continue;
             }
         }
     }
diff --git a/java/org/apache/jasper/tagplugins/jstl/Util.java 
b/java/org/apache/jasper/tagplugins/jstl/Util.java
index 33a7473a6f..8935c6ab32 100644
--- a/java/org/apache/jasper/tagplugins/jstl/Util.java
+++ b/java/org/apache/jasper/tagplugins/jstl/Util.java
@@ -373,7 +373,7 @@ public class Util {
             if (isWriterUsed) {
                 return sw.toString();
             } else if (isStreamUsed) {
-                if (this.charEncoding != null && 
!this.charEncoding.equals("")) {
+                if (this.charEncoding != null && !this.charEncoding.isEmpty()) 
{
                     return bos.toString(charEncoding);
                 } else {
                     return bos.toString("ISO-8859-1");
diff --git a/java/org/apache/jasper/tagplugins/jstl/core/ForEach.java 
b/java/org/apache/jasper/tagplugins/jstl/core/ForEach.java
index c62283abfe..87c4b87854 100644
--- a/java/org/apache/jasper/tagplugins/jstl/core/ForEach.java
+++ b/java/org/apache/jasper/tagplugins/jstl/core/ForEach.java
@@ -26,7 +26,7 @@ public final class ForEach implements TagPlugin {
     @Override
     public void doTag(TagPluginContext ctxt) {
 
-        String index = null;
+        String index;
 
         boolean hasVarStatus = ctxt.isAttributeSpecified("varStatus");
         if (hasVarStatus) {
diff --git a/java/org/apache/jasper/tagplugins/jstl/core/Out.java 
b/java/org/apache/jasper/tagplugins/jstl/core/Out.java
index aa324db222..a4590bcc0a 100644
--- a/java/org/apache/jasper/tagplugins/jstl/core/Out.java
+++ b/java/org/apache/jasper/tagplugins/jstl/core/Out.java
@@ -33,9 +33,8 @@ public final class Out implements TagPlugin {
 
         //these two data member are to indicate
         //whether the corresponding attribute is specified
-        boolean hasDefault=false, hasEscapeXml=false;
-        hasDefault = ctxt.isAttributeSpecified("default");
-        hasEscapeXml = ctxt.isAttributeSpecified("escapeXml");
+        boolean hasDefault = ctxt.isAttributeSpecified("default");
+        boolean hasEscapeXml = ctxt.isAttributeSpecified("escapeXml");
 
         //strValName, strEscapeXmlName & strDefName are two variables' name
         //standing for value, escapeXml and default attribute
diff --git a/java/org/apache/jasper/tagplugins/jstl/core/Set.java 
b/java/org/apache/jasper/tagplugins/jstl/core/Set.java
index 81dbf797a3..8a64a1df74 100644
--- a/java/org/apache/jasper/tagplugins/jstl/core/Set.java
+++ b/java/org/apache/jasper/tagplugins/jstl/core/Set.java
@@ -25,20 +25,17 @@ public class Set implements TagPlugin {
     @Override
     public void doTag(TagPluginContext ctxt) {
 
-        //the flags to indicate whether the attributes have been specified
-        boolean hasValue = false, hasVar = false, hasScope = false,
-        hasTarget = false;
-
         //the scope name
         String strScope;
         //the id of the scope
         int iScope;
 
+        //the flags to indicate whether the attributes have been specified
         //initialize the flags
-        hasValue = ctxt.isAttributeSpecified("value");
-        hasVar = ctxt.isAttributeSpecified("var");
-        hasScope = ctxt.isAttributeSpecified("scope");
-        hasTarget = ctxt.isAttributeSpecified("target");
+        boolean hasValue = ctxt.isAttributeSpecified("value");
+        boolean hasVar = ctxt.isAttributeSpecified("var");
+        boolean hasScope = ctxt.isAttributeSpecified("scope");
+        boolean hasTarget = ctxt.isAttributeSpecified("target");
 
         //the temp variables name
         String resultName = ctxt.getTemporaryVariableName();


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


Reply via email to