This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new b6e09cf83c Code clean-up - formatting. No functional change.
b6e09cf83c is described below
commit b6e09cf83ccc4cc07c0f29b6668882280056a9f6
Author: Mark Thomas <[email protected]>
AuthorDate: Fri Feb 7 15:30:37 2025 +0000
Code clean-up - formatting. No functional change.
---
java/org/apache/jasper/compiler/JspReader.java | 320 +++++------
.../apache/jasper/compiler/JspRuntimeContext.java | 97 ++--
java/org/apache/jasper/compiler/JspUtil.java | 331 +++++------
java/org/apache/jasper/compiler/Localizer.java | 18 +-
java/org/apache/jasper/compiler/Mark.java | 8 +-
.../compiler/NewlineReductionServletWriter.java | 11 +-
java/org/apache/jasper/compiler/Node.java | 602 ++++++++-------------
7 files changed, 586 insertions(+), 801 deletions(-)
diff --git a/java/org/apache/jasper/compiler/JspReader.java
b/java/org/apache/jasper/compiler/JspReader.java
index df3ee8a0f4..7681a9b446 100644
--- a/java/org/apache/jasper/compiler/JspReader.java
+++ b/java/org/apache/jasper/compiler/JspReader.java
@@ -29,9 +29,8 @@ import org.apache.juli.logging.LogFactory;
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.
+ * 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.
*
* @author Anil K. Vijendran
* @author Anselm Baird-Smith
@@ -69,41 +68,33 @@ class JspReader {
/**
* Constructor.
*
- * @param ctxt The compilation context
- * @param fname The file name
+ * @param ctxt The compilation context
+ * @param fname The file name
* @param encoding The file encoding
- * @param jar ?
- * @param err The error dispatcher
- * @throws JasperException If a Jasper-internal error occurs
+ * @param jar ?
+ * @param err The error dispatcher
+ *
+ * @throws JasperException If a Jasper-internal error occurs
* @throws FileNotFoundException If the JSP file is not found (or is
unreadable)
- * @throws IOException If an IO-level error occurs, e.g. reading the file
+ * @throws IOException If an IO-level error occurs, e.g. reading
the file
*/
- JspReader(JspCompilationContext ctxt,
- String fname,
- String encoding,
- Jar jar,
- ErrorDispatcher err)
+ JspReader(JspCompilationContext ctxt, String fname, String encoding, Jar
jar, ErrorDispatcher err)
throws JasperException, FileNotFoundException, IOException {
- this(ctxt, fname, JspUtil.getReader(fname, encoding, jar, ctxt, err),
- err);
+ this(ctxt, fname, JspUtil.getReader(fname, encoding, jar, ctxt, err),
err);
}
/**
- * Constructor: same as above constructor but with initialized reader
- * to the file given.
+ * Constructor: same as above constructor but with initialized reader to
the file given.
*
* @param ctxt The compilation context
* @param fname The file name
* @param reader A reader for the JSP source file
- * @param err The error dispatcher
+ * @param err The error dispatcher
*
* @throws JasperException If an error occurs parsing the JSP file
*/
- JspReader(JspCompilationContext ctxt,
- String fname,
- InputStreamReader reader,
- ErrorDispatcher err)
+ JspReader(JspCompilationContext ctxt, String fname, InputStreamReader
reader, ErrorDispatcher err)
throws JasperException {
this.context = ctxt;
@@ -112,7 +103,7 @@ class JspReader {
try {
CharArrayWriter caw = new CharArrayWriter();
char buf[] = new char[1024];
- for (int i = 0 ; (i = reader.read(buf)) != -1 ;) {
+ for (int i = 0; (i = reader.read(buf)) != -1;) {
caw.write(buf, 0, i);
}
caw.close();
@@ -126,7 +117,7 @@ class JspReader {
try {
reader.close();
} catch (Exception any) {
- if(log.isDebugEnabled()) {
+ if (log.isDebugEnabled()) {
log.debug(Localizer.getMessage("jsp.error.file.close"), any);
}
}
@@ -136,8 +127,7 @@ class JspReader {
/**
- * @return JSP compilation context with which this JspReader is
- * associated
+ * @return JSP compilation context with which this JspReader is associated
*/
JspCompilationContext getJspCompilationContext() {
return context;
@@ -171,9 +161,8 @@ class JspReader {
}
/**
- * A faster approach than calling {@link #mark()} & {@link #nextChar()}.
- * However, this approach is only safe if the mark is only used within the
- * JspReader.
+ * A faster approach than calling {@link #mark()} & {@link #nextChar()}.
However, this approach is only safe if the
+ * mark is only used within the JspReader.
*/
private int nextChar(Mark mark) {
if (!hasMoreInput()) {
@@ -196,8 +185,7 @@ class JspReader {
}
/**
- * Search the given character, If it was found, then mark the current
cursor
- * and the cursor point to next character.
+ * Search the given character, If it was found, then mark the current
cursor and the cursor point to next character.
*/
private Boolean indexOf(char c, Mark mark) {
if (!hasMoreInput()) {
@@ -209,30 +197,30 @@ class JspReader {
int line = current.line;
int col = current.col;
int i = current.cursor;
- for(; i < end; i ++) {
- ch = current.stream[i];
+ for (; i < end; i++) {
+ ch = current.stream[i];
- if (ch == c) {
- mark.update(i, line, col);
- }
- if (ch == '\n') {
+ if (ch == c) {
+ mark.update(i, line, col);
+ }
+ if (ch == '\n') {
line++;
col = 0;
} else {
col++;
}
- if (ch == c) {
- current.update(i+1, line, col);
- return Boolean.TRUE;
- }
+ if (ch == c) {
+ current.update(i + 1, line, col);
+ return Boolean.TRUE;
+ }
}
current.update(i, line, col);
return Boolean.FALSE;
}
/**
- * Back up the current cursor by one char, assumes current.cursor > 0,
- * and that the char to be pushed back is not '\n'.
+ * Back up the current cursor by one char, assumes current.cursor > 0, and
that the char to be pushed back is not
+ * '\n'.
*/
void pushChar() {
current.cursor--;
@@ -263,11 +251,9 @@ class JspReader {
/**
* Read ahead the given number of characters without moving the cursor.
*
- * @param readAhead The number of characters to read ahead. NOTE: This is
- * zero based.
+ * @param readAhead The number of characters to read ahead. NOTE: This is
zero based.
*
- * @return The requested character or -1 if the end of the input is reached
- * first
+ * @return The requested character or -1 if the end of the input is
reached first
*/
int peekChar(int readAhead) {
int target = current.cursor + readAhead;
@@ -286,7 +272,7 @@ class JspReader {
* This method avoids a call to {@link #mark()} when doing comparison.
*/
private boolean markEquals(Mark another) {
- return another.equals(current);
+ return another.equals(current);
}
void reset(Mark mark) {
@@ -294,55 +280,56 @@ class JspReader {
}
/**
- * Similar to {@link #reset(Mark)} but no new Mark will be created.
- * Therefore, the parameter mark must NOT be used in other places.
+ * Similar to {@link #reset(Mark)} but no new Mark will be created.
Therefore, the parameter mark must NOT be used
+ * in other places.
*/
private void setCurrent(Mark mark) {
- current = mark;
+ current = mark;
}
/**
* search the stream for a match to a string
+ *
* @param string The string to match
- * @return <strong>true</strong> is one is found, the current position
- * in stream is positioned after the search string, <strong>
- * false</strong> otherwise, position in stream unchanged.
+ *
+ * @return <strong>true</strong> is one is found, the current position in
stream is positioned after the search
+ * string, <strong> false</strong> otherwise, position in
stream unchanged.
*/
boolean matches(String string) {
- int len = string.length();
- int cursor = current.cursor;
- int streamSize = current.stream.length;
- if (cursor + len < streamSize) { //Try to scan in memory
- int line = current.line;
- int col = current.col;
- int ch;
- int i = 0;
- for(; i < len; i ++) {
- ch = current.stream[i+cursor];
- if (string.charAt(i) != ch) {
- return false;
- }
- if (ch == '\n') {
- line ++;
- col = 0;
- } else {
- col++;
- }
- }
- current.update(i+cursor, line, col);
- } else {
- Mark mark = mark();
- int ch = 0;
- int i = 0;
- do {
- ch = nextChar();
- if (((char) ch) != string.charAt(i++)) {
- setCurrent(mark);
- return false;
- }
- } while (i < len);
- }
- return true;
+ int len = string.length();
+ int cursor = current.cursor;
+ int streamSize = current.stream.length;
+ if (cursor + len < streamSize) { // Try to scan in memory
+ int line = current.line;
+ int col = current.col;
+ int ch;
+ int i = 0;
+ for (; i < len; i++) {
+ ch = current.stream[i + cursor];
+ if (string.charAt(i) != ch) {
+ return false;
+ }
+ if (ch == '\n') {
+ line++;
+ col = 0;
+ } else {
+ col++;
+ }
+ }
+ current.update(i + cursor, line, col);
+ } else {
+ Mark mark = mark();
+ int ch = 0;
+ int i = 0;
+ do {
+ ch = nextChar();
+ if (((char) ch) != string.charAt(i++)) {
+ setCurrent(mark);
+ return false;
+ }
+ } while (i < len);
+ }
+ return true;
}
boolean matchesETag(String tagName) {
@@ -361,33 +348,32 @@ class JspReader {
}
boolean matchesETagWithoutLessThan(String tagName) {
- Mark mark = mark();
+ Mark mark = mark();
- if (!matches("/" + tagName)) {
- return false;
- }
- skipSpaces();
- if (nextChar() == '>') {
- return true;
- }
+ if (!matches("/" + tagName)) {
+ return false;
+ }
+ skipSpaces();
+ if (nextChar() == '>') {
+ return true;
+ }
- setCurrent(mark);
- return false;
+ setCurrent(mark);
+ return false;
}
/**
- * Looks ahead to see if there are optional spaces followed by
- * the given String. If so, true is returned and those spaces and
- * characters are skipped. If not, false is returned and the
- * position is restored to where we were before.
+ * Looks ahead to see if there are optional spaces followed by the given
String. If so, true is returned and those
+ * spaces and characters are skipped. If not, false is returned and the
position is restored to where we were
+ * before.
*/
boolean matchesOptionalSpacesFollowedBy(String s) {
Mark mark = mark();
skipSpaces();
- boolean result = matches( s );
- if( !result ) {
+ boolean result = matches(s);
+ if (!result) {
setCurrent(mark);
}
@@ -404,13 +390,13 @@ class JspReader {
}
/**
- * Skip until the given string is matched in the stream.
- * When returned, the context is positioned past the end of the match.
+ * Skip until the given string is matched in the stream. When returned,
the context is positioned past the end of
+ * the match.
*
* @param limit The String to match.
- * @return A non-null <code>Mark</code> instance (positioned immediately
- * before the search string) if found, <strong>null</strong>
- * otherwise.
+ *
+ * @return A non-null <code>Mark</code> instance (positioned immediately
before the search string) if found,
+ * <strong>null</strong> otherwise.
*/
Mark skipUntil(String limit) {
Mark ret = mark();
@@ -419,58 +405,54 @@ class JspReader {
Boolean result = null;
Mark restart = null;
- skip:
- while((result = indexOf(firstChar, ret)) != null) {
- if (result.booleanValue()) {
- if (restart != null) {
- restart.init(current, true);
- } else {
- restart = mark();
- }
- for (int i = 1 ; i < limlen ; i++) {
- if (peekChar() == limit.charAt(i)) {
- nextChar();
- } else {
- current.init(restart, true);
- continue skip;
- }
- }
- return ret;
+ skip: while ((result = indexOf(firstChar, ret)) != null) {
+ if (result.booleanValue()) {
+ if (restart != null) {
+ restart.init(current, true);
+ } else {
+ restart = mark();
+ }
+ for (int i = 1; i < limlen; i++) {
+ if (peekChar() == limit.charAt(i)) {
+ nextChar();
+ } else {
+ current.init(restart, true);
+ continue skip;
+ }
+ }
+ return ret;
}
}
return null;
}
/**
- * Skip until the given string is matched in the stream, but ignoring
- * chars initially escaped by a '\' and any EL expressions.
- * When returned, the context is positioned past the end of the match.
+ * Skip until the given string is matched in the stream, but ignoring
chars initially escaped by a '\' and any EL
+ * expressions. When returned, the context is positioned past the end of
the match.
*
* @param limit The String to match.
- * @param ignoreEL <code>true</code> if something that looks like EL should
- * not be treated as EL.
- * @return A non-null <code>Mark</code> instance (positioned immediately
- * before the search string) if found, <strong>null</strong>
- * otherwise.
+ * @param ignoreEL <code>true</code> if something that looks like EL
should not be treated as EL.
+ *
+ * @return A non-null <code>Mark</code> instance (positioned immediately
before the search string) if found,
+ * <strong>null</strong> otherwise.
*/
Mark skipUntilIgnoreEsc(String limit, boolean ignoreEL) {
Mark ret = mark();
int limlen = limit.length();
int ch;
- int prev = 'x'; // Doesn't matter
+ int prev = 'x'; // Doesn't matter
char firstChar = limit.charAt(0);
- skip:
- for (ch = nextChar(ret) ; ch != -1 ; prev = ch, ch = nextChar(ret)) {
+ skip: for (ch = nextChar(ret); ch != -1; prev = ch, ch =
nextChar(ret)) {
if (ch == '\\' && prev == '\\') {
- ch = 0; // Double \ is not an escape char
anymore
+ ch = 0; // Double \ is not an escape char anymore
} else if (prev == '\\') {
continue;
- } else if (!ignoreEL && (ch == '$' || ch == '#') && peekChar() ==
'{' ) {
+ } else if (!ignoreEL && (ch == '$' || ch == '#') && peekChar() ==
'{') {
// Move beyond the '{'
nextChar();
skipELExpression();
} else if (ch == firstChar) {
- for (int i = 1 ; i < limlen ; i++) {
+ for (int i = 1; i < limlen; i++) {
if (peekChar() == limit.charAt(i)) {
nextChar();
} else {
@@ -484,12 +466,13 @@ class JspReader {
}
/**
- * Skip until the given end tag is matched in the stream.
- * When returned, the context is positioned past the end of the tag.
+ * Skip until the given end tag is matched in the stream. When returned,
the context is positioned past the end of
+ * the tag.
*
* @param tag The name of the tag whose ETag (</tag>) to match.
- * @return A non-null <code>Mark</code> instance (positioned immediately
- * before the ETag) if found, <strong>null</strong>
otherwise.
+ *
+ * @return A non-null <code>Mark</code> instance (positioned immediately
before the ETag) if found,
+ * <strong>null</strong> otherwise.
*/
Mark skipUntilETag(String tag) {
Mark ret = skipUntil("</" + tag);
@@ -503,13 +486,12 @@ class JspReader {
}
/**
- * Parse ELExpressionBody that is a body of ${} or #{} expression. Initial
- * reader position is expected to be just after '${' or '#{' characters.
+ * Parse ELExpressionBody that is a body of ${} or #{} expression. Initial
reader position is expected to be just
+ * after '${' or '#{' characters.
* <p>
- * In case of success, this method returns <code>Mark</code> for the last
- * character before the terminating '}' and reader is positioned just after
- * the '}' character. If no terminating '}' is encountered, this method
- * returns <code>null</code>.
+ * In case of success, this method returns <code>Mark</code> for the last
character before the terminating '}' and
+ * reader is positioned just after the '}' character. If no terminating
'}' is encountered, this method returns
+ * <code>null</code>.
* <p>
* Starting with EL 3.0, nested paired {}s are supported.
*
@@ -517,8 +499,8 @@ class JspReader {
*/
Mark skipELExpression() {
// ELExpressionBody.
- // Starts with "#{" or "${". Ends with "}".
- // May contain quoted "{", "}", '{', or '}' and nested "{...}"
+ // Starts with "#{" or "${". Ends with "}".
+ // May contain quoted "{", "}", '{', or '}' and nested "{...}"
Mark last = mark();
boolean singleQuoted = false;
boolean doubleQuoted = false;
@@ -542,11 +524,11 @@ class JspReader {
singleQuoted = !singleQuoted;
} else if (currentChar == '{' && !doubleQuoted && !singleQuoted) {
nesting++;
- } else if (currentChar =='}' && !doubleQuoted && !singleQuoted) {
+ } else if (currentChar == '}' && !doubleQuoted && !singleQuoted) {
// Note: This also matches the terminating '}' at which point
- // nesting will be set to -1 - hence the test for
- // while (currentChar != '}' || nesting > -1 ||...) below
- // to continue the loop until the final '}' is detected
+ // nesting will be set to -1 - hence the test for
+ // while (currentChar != '}' || nesting > -1 ||...) below
+ // to continue the loop until the final '}' is detected
nesting--;
}
} while (currentChar != '}' || singleQuoted || doubleQuoted || nesting
> -1);
@@ -560,9 +542,8 @@ class JspReader {
}
/**
- * Parse a space delimited token.
- * If quoted the token will consume all characters up to a matching quote,
- * otherwise, it consumes up to the first delimiter character.
+ * Parse a space delimited token. If quoted the token will consume all
characters up to a matching quote, otherwise,
+ * it consumes up to the first delimiter character.
*
* @param quoted If <strong>true</strong> accept quoted strings.
*/
@@ -583,8 +564,7 @@ class JspReader {
char endQuote = ch == '"' ? '"' : '\'';
// Consume the open quote:
ch = nextChar();
- for (ch = nextChar(); ch != -1 && ch != endQuote;
- ch = nextChar()) {
+ for (ch = nextChar(); ch != -1 && ch != endQuote; ch =
nextChar()) {
if (ch == '\\') {
ch = nextChar();
}
@@ -604,8 +584,7 @@ class JspReader {
ch = nextChar();
// Take care of the quoting here.
if (ch == '\\') {
- if (peekChar() == '"' || peekChar() == '\'' ||
- peekChar() == '>' || peekChar() == '%') {
+ if (peekChar() == '"' || peekChar() == '\'' ||
peekChar() == '>' || peekChar() == '%') {
ch = nextChar();
}
}
@@ -619,25 +598,22 @@ 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>.
+ * 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>.
*
* @return A boolean.
*/
private boolean isDelimiter() {
- if (! isSpace()) {
+ if (!isSpace()) {
int ch = peekChar();
// Look for a single-char work delimiter:
- if (ch == '=' || ch == '>' || ch == '"' || ch == '\''
- || ch == '/') {
+ if (ch == '=' || ch == '>' || ch == '"' || ch == '\'' || ch ==
'/') {
return true;
}
// Look for an end-of-comment or end-of-tag:
if (ch == '-') {
Mark mark = mark();
- if (((ch = nextChar()) == '>')
- || ((ch == '-') && (nextChar() == '>'))) {
+ if (((ch = nextChar()) == '>') || ((ch == '-') && (nextChar()
== '>'))) {
setCurrent(mark);
return true;
} else {
diff --git a/java/org/apache/jasper/compiler/JspRuntimeContext.java
b/java/org/apache/jasper/compiler/JspRuntimeContext.java
index 9f3b69c6ae..0e5e74eea6 100644
--- a/java/org/apache/jasper/compiler/JspRuntimeContext.java
+++ b/java/org/apache/jasper/compiler/JspRuntimeContext.java
@@ -40,14 +40,9 @@ import org.apache.juli.logging.LogFactory;
/**
- * Class for tracking JSP compile time file dependencies when the
- * >%@include file="..."%< directive is used.
- *
- * A background thread periodically checks the files a JSP page
- * is dependent upon. If a dependent file changes the JSP page
- * which included it is recompiled.
- *
- * Only used if a web application context is a directory.
+ * Class for tracking JSP compile time file dependencies when the
>%@include file="..."%< directive is used. A
+ * background thread periodically checks the files a JSP page is dependent
upon. If a dependent file changes the JSP
+ * page which included it is recompiled. Only used if a web application
context is a directory.
*
* @author Glenn L. Nielsen
*/
@@ -71,9 +66,8 @@ public final class JspRuntimeContext {
// ----------------------------------------------------------- Constructors
/**
- * Create a JspRuntimeContext for a web application context.
- *
- * Loads in any previously generated dependencies from file.
+ * Create a JspRuntimeContext for a web application context. Loads in any
previously generated dependencies from
+ * file.
*
* @param context ServletContext for web application
* @param options The main Jasper options
@@ -91,15 +85,13 @@ public final class JspRuntimeContext {
if (log.isTraceEnabled()) {
if (loader != null) {
-
log.trace(Localizer.getMessage("jsp.message.parent_class_loader_is",
- loader.toString()));
+
log.trace(Localizer.getMessage("jsp.message.parent_class_loader_is",
loader.toString()));
} else {
-
log.trace(Localizer.getMessage("jsp.message.parent_class_loader_is",
- "<none>"));
+
log.trace(Localizer.getMessage("jsp.message.parent_class_loader_is", "<none>"));
}
}
- parentClassLoader = loader;
+ parentClassLoader = loader;
classpath = initClassPath();
if (context instanceof org.apache.jasper.servlet.JspCServletContext) {
@@ -109,17 +101,15 @@ public final class JspRuntimeContext {
// If this web application context is running from a
// directory, start the background compilation thread
String appBase = context.getRealPath("/");
- if (!options.getDevelopment()
- && appBase != null
- && options.getCheckInterval() > 0) {
+ if (!options.getDevelopment() && appBase != null &&
options.getCheckInterval() > 0) {
lastCompileCheck = System.currentTimeMillis();
}
if (options.getMaxLoadedJsps() > 0) {
jspQueue = new FastRemovalDequeue<>(options.getMaxLoadedJsps());
if (log.isTraceEnabled()) {
- log.trace(Localizer.getMessage("jsp.message.jsp_queue_created",
- "" +
options.getMaxLoadedJsps(), context.getContextPath()));
+
log.trace(Localizer.getMessage("jsp.message.jsp_queue_created", "" +
options.getMaxLoadedJsps(),
+ context.getContextPath()));
}
}
@@ -144,7 +134,7 @@ public final class JspRuntimeContext {
/**
* Maps JSP pages to their JspServletWrapper's
*/
- private final Map<String, JspServletWrapper> jsps = new
ConcurrentHashMap<>();
+ private final Map<String,JspServletWrapper> jsps = new
ConcurrentHashMap<>();
/**
* Keeps JSP pages ordered by last access.
@@ -152,9 +142,8 @@ public final class JspRuntimeContext {
private FastRemovalDequeue<JspServletWrapper> jspQueue = null;
/**
- * Map of class name to associated source map. This is maintained here as
- * multiple JSPs can depend on the same file (included JSP, tag file, etc.)
- * so a web application scoped Map is required.
+ * Map of class name to associated source map. This is maintained here as
multiple JSPs can depend on the same file
+ * (included JSP, tag file, etc.) so a web application scoped Map is
required.
*/
private final Map<String,SmapStratum> smaps = new ConcurrentHashMap<>();
@@ -170,7 +159,7 @@ public final class JspRuntimeContext {
* Add a new JspServletWrapper.
*
* @param jspUri JSP URI
- * @param jsw Servlet wrapper for JSP
+ * @param jsw Servlet wrapper for JSP
*/
public void addWrapper(String jspUri, JspServletWrapper jsw) {
jsps.put(jspUri, jsw);
@@ -180,6 +169,7 @@ public final class JspRuntimeContext {
* Get an already existing JspServletWrapper.
*
* @param jspUri JSP URI
+ *
* @return JspServletWrapper for JSP
*/
public JspServletWrapper getWrapper(String jspUri) {
@@ -187,7 +177,7 @@ public final class JspRuntimeContext {
}
/**
- * Remove a JspServletWrapper.
+ * Remove a JspServletWrapper.
*
* @param jspUri JSP URI of JspServletWrapper to remove
*/
@@ -196,23 +186,23 @@ public final class JspRuntimeContext {
}
/**
- * Push a newly compiled JspServletWrapper into the queue at first
- * execution of jsp. Destroy any JSP that has been replaced in the queue.
+ * Push a newly compiled JspServletWrapper into the queue at first
execution of jsp. Destroy any JSP that has been
+ * replaced in the queue.
*
* @param jsw Servlet wrapper for jsp.
+ *
* @return an unloadHandle that can be pushed to front of queue at later
execution times.
- * */
+ */
public FastRemovalDequeue<JspServletWrapper>.Entry push(JspServletWrapper
jsw) {
if (log.isTraceEnabled()) {
- log.trace(Localizer.getMessage("jsp.message.jsp_added",
- jsw.getJspUri(),
context.getContextPath()));
+ log.trace(Localizer.getMessage("jsp.message.jsp_added",
jsw.getJspUri(), context.getContextPath()));
}
FastRemovalDequeue<JspServletWrapper>.Entry entry = jspQueue.push(jsw);
JspServletWrapper replaced = entry.getReplaced();
if (replaced != null) {
if (log.isTraceEnabled()) {
-
log.trace(Localizer.getMessage("jsp.message.jsp_removed_excess",
- replaced.getJspUri(),
context.getContextPath()));
+
log.trace(Localizer.getMessage("jsp.message.jsp_removed_excess",
replaced.getJspUri(),
+ context.getContextPath()));
}
unloadJspServletWrapper(replaced);
entry.clearReplaced();
@@ -224,19 +214,18 @@ public final class JspRuntimeContext {
* Push unloadHandle for JspServletWrapper to front of the queue.
*
* @param unloadHandle the unloadHandle for the jsp.
- * */
+ */
public void makeYoungest(FastRemovalDequeue<JspServletWrapper>.Entry
unloadHandle) {
if (log.isTraceEnabled()) {
JspServletWrapper jsw = unloadHandle.getContent();
- log.trace(Localizer.getMessage("jsp.message.jsp_queue_update",
- jsw.getJspUri(),
context.getContextPath()));
+ log.trace(Localizer.getMessage("jsp.message.jsp_queue_update",
jsw.getJspUri(), context.getContextPath()));
}
jspQueue.moveFirst(unloadHandle);
}
/**
- * Returns the number of JSPs for which JspServletWrappers exist, i.e.,
- * the number of JSPs that have been loaded into the webapp.
+ * Returns the number of JSPs for which JspServletWrappers exist, i.e.,
the number of JSPs that have been loaded
+ * into the webapp.
*
* @return The number of JSPs that have been loaded into the webapp
*/
@@ -290,8 +279,8 @@ public final class JspRuntimeContext {
/**
* Gets the number of JSPs that are in the JSP limiter queue
*
- * @return The number of JSPs (in the webapp with which this JspServlet is
- * associated) that are in the JSP limiter queue
+ * @return The number of JSPs (in the webapp with which this JspServlet is
associated) that are in the JSP limiter
+ * queue
*/
public int getJspQueueLength() {
if (jspQueue != null) {
@@ -303,8 +292,7 @@ public final class JspRuntimeContext {
/**
* Gets the number of JSPs that have been unloaded.
*
- * @return The number of JSPs (in the webapp with which this JspServlet is
- * associated) that have been unloaded
+ * @return The number of JSPs (in the webapp with which this JspServlet is
associated) that have been unloaded
*/
public int getJspUnloadCount() {
return jspUnloadCount.intValue();
@@ -312,8 +300,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 JSP's.
*/
public void checkCompile() {
@@ -333,7 +320,7 @@ public final class JspRuntimeContext {
// check is in progress. See BZ 62603.
compileCheckInProgress = true;
- Object [] wrappers = jsps.values().toArray();
+ Object[] wrappers = jsps.values().toArray();
for (Object wrapper : wrappers) {
JspServletWrapper jsw = (JspServletWrapper) wrapper;
JspCompilationContext ctxt = jsw.getJspEngineContext();
@@ -408,6 +395,7 @@ public final class JspRuntimeContext {
/**
* Method used to initialize classpath for compiles.
+ *
* @return the compilation classpath
*/
private String initClassPath() {
@@ -415,7 +403,7 @@ public final class JspRuntimeContext {
StringBuilder cpath = new StringBuilder();
if (parentClassLoader instanceof URLClassLoader) {
- URL [] urls = ((URLClassLoader)parentClassLoader).getURLs();
+ URL[] urls = ((URLClassLoader) parentClassLoader).getURLs();
for (URL url : urls) {
// Tomcat can use URLs other than file URLs. However, a
protocol
@@ -444,7 +432,7 @@ public final class JspRuntimeContext {
String path = cpath.toString() + cp;
- if(log.isTraceEnabled()) {
+ if (log.isTraceEnabled()) {
log.trace("Compilation classpath initialized: " + path);
}
return path;
@@ -453,7 +441,7 @@ public final class JspRuntimeContext {
private void unloadJspServletWrapper(JspServletWrapper jsw) {
removeWrapper(jsw.getJspUri());
- synchronized(jsw) {
+ synchronized (jsw) {
jsw.destroy();
}
jspUnloadCount.incrementAndGet();
@@ -470,21 +458,20 @@ public final class JspRuntimeContext {
if (jspQueue != null) {
queueLength = jspQueue.getSize();
}
- log.trace(Localizer.getMessage("jsp.message.jsp_unload_check",
- context.getContextPath(), "" +
jsps.size(), "" + queueLength));
+ log.trace(Localizer.getMessage("jsp.message.jsp_unload_check",
context.getContextPath(), "" + jsps.size(),
+ "" + queueLength));
}
long now = System.currentTimeMillis();
if (jspIdleTimeout > 0) {
long unloadBefore = now - jspIdleTimeout;
- Object [] wrappers = jsps.values().toArray();
+ Object[] wrappers = jsps.values().toArray();
for (Object wrapper : wrappers) {
JspServletWrapper jsw = (JspServletWrapper) wrapper;
synchronized (jsw) {
if (jsw.getLastUsageTime() < unloadBefore) {
if (log.isTraceEnabled()) {
-
log.trace(Localizer.getMessage("jsp.message.jsp_removed_idle",
- jsw.getJspUri(), context.getContextPath(),
- "" + (now - jsw.getLastUsageTime())));
+
log.trace(Localizer.getMessage("jsp.message.jsp_removed_idle", jsw.getJspUri(),
+ context.getContextPath(), "" + (now -
jsw.getLastUsageTime())));
}
if (jspQueue != null) {
jspQueue.remove(jsw.getUnloadHandle());
diff --git a/java/org/apache/jasper/compiler/JspUtil.java
b/java/org/apache/jasper/compiler/JspUtil.java
index e0df712a65..5e00d198d0 100644
--- a/java/org/apache/jasper/compiler/JspUtil.java
+++ b/java/org/apache/jasper/compiler/JspUtil.java
@@ -32,8 +32,7 @@ import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
/**
- * This class has all the utility method(s). Ideally should move all the bean
- * containers here.
+ * This class has all the utility method(s). Ideally should move all the bean
containers here.
*
* @author Mandar Raje.
* @author Rajiv Mordani.
@@ -51,15 +50,12 @@ public class JspUtil {
private static final String OPEN_EXPR = "<%=";
private static final String CLOSE_EXPR = "%>";
- 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", "private", "protected", "public",
- "return", "short", "static", "strictfp", "super", "switch",
- "synchronized", "this", "throw", "throws", "transient", "try",
- "void", "volatile", "while" };
+ 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",
+ "private", "protected", "public", "return", "short",
"static", "strictfp", "super", "switch",
+ "synchronized", "this", "throw", "throws", "transient",
"try", "void", "volatile", "while" };
static final int JSP_INPUT_STREAM_BUFFER_SIZE = 1024;
@@ -67,15 +63,16 @@ public class JspUtil {
/**
* Takes a potential expression and converts it into XML form.
+ *
* @param expression The expression to convert
+ *
* @return XML view
*/
public static String getExprInXml(String expression) {
String returnString;
int length = expression.length();
- if (expression.startsWith(OPEN_EXPR) &&
- expression.endsWith(CLOSE_EXPR)) {
+ if (expression.startsWith(OPEN_EXPR) &&
expression.endsWith(CLOSE_EXPR)) {
returnString = expression.substring(1, length - 1);
} else {
returnString = expression;
@@ -87,40 +84,32 @@ public class JspUtil {
/**
* Checks to see if the given scope is valid.
*
- * @param scope
- * The scope to be checked
- * @param n
- * The Node containing the 'scope' attribute whose value is to
be
- * checked
- * @param err
- * error dispatcher
- *
- * @throws JasperException
- * if scope is not null and different from "page",
- * "request", "session", and
- * "application"
+ * @param scope The scope to be checked
+ * @param n The Node containing the 'scope' attribute whose value is
to be checked
+ * @param err error dispatcher
+ *
+ * @throws JasperException if scope is not null and different from
"page", "request",
+ * "session", and
"application"
*/
- public static void checkScope(String scope, Node n, ErrorDispatcher err)
- throws JasperException {
- if (scope != null && !scope.equals("page") && !scope.equals("request")
- && !scope.equals("session") && !scope.equals("application")) {
+ public static void checkScope(String scope, Node n, ErrorDispatcher err)
throws JasperException {
+ if (scope != null && !scope.equals("page") && !scope.equals("request")
&& !scope.equals("session") &&
+ !scope.equals("application")) {
err.jspError(n, "jsp.error.invalid.scope", scope);
}
}
/**
- * Checks if all mandatory attributes are present and if all attributes
- * present have valid names. Checks attributes specified as XML-style
- * attributes as well as attributes specified using the jsp:attribute
- * standard action.
- * @param typeOfTag The tag type
- * @param n The corresponding node
+ * Checks if all mandatory attributes are present and if all attributes
present have valid names. Checks attributes
+ * specified as XML-style attributes as well as attributes specified using
the jsp:attribute standard action.
+ *
+ * @param typeOfTag The tag type
+ * @param n The corresponding node
* @param validAttributes The array with the valid attributes
- * @param err Dispatcher for errors
+ * @param err Dispatcher for errors
+ *
* @throws JasperException An error occurred
*/
- public static void checkAttributes(String typeOfTag, Node n,
- ValidAttribute[] validAttributes, ErrorDispatcher err)
+ public static void checkAttributes(String typeOfTag, Node n,
ValidAttribute[] validAttributes, ErrorDispatcher err)
throws JasperException {
Attributes attrs = n.getAttributes();
Mark start = n.getStart();
@@ -130,7 +119,7 @@ public class JspUtil {
int tempLength = (attrs == null) ? 0 : attrs.getLength();
ArrayList<String> temp = new ArrayList<>(tempLength);
for (int i = 0; i < tempLength; i++) {
- @SuppressWarnings("null") // If attrs==null, tempLength == 0
+ @SuppressWarnings("null") // If attrs==null, tempLength == 0
String qName = attrs.getQName(i);
if ((!qName.equals("xmlns")) && (!qName.startsWith("xmlns:"))) {
temp.add(qName);
@@ -148,9 +137,7 @@ public class JspUtil {
temp.add(attrName);
// Check if this value appear in the attribute of the node
if (n.getAttributeValue(attrName) != null) {
- err.jspError(n,
- "jsp.error.duplicate.name.jspattribute",
- attrName);
+ err.jspError(n,
"jsp.error.duplicate.name.jspattribute", attrName);
}
} else {
// Nothing can come before jsp:attribute, and only
@@ -161,9 +148,8 @@ public class JspUtil {
}
/*
- * First check to see if all the mandatory attributes are present. If
so
- * only then proceed to see if the other attributes are valid for the
- * particular tag.
+ * First check to see if all the mandatory attributes are present. If
so only then proceed to see if the other
+ * attributes are valid for the particular tag.
*/
String missingAttribute = null;
@@ -184,8 +170,7 @@ public class JspUtil {
// If mandatory attribute is missing then the exception is thrown
if (!valid) {
- err.jspError(start, "jsp.error.mandatory.attribute", typeOfTag,
- missingAttribute);
+ err.jspError(start, "jsp.error.mandatory.attribute", typeOfTag,
missingAttribute);
}
// Check to see if there are any more attributes for the specified tag.
@@ -195,7 +180,7 @@ public class JspUtil {
}
// Now check to see if the rest of the attributes are valid too.
- for(String attribute : temp) {
+ for (String attribute : temp) {
valid = false;
for (ValidAttribute validAttribute : validAttributes) {
if (attribute.equals(validAttribute.name)) {
@@ -204,8 +189,7 @@ public class JspUtil {
}
}
if (!valid) {
- err.jspError(start, "jsp.error.invalid.attribute", typeOfTag,
- attribute);
+ err.jspError(start, "jsp.error.invalid.attribute", typeOfTag,
attribute);
}
}
// XXX *could* move EL-syntax validation here... (sb)
@@ -227,12 +211,11 @@ public class JspUtil {
}
/**
- * Convert a String value to 'boolean'. Besides the standard conversions
- * done by Boolean.parseBoolean(s), the value "yes" (ignore case)
- * is also converted to 'true'. If 's' is null, then 'false' is returned.
+ * Convert a String value to 'boolean'. Besides the standard conversions
done by Boolean.parseBoolean(s), the value
+ * "yes" (ignore case) is also converted to 'true'. If 's' is null, then
'false' is returned.
+ *
+ * @param s the string to be converted
*
- * @param s
- * the string to be converted
* @return the boolean value associated with the string s
*/
public static boolean booleanValue(String s) {
@@ -248,22 +231,20 @@ public class JspUtil {
}
/**
- * Returns the <code>Class</code> object associated with the class or
- * interface with the given string name.
- *
+ * Returns the <code>Class</code> object associated with the class or
interface with the given string name.
* <p>
- * The <code>Class</code> object is determined by passing the given string
- * name to the <code>Class.forName()</code> method, unless the given string
- * name represents a primitive type, in which case it is converted to a
- * <code>Class</code> object by appending ".class" to it (e.g.,
- * "int.class").
- * @param type The class name, array or primitive type
+ * The <code>Class</code> object is determined by passing the given string
name to the <code>Class.forName()</code>
+ * method, unless the given string name represents a primitive type, in
which case it is converted to a
+ * <code>Class</code> object by appending ".class" to it (e.g.,
"int.class").
+ *
+ * @param type The class name, array or primitive type
* @param loader The class loader
+ *
* @return the loaded class
+ *
* @throws ClassNotFoundException Loading class failed
*/
- public static Class<?> toClass(String type, ClassLoader loader)
- throws ClassNotFoundException {
+ public static Class<?> toClass(String type, ClassLoader loader) throws
ClassNotFoundException {
Class<?> c = null;
int i0 = type.indexOf('[');
@@ -315,18 +296,14 @@ public class JspUtil {
/**
* Produces a String representing a call to the EL interpreter.
*
- * @param isTagFile <code>true</code> if the file is a tag file
- * rather than a JSP
- * @param expression
- * a String containing zero or more "${}" expressions
- * @param expectedType
- * the expected type of the interpreted result
- * @param fnmapvar
- * Variable pointing to a function map.
+ * @param isTagFile <code>true</code> if the file is a tag file rather
than a JSP
+ * @param expression a String containing zero or more "${}" expressions
+ * @param expectedType the expected type of the interpreted result
+ * @param fnmapvar Variable pointing to a function map.
+ *
* @return a String representing a call to the EL interpreter.
*/
- public static String interpreterCall(boolean isTagFile, String expression,
- Class<?> expectedType, String fnmapvar) {
+ public static String interpreterCall(boolean isTagFile, String expression,
Class<?> expectedType, String fnmapvar) {
/*
* Determine which context object to use.
*/
@@ -338,8 +315,8 @@ public class JspUtil {
}
/*
- * Determine whether to use the expected type's textual name or, if
it's
- * a primitive, the name of its correspondent boxed type.
+ * Determine whether to use the expected type's textual name or, if
it's a primitive, the name of its
+ * correspondent boxed type.
*/
String returnType = expectedType.getCanonicalName();
String targetType = returnType;
@@ -376,14 +353,9 @@ public class JspUtil {
* Build up the base call to the interpreter.
*/
targetType = toJavaSourceType(targetType);
- StringBuilder call = new StringBuilder(
- "("
- + returnType
- + ") "
- +
"org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate"
- + "(" + Generator.quote(expression) + ", " + targetType
- + ".class, " + "(jakarta.servlet.jsp.PageContext)" +
jspCtxt + ", "
- + fnmapvar + ")");
+ StringBuilder call = new StringBuilder("(" + returnType + ") " +
+
"org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate" + "(" +
Generator.quote(expression) +
+ ", " + targetType + ".class, " +
"(jakarta.servlet.jsp.PageContext)" + jspCtxt + ", " + fnmapvar + ")");
/*
* Add the primitive converter method if we need to.
@@ -396,11 +368,9 @@ public class JspUtil {
return call.toString();
}
- public static String coerceToPrimitiveBoolean(String s,
- boolean isNamedAttribute) {
+ public static String coerceToPrimitiveBoolean(String s, boolean
isNamedAttribute) {
if (isNamedAttribute) {
- return
"org.apache.jasper.runtime.JspRuntimeLibrary.coerceToBoolean("
- + s + ")";
+ return
"org.apache.jasper.runtime.JspRuntimeLibrary.coerceToBoolean(" + s + ")";
} else {
if (s == null || s.length() == 0) {
return "false";
@@ -412,8 +382,8 @@ public class JspUtil {
public static String coerceToBoolean(String s, boolean isNamedAttribute) {
if (isNamedAttribute) {
- return "(java.lang.Boolean)
org.apache.jasper.runtime.JspRuntimeLibrary.coerce("
- + s + ", java.lang.Boolean.class)";
+ return "(java.lang.Boolean)
org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" + s +
+ ", java.lang.Boolean.class)";
} else {
if (s == null || s.length() == 0) {
return "java.lang.Boolean.FALSE";
@@ -424,11 +394,9 @@ public class JspUtil {
}
}
- public static String coerceToPrimitiveByte(String s,
- boolean isNamedAttribute) {
+ public static String coerceToPrimitiveByte(String s, boolean
isNamedAttribute) {
if (isNamedAttribute) {
- return "org.apache.jasper.runtime.JspRuntimeLibrary.coerceToByte("
- + s + ")";
+ return "org.apache.jasper.runtime.JspRuntimeLibrary.coerceToByte("
+ s + ")";
} else {
if (s == null || s.length() == 0) {
return "(byte) 0";
@@ -440,8 +408,8 @@ public class JspUtil {
public static String coerceToByte(String s, boolean isNamedAttribute) {
if (isNamedAttribute) {
- return "(java.lang.Byte)
org.apache.jasper.runtime.JspRuntimeLibrary.coerce("
- + s + ", java.lang.Byte.class)";
+ return "(java.lang.Byte)
org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" + s +
+ ", java.lang.Byte.class)";
} else {
if (s == null || s.length() == 0) {
return "java.lang.Byte.valueOf((byte) 0)";
@@ -454,8 +422,7 @@ public class JspUtil {
public static String coerceToChar(String s, boolean isNamedAttribute) {
if (isNamedAttribute) {
- return "org.apache.jasper.runtime.JspRuntimeLibrary.coerceToChar("
- + s + ")";
+ return "org.apache.jasper.runtime.JspRuntimeLibrary.coerceToChar("
+ s + ")";
} else {
if (s == null || s.length() == 0) {
return "(char) 0";
@@ -469,8 +436,8 @@ public class JspUtil {
public static String coerceToCharacter(String s, boolean isNamedAttribute)
{
if (isNamedAttribute) {
- return "(java.lang.Character)
org.apache.jasper.runtime.JspRuntimeLibrary.coerce("
- + s + ", java.lang.Character.class)";
+ return "(java.lang.Character)
org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" + s +
+ ", java.lang.Character.class)";
} else {
if (s == null || s.length() == 0) {
return "java.lang.Character.valueOf((char) 0)";
@@ -482,11 +449,9 @@ public class JspUtil {
}
}
- public static String coerceToPrimitiveDouble(String s,
- boolean isNamedAttribute) {
+ public static String coerceToPrimitiveDouble(String s, boolean
isNamedAttribute) {
if (isNamedAttribute) {
- return
"org.apache.jasper.runtime.JspRuntimeLibrary.coerceToDouble("
- + s + ")";
+ return
"org.apache.jasper.runtime.JspRuntimeLibrary.coerceToDouble(" + s + ")";
} else {
if (s == null || s.length() == 0) {
return "(double) 0";
@@ -498,8 +463,7 @@ public class JspUtil {
public static String coerceToDouble(String s, boolean isNamedAttribute) {
if (isNamedAttribute) {
- return "(java.lang.Double)
org.apache.jasper.runtime.JspRuntimeLibrary.coerce("
- + s + ", Double.class)";
+ return "(java.lang.Double)
org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" + s + ", Double.class)";
} else {
if (s == null || s.length() == 0) {
return "java.lang.Double.valueOf(0)";
@@ -510,11 +474,9 @@ public class JspUtil {
}
}
- public static String coerceToPrimitiveFloat(String s,
- boolean isNamedAttribute) {
+ public static String coerceToPrimitiveFloat(String s, boolean
isNamedAttribute) {
if (isNamedAttribute) {
- return "org.apache.jasper.runtime.JspRuntimeLibrary.coerceToFloat("
- + s + ")";
+ return
"org.apache.jasper.runtime.JspRuntimeLibrary.coerceToFloat(" + s + ")";
} else {
if (s == null || s.length() == 0) {
return "(float) 0";
@@ -526,8 +488,8 @@ public class JspUtil {
public static String coerceToFloat(String s, boolean isNamedAttribute) {
if (isNamedAttribute) {
- return "(java.lang.Float)
org.apache.jasper.runtime.JspRuntimeLibrary.coerce("
- + s + ", java.lang.Float.class)";
+ return "(java.lang.Float)
org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" + s +
+ ", java.lang.Float.class)";
} else {
if (s == null || s.length() == 0) {
return "java.lang.Float.valueOf(0)";
@@ -540,8 +502,7 @@ public class JspUtil {
public static String coerceToInt(String s, boolean isNamedAttribute) {
if (isNamedAttribute) {
- return "org.apache.jasper.runtime.JspRuntimeLibrary.coerceToInt("
- + s + ")";
+ return "org.apache.jasper.runtime.JspRuntimeLibrary.coerceToInt("
+ s + ")";
} else {
if (s == null || s.length() == 0) {
return "0";
@@ -553,8 +514,8 @@ public class JspUtil {
public static String coerceToInteger(String s, boolean isNamedAttribute) {
if (isNamedAttribute) {
- return "(java.lang.Integer)
org.apache.jasper.runtime.JspRuntimeLibrary.coerce("
- + s + ", java.lang.Integer.class)";
+ return "(java.lang.Integer)
org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" + s +
+ ", java.lang.Integer.class)";
} else {
if (s == null || s.length() == 0) {
return "java.lang.Integer.valueOf(0)";
@@ -565,11 +526,9 @@ public class JspUtil {
}
}
- public static String coerceToPrimitiveShort(String s,
- boolean isNamedAttribute) {
+ public static String coerceToPrimitiveShort(String s, boolean
isNamedAttribute) {
if (isNamedAttribute) {
- return "org.apache.jasper.runtime.JspRuntimeLibrary.coerceToShort("
- + s + ")";
+ return
"org.apache.jasper.runtime.JspRuntimeLibrary.coerceToShort(" + s + ")";
} else {
if (s == null || s.length() == 0) {
return "(short) 0";
@@ -581,8 +540,8 @@ public class JspUtil {
public static String coerceToShort(String s, boolean isNamedAttribute) {
if (isNamedAttribute) {
- return "(java.lang.Short)
org.apache.jasper.runtime.JspRuntimeLibrary.coerce("
- + s + ", java.lang.Short.class)";
+ return "(java.lang.Short)
org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" + s +
+ ", java.lang.Short.class)";
} else {
if (s == null || s.length() == 0) {
return "java.lang.Short.valueOf((short) 0)";
@@ -593,11 +552,9 @@ public class JspUtil {
}
}
- public static String coerceToPrimitiveLong(String s,
- boolean isNamedAttribute) {
+ public static String coerceToPrimitiveLong(String s, boolean
isNamedAttribute) {
if (isNamedAttribute) {
- return "org.apache.jasper.runtime.JspRuntimeLibrary.coerceToLong("
- + s + ")";
+ return "org.apache.jasper.runtime.JspRuntimeLibrary.coerceToLong("
+ s + ")";
} else {
if (s == null || s.length() == 0) {
return "(long) 0";
@@ -609,8 +566,8 @@ public class JspUtil {
public static String coerceToLong(String s, boolean isNamedAttribute) {
if (isNamedAttribute) {
- return "(java.lang.Long)
org.apache.jasper.runtime.JspRuntimeLibrary.coerce("
- + s + ", java.lang.Long.class)";
+ return "(java.lang.Long)
org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" + s +
+ ", java.lang.Long.class)";
} else {
if (s == null || s.length() == 0) {
return "java.lang.Long.valueOf(0)";
@@ -621,8 +578,8 @@ public class JspUtil {
}
}
- public static BufferedInputStream getInputStream(String fname, Jar jar,
- JspCompilationContext ctxt) throws IOException {
+ public static BufferedInputStream getInputStream(String fname, Jar jar,
JspCompilationContext ctxt)
+ throws IOException {
InputStream in = null;
@@ -634,15 +591,13 @@ public class JspUtil {
}
if (in == null) {
- throw new FileNotFoundException(Localizer.getMessage(
- "jsp.error.file.not.found", fname));
+ throw new
FileNotFoundException(Localizer.getMessage("jsp.error.file.not.found", fname));
}
return new BufferedInputStream(in, JSP_INPUT_STREAM_BUFFER_SIZE);
}
- public static InputSource getInputSource(String fname, Jar jar,
JspCompilationContext ctxt)
- throws IOException {
+ public static InputSource getInputSource(String fname, Jar jar,
JspCompilationContext ctxt) throws IOException {
InputSource source;
if (jar != null) {
String jarEntryName = fname.substring(1);
@@ -656,20 +611,19 @@ public class JspUtil {
}
/**
- * Gets the fully-qualified class name of the tag handler corresponding to
- * the given tag file path.
+ * Gets the fully-qualified class name of the tag handler corresponding to
the given tag file path.
*
- * @param path Tag file path
+ * @param path Tag file path
* @param packageName The package name
- * @param urn The tag identifier
- * @param err Error dispatcher
+ * @param urn The tag identifier
+ * @param err Error dispatcher
+ *
+ * @return Fully-qualified class name of the tag handler corresponding to
the given tag file path
*
- * @return Fully-qualified class name of the tag handler corresponding to
- * the given tag file path
* @throws JasperException Failed to generate a class name for the tag
*/
- public static String getTagHandlerClassName(String path, String
packageName, String urn,
- ErrorDispatcher err) throws JasperException {
+ public static String getTagHandlerClassName(String path, String
packageName, String urn, ErrorDispatcher err)
+ throws JasperException {
String className = null;
@@ -711,8 +665,7 @@ public class JspUtil {
}
private static String getClassNameBase(String packageName, String urn) {
- StringBuilder base =
- new StringBuilder(packageName + ".meta.");
+ StringBuilder base = new StringBuilder(packageName + ".meta.");
if (urn != null) {
base.append(makeJavaPackage(urn));
base.append('.');
@@ -723,8 +676,7 @@ public class JspUtil {
/**
* Converts the given path to a Java package or fully-qualified class name
*
- * @param path
- * Path to convert
+ * @param path Path to convert
*
* @return Java package corresponding to the given path
*/
@@ -745,8 +697,7 @@ public class JspUtil {
/**
* Converts the given identifier to a legal Java identifier
*
- * @param identifier
- * Identifier to convert
+ * @param identifier Identifier to convert
*
* @return Legal Java identifier corresponding to the given identifier
*/
@@ -755,11 +706,9 @@ public class JspUtil {
}
/**
- * Converts the given identifier to a legal Java identifier
- * to be used for JSP Tag file attribute names.
+ * Converts the given identifier to a legal Java identifier to be used for
JSP Tag file attribute names.
*
- * @param identifier
- * Identifier to convert
+ * @param identifier Identifier to convert
*
* @return Legal Java identifier corresponding to the given identifier
*/
@@ -770,21 +719,18 @@ public class JspUtil {
/**
* Converts the given identifier to a legal Java identifier.
*
- * @param identifier
- * Identifier to convert
+ * @param identifier Identifier to convert
*
* @return Legal Java identifier corresponding to the given identifier
*/
- private static String makeJavaIdentifier(String identifier,
- boolean periodToUnderscore) {
+ private static String makeJavaIdentifier(String identifier, boolean
periodToUnderscore) {
StringBuilder modifiedIdentifier = new
StringBuilder(identifier.length());
if (!Character.isJavaIdentifierStart(identifier.charAt(0))) {
modifiedIdentifier.append('_');
}
for (int i = 0; i < identifier.length(); i++) {
char ch = identifier.charAt(i);
- if (Character.isJavaIdentifierPart(ch) &&
- (ch != '_' || !periodToUnderscore)) {
+ if (Character.isJavaIdentifierPart(ch) && (ch != '_' ||
!periodToUnderscore)) {
modifiedIdentifier.append(ch);
} else if (ch == '.' && periodToUnderscore) {
modifiedIdentifier.append('_');
@@ -800,7 +746,9 @@ public class JspUtil {
/**
* Mangle the specified character to create a legal Java class name.
+ *
* @param ch The character
+ *
* @return the replacement character as a string
*/
public static final String mangleChar(char ch) {
@@ -815,7 +763,9 @@ public class JspUtil {
/**
* Test whether the argument is a Java keyword.
+ *
* @param key The name
+ *
* @return <code>true</code> if the name is a java identifier
*/
public static boolean isJavaKeyword(String key) {
@@ -836,16 +786,14 @@ public class JspUtil {
return false;
}
- static InputStreamReader getReader(String fname, String encoding,
- Jar jar, JspCompilationContext ctxt, ErrorDispatcher err)
- throws JasperException, IOException {
+ static InputStreamReader getReader(String fname, String encoding, Jar jar,
JspCompilationContext ctxt,
+ ErrorDispatcher err) throws JasperException, IOException {
return getReader(fname, encoding, jar, ctxt, err, 0);
}
- static InputStreamReader getReader(String fname, String encoding,
- Jar jar, JspCompilationContext ctxt, ErrorDispatcher err, int skip)
- throws JasperException, IOException {
+ static InputStreamReader getReader(String fname, String encoding, Jar jar,
JspCompilationContext ctxt,
+ ErrorDispatcher err, int skip) throws JasperException, IOException
{
InputStreamReader reader = null;
InputStream in = getInputStream(fname, jar, ctxt);
@@ -871,11 +819,11 @@ public class JspUtil {
}
/**
- * Handles taking input from TLDs 'java.lang.Object' ->
- * 'java.lang.Object.class' 'int' -> 'int.class' 'void' ->
'Void.TYPE'
- * 'int[]' -> 'int[].class'
+ * Handles taking input from TLDs 'java.lang.Object' ->
'java.lang.Object.class' 'int' -> 'int.class' 'void'
+ * -> 'Void.TYPE' 'int[]' -> 'int[].class'
*
* @param type The type from the TLD
+ *
* @return the Java type
*/
public static String toJavaSourceTypeFromTld(String type) {
@@ -886,10 +834,11 @@ public class JspUtil {
}
/**
- * Class.getName() return arrays in the form "[[[<et>", where et, the
- * element type can be one of ZBCDFIJS or L<classname>;. It is
- * converted into forms that can be understood by javac.
+ * Class.getName() return arrays in the form "[[[<et>", where et,
the element type can be one of ZBCDFIJS or
+ * L<classname>;. It is converted into forms that can be understood
by javac.
+ *
* @param type the type to convert
+ *
* @return the equivalent type in Java sources
*/
public static String toJavaSourceType(String type) {
@@ -905,15 +854,33 @@ public class JspUtil {
dims++;
} else {
switch (type.charAt(i)) {
- case 'Z': t = "boolean"; break;
- case 'B': t = "byte"; break;
- case 'C': t = "char"; break;
- case 'D': t = "double"; break;
- case 'F': t = "float"; break;
- case 'I': t = "int"; break;
- case 'J': t = "long"; break;
- case 'S': t = "short"; break;
- case 'L': t = type.substring(i+1, type.indexOf(';')); break;
+ case 'Z':
+ t = "boolean";
+ break;
+ case 'B':
+ t = "byte";
+ break;
+ case 'C':
+ t = "char";
+ break;
+ case 'D':
+ t = "double";
+ break;
+ case 'F':
+ t = "float";
+ break;
+ case 'I':
+ t = "int";
+ break;
+ case 'J':
+ t = "long";
+ break;
+ case 'S':
+ t = "short";
+ break;
+ case 'L':
+ t = type.substring(i + 1, type.indexOf(';'));
+ break;
}
break;
}
diff --git a/java/org/apache/jasper/compiler/Localizer.java
b/java/org/apache/jasper/compiler/Localizer.java
index e22803a64d..d0645338df 100644
--- a/java/org/apache/jasper/compiler/Localizer.java
+++ b/java/org/apache/jasper/compiler/Localizer.java
@@ -23,8 +23,7 @@ import java.util.ResourceBundle;
import org.apache.jasper.runtime.ExceptionUtils;
/**
- * Class responsible for converting error codes to corresponding localized
- * error messages.
+ * Class responsible for converting error codes to corresponding localized
error messages.
*
* @author Jan Luehe
*/
@@ -41,11 +40,10 @@ public class Localizer {
}
/*
- * Returns the localized error message corresponding to the given error
- * code.
+ * Returns the localized error message corresponding to the given error
code.
*
- * If the given error code is not defined in the resource bundle for
- * localized error messages, it is used as the error message.
+ * If the given error code is not defined in the resource bundle for
localized error messages, it is used as the
+ * error message.
*
* @param errCode Error code to localize
*
@@ -63,13 +61,13 @@ public class Localizer {
}
/*
- * Returns the localized error message corresponding to the given error
- * code.
+ * Returns the localized error message corresponding to the given error
code.
*
- * If the given error code is not defined in the resource bundle for
- * localized error messages, it is used as the error message.
+ * If the given error code is not defined in the resource bundle for
localized error messages, it is used as the
+ * error message.
*
* @param errCode Error code to localize
+ *
* @param args Arguments for parametric replacement
*
* @return Localized error message
diff --git a/java/org/apache/jasper/compiler/Mark.java
b/java/org/apache/jasper/compiler/Mark.java
index a677087c74..a53cd7bb03 100644
--- a/java/org/apache/jasper/compiler/Mark.java
+++ b/java/org/apache/jasper/compiler/Mark.java
@@ -42,9 +42,9 @@ final class Mark {
/**
* Constructor
*
- * @param reader JspReader this mark belongs to
+ * @param reader JspReader this mark belongs to
* @param inStream current stream for this mark
- * @param name JSP file name
+ * @param name JSP file name
*/
Mark(JspReader reader, char[] inStream, String name) {
this.ctxt = reader.getJspCompilationContext();
@@ -60,7 +60,7 @@ final class Mark {
* Constructor
*/
Mark(Mark other) {
- init(other, false);
+ init(other, false);
}
void update(int cursor, int line, int col) {
@@ -105,7 +105,7 @@ final class Mark {
@Override
public String toString() {
- return getFile()+"("+line+","+col+")";
+ return getFile() + "(" + line + "," + col + ")";
}
public String getFile() {
diff --git a/java/org/apache/jasper/compiler/NewlineReductionServletWriter.java
b/java/org/apache/jasper/compiler/NewlineReductionServletWriter.java
index ed6fbfe44b..72fe3f1c5e 100644
--- a/java/org/apache/jasper/compiler/NewlineReductionServletWriter.java
+++ b/java/org/apache/jasper/compiler/NewlineReductionServletWriter.java
@@ -19,13 +19,10 @@ package org.apache.jasper.compiler;
import java.io.PrintWriter;
/**
- * This class filters duplicate newlines instructions from the compiler output,
- * and therefore from the runtime JSP. The duplicates typically happen because
- * the compiler has multiple branches that write them, but they operate
- * independently and don't realize that the previous output was identical.
- *
- * Removing these lines makes the JSP more efficient by executing fewer
- * operations during runtime.
+ * This class filters duplicate newlines instructions from the compiler
output, and therefore from the runtime JSP. The
+ * duplicates typically happen because the compiler has multiple branches that
write them, but they operate
+ * independently and don't realize that the previous output was identical.
Removing these lines makes the JSP more
+ * efficient by executing fewer operations during runtime.
*/
public class NewlineReductionServletWriter extends ServletWriter {
diff --git a/java/org/apache/jasper/compiler/Node.java
b/java/org/apache/jasper/compiler/Node.java
index a197251454..fa8d56f69a 100644
--- a/java/org/apache/jasper/compiler/Node.java
+++ b/java/org/apache/jasper/compiler/Node.java
@@ -40,8 +40,8 @@ import org.apache.jasper.compiler.tagplugin.TagPluginContext;
import org.xml.sax.Attributes;
/**
- * An internal data representation of a JSP page or a JSP document (XML). Also
- * included here is a visitor class for traversing nodes.
+ * An internal data representation of a JSP page or a JSP document (XML). Also
included here is a visitor class for
+ * traversing nodes.
*
* @author Kin-man Chung
* @author Jan Luehe
@@ -82,10 +82,9 @@ abstract class Node implements TagConstants {
protected String localName;
/*
- * The name of the inner class to which the codes for this node and its
body
- * are generated. For instance, for <jsp:body> in foo.jsp, this is
- * "foo_jspHelper". This is primarily used for communicating such info from
- * Generator to Smap generator.
+ * The name of the inner class to which the codes for this node and its
body are generated. For instance, for
+ * <jsp:body> in foo.jsp, this is "foo_jspHelper". This is primarily used
for communicating such info from Generator
+ * to Smap generator.
*/
protected String innerClassName;
@@ -99,10 +98,8 @@ abstract class Node implements TagConstants {
/**
* Constructor.
*
- * @param start
- * The location of the jsp page
- * @param parent
- * The enclosing node
+ * @param start The location of the jsp page
+ * @param parent The enclosing node
*/
Node(Mark start, Node parent) {
this.startMark = start;
@@ -112,19 +109,13 @@ abstract class Node implements TagConstants {
/**
* Constructor for Nodes parsed from standard syntax.
*
- * @param qName
- * The action's qualified name
- * @param localName
- * The action's local name
- * @param attrs
- * The attributes for this node
- * @param start
- * The location of the jsp page
- * @param parent
- * The enclosing node
+ * @param qName The action's qualified name
+ * @param localName The action's local name
+ * @param attrs The attributes for this node
+ * @param start The location of the jsp page
+ * @param parent The enclosing node
*/
- Node(String qName, String localName, Attributes attrs, Mark start,
- Node parent) {
+ Node(String qName, String localName, Attributes attrs, Mark start, Node
parent) {
this.qName = qName;
this.localName = localName;
this.attrs = attrs;
@@ -135,25 +126,16 @@ abstract class Node implements TagConstants {
/**
* Constructor for Nodes parsed from XML syntax.
*
- * @param qName
- * The action's qualified name
- * @param localName
- * The action's local name
- * @param attrs
- * The action's attributes whose name does not start with xmlns
- * @param nonTaglibXmlnsAttrs
- * The action's xmlns attributes that do not represent tag
- * libraries
- * @param taglibAttrs
- * The action's xmlns attributes that represent tag libraries
- * @param start
- * The location of the jsp page
- * @param parent
- * The enclosing node
+ * @param qName The action's qualified name
+ * @param localName The action's local name
+ * @param attrs The action's attributes whose name does not
start with xmlns
+ * @param nonTaglibXmlnsAttrs The action's xmlns attributes that do not
represent tag libraries
+ * @param taglibAttrs The action's xmlns attributes that represent
tag libraries
+ * @param start The location of the jsp page
+ * @param parent The enclosing node
*/
- Node(String qName, String localName, Attributes attrs,
- Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs, Mark start,
- Node parent) {
+ Node(String qName, String localName, Attributes attrs, Attributes
nonTaglibXmlnsAttrs, Attributes taglibAttrs,
+ Mark start, Node parent) {
this.qName = qName;
this.localName = localName;
this.attrs = attrs;
@@ -166,12 +148,10 @@ abstract class Node implements TagConstants {
/*
* Constructor.
*
- * @param qName The action's qualified name @param localName The action's
- * local name @param text The text associated with this node @param start
- * The location of the jsp page @param parent The enclosing node
+ * @param qName The action's qualified name @param localName The action's
local name @param text The text associated
+ * with this node @param start The location of the jsp page @param parent
The enclosing node
*/
- Node(String qName, String localName, String text, Mark start,
- Node parent) {
+ Node(String qName, String localName, String text, Mark start, Node parent)
{
this.qName = qName;
this.localName = localName;
this.text = text;
@@ -190,27 +170,25 @@ abstract class Node implements TagConstants {
/*
* Gets this Node's attributes.
*
- * In the case of a Node parsed from standard syntax, this method returns
- * all the Node's attributes.
+ * In the case of a Node parsed from standard syntax, this method returns
all the Node's attributes.
*
- * In the case of a Node parsed from XML syntax, this method returns only
- * those attributes whose name does not start with xmlns.
+ * In the case of a Node parsed from XML syntax, this method returns only
those attributes whose name does not start
+ * with xmlns.
*/
public Attributes getAttributes() {
return this.attrs;
}
/*
- * Gets this Node's xmlns attributes that represent tag libraries (only
- * meaningful for Nodes parsed from XML syntax)
+ * Gets this Node's xmlns attributes that represent tag libraries (only
meaningful for Nodes parsed from XML syntax)
*/
public Attributes getTaglibAttributes() {
return this.taglibAttrs;
}
/*
- * Gets this Node's xmlns attributes that do not represent tag libraries
- * (only meaningful for Nodes parsed from XML syntax)
+ * Gets this Node's xmlns attributes that do not represent tag libraries
(only meaningful for Nodes parsed from XML
+ * syntax)
*/
public Attributes getNonTaglibXmlnsAttributes() {
return this.nonTaglibXmlnsAttrs;
@@ -225,8 +203,8 @@ abstract class Node implements TagConstants {
}
/**
- * Get the attribute that is non request time expression, either from the
- * attribute of the node, or from a jsp:attribute
+ * Get the attribute that is non request time expression, either from the
attribute of the node, or from a
+ * jsp:attribute
*
* @param name The name of the attribute
*
@@ -248,15 +226,13 @@ abstract class Node implements TagConstants {
}
/**
- * Searches all sub-nodes of this node for jsp:attribute standard actions
- * with the given name.
+ * Searches all sub-nodes of this node for jsp:attribute standard actions
with the given name.
* <p>
- * This should always be called and only be called for nodes that accept
- * dynamic runtime attribute expressions.
+ * This should always be called and only be called for nodes that accept
dynamic runtime attribute expressions.
*
* @param name The name of the attribute
- * @return the NamedAttribute node of the matching named attribute, nor
null
- * if no such node is found.
+ *
+ * @return the NamedAttribute node of the matching named attribute, nor
null if no such node is found.
*/
public NamedAttribute getNamedAttributeNode(String name) {
NamedAttribute result = null;
@@ -284,11 +260,10 @@ abstract class Node implements TagConstants {
}
/**
- * Searches all subnodes of this node for jsp:attribute standard actions,
- * and returns that set of nodes as a Node.Nodes object.
+ * Searches all subnodes of this node for jsp:attribute standard actions,
and returns that set of nodes as a
+ * Node.Nodes object.
*
- * @return Possibly empty Node.Nodes object containing any jsp:attribute
- * subnodes of this Node
+ * @return Possibly empty Node.Nodes object containing any jsp:attribute
subnodes of this Node
*/
public Node.Nodes getNamedAttributeNodes() {
@@ -371,11 +346,10 @@ 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 by the extending classes.
+ * Selects and invokes a method in the visitor class based on the node
type. This is abstract and should be overrode
+ * by the extending classes.
*
- * @param v
- * The visitor class
+ * @param v The visitor class
*/
abstract void accept(Visitor v) throws JasperException;
@@ -416,28 +390,23 @@ abstract class Node implements TagConstants {
private String jspConfigPageEnc;
/*
- * Flag indicating if the default page encoding is being used (only
- * applicable with standard syntax).
+ * Flag indicating if the default page encoding is being used (only
applicable with standard syntax).
*
- * True if the page does not provide a page directive with a
- * 'contentType' attribute (or the 'contentType' attribute doesn't have
- * a CHARSET value), the page does not provide a page directive with a
- * 'pageEncoding' attribute, and there is no JSP configuration element
- * page-encoding whose URL pattern matches the page.
+ * True if the page does not provide a page directive with a
'contentType' attribute (or the 'contentType'
+ * attribute doesn't have a CHARSET value), the page does not provide
a page directive with a 'pageEncoding'
+ * attribute, and there is no JSP configuration element page-encoding
whose URL pattern matches the page.
*/
private boolean isDefaultPageEncoding;
/*
- * Indicates whether an encoding has been explicitly specified in the
- * page's XML prolog (only used for pages in XML syntax). This
- * information is used to decide whether a translation error must be
- * reported for encoding conflicts.
+ * Indicates whether an encoding has been explicitly specified in the
page's XML prolog (only used for pages in
+ * XML syntax). This information is used to decide whether a
translation error must be reported for encoding
+ * conflicts.
*/
private boolean isEncodingSpecifiedInProlog;
/*
- * Indicates whether an encoding has been explicitly specified in the
- * page's dom.
+ * Indicates whether an encoding has been explicitly specified in the
page's dom.
*/
private boolean isBomPresent;
@@ -474,16 +443,16 @@ abstract class Node implements TagConstants {
}
/*
- * Sets the encoding specified in the JSP config element whose URL
- * pattern matches the page containing this Root.
+ * Sets the encoding specified in the JSP config element whose URL
pattern matches the page containing this
+ * Root.
*/
public void setJspConfigPageEncoding(String enc) {
jspConfigPageEnc = enc;
}
/*
- * Gets the encoding specified in the JSP config element whose URL
- * pattern matches the page containing this Root.
+ * Gets the encoding specified in the JSP config element whose URL
pattern matches the page containing this
+ * Root.
*/
public String getJspConfigPageEncoding() {
return jspConfigPageEnc;
@@ -541,11 +510,9 @@ abstract class Node implements TagConstants {
*/
public static class JspRoot extends Node {
- JspRoot(String qName, Attributes attrs,
- Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs,
- Mark start, Node parent) {
- super(qName, ROOT_ACTION, attrs, nonTaglibXmlnsAttrs, taglibAttrs,
- start, parent);
+ JspRoot(String qName, Attributes attrs, Attributes
nonTaglibXmlnsAttrs, Attributes taglibAttrs, Mark start,
+ Node parent) {
+ super(qName, ROOT_ACTION, attrs, nonTaglibXmlnsAttrs, taglibAttrs,
start, parent);
}
@Override
@@ -565,11 +532,9 @@ abstract class Node implements TagConstants {
this(JSP_PAGE_DIRECTIVE_ACTION, attrs, null, null, start, parent);
}
- PageDirective(String qName, Attributes attrs,
- Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs,
+ PageDirective(String qName, Attributes attrs, Attributes
nonTaglibXmlnsAttrs, Attributes taglibAttrs,
Mark start, Node parent) {
- super(qName, PAGE_DIRECTIVE_ACTION, attrs, nonTaglibXmlnsAttrs,
- taglibAttrs, start, parent);
+ super(qName, PAGE_DIRECTIVE_ACTION, attrs, nonTaglibXmlnsAttrs,
taglibAttrs, start, parent);
imports = new ArrayList<>();
}
@@ -579,12 +544,10 @@ abstract class Node implements TagConstants {
}
/**
- * Parses the comma-separated list of class or package names in the
- * given attribute value and adds each component to this
PageDirective's
- * vector of imported classes and packages.
+ * Parses the comma-separated list of class or package names in the
given attribute value and adds each
+ * component to this PageDirective's vector of imported classes and
packages.
*
- * @param value
- * A comma-separated string of imports.
+ * @param value A comma-separated string of imports.
*/
public void addImport(String value) {
int start = 0;
@@ -606,16 +569,14 @@ abstract class Node implements TagConstants {
}
/**
- * Just need enough validation to make sure nothing strange is going
on.
- * The compiler will validate this thoroughly when it tries to compile
- * the resulting .java file.
+ * Just need enough validation to make sure nothing strange is going
on. The compiler will validate this
+ * thoroughly when it tries to compile the resulting .java file.
*/
private String validateImport(String importEntry) {
// This should either be a fully-qualified class name or a package
// name with a wildcard
if (importEntry.indexOf(';') > -1) {
- throw new IllegalArgumentException(
- Localizer.getMessage("jsp.error.page.invalid.import"));
+ throw new
IllegalArgumentException(Localizer.getMessage("jsp.error.page.invalid.import"));
}
return importEntry.trim();
}
@@ -630,11 +591,9 @@ abstract class Node implements TagConstants {
this(JSP_INCLUDE_DIRECTIVE_ACTION, attrs, null, null, start,
parent);
}
- IncludeDirective(String qName, Attributes attrs,
- Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs,
+ IncludeDirective(String qName, Attributes attrs, Attributes
nonTaglibXmlnsAttrs, Attributes taglibAttrs,
Mark start, Node parent) {
- super(qName, INCLUDE_DIRECTIVE_ACTION, attrs, nonTaglibXmlnsAttrs,
- taglibAttrs, start, parent);
+ super(qName, INCLUDE_DIRECTIVE_ACTION, attrs, nonTaglibXmlnsAttrs,
taglibAttrs, start, parent);
}
@Override
@@ -649,8 +608,7 @@ abstract class Node implements TagConstants {
public static class TaglibDirective extends Node {
TaglibDirective(Attributes attrs, Mark start, Node parent) {
- super(JSP_TAGLIB_DIRECTIVE_ACTION, TAGLIB_DIRECTIVE_ACTION, attrs,
- start, parent);
+ super(JSP_TAGLIB_DIRECTIVE_ACTION, TAGLIB_DIRECTIVE_ACTION, attrs,
start, parent);
}
@Override
@@ -669,11 +627,9 @@ abstract class Node implements TagConstants {
this(JSP_TAG_DIRECTIVE_ACTION, attrs, null, null, start, parent);
}
- TagDirective(String qName, Attributes attrs,
- Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs,
- Mark start, Node parent) {
- super(qName, TAG_DIRECTIVE_ACTION, attrs, nonTaglibXmlnsAttrs,
- taglibAttrs, start, parent);
+ TagDirective(String qName, Attributes attrs, Attributes
nonTaglibXmlnsAttrs, Attributes taglibAttrs, Mark start,
+ Node parent) {
+ super(qName, TAG_DIRECTIVE_ACTION, attrs, nonTaglibXmlnsAttrs,
taglibAttrs, start, parent);
imports = new ArrayList<>();
}
@@ -683,12 +639,10 @@ abstract class Node implements TagConstants {
}
/**
- * Parses the comma-separated list of class or package names in the
- * given attribute value and adds each component to this
PageDirective's
- * vector of imported classes and packages.
+ * Parses the comma-separated list of class or package names in the
given attribute value and adds each
+ * component to this PageDirective's vector of imported classes and
packages.
*
- * @param value
- * A comma-separated string of imports.
+ * @param value A comma-separated string of imports.
*/
public void addImport(String value) {
int start = 0;
@@ -716,15 +670,12 @@ abstract class Node implements TagConstants {
public static class AttributeDirective extends Node {
AttributeDirective(Attributes attrs, Mark start, Node parent) {
- this(JSP_ATTRIBUTE_DIRECTIVE_ACTION, attrs, null, null, start,
- parent);
+ this(JSP_ATTRIBUTE_DIRECTIVE_ACTION, attrs, null, null, start,
parent);
}
- AttributeDirective(String qName, Attributes attrs,
- Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs,
+ AttributeDirective(String qName, Attributes attrs, Attributes
nonTaglibXmlnsAttrs, Attributes taglibAttrs,
Mark start, Node parent) {
- super(qName, ATTRIBUTE_DIRECTIVE_ACTION, attrs,
- nonTaglibXmlnsAttrs, taglibAttrs, start, parent);
+ super(qName, ATTRIBUTE_DIRECTIVE_ACTION, attrs,
nonTaglibXmlnsAttrs, taglibAttrs, start, parent);
}
@Override
@@ -739,15 +690,12 @@ abstract class Node implements TagConstants {
public static class VariableDirective extends Node {
VariableDirective(Attributes attrs, Mark start, Node parent) {
- this(JSP_VARIABLE_DIRECTIVE_ACTION, attrs, null, null, start,
- parent);
+ this(JSP_VARIABLE_DIRECTIVE_ACTION, attrs, null, null, start,
parent);
}
- VariableDirective(String qName, Attributes attrs,
- Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs,
+ VariableDirective(String qName, Attributes attrs, Attributes
nonTaglibXmlnsAttrs, Attributes taglibAttrs,
Mark start, Node parent) {
- super(qName, VARIABLE_DIRECTIVE_ACTION, attrs, nonTaglibXmlnsAttrs,
- taglibAttrs, start, parent);
+ super(qName, VARIABLE_DIRECTIVE_ACTION, attrs,
nonTaglibXmlnsAttrs, taglibAttrs, start, parent);
}
@Override
@@ -765,11 +713,9 @@ abstract class Node implements TagConstants {
this(JSP_INVOKE_ACTION, attrs, null, null, start, parent);
}
- InvokeAction(String qName, Attributes attrs,
- Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs,
- Mark start, Node parent) {
- super(qName, INVOKE_ACTION, attrs, nonTaglibXmlnsAttrs,
- taglibAttrs, start, parent);
+ InvokeAction(String qName, Attributes attrs, Attributes
nonTaglibXmlnsAttrs, Attributes taglibAttrs, Mark start,
+ Node parent) {
+ super(qName, INVOKE_ACTION, attrs, nonTaglibXmlnsAttrs,
taglibAttrs, start, parent);
}
@Override
@@ -787,11 +733,9 @@ abstract class Node implements TagConstants {
this(JSP_DOBODY_ACTION, attrs, null, null, start, parent);
}
- DoBodyAction(String qName, Attributes attrs,
- Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs,
- Mark start, Node parent) {
- super(qName, DOBODY_ACTION, attrs, nonTaglibXmlnsAttrs,
- taglibAttrs, start, parent);
+ DoBodyAction(String qName, Attributes attrs, Attributes
nonTaglibXmlnsAttrs, Attributes taglibAttrs, Mark start,
+ Node parent) {
+ super(qName, DOBODY_ACTION, attrs, nonTaglibXmlnsAttrs,
taglibAttrs, start, parent);
}
@Override
@@ -820,22 +764,18 @@ abstract class Node implements TagConstants {
*/
public abstract static class ScriptingElement extends Node {
- ScriptingElement(String qName, String localName, String text,
- Mark start, Node parent) {
+ ScriptingElement(String qName, String localName, String text, Mark
start, Node parent) {
super(qName, localName, text, start, parent);
}
- ScriptingElement(String qName, String localName,
- Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs,
+ ScriptingElement(String qName, String localName, Attributes
nonTaglibXmlnsAttrs, Attributes taglibAttrs,
Mark start, Node parent) {
- super(qName, localName, null, nonTaglibXmlnsAttrs, taglibAttrs,
- start, parent);
+ super(qName, localName, null, nonTaglibXmlnsAttrs, taglibAttrs,
start, parent);
}
/**
- * When this node was created from a JSP page in JSP syntax, its text
- * was stored as a String in the "text" field, whereas when this node
- * was created from a JSP document, its text was stored as one or more
+ * When this node was created from a JSP page in JSP syntax, its text
was stored as a String in the "text"
+ * field, whereas when this node was created from a JSP document, its
text was stored as one or more
* TemplateText nodes in its body. This method handles either case.
*
* @return The text string
@@ -859,8 +799,7 @@ abstract class Node implements TagConstants {
}
/**
- * For the same reason as above, the source line information in the
- * contained TemplateText node should be used.
+ * For the same reason as above, the source line information in the
contained TemplateText node should be used.
*/
@Override
public Mark getStart() {
@@ -878,14 +817,11 @@ abstract class Node implements TagConstants {
public static class Declaration extends ScriptingElement {
Declaration(String text, Mark start, Node parent) {
- super(JSP_DECLARATION_ACTION, DECLARATION_ACTION, text, start,
- parent);
+ super(JSP_DECLARATION_ACTION, DECLARATION_ACTION, text, start,
parent);
}
- Declaration(String qName, Attributes nonTaglibXmlnsAttrs,
- Attributes taglibAttrs, Mark start, Node parent) {
- super(qName, DECLARATION_ACTION, nonTaglibXmlnsAttrs, taglibAttrs,
- start, parent);
+ Declaration(String qName, Attributes nonTaglibXmlnsAttrs, Attributes
taglibAttrs, Mark start, Node parent) {
+ super(qName, DECLARATION_ACTION, nonTaglibXmlnsAttrs, taglibAttrs,
start, parent);
}
@Override
@@ -895,8 +831,7 @@ abstract class Node implements TagConstants {
}
/**
- * Represents an expression. Expressions in attributes are embedded in the
- * attribute string and not here.
+ * Represents an expression. Expressions in attributes are embedded in the
attribute string and not here.
*/
public static class Expression extends ScriptingElement {
@@ -904,10 +839,8 @@ abstract class Node implements TagConstants {
super(JSP_EXPRESSION_ACTION, EXPRESSION_ACTION, text, start,
parent);
}
- Expression(String qName, Attributes nonTaglibXmlnsAttrs,
- Attributes taglibAttrs, Mark start, Node parent) {
- super(qName, EXPRESSION_ACTION, nonTaglibXmlnsAttrs, taglibAttrs,
- start, parent);
+ Expression(String qName, Attributes nonTaglibXmlnsAttrs, Attributes
taglibAttrs, Mark start, Node parent) {
+ super(qName, EXPRESSION_ACTION, nonTaglibXmlnsAttrs, taglibAttrs,
start, parent);
}
@Override
@@ -925,10 +858,8 @@ abstract class Node implements TagConstants {
super(JSP_SCRIPTLET_ACTION, SCRIPTLET_ACTION, text, start, parent);
}
- Scriptlet(String qName, Attributes nonTaglibXmlnsAttrs,
- Attributes taglibAttrs, Mark start, Node parent) {
- super(qName, SCRIPTLET_ACTION, nonTaglibXmlnsAttrs, taglibAttrs,
- start, parent);
+ Scriptlet(String qName, Attributes nonTaglibXmlnsAttrs, Attributes
taglibAttrs, Mark start, Node parent) {
+ super(qName, SCRIPTLET_ACTION, nonTaglibXmlnsAttrs, taglibAttrs,
start, parent);
}
@Override
@@ -938,8 +869,7 @@ abstract class Node implements TagConstants {
}
/**
- * Represents an EL expression. Expressions in attributes are embedded in
- * the attribute string and not here.
+ * Represents an EL expression. Expressions in attributes are embedded in
the attribute string and not here.
*/
public static class ELExpression extends Node {
@@ -981,11 +911,9 @@ abstract class Node implements TagConstants {
this(JSP_PARAM_ACTION, attrs, null, null, start, parent);
}
- ParamAction(String qName, Attributes attrs,
- Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs,
- Mark start, Node parent) {
- super(qName, PARAM_ACTION, attrs, nonTaglibXmlnsAttrs, taglibAttrs,
- start, parent);
+ ParamAction(String qName, Attributes attrs, Attributes
nonTaglibXmlnsAttrs, Attributes taglibAttrs, Mark start,
+ Node parent) {
+ super(qName, PARAM_ACTION, attrs, nonTaglibXmlnsAttrs,
taglibAttrs, start, parent);
}
@Override
@@ -1013,11 +941,9 @@ abstract class Node implements TagConstants {
this(JSP_INCLUDE_ACTION, attrs, null, null, start, parent);
}
- IncludeAction(String qName, Attributes attrs,
- Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs,
+ IncludeAction(String qName, Attributes attrs, Attributes
nonTaglibXmlnsAttrs, Attributes taglibAttrs,
Mark start, Node parent) {
- super(qName, INCLUDE_ACTION, attrs, nonTaglibXmlnsAttrs,
- taglibAttrs, start, parent);
+ super(qName, INCLUDE_ACTION, attrs, nonTaglibXmlnsAttrs,
taglibAttrs, start, parent);
}
@Override
@@ -1045,11 +971,9 @@ abstract class Node implements TagConstants {
this(JSP_FORWARD_ACTION, attrs, null, null, start, parent);
}
- ForwardAction(String qName, Attributes attrs,
- Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs,
+ ForwardAction(String qName, Attributes attrs, Attributes
nonTaglibXmlnsAttrs, Attributes taglibAttrs,
Mark start, Node parent) {
- super(qName, FORWARD_ACTION, attrs, nonTaglibXmlnsAttrs,
- taglibAttrs, start, parent);
+ super(qName, FORWARD_ACTION, attrs, nonTaglibXmlnsAttrs,
taglibAttrs, start, parent);
}
@Override
@@ -1075,11 +999,9 @@ abstract class Node implements TagConstants {
this(JSP_GET_PROPERTY_ACTION, attrs, null, null, start, parent);
}
- GetProperty(String qName, Attributes attrs,
- Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs,
- Mark start, Node parent) {
- super(qName, GET_PROPERTY_ACTION, attrs, nonTaglibXmlnsAttrs,
- taglibAttrs, start, parent);
+ GetProperty(String qName, Attributes attrs, Attributes
nonTaglibXmlnsAttrs, Attributes taglibAttrs, Mark start,
+ Node parent) {
+ super(qName, GET_PROPERTY_ACTION, attrs, nonTaglibXmlnsAttrs,
taglibAttrs, start, parent);
}
@Override
@@ -1099,11 +1021,9 @@ abstract class Node implements TagConstants {
this(JSP_SET_PROPERTY_ACTION, attrs, null, null, start, parent);
}
- SetProperty(String qName, Attributes attrs,
- Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs,
- Mark start, Node parent) {
- super(qName, SET_PROPERTY_ACTION, attrs, nonTaglibXmlnsAttrs,
- taglibAttrs, start, parent);
+ SetProperty(String qName, Attributes attrs, Attributes
nonTaglibXmlnsAttrs, Attributes taglibAttrs, Mark start,
+ Node parent) {
+ super(qName, SET_PROPERTY_ACTION, attrs, nonTaglibXmlnsAttrs,
taglibAttrs, start, parent);
}
@Override
@@ -1131,11 +1051,9 @@ abstract class Node implements TagConstants {
this(JSP_USE_BEAN_ACTION, attrs, null, null, start, parent);
}
- UseBean(String qName, Attributes attrs,
- Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs,
- Mark start, Node parent) {
- super(qName, USE_BEAN_ACTION, attrs, nonTaglibXmlnsAttrs,
- taglibAttrs, start, parent);
+ UseBean(String qName, Attributes attrs, Attributes
nonTaglibXmlnsAttrs, Attributes taglibAttrs, Mark start,
+ Node parent) {
+ super(qName, USE_BEAN_ACTION, attrs, nonTaglibXmlnsAttrs,
taglibAttrs, start, parent);
}
@Override
@@ -1159,11 +1077,9 @@ abstract class Node implements TagConstants {
private JspAttribute[] jspAttrs;
- UninterpretedTag(String qName, String localName,
- Attributes attrs, Attributes nonTaglibXmlnsAttrs,
+ UninterpretedTag(String qName, String localName, Attributes attrs,
Attributes nonTaglibXmlnsAttrs,
Attributes taglibAttrs, Mark start, Node parent) {
- super(qName, localName, attrs, nonTaglibXmlnsAttrs, taglibAttrs,
- start, parent);
+ super(qName, localName, attrs, nonTaglibXmlnsAttrs, taglibAttrs,
start, parent);
}
@Override
@@ -1193,11 +1109,9 @@ abstract class Node implements TagConstants {
this(JSP_ELEMENT_ACTION, attrs, null, null, start, parent);
}
- JspElement(String qName, Attributes attrs,
- Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs,
- Mark start, Node parent) {
- super(qName, ELEMENT_ACTION, attrs, nonTaglibXmlnsAttrs,
- taglibAttrs, start, parent);
+ JspElement(String qName, Attributes attrs, Attributes
nonTaglibXmlnsAttrs, Attributes taglibAttrs, Mark start,
+ Node parent) {
+ super(qName, ELEMENT_ACTION, attrs, nonTaglibXmlnsAttrs,
taglibAttrs, start, parent);
}
@Override
@@ -1233,11 +1147,9 @@ abstract class Node implements TagConstants {
*/
public static class JspOutput extends Node {
- JspOutput(String qName, Attributes attrs,
- Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs,
- Mark start, Node parent) {
- super(qName, OUTPUT_ACTION, attrs, nonTaglibXmlnsAttrs,
- taglibAttrs, start, parent);
+ JspOutput(String qName, Attributes attrs, Attributes
nonTaglibXmlnsAttrs, Attributes taglibAttrs, Mark start,
+ Node parent) {
+ super(qName, OUTPUT_ACTION, attrs, nonTaglibXmlnsAttrs,
taglibAttrs, start, parent);
}
@Override
@@ -1247,8 +1159,8 @@ abstract class Node implements TagConstants {
}
/**
- * Collected information about child elements. Used by nodes like
CustomTag,
- * JspBody, and NamedAttribute. The information is set in the Collector.
+ * Collected information about child elements. Used by nodes like
CustomTag, JspBody, and NamedAttribute. The
+ * information is set in the Collector.
*/
public static class ChildInfo {
private boolean scriptless; // true if the tag and its body
@@ -1318,9 +1230,8 @@ abstract class Node implements TagConstants {
private final ChildInfo childInfo = new ChildInfo();
- ChildInfoBase(String qName, String localName, Attributes attrs,
- Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs, Mark
start,
- Node parent) {
+ ChildInfoBase(String qName, String localName, Attributes attrs,
Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs, Mark start, Node parent) {
super(qName, localName, attrs, nonTaglibXmlnsAttrs, taglibAttrs,
start, parent);
}
@@ -1382,10 +1293,9 @@ abstract class Node implements TagConstants {
private TagPluginContext tagPluginContext;
/**
- * The following two fields are used for holding the Java scriptlets
- * that the tag plugins may generate. Meaningful only if useTagPlugin
is
- * true; Could move them into TagPluginContextImpl, but we'll need to
- * cast tagPluginContext to TagPluginContextImpl all the time...
+ * The following two fields are used for holding the Java scriptlets
that the tag plugins may generate.
+ * Meaningful only if useTagPlugin is true; Could move them into
TagPluginContextImpl, but we'll need to cast
+ * tagPluginContext to TagPluginContextImpl all the time...
*/
private Nodes atSTag;
@@ -1394,22 +1304,18 @@ abstract class Node implements TagConstants {
/*
* Constructor for custom action implemented by tag handler.
*/
- CustomTag(String qName, String prefix, String localName,
- String uri, Attributes attrs, Mark start, Node parent,
+ CustomTag(String qName, String prefix, String localName, String uri,
Attributes attrs, Mark start, Node parent,
TagInfo tagInfo, Class<?> tagHandlerClass) {
- this(qName, prefix, localName, uri, attrs, null, null, start,
- parent, tagInfo, tagHandlerClass);
+ this(qName, prefix, localName, uri, attrs, null, null, start,
parent, tagInfo, tagHandlerClass);
}
/*
* Constructor for custom action implemented by tag handler.
*/
- CustomTag(String qName, String prefix, String localName,
- String uri, Attributes attrs, Attributes nonTaglibXmlnsAttrs,
- Attributes taglibAttrs, Mark start, Node parent,
- TagInfo tagInfo, Class<?> tagHandlerClass) {
- super(qName, localName, attrs, nonTaglibXmlnsAttrs, taglibAttrs,
- start, parent);
+ CustomTag(String qName, String prefix, String localName, String uri,
Attributes attrs,
+ Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs, Mark
start, Node parent, TagInfo tagInfo,
+ Class<?> tagHandlerClass) {
+ super(qName, localName, attrs, nonTaglibXmlnsAttrs, taglibAttrs,
start, parent);
this.uri = uri;
this.prefix = prefix;
@@ -1418,40 +1324,30 @@ abstract class Node implements TagConstants {
this.tagHandlerClass = tagHandlerClass;
this.customNestingLevel = makeCustomNestingLevel();
- this.implementsIterationTag = IterationTag.class
- .isAssignableFrom(tagHandlerClass);
- this.implementsBodyTag = BodyTag.class
- .isAssignableFrom(tagHandlerClass);
- this.implementsTryCatchFinally = TryCatchFinally.class
- .isAssignableFrom(tagHandlerClass);
- this.implementsSimpleTag = SimpleTag.class
- .isAssignableFrom(tagHandlerClass);
- this.implementsDynamicAttributes = DynamicAttributes.class
- .isAssignableFrom(tagHandlerClass);
- this.implementsJspIdConsumer = JspIdConsumer.class
- .isAssignableFrom(tagHandlerClass);
+ this.implementsIterationTag =
IterationTag.class.isAssignableFrom(tagHandlerClass);
+ this.implementsBodyTag =
BodyTag.class.isAssignableFrom(tagHandlerClass);
+ this.implementsTryCatchFinally =
TryCatchFinally.class.isAssignableFrom(tagHandlerClass);
+ this.implementsSimpleTag =
SimpleTag.class.isAssignableFrom(tagHandlerClass);
+ this.implementsDynamicAttributes =
DynamicAttributes.class.isAssignableFrom(tagHandlerClass);
+ this.implementsJspIdConsumer =
JspIdConsumer.class.isAssignableFrom(tagHandlerClass);
}
/*
* Constructor for custom action implemented by tag file.
*/
- CustomTag(String qName, String prefix, String localName,
- String uri, Attributes attrs, Mark start, Node parent,
+ CustomTag(String qName, String prefix, String localName, String uri,
Attributes attrs, Mark start, Node parent,
TagFileInfo tagFileInfo) {
- this(qName, prefix, localName, uri, attrs, null, null, start,
- parent, tagFileInfo);
+ this(qName, prefix, localName, uri, attrs, null, null, start,
parent, tagFileInfo);
}
/*
* Constructor for custom action implemented by tag file.
*/
- CustomTag(String qName, String prefix, String localName,
- String uri, Attributes attrs, Attributes nonTaglibXmlnsAttrs,
- Attributes taglibAttrs, Mark start, Node parent,
+ CustomTag(String qName, String prefix, String localName, String uri,
Attributes attrs,
+ Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs, Mark
start, Node parent,
TagFileInfo tagFileInfo) {
- super(qName, localName, attrs, nonTaglibXmlnsAttrs, taglibAttrs,
- start, parent);
+ super(qName, localName, attrs, nonTaglibXmlnsAttrs, taglibAttrs,
start, parent);
this.uri = uri;
this.prefix = prefix;
@@ -1523,8 +1419,7 @@ abstract class Node implements TagConstants {
}
/*
- * @return true if this custom action is supported by a tag file, false
- * otherwise
+ * @return true if this custom action is supported by a tag file,
false otherwise
*/
public boolean isTagFile() {
return tagFileInfo != null;
@@ -1588,57 +1483,55 @@ abstract class Node implements TagConstants {
public void setScriptingVars(List<Object> vec, int scope) {
switch (scope) {
- case VariableInfo.AT_BEGIN:
- this.atBeginScriptingVars = vec;
- break;
- case VariableInfo.AT_END:
- this.atEndScriptingVars = vec;
- break;
- case VariableInfo.NESTED:
- this.nestedScriptingVars = vec;
- break;
- default:
- throw new IllegalArgumentException(
-
Localizer.getMessage("jsp.error.page.invalid.varscope",
Integer.valueOf(scope)));
+ case VariableInfo.AT_BEGIN:
+ this.atBeginScriptingVars = vec;
+ break;
+ case VariableInfo.AT_END:
+ this.atEndScriptingVars = vec;
+ break;
+ case VariableInfo.NESTED:
+ this.nestedScriptingVars = vec;
+ break;
+ default:
+ throw new IllegalArgumentException(
+
Localizer.getMessage("jsp.error.page.invalid.varscope",
Integer.valueOf(scope)));
}
}
/*
- * Gets the scripting variables for the given scope that need to be
- * declared.
+ * Gets the scripting variables for the given scope that need to be
declared.
*/
public List<Object> getScriptingVars(int scope) {
List<Object> vec = null;
switch (scope) {
- case VariableInfo.AT_BEGIN:
- vec = this.atBeginScriptingVars;
- break;
- case VariableInfo.AT_END:
- vec = this.atEndScriptingVars;
- break;
- case VariableInfo.NESTED:
- vec = this.nestedScriptingVars;
- break;
- default:
- throw new IllegalArgumentException(
-
Localizer.getMessage("jsp.error.page.invalid.varscope",
Integer.valueOf(scope)));
+ case VariableInfo.AT_BEGIN:
+ vec = this.atBeginScriptingVars;
+ break;
+ case VariableInfo.AT_END:
+ vec = this.atEndScriptingVars;
+ break;
+ case VariableInfo.NESTED:
+ vec = this.nestedScriptingVars;
+ break;
+ default:
+ throw new IllegalArgumentException(
+
Localizer.getMessage("jsp.error.page.invalid.varscope",
Integer.valueOf(scope)));
}
return vec;
}
/*
- * Gets this custom tag's custom nesting level, which is given as the
- * number of times this custom tag is nested inside itself.
+ * Gets this custom tag's custom nesting level, which is given as the
number of times this custom tag is nested
+ * inside itself.
*/
public int getCustomNestingLevel() {
return customNestingLevel;
}
/**
- * Checks to see if the attribute of the given name is of type
- * JspFragment.
+ * Checks to see if the attribute of the given name is of type
JspFragment.
*
* @param name The attribute to check
*
@@ -1649,8 +1542,7 @@ abstract class Node implements TagConstants {
TagAttributeInfo[] attributes = tagInfo.getAttributes();
for (TagAttributeInfo attribute : attributes) {
- if (attribute.getName().equals(name)
- && attribute.isFragment()) {
+ if (attribute.getName().equals(name) &&
attribute.isFragment()) {
result = true;
break;
}
@@ -1692,14 +1584,13 @@ abstract class Node implements TagConstants {
}
/*
- * Computes this custom tag's custom nesting level, which corresponds
to
- * the number of times this custom tag is nested inside itself.
+ * Computes this custom tag's custom nesting level, which corresponds
to the number of times this custom tag is
+ * nested inside itself.
*
* Example:
*
- * <g:h> <a:b> -- nesting level 0 <c:d> <e:f> <a:b> -- nesting level 1
- * <a:b> -- nesting level 2 </a:b> </a:b> <a:b> -- nesting level 1
- * </a:b> </e:f> </c:d> </a:b> </g:h>
+ * <g:h> <a:b> -- nesting level 0 <c:d> <e:f> <a:b> -- nesting level 1
<a:b> -- nesting level 2 </a:b> </a:b>
+ * <a:b> -- nesting level 1 </a:b> </e:f> </c:d> </a:b> </g:h>
*
* @return Custom tag's nesting level
*/
@@ -1707,8 +1598,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(((Node.CustomTag) p).qName)) {
n++;
}
p = p.parent;
@@ -1717,12 +1607,10 @@ abstract class Node implements TagConstants {
}
/**
- * A custom action is considered to have an empty body if the following
- * holds true: - getBody() returns null, or - all immediate children
are
- * jsp:attribute actions, or - the action's jsp:body is empty.
+ * A custom action is considered to have an empty body if the
following holds true: - getBody() returns null, or
+ * - all immediate children are jsp:attribute actions, or - the
action's jsp:body is empty.
*
- * @return {@code true} if this custom action has an empty body, and
- * {@code false} otherwise.
+ * @return {@code true} if this custom action has an empty body, and
{@code false} otherwise.
*/
public boolean hasEmptyBody() {
boolean hasEmptyBody = true;
@@ -1747,8 +1635,8 @@ abstract class Node implements TagConstants {
}
/**
- * Used as a placeholder for the evaluation code of a custom action
- * attribute (used by the tag plugin machinery only).
+ * Used as a placeholder for the evaluation code of a custom action
attribute (used by the tag plugin machinery
+ * only).
*/
public static class AttributeGenerator extends Node {
private String name; // name of the attribute
@@ -1780,10 +1668,8 @@ abstract class Node implements TagConstants {
*/
public static class JspText extends Node {
- JspText(String qName, Attributes nonTaglibXmlnsAttrs,
- Attributes taglibAttrs, Mark start, Node parent) {
- super(qName, TEXT_ACTION, null, nonTaglibXmlnsAttrs, taglibAttrs,
- start, parent);
+ JspText(String qName, Attributes nonTaglibXmlnsAttrs, Attributes
taglibAttrs, Mark start, Node parent) {
+ super(qName, TEXT_ACTION, null, nonTaglibXmlnsAttrs, taglibAttrs,
start, parent);
}
@Override
@@ -1817,12 +1703,10 @@ abstract class Node implements TagConstants {
this(JSP_ATTRIBUTE_ACTION, attrs, null, null, start, parent);
}
- NamedAttribute(String qName, Attributes attrs,
- Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs,
+ NamedAttribute(String qName, Attributes attrs, Attributes
nonTaglibXmlnsAttrs, Attributes taglibAttrs,
Mark start, Node parent) {
- super(qName, ATTRIBUTE_ACTION, attrs, nonTaglibXmlnsAttrs,
- taglibAttrs, start, parent);
+ super(qName, ATTRIBUTE_ACTION, attrs, nonTaglibXmlnsAttrs,
taglibAttrs, start, parent);
if ("false".equals(this.getAttributeValue("trim"))) {
// (if null or true, leave default of true)
trim = false;
@@ -1870,8 +1754,8 @@ abstract class Node implements TagConstants {
}
/**
- * @return A unique temporary variable name to store the result in.
- * (this probably could go elsewhere, but it's convenient here)
+ * @return A unique temporary variable name to store the result in.
(this probably could go elsewhere, but it's
+ * convenient here)
*/
public String getTemporaryVariableName() {
if (temporaryVariableName == null) {
@@ -1881,9 +1765,8 @@ abstract class Node implements TagConstants {
}
/*
- * Get the attribute value from this named attribute (<jsp:attribute>).
- * Since this method is only for attributes that are not rtexpr, we can
- * assume the body of the jsp:attribute is a template text.
+ * Get the attribute value from this named attribute
(<jsp:attribute>). Since this method is only for attributes
+ * that are not rtexpr, we can assume the body of the jsp:attribute is
a template text.
*/
@Override
public String getText() {
@@ -1927,10 +1810,8 @@ abstract class Node implements TagConstants {
this(JSP_BODY_ACTION, null, null, start, parent);
}
- JspBody(String qName, Attributes nonTaglibXmlnsAttrs,
- Attributes taglibAttrs, Mark start, Node parent) {
- super(qName, BODY_ACTION, null, nonTaglibXmlnsAttrs, taglibAttrs,
- start, parent);
+ JspBody(String qName, Attributes nonTaglibXmlnsAttrs, Attributes
taglibAttrs, Mark start, Node parent) {
+ super(qName, BODY_ACTION, null, nonTaglibXmlnsAttrs, taglibAttrs,
start, parent);
}
@Override
@@ -1998,10 +1879,8 @@ abstract class Node implements TagConstants {
/**
* Add a source to Java line mapping
*
- * @param srcLine
- * The position of the source line, relative to the line at
- * the start of this node. The corresponding java line is
- * assumed to be consecutive, i.e. one more than the last.
+ * @param srcLine The position of the source line, relative to the
line at the start of this node. The
+ * corresponding java line is assumed to be
consecutive, i.e. one more than the last.
*/
public void addSmap(int srcLine) {
if (extraSmap == null) {
@@ -2016,11 +1895,9 @@ abstract class Node implements TagConstants {
}
/**
- * Represents attributes that can be request time expressions.
- *
- * Can either be a plain attribute, an attribute that represents a request
- * time expression value, or a named attribute (specified using the
- * jsp:attribute standard action).
+ * Represents attributes that can be request time expressions. Can either
be a plain attribute, an attribute that
+ * represents a request time expression value, or a named attribute
(specified using the jsp:attribute standard
+ * action).
*/
public static class JspAttribute {
@@ -2047,9 +1924,8 @@ abstract class Node implements TagConstants {
// The node in the parse tree for the NamedAttribute
private final NamedAttribute namedAttributeNode;
- JspAttribute(TagAttributeInfo tai, String qName, String uri,
- String localName, String value, boolean expr, ELNode.Nodes el,
- boolean dyn) {
+ JspAttribute(TagAttributeInfo tai, String qName, String uri, String
localName, String value, boolean expr,
+ ELNode.Nodes el, boolean dyn) {
this.qName = qName;
this.uri = uri;
this.localName = localName;
@@ -2065,13 +1941,12 @@ abstract class Node implements TagConstants {
/**
* Allow node to validate itself.
*
- * @param ef The expression factory to use to evaluate any EL
+ * @param ef The expression factory to use to evaluate any EL
* @param ctx The context to use to evaluate any EL
*
* @throws ELException If validation fails
*/
- public void validateEL(ExpressionFactory ef, ELContext ctx)
- throws ELException {
+ public void validateEL(ExpressionFactory ef, ELContext ctx) throws
ELException {
if (this.el != null) {
// determine exact type
ef.createValueExpression(ctx, this.value, String.class);
@@ -2079,9 +1954,8 @@ abstract class Node implements TagConstants {
}
/**
- * Use this constructor if the JspAttribute represents a named
- * attribute. In this case, we have to store the nodes of the body of
- * the attribute.
+ * Use this constructor if the JspAttribute represents a named
attribute. In this case, we have to store the
+ * nodes of the body of the attribute.
*/
JspAttribute(NamedAttribute na, TagAttributeInfo tai, boolean dyn) {
this.qName = na.getName();
@@ -2111,8 +1985,7 @@ abstract class Node implements TagConstants {
}
/**
- * @return The namespace of the attribute, or null if in the default
- * namespace
+ * @return The namespace of the attribute, or null if in the default
namespace
*/
public String getURI() {
return uri;
@@ -2123,16 +1996,14 @@ abstract class Node implements TagConstants {
}
/**
- * @return return true if there's TagAttributeInfo meaning we need to
- * assign a ValueExpression
+ * @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 return true if there's TagAttributeInfo meaning we need to
- * assign a MethodExpression
+ * @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;
@@ -2179,9 +2050,8 @@ abstract class Node implements TagConstants {
/**
* Only makes sense if namedAttribute is false.
*
- * @return the value for the attribute, or the expression string
- * (stripped of "<%=", "%>", "%=", or "%" but containing "${"
- * and "}" for EL expressions)
+ * @return the value for the attribute, or the expression string
(stripped of "<%=", "%>", "%=", or "%" but
+ * containing "${" and "}" for EL expressions)
*/
public String getValue() {
return value;
@@ -2211,28 +2081,23 @@ abstract class Node implements TagConstants {
}
/**
- * @return true if the value represents an expression that should be
fed
- * to the expression interpreter
- * false for string literals or rtexprvalues that should not be
- * interpreted or reevaluated
+ * @return true if the value represents an expression that should be
fed to the expression interpreter false for
+ * string literals or rtexprvalues that should not be
interpreted or reevaluated
*/
public boolean isELInterpreterInput() {
- return el != null || this.isDeferredInput()
- || this.isDeferredMethodInput();
+ return el != null || this.isDeferredInput() ||
this.isDeferredMethodInput();
}
/**
- * @return true if the value is a string literal known at translation
- * time.
+ * @return true if the value is a string literal known at translation
time.
*/
public boolean isLiteral() {
return !expression && (el == null) && !namedAttribute;
}
/**
- * @return {@code true} if the attribute is a "dynamic" attribute of a
- * custom tag that implements DynamicAttributes interface. That is,
- * a random extra attribute that is not declared by the tag.
+ * @return {@code true} if the attribute is a "dynamic" attribute of a
custom tag that implements
+ * DynamicAttributes interface. That is, a random extra
attribute that is not declared by the tag.
*/
public boolean isDynamic() {
return dynamic;
@@ -2244,8 +2109,7 @@ abstract class Node implements TagConstants {
}
/**
- * An ordered list of Node, used to represent the body of an element, or a
- * jsp page of jsp document.
+ * An ordered list of Node, used to represent the body of an element, or a
jsp page of jsp document.
*/
public static class Nodes {
@@ -2268,8 +2132,7 @@ abstract class Node implements TagConstants {
/**
* Appends a node to the list
*
- * @param n
- * The node to add
+ * @param n The node to add
*/
public void add(Node n) {
list.add(n);
@@ -2279,8 +2142,7 @@ abstract class Node implements TagConstants {
/**
* Removes the given node from the list.
*
- * @param n
- * The node to be removed
+ * @param n The node to be removed
*/
public void remove(Node n) {
list.remove(n);
@@ -2289,8 +2151,7 @@ abstract class Node implements TagConstants {
/**
* Visit the nodes in the list with the supplied visitor
*
- * @param v
- * The visitor used
+ * @param v The visitor used
*
* @throws JasperException if an error occurs while visiting a node
*/
@@ -2327,16 +2188,15 @@ abstract class Node implements TagConstants {
}
/**
- * A visitor class for visiting the node. This class also provides the
- * default action (i.e. nop) for each of the child class of the Node. An
- * actual visitor should extend this class and supply the visit method for
- * the nodes that it cares.
+ * A visitor class for visiting the node. This class also provides the
default action (i.e. nop) for each of the
+ * child class of the Node. An actual visitor should extend this class and
supply the visit method for the nodes
+ * that it cares.
*/
public static class Visitor {
/**
- * This method provides a place to put actions that are common to all
- * nodes. Override this in the child visitor class if need to.
+ * This method provides a place to put actions that are common to all
nodes. Override this in the child visitor
+ * class if need to.
*
* @param n The node to visit
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]