This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new 92e7e3b788 Cleanups for EL and JSP
92e7e3b788 is described below
commit 92e7e3b788eae535f2fc61cc3a3fe8e17e8404e4
Author: remm <[email protected]>
AuthorDate: Thu Mar 20 22:10:45 2025 +0100
Cleanups for EL and JSP
---
java/org/apache/el/MethodExpressionImpl.java | 2 +-
java/org/apache/el/lang/ELSupport.java | 6 +++---
java/org/apache/el/parser/AstValue.java | 9 ++++++---
java/org/apache/el/util/ExceptionUtils.java | 6 +++---
java/org/apache/el/util/ReflectionUtil.java | 3 +--
java/org/apache/jasper/Constants.java | 6 +-----
java/org/apache/jasper/EmbeddedServletOptions.java | 4 ++--
java/org/apache/jasper/JspCompilationContext.java | 4 ++--
java/org/apache/jasper/compiler/Compiler.java | 23 +++++++++++-----------
java/org/apache/jasper/compiler/ELNode.java | 2 +-
.../apache/jasper/compiler/ErrorDispatcher.java | 2 +-
java/org/apache/jasper/compiler/Generator.java | 10 +++++-----
.../apache/jasper/compiler/JspDocumentParser.java | 8 ++++----
java/org/apache/jasper/compiler/JspReader.java | 4 ++--
.../apache/jasper/compiler/JspRuntimeContext.java | 6 +++---
java/org/apache/jasper/compiler/Mark.java | 2 +-
java/org/apache/jasper/compiler/Node.java | 6 +++---
java/org/apache/jasper/compiler/PageDataImpl.java | 2 +-
java/org/apache/jasper/compiler/PageInfo.java | 2 +-
java/org/apache/jasper/compiler/Parser.java | 7 +++----
.../apache/jasper/compiler/ParserController.java | 4 ++--
java/org/apache/jasper/compiler/SmapStratum.java | 2 +-
.../jasper/compiler/StringInterpreterFactory.java | 2 +-
.../apache/jasper/compiler/TagFileProcessor.java | 4 ++--
java/org/apache/jasper/compiler/TldCache.java | 2 +-
java/org/apache/jasper/compiler/Validator.java | 4 ++--
.../compiler/tagplugin/TagPluginContext.java | 6 +++---
java/org/apache/jasper/el/JasperELResolver.java | 2 +-
.../org/apache/jasper/runtime/BodyContentImpl.java | 6 +++---
java/org/apache/jasper/runtime/JspWriterImpl.java | 6 +++---
.../apache/jasper/servlet/JasperInitializer.java | 2 +-
.../apache/jasper/servlet/JspCServletContext.java | 6 +-----
java/org/apache/jasper/servlet/JspServlet.java | 4 ++--
.../apache/jasper/servlet/JspServletWrapper.java | 15 +++++++-------
.../jasper/tagplugins/jstl/core/ForEach.java | 2 +-
.../apache/jasper/tagplugins/jstl/core/Param.java | 2 +-
.../apache/jasper/tagplugins/jstl/core/Set.java | 2 +-
.../apache/jasper/tagplugins/jstl/core/When.java | 2 +-
38 files changed, 90 insertions(+), 97 deletions(-)
diff --git a/java/org/apache/el/MethodExpressionImpl.java
b/java/org/apache/el/MethodExpressionImpl.java
index c9174d5796..4a0bac0aa7 100644
--- a/java/org/apache/el/MethodExpressionImpl.java
+++ b/java/org/apache/el/MethodExpressionImpl.java
@@ -53,7 +53,7 @@ import org.apache.el.util.ReflectionUtil;
* This provides the <code>base</code> object on which the method appears. If
the <code>base</code> object is null, a
* <code>NullPointerException</code> must be thrown. At the last resolution,
the final <code>property</code> is then
* coerced to a <code>String</code>, which provides the name of the method to
be found. A method matching the name and
- * expected parameters provided at parse time is found and it is either
queried or invoked (depending on the method
+ * expected parameters provided at parse time is found, and it is either
queried or invoked (depending on the method
* called on this <code>MethodExpression</code>).
* </p>
* <p>
diff --git a/java/org/apache/el/lang/ELSupport.java
b/java/org/apache/el/lang/ELSupport.java
index 2b22cd8a02..7ae561555a 100644
--- a/java/org/apache/el/lang/ELSupport.java
+++ b/java/org/apache/el/lang/ELSupport.java
@@ -190,8 +190,8 @@ public class ELSupport {
}
/*
- * Going to have to have some casts /raw types somewhere so doing it here
keeps them all in one place. There might
- * be a neater / better solution but I couldn't find it.
+ * Going to have some casts /raw types somewhere so doing it here keeps
them all in one place. There might
+ * be a neater / better solution, but I couldn't find it.
*/
@SuppressWarnings("unchecked")
public static Enum<?> coerceToEnum(final ELContext ctx, final Object obj,
@@ -731,6 +731,6 @@ public class ELSupport {
private ELSupport() {
- // Uility class - hide default constructor;
+ // Utility class - hide default constructor;
}
}
diff --git a/java/org/apache/el/parser/AstValue.java
b/java/org/apache/el/parser/AstValue.java
index 63abe1de49..7e32a5cfb6 100644
--- a/java/org/apache/el/parser/AstValue.java
+++ b/java/org/apache/el/parser/AstValue.java
@@ -98,7 +98,8 @@ public final class AstValue extends SimpleNode {
i += 2;
if (property == null) {
- throw new
PropertyNotFoundException(MessageFactory.get("error.unreachable.property",
property));
+ throw new PropertyNotFoundException(
+ MessageFactory.get("error.unreachable.property",
this.children[i].getImage()));
}
} else if (i + 1 < propCount) {
// Object with property not at end of expression
@@ -114,11 +115,13 @@ public final class AstValue extends SimpleNode {
i++;
if (property == null) {
- throw new
PropertyNotFoundException(MessageFactory.get("error.unreachable.property",
property));
+ throw new PropertyNotFoundException(
+ MessageFactory.get("error.unreachable.property",
this.children[i].getImage()));
}
}
if (base == null) {
- throw new
PropertyNotFoundException(MessageFactory.get("error.unreachable.property",
property));
+ throw new PropertyNotFoundException(
+ MessageFactory.get("error.unreachable.property",
this.children[i].getImage()));
}
}
diff --git a/java/org/apache/el/util/ExceptionUtils.java
b/java/org/apache/el/util/ExceptionUtils.java
index 798fd36a40..2314b1a547 100644
--- a/java/org/apache/el/util/ExceptionUtils.java
+++ b/java/org/apache/el/util/ExceptionUtils.java
@@ -17,7 +17,7 @@
package org.apache.el.util;
/**
- * Utilities for handling Throwables and Exceptions.
+ * Utilities for handling Throwable and Exceptions.
*/
/*
* Copied from o.a.t.u.ExceptionUtils
@@ -45,8 +45,8 @@ public class ExceptionUtils {
/**
- * NO-OP method provided to enable simple pre-loading of this class. Since
the class is used extensively in error
- * handling, it is prudent to pre-load it to avoid any failure to load
this class masking the true problem during
+ * NO-OP method provided to enable simple preloading of this class. Since
the class is used extensively in error
+ * handling, it is prudent to preload it to avoid any failure to load this
class masking the true problem during
* error handling.
*/
public static void preload() {
diff --git a/java/org/apache/el/util/ReflectionUtil.java
b/java/org/apache/el/util/ReflectionUtil.java
index 2e2540c483..fce0396320 100644
--- a/java/org/apache/el/util/ReflectionUtil.java
+++ b/java/org/apache/el/util/ReflectionUtil.java
@@ -427,8 +427,7 @@ public class ReflectionUtil {
* This class duplicates code in jakarta.el.Util. When making changes keep
the code in sync.
*/
private static boolean isCoercibleFrom(EvaluationContext ctx, Object src,
Class<?> target) {
- // TODO: This isn't pretty but it works. Significant refactoring would
- // be required to avoid the exception.
+ // TODO: This isn't pretty but it works. Significant refactoring would
be required to avoid the exception.
try {
ELSupport.coerceToType(ctx, src, target);
} catch (ELException e) {
diff --git a/java/org/apache/jasper/Constants.java
b/java/org/apache/jasper/Constants.java
index dcc10f6232..04ee2c5bdf 100644
--- a/java/org/apache/jasper/Constants.java
+++ b/java/org/apache/jasper/Constants.java
@@ -16,8 +16,6 @@
*/
package org.apache.jasper;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
/**
@@ -35,10 +33,8 @@ public class Constants {
/**
* These classes/packages are automatically imported by the generated code.
*/
- private static final String[] PRIVATE_STANDARD_IMPORTS =
- { "jakarta.servlet.*", "jakarta.servlet.http.*",
"jakarta.servlet.jsp.*" };
public static final List<String> STANDARD_IMPORTS =
-
Collections.unmodifiableList(Arrays.asList(PRIVATE_STANDARD_IMPORTS));
+ List.of("jakarta.servlet.*", "jakarta.servlet.http.*",
"jakarta.servlet.jsp.*");
/**
* Default size of the JSP buffer.
diff --git a/java/org/apache/jasper/EmbeddedServletOptions.java
b/java/org/apache/jasper/EmbeddedServletOptions.java
index 70630abf50..49ec95b63e 100644
--- a/java/org/apache/jasper/EmbeddedServletOptions.java
+++ b/java/org/apache/jasper/EmbeddedServletOptions.java
@@ -880,11 +880,11 @@ public final class EmbeddedServletOptions implements
Options {
}
}
- // Setup the global Tag Libraries location cache for this
+ // Set up the global Tag Libraries location cache for this
// web-application.
tldCache = TldCache.getInstance(context);
- // Setup the jsp config info for this web app.
+ // Set up the jsp config info for this web app.
jspConfig = new JspConfig(context);
// Create a Tag plugin instance
diff --git a/java/org/apache/jasper/JspCompilationContext.java
b/java/org/apache/jasper/JspCompilationContext.java
index 02d7d7c130..9eb8d8f307 100644
--- a/java/org/apache/jasper/JspCompilationContext.java
+++ b/java/org/apache/jasper/JspCompilationContext.java
@@ -43,7 +43,7 @@ import org.apache.tomcat.Jar;
import org.apache.tomcat.util.descriptor.tld.TldResourcePath;
/**
- * A place holder for various things that are used through out the JSP engine.
This is a per-request/per-context data
+ * A placeholder for various things that are used throughout the JSP engine.
This is a per-request/per-context data
* structure. Some of the instance variables are set at different points. Most
of the path-related stuff is here -
* mangling names, versions, dirs, loading resources and dealing with uris.
*
@@ -188,7 +188,7 @@ public class JspCompilationContext {
/**
* The output directory to generate code into. The output directory is
make up of the scratch directory, which is
- * provide in Options, plus the directory derived from the package name.
+ * provided in Options, plus the directory derived from the package name.
*
* @return the output directory in which the generated sources are placed
*/
diff --git a/java/org/apache/jasper/compiler/Compiler.java
b/java/org/apache/jasper/compiler/Compiler.java
index 905fab96e1..94eab9d081 100644
--- a/java/org/apache/jasper/compiler/Compiler.java
+++ b/java/org/apache/jasper/compiler/Compiler.java
@@ -108,9 +108,10 @@ public abstract class Compiler {
*/
protected Map<String,SmapStratum> generateJava() throws Exception {
- long t1, t2, t3, t4;
-
- t1 = t2 = t3 = t4 = 0;
+ long t1 = 0;
+ long t2 = 0;
+ long t3 = 0;
+ long t4;
if (log.isDebugEnabled()) {
t1 = System.currentTimeMillis();
@@ -244,9 +245,9 @@ public abstract class Compiler {
Generator.generate(writer, this, pageNodes);
}
- // The writer is only used during the compile, dereference
+ // The writer is only used during compile, dereference
// it in the JspCompilationContext when done to allow it
- // to be GC'd and save memory.
+ // to be GCed and save memory.
ctxt.setWriter(null);
if (log.isTraceEnabled()) {
@@ -276,7 +277,7 @@ public abstract class Compiler {
ctxt.getRuntimeContext().getSmaps().putAll(smaps);
}
- // If any proto type .java and .class files was generated,
+ // If any prototype .java and .class files was generated,
// the prototype .java may have been replaced by the current
// compilation (if the tag file is self referencing), but the
// .class file need to be removed, to make sure that javac would
@@ -288,7 +289,7 @@ public abstract class Compiler {
private ServletWriter setupContextWriter(String javaFileName) throws
FileNotFoundException, JasperException {
ServletWriter writer;
- // Setup the ServletWriter
+ // Set up the ServletWriter
String javaEncoding = ctxt.getOptions().getJavaEncoding();
OutputStreamWriter osw = null;
@@ -332,7 +333,7 @@ public abstract class Compiler {
}
/**
- * Compile the jsp file from the current engine context. As an side-
effect, tag files that are referenced by this
+ * Compile the jsp file from the current engine context. As a side effect,
tag files that are referenced by this
* page are also compiled.
*
* @param compileClass If true, generate both .java and .class file If
false, generate only .java file
@@ -346,7 +347,7 @@ public abstract class Compiler {
}
/**
- * Compile the jsp file from the current engine context. As an side-
effect, tag files that are referenced by this
+ * Compile the jsp file from the current engine context. As a side effect,
tag files that are referenced by this
* page are also compiled.
*
* @param compileClass If true, generate both .java and .class file If
false, generate only .java file
@@ -389,7 +390,7 @@ public abstract class Compiler {
}
// Make sure these object which are only used during the
// generation and compilation of the JSP page get
- // dereferenced so that they can be GC'd and reduce the
+ // dereferenced so that they can be GCed and reduce the
// memory footprint.
tfp = null;
errDispatcher = null;
@@ -416,7 +417,7 @@ public abstract class Compiler {
/**
* Determine if a compilation is necessary by checking the time stamp of
the JSP page with that of the corresponding
* .class or .java file. If the page has dependencies, the check is also
extended to its dependents, and so on. This
- * method can by overridden by a subclasses of Compiler.
+ * method can be overridden by a subclasses of Compiler.
*
* @param checkClass If true, check against .class file, if false, check
against .java file.
*
diff --git a/java/org/apache/jasper/compiler/ELNode.java
b/java/org/apache/jasper/compiler/ELNode.java
index a1568d484b..6730a59b5e 100644
--- a/java/org/apache/jasper/compiler/ELNode.java
+++ b/java/org/apache/jasper/compiler/ELNode.java
@@ -31,7 +31,7 @@ import org.apache.jasper.JasperException;
* @author Kin-man Chung
*/
-abstract class ELNode {
+public abstract class ELNode {
public abstract void accept(Visitor v) throws JasperException;
diff --git a/java/org/apache/jasper/compiler/ErrorDispatcher.java
b/java/org/apache/jasper/compiler/ErrorDispatcher.java
index 436ae5354a..16ec6b76dd 100644
--- a/java/org/apache/jasper/compiler/ErrorDispatcher.java
+++ b/java/org/apache/jasper/compiler/ErrorDispatcher.java
@@ -250,7 +250,7 @@ public class ErrorDispatcher {
file = where.getFile();
}
} else {
- // Get the context-relative resource path, so as to not
disclose any local file system details
+ // Get the context-relative resource path, to avoid disclosing
any local file system details
file = where.getFile();
}
line = where.getLineNumber();
diff --git a/java/org/apache/jasper/compiler/Generator.java
b/java/org/apache/jasper/compiler/Generator.java
index 8817380fbf..b7aab2f3af 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -2444,7 +2444,7 @@ class Generator {
// JspFragment, because a fragment is always scriptless.
// Thus, there is no need to save/ restore/ sync them.
// Note, that JspContextWrapper.syncFoo() methods will take
- // care of saving/ restoring/ sync'ing of JspContext
attributes.
+ // care of saving/ restoring/ syncing of JspContext attributes.
return;
}
@@ -2516,7 +2516,7 @@ class Generator {
// JspFragment, because a fragment is always scriptless.
// Thus, there is no need to save/ restore/ sync them.
// Note, that JspContextWrapper.syncFoo() methods will take
- // care of saving/ restoring/ sync'ing of JspContext
attributes.
+ // care of saving/ restoring/ syncing of JspContext attributes.
return;
}
@@ -2582,7 +2582,7 @@ class Generator {
// JspFragment, because a fragment is always scriptless.
// Thus, there is no need to save/ restore/ sync them.
// Note, that JspContextWrapper.syncFoo() methods will take
- // care of saving/ restoring/ sync'ing of JspContext
attributes.
+ // care of saving/ restoring/ syncing of JspContext attributes.
return;
}
@@ -2976,7 +2976,7 @@ class Generator {
fragmentHelperClass.closeFragment(fragment, methodNesting);
// XXX - Need to change pageContext to jspContext if
// we're not in a place where pageContext is defined (e.g.
- // in a fragment or in a tag file.
+ // in a fragment or in a tag file).
out.print("new " + fragmentHelperClass.getClassName() + "( " +
fragment.getId() + ", _jspx_page_context, " +
tagHandlerVar + ", " + pushBodyCountVar + ")");
}
@@ -3720,7 +3720,7 @@ class Generator {
/*
* For a CustomTag, the codes that are generated at the beginning of
the tag may not be in the same buffer as
* 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.
+ * correspond to any JSP lines, they should be null.
*/
private final Node node;
diff --git a/java/org/apache/jasper/compiler/JspDocumentParser.java
b/java/org/apache/jasper/compiler/JspDocumentParser.java
index 8cec660765..4cdad98e16 100644
--- a/java/org/apache/jasper/compiler/JspDocumentParser.java
+++ b/java/org/apache/jasper/compiler/JspDocumentParser.java
@@ -364,7 +364,7 @@ class JspDocumentParser extends DefaultHandler2 implements
TagConstants {
*
* The SAX does not call this method with all of the template text, but
may invoke this method with chunks of it.
* This is a problem when we try to determine if the text contains only
whitespaces, or when we are looking for an
- * EL expression string. Therefore it is necessary to buffer and
concatenate the chunks and process the concatenated
+ * EL expression string. Therefore, it is necessary to buffer and
concatenate the chunks and process the concatenated
* text later (at beginTag and endTag)
*
* @param buf The characters
@@ -535,12 +535,12 @@ class JspDocumentParser extends DefaultHandler2
implements TagConstants {
continue;
}
// Ignore any whitespace (including spaces, carriage returns,
- // line feeds, and tabs, that appear at the beginning and at
+ // line feeds, and tabs) that appear at the beginning and at
// the end of the body of the <jsp:attribute> action, if the
// action's 'trim' attribute is set to TRUE (default).
// In addition, any textual nodes in the <jsp:attribute> that
- // have only white space are dropped from the document, with
- // the exception of leading and trailing white-space-only
+ // have only white space are dropped from the document,
+ // except for leading and trailing white-space-only
// textual nodes in a <jsp:attribute> whose 'trim' attribute
// is set to FALSE, which must be kept verbatim.
if (i == 0) {
diff --git a/java/org/apache/jasper/compiler/JspReader.java
b/java/org/apache/jasper/compiler/JspReader.java
index 95e20ad5c5..c5ad96aab0 100644
--- a/java/org/apache/jasper/compiler/JspReader.java
+++ b/java/org/apache/jasper/compiler/JspReader.java
@@ -30,7 +30,7 @@ import org.apache.tomcat.Jar;
/**
* JspReader is an input buffer for the JSP parser. It should allow unlimited
lookahead and pushback. It also has a
- * bunch of parsing utility methods for understanding htmlesque thingies.
+ * bunch of parsing utility methods for understanding html style content.
*
* @author Anil K. Vijendran
* @author Anselm Baird-Smith
@@ -599,7 +599,7 @@ class JspReader {
/**
* Parse utils - Is current character a token delimiter ? Delimiters are
currently defined to be =, >, <, ",
- * and ' or any any space character as defined by <code>isSpace</code>.
+ * and ' or any space character as defined by <code>isSpace</code>.
*
* @return A boolean.
*/
diff --git a/java/org/apache/jasper/compiler/JspRuntimeContext.java
b/java/org/apache/jasper/compiler/JspRuntimeContext.java
index 83fe94ae14..6b95af6507 100644
--- a/java/org/apache/jasper/compiler/JspRuntimeContext.java
+++ b/java/org/apache/jasper/compiler/JspRuntimeContext.java
@@ -338,7 +338,7 @@ public final class JspRuntimeContext {
/**
- * Method used by background thread to check the JSP dependencies
registered with this class for JSP's.
+ * Method used by background thread to check the JSP dependencies
registered with this class for JSPs.
*/
public void checkCompile() {
@@ -387,7 +387,7 @@ public final class JspRuntimeContext {
try {
if (jsw.isTagFile()) {
// Although this is a public method, all other paths to
this
- // method use this sync and it is required to prevent race
+ // method use this sync, and it is required to prevent race
// conditions during the reload.
synchronized (this) {
jsw.loadTagFile();
@@ -558,7 +558,7 @@ public final class JspRuntimeContext {
/**
- * Method used by background thread to check if any JSP's should be
unloaded.
+ * Method used by background thread to check if any JSPs should be
unloaded.
*/
public void checkUnload() {
diff --git a/java/org/apache/jasper/compiler/Mark.java
b/java/org/apache/jasper/compiler/Mark.java
index a53cd7bb03..1ed7069104 100644
--- a/java/org/apache/jasper/compiler/Mark.java
+++ b/java/org/apache/jasper/compiler/Mark.java
@@ -26,7 +26,7 @@ import org.apache.jasper.JspCompilationContext;
*
* @author Anil K. Vijendran
*/
-final class Mark {
+public final class Mark {
// position within current stream
int cursor, line, col;
diff --git a/java/org/apache/jasper/compiler/Node.java
b/java/org/apache/jasper/compiler/Node.java
index c7a26b49ae..4c166dcf73 100644
--- a/java/org/apache/jasper/compiler/Node.java
+++ b/java/org/apache/jasper/compiler/Node.java
@@ -49,7 +49,7 @@ import org.xml.sax.Attributes;
* @author Mark Roth
*/
-abstract class Node implements TagConstants {
+public abstract class Node implements TagConstants {
private static final VariableInfo[] ZERO_VARIABLE_INFO = {};
@@ -346,7 +346,7 @@ abstract class Node implements TagConstants {
}
/**
- * Selects and invokes a method in the visitor class based on the node
type. This is abstract and should be overrode
+ * Selects and invokes a method in the visitor class based on the node
type. This is abstract and should be overridden
* by the extending classes.
*
* @param v The visitor class
@@ -2280,7 +2280,7 @@ abstract class Node implements TagConstants {
/**
* This method provides a place to put actions that are common to all
nodes. Override this in the child visitor
- * class if need to.
+ * class if needed.
*
* @param n The node to visit
*/
diff --git a/java/org/apache/jasper/compiler/PageDataImpl.java
b/java/org/apache/jasper/compiler/PageDataImpl.java
index 9d1f25d550..42b2edf487 100644
--- a/java/org/apache/jasper/compiler/PageDataImpl.java
+++ b/java/org/apache/jasper/compiler/PageDataImpl.java
@@ -77,7 +77,7 @@ class PageDataImpl extends PageData implements TagConstants {
}
/*
- * First-pass Visitor for JspRoot nodes (representing jsp:root elements)
and TablibDirective nodes, ignoring any
+ * First-pass Visitor for JspRoot nodes (representing jsp:root elements)
and TaglibDirective nodes, ignoring any
* other nodes.
*
* The purpose of this Visitor is to collect the attributes of the
top-level jsp:root and those of the jsp:root
diff --git a/java/org/apache/jasper/compiler/PageInfo.java
b/java/org/apache/jasper/compiler/PageInfo.java
index 588fa39007..7782a9e977 100644
--- a/java/org/apache/jasper/compiler/PageInfo.java
+++ b/java/org/apache/jasper/compiler/PageInfo.java
@@ -39,7 +39,7 @@ import org.apache.jasper.JspCompilationContext;
* @author Kin-man Chung
*/
-class PageInfo {
+public class PageInfo {
private final List<String> imports;
private final Map<String,Long> dependants;
diff --git a/java/org/apache/jasper/compiler/Parser.java
b/java/org/apache/jasper/compiler/Parser.java
index 984d4f9024..7bcd843e89 100644
--- a/java/org/apache/jasper/compiler/Parser.java
+++ b/java/org/apache/jasper/compiler/Parser.java
@@ -564,7 +564,7 @@ class Parser implements TagConstants {
}
/*
- * Parses a attribute directive with the following syntax:
AttributeDirective ::= ( S Attribute)*
+ * Parses an attribute directive with the following syntax:
AttributeDirective ::= ( S Attribute)*
*/
private void parseAttributeDirective(Node parent) throws JasperException {
Attributes attrs = parseAttributes();
@@ -960,8 +960,7 @@ class Parser implements TagConstants {
boolean result = false;
if (reader.matchesOptionalSpacesFollowedBy("<jsp:attribute")) {
- // May be an EmptyBody, depending on whether
- // There's a "<jsp:body" before the ETag
+ // It may be an EmptyBody, depending on whether there's a
"<jsp:body" before the ETag
// First, parse <jsp:attribute> elements:
parseNamedAttributes(parent);
@@ -1188,7 +1187,7 @@ class Parser implements TagConstants {
// 'CustomActionJSPContent', or 'CustomActionScriptlessContent'.
// depending on body-content in TLD.
- // Looking for a body, it still can be empty; but if there is a
+ // Looking for a body, it still can be empty; but if there is
// a tag body, its syntax would be dependent on the type of
// body content declared in the TLD.
String bc;
diff --git a/java/org/apache/jasper/compiler/ParserController.java
b/java/org/apache/jasper/compiler/ParserController.java
index 6fefdbcfdc..5f90f621b5 100644
--- a/java/org/apache/jasper/compiler/ParserController.java
+++ b/java/org/apache/jasper/compiler/ParserController.java
@@ -40,7 +40,7 @@ import org.xml.sax.Attributes;
* @author Pierre Delisle
* @author Jan Luehe
*/
-class ParserController implements TagConstants {
+public class ParserController implements TagConstants {
private static final String CHARSET = "charset=";
private static final String TAGS_IN_JAR_LOCATION = "/META-INF/tags/";
@@ -197,7 +197,7 @@ class ParserController implements TagConstants {
/*
* An included file is being parsed that was included from the
standard location for tag files in JAR but
* tries to escape that location to either somewhere in the JAR
not under the standard location or outside
- * of the JAR. Neither of these are permitted.
+ * the JAR. Neither of these are permitted.
*/
err.jspError("jsp.error.invalid.includeInTagFileJar", inFileName,
jar.getJarFileURL().toString());
}
diff --git a/java/org/apache/jasper/compiler/SmapStratum.java
b/java/org/apache/jasper/compiler/SmapStratum.java
index 8eab419f9e..6adcf1d1c3 100644
--- a/java/org/apache/jasper/compiler/SmapStratum.java
+++ b/java/org/apache/jasper/compiler/SmapStratum.java
@@ -30,7 +30,7 @@ public class SmapStratum {
/**
* Represents a single LineSection in an SMAP, associated with a
particular stratum.
*/
- static class LineInfo {
+ public static class LineInfo {
private int inputStartLine = -1;
private int outputStartLine = -1;
private int lineFileID = 0;
diff --git a/java/org/apache/jasper/compiler/StringInterpreterFactory.java
b/java/org/apache/jasper/compiler/StringInterpreterFactory.java
index 22d7dea62e..45c637dab6 100644
--- a/java/org/apache/jasper/compiler/StringInterpreterFactory.java
+++ b/java/org/apache/jasper/compiler/StringInterpreterFactory.java
@@ -153,7 +153,7 @@ public class StringInterpreterFactory {
/**
- * Intended to be used by sub-classes that don't need/want to
re-implement the logic in
+ * Intended to be used by subclasses that don't need/want to
re-implement the logic in
* {@link #convertString(Class, String, String, Class, boolean)}.
*
* @param c unused
diff --git a/java/org/apache/jasper/compiler/TagFileProcessor.java
b/java/org/apache/jasper/compiler/TagFileProcessor.java
index e7983d0433..a969ba241c 100644
--- a/java/org/apache/jasper/compiler/TagFileProcessor.java
+++ b/java/org/apache/jasper/compiler/TagFileProcessor.java
@@ -46,7 +46,7 @@ import org.apache.tomcat.util.descriptor.tld.TldResourcePath;
* @author Kin-man Chung
*/
-class TagFileProcessor {
+public class TagFileProcessor {
private List<Compiler> tempVector;
@@ -625,7 +625,7 @@ class TagFileProcessor {
/**
* Removed the java and class files for the tag prototype generated from
the current compilation.
*
- * @param classFileName If non-null, remove only the class file with with
this name.
+ * @param classFileName If non-null, remove only the class file with this
name.
*/
public void removeProtoTypeFiles(String classFileName) {
for (Compiler c : tempVector) {
diff --git a/java/org/apache/jasper/compiler/TldCache.java
b/java/org/apache/jasper/compiler/TldCache.java
index f2106493f8..c1f8014c2e 100644
--- a/java/org/apache/jasper/compiler/TldCache.java
+++ b/java/org/apache/jasper/compiler/TldCache.java
@@ -35,7 +35,7 @@ import org.xml.sax.SAXException;
/**
* This class caches parsed instances of TLD files to remove the need for the
same TLD to be parsed for each JSP that
- * references it. It does not protect against multiple threads processing the
same, new TLD but it does ensure that each
+ * references it. It does not protect against multiple threads processing the
same new TLD, but it does ensure that each
* all threads will use the same TLD object after parsing.
*/
public class TldCache {
diff --git a/java/org/apache/jasper/compiler/Validator.java
b/java/org/apache/jasper/compiler/Validator.java
index 61c90137e1..6d274e414a 100644
--- a/java/org/apache/jasper/compiler/Validator.java
+++ b/java/org/apache/jasper/compiler/Validator.java
@@ -1183,10 +1183,10 @@ class Validator {
/**
* Preprocess attributes that can be expressions. Expression
delimiters are stripped.
* <p>
- * If value is null, checks if there are any NamedAttribute
subelements in the tree node, and if so, constructs
+ * If value is null, checks if there are any NamedAttribute sub
elements in the tree node, and if so, constructs
* a JspAttribute out of a child NamedAttribute node.
*
- * @param el EL expression, if already parsed by the caller (so that
we can skip re-parsing it)
+ * @param el EL expression, if already parsed by the caller (so that
we can skip reparsing it)
*/
private Node.JspAttribute getJspAttribute(TagAttributeInfo tai, String
qName, String uri, String localName,
String value, Node n, ELNode.Nodes el, boolean dynamic) throws
JasperException {
diff --git a/java/org/apache/jasper/compiler/tagplugin/TagPluginContext.java
b/java/org/apache/jasper/compiler/tagplugin/TagPluginContext.java
index 7f6ad2c098..38d9383a57 100644
--- a/java/org/apache/jasper/compiler/tagplugin/TagPluginContext.java
+++ b/java/org/apache/jasper/compiler/tagplugin/TagPluginContext.java
@@ -81,7 +81,7 @@ public interface TagPluginContext {
String getConstantAttribute(String attribute);
/**
- * Generate codes to evaluate value of a attribute in the custom tag The
codes is a Java expression. NOTE: Currently
+ * Generate codes to evaluate value of an attribute in the custom tag The
codes is a Java expression. NOTE: Currently
* cannot handle attributes that are fragments.
*
* @param attribute The specified attribute
@@ -101,10 +101,10 @@ public interface TagPluginContext {
/**
* Get the PluginContext for the parent of this custom tag. NOTE: The
operations available for PluginContext so
- * obtained is limited to getPluginAttribute and setPluginAttribute, and
queries (e.g. isScriptless(). There should
+ * obtained is limited to getPluginAttribute and setPluginAttribute, and
queries (e.g. isScriptless()). There should
* be no calls to generate*().
*
- * @return The pluginContext for the parent node. null if the parent is
not a custom tag, or if the pluginContext if
+ * @return The pluginContext for the parent node. null if the parent is
not a custom tag, or if the pluginContext is
* not available (because useTagPlugin is false, e.g).
*/
TagPluginContext getParentContext();
diff --git a/java/org/apache/jasper/el/JasperELResolver.java
b/java/org/apache/jasper/el/JasperELResolver.java
index 6e18a14383..aa2971a131 100644
--- a/java/org/apache/jasper/el/JasperELResolver.java
+++ b/java/org/apache/jasper/el/JasperELResolver.java
@@ -107,7 +107,7 @@ public class JasperELResolver extends CompositeELResolver {
// call implicit and app resolvers
int index = 1 /* implicit */ + appResolversSize;
for (int i = 0; i < index; i++) {
- result = resolvers[i].getValue(context, base, property);
+ result = resolvers[i].getValue(context, null, property);
if (context.isPropertyResolved()) {
return result;
}
diff --git a/java/org/apache/jasper/runtime/BodyContentImpl.java
b/java/org/apache/jasper/runtime/BodyContentImpl.java
index 4a3cd0960f..8ff21e212b 100644
--- a/java/org/apache/jasper/runtime/BodyContentImpl.java
+++ b/java/org/apache/jasper/runtime/BodyContentImpl.java
@@ -27,8 +27,8 @@ import jakarta.servlet.jsp.tagext.BodyContent;
import org.apache.jasper.compiler.Localizer;
/**
- * Write text to a character-output stream, buffering characters so as to
provide for the efficient writing of single
- * characters, arrays, and strings. Provide support for discarding for the
output that has been buffered.
+ * Write text to a character-output stream, buffering characters to provide
efficient writing of single
+ * characters, arrays, and strings. Provide support for discarding the output
that has been buffered.
*
* @author Rajiv Mordani
* @author Jan Luehe
@@ -341,7 +341,7 @@ public class BodyContentImpl extends BodyContent {
public void writeOut(Writer out) throws IOException {
if (writer == null) {
out.write(cb, 0, nextChar);
- // Flush not called as the writer passed could be a BodyContent and
+ // Flush not called as the writer passed could be a BodyContent,
and
// it doesn't allow to flush.
}
}
diff --git a/java/org/apache/jasper/runtime/JspWriterImpl.java
b/java/org/apache/jasper/runtime/JspWriterImpl.java
index 07b0bbba83..ec8256c41e 100644
--- a/java/org/apache/jasper/runtime/JspWriterImpl.java
+++ b/java/org/apache/jasper/runtime/JspWriterImpl.java
@@ -27,8 +27,8 @@ import org.apache.jasper.Constants;
import org.apache.jasper.compiler.Localizer;
/**
- * Write text to a character-output stream, buffering characters so as to
provide for the efficient writing of single
- * characters, arrays, and strings. Provide support for discarding for the
output that has been buffered. This needs
+ * Write text to a character-output stream, buffering characters to provide
efficient writing of single
+ * characters, arrays, and strings. Provide support for discarding the output
that has been buffered. This needs
* revisiting when the buffering problems in the JSP spec are fixed -akv
*
* @author Anil K. Vijendran
@@ -202,7 +202,7 @@ public class JspWriterImpl extends JspWriter {
}
/**
- * Our own little min method, to avoid loading java.lang.Math if we've run
out of file descriptors and we're trying
+ * Our own little min method, to avoid loading java.lang.Math if we've run
out of file descriptors, and we're trying
* to print a stack trace.
*/
private static int min(int a, int b) {
diff --git a/java/org/apache/jasper/servlet/JasperInitializer.java
b/java/org/apache/jasper/servlet/JasperInitializer.java
index d4b7331f15..9f4d658d5c 100644
--- a/java/org/apache/jasper/servlet/JasperInitializer.java
+++ b/java/org/apache/jasper/servlet/JasperInitializer.java
@@ -61,7 +61,7 @@ public class JasperInitializer implements
ServletContainerInitializer {
log.debug(Localizer.getMessage(MSG + ".onStartup",
context.getServletContextName()));
}
- // Setup a simple default Instance Manager
+ // Set up a simple default Instance Manager
if (context.getAttribute(InstanceManager.class.getName()) == null) {
context.setAttribute(InstanceManager.class.getName(), new
SimpleInstanceManager());
}
diff --git a/java/org/apache/jasper/servlet/JspCServletContext.java
b/java/org/apache/jasper/servlet/JspCServletContext.java
index 0f0d23ae73..6d52de07cf 100644
--- a/java/org/apache/jasper/servlet/JspCServletContext.java
+++ b/java/org/apache/jasper/servlet/JspCServletContext.java
@@ -187,11 +187,7 @@ public class JspCServletContext implements ServletContext {
List<URL> resourceJars = new ArrayList<>();
// Build list of potential resource JARs. Use same ordering as
ContextConfig
Set<WebXml> resourceFragments = new LinkedHashSet<>(orderedFragments);
- for (WebXml fragment : fragments) {
- if (!resourceFragments.contains(fragment)) {
- resourceFragments.add(fragment);
- }
- }
+ resourceFragments.addAll(fragments);
for (WebXml resourceFragment : resourceFragments) {
try (Jar jar = JarFactory.newInstance(resourceFragment.getURL())) {
diff --git a/java/org/apache/jasper/servlet/JspServlet.java
b/java/org/apache/jasper/servlet/JspServlet.java
index 7822e5d07a..942f762d68 100644
--- a/java/org/apache/jasper/servlet/JspServlet.java
+++ b/java/org/apache/jasper/servlet/JspServlet.java
@@ -45,8 +45,8 @@ import org.apache.tomcat.PeriodicEventListener;
import org.apache.tomcat.util.security.Escape;
/**
- * The JSP engine (a.k.a Jasper). The servlet container is responsible for
providing a URLClassLoader for the web
- * application context Jasper is being used in. Jasper will try get the Tomcat
ServletContext attribute for its
+ * The Jasper JSP engine. The servlet container is responsible for providing a
URLClassLoader for the web
+ * application context Jasper is being used in. Jasper will try to get the
Tomcat ServletContext attribute for its
* ServletContext class loader, if that fails, it uses the parent class
loader. In either case, it must be a
* URLClassLoader.
*
diff --git a/java/org/apache/jasper/servlet/JspServletWrapper.java
b/java/org/apache/jasper/servlet/JspServletWrapper.java
index 2b98fe6a8f..0c9f924f27 100644
--- a/java/org/apache/jasper/servlet/JspServletWrapper.java
+++ b/java/org/apache/jasper/servlet/JspServletWrapper.java
@@ -49,8 +49,8 @@ import org.apache.tomcat.InstanceManager;
import org.apache.tomcat.Jar;
/**
- * The JSP engine (a.k.a Jasper). The servlet container is responsible for
providing a URLClassLoader for the web
- * application context Jasper is being used in. Jasper will try get the Tomcat
ServletContext attribute for its
+ * The Jasper JSP engine. The servlet container is responsible for providing a
URLClassLoader for the web
+ * application context Jasper is being used in. Jasper will try to get the
Tomcat ServletContext attribute for its
* ServletContext class loader, if that fails, it uses the parent class
loader. In either case, it must be a
* URLClassLoader.
*
@@ -81,8 +81,8 @@ public class JspServletWrapper {
private final ServletConfig config;
private final Options options;
/*
- * The servlet / tag file needs a compilation check on first access. Use a
separate flag (rather then theServlet ==
- * null / tagHandlerClass == null as it avoids the potentially expensive
isOutDated() calls in ctxt.compile() if
+ * The servlet / tag file needs a compilation check on first access. Use a
separate flag (rather than theServlet ==
+ * null / tagHandlerClass == null) as it avoids the potentially expensive
isOutDated() calls in ctxt.compile() if
* there are multiple concurrent requests for the servlet / tag before the
class has been loaded.
*/
private volatile boolean mustCompile = true;
@@ -273,7 +273,7 @@ public class JspServletWrapper {
/**
* Compile and load a prototype for the Tag file. This is needed when
compiling tag files with circular
- * dependencies. A prototype (skeleton) with no dependencies on other
other tag files is generated and compiled.
+ * dependencies. A prototype (skeleton) with no dependencies on other tag
files is generated and compiled.
*
* @return the loaded class
*
@@ -513,8 +513,7 @@ public class JspServletWrapper {
* Attempts to construct a JasperException that contains helpful
information about what went wrong. Uses the JSP
* compiler system to translate the line number in the generated servlet
that originated the exception to a line
* number in the JSP. Then constructs an exception containing that
information, and a snippet of the JSP to help
- * debugging. Please see
https://bz.apache.org/bugzilla/show_bug.cgi?id=37062 and
http://www.tfenne.com/jasper/ for
- * more details.
+ * debugging. Please see <a
href="https://bz.apache.org/bugzilla/show_bug.cgi?id=37062">BZ 37062</a> for
more details.
* </p>
*
* @param ex the exception that was the cause of the problem.
@@ -549,7 +548,7 @@ public class JspServletWrapper {
if (smap == null) {
// If we couldn't find a frame in the stack trace corresponding
- // to the generated servlet class or we don't have a copy of
the
+ // to the generated servlet class, or we don't have a copy of
the
// smap to hand, we can't really add anything
return new JasperException(ex);
}
diff --git a/java/org/apache/jasper/tagplugins/jstl/core/ForEach.java
b/java/org/apache/jasper/tagplugins/jstl/core/ForEach.java
index b3d318f034..7a6634153d 100644
--- a/java/org/apache/jasper/tagplugins/jstl/core/ForEach.java
+++ b/java/org/apache/jasper/tagplugins/jstl/core/ForEach.java
@@ -71,7 +71,7 @@ public final class ForEach implements TagPlugin {
}
/**
- * Generate codes for Collections The pseudo code is:
+ * Generate codes for Collections The pseudocode is:
*/
private void doCollection(TagPluginContext ctxt) {
diff --git a/java/org/apache/jasper/tagplugins/jstl/core/Param.java
b/java/org/apache/jasper/tagplugins/jstl/core/Param.java
index d182cf118c..e9028b7c21 100644
--- a/java/org/apache/jasper/tagplugins/jstl/core/Param.java
+++ b/java/org/apache/jasper/tagplugins/jstl/core/Param.java
@@ -33,7 +33,7 @@ public class Param implements TagPlugin {
String encName = ctxt.getTemporaryVariableName();
String index = ctxt.getTemporaryVariableName();
- // if the param tag has no parents, throw a exception
+ // if the param tag has no parents, throw an exception
TagPluginContext parent = ctxt.getParentContext();
if (parent == null) {
ctxt.generateJavaSource(
diff --git a/java/org/apache/jasper/tagplugins/jstl/core/Set.java
b/java/org/apache/jasper/tagplugins/jstl/core/Set.java
index ba3ddff6d0..465edf445b 100644
--- a/java/org/apache/jasper/tagplugins/jstl/core/Set.java
+++ b/java/org/apache/jasper/tagplugins/jstl/core/Set.java
@@ -63,7 +63,7 @@ public class Set implements TagPlugin {
// get the iScope according to the strScope
iScope = Util.getScope(strScope);
- String jspCtxt = null;
+ String jspCtxt;
if (ctxt.isTagFile()) {
jspCtxt = "this.getJspContext()";
} else {
diff --git a/java/org/apache/jasper/tagplugins/jstl/core/When.java
b/java/org/apache/jasper/tagplugins/jstl/core/When.java
index b6568003e7..5bc75db74a 100644
--- a/java/org/apache/jasper/tagplugins/jstl/core/When.java
+++ b/java/org/apache/jasper/tagplugins/jstl/core/When.java
@@ -42,7 +42,7 @@ public final class When implements TagPlugin {
ctxt.generateBody();
// We don't generate the closing "}" for the "if" here because there
- // may be whitespaces in between <c:when>'s. Instead we delay
+ // may be whitespaces in between <c:when>'s. Instead, we delay
// generating it until the next <c:when> or <c:otherwise> or
// <c:choose>
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]