You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by jb...@apache.org on 2010/11/20 19:14:04 UTC
svn commit: r1037284 [9/12] - in /tomcat/taglibs/standard/trunk/jstlel: ./
src/main/java/org/apache/taglibs/standard/lang/jstl/
src/main/java/org/apache/taglibs/standard/lang/jstl/parser/
src/main/java/org/apache/taglibs/standard/lang/support/ src/main...
Modified: tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/SimpleCharStream.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/SimpleCharStream.java?rev=1037284&r1=1037283&r2=1037284&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/SimpleCharStream.java (original)
+++ tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/SimpleCharStream.java Sat Nov 20 18:14:00 2010
@@ -6,396 +6,361 @@ package org.apache.taglibs.standard.lang
* contain only ASCII characters (without unicode processing).
*/
-public final class SimpleCharStream
-{
- public static final boolean staticFlag = false;
- int bufsize;
- int available;
- int tokenBegin;
- public int bufpos = -1;
- private int bufline[];
- private int bufcolumn[];
-
- private int column = 0;
- private int line = 1;
-
- private boolean prevCharIsCR = false;
- private boolean prevCharIsLF = false;
-
- private java.io.Reader inputStream;
-
- private char[] buffer;
- private int maxNextCharInd = 0;
- private int inBuf = 0;
-
- private final void ExpandBuff(boolean wrapAround)
- {
- char[] newbuffer = new char[bufsize + 2048];
- int newbufline[] = new int[bufsize + 2048];
- int newbufcolumn[] = new int[bufsize + 2048];
-
- try
- {
- if (wrapAround)
- {
- System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
- System.arraycopy(buffer, 0, newbuffer,
- bufsize - tokenBegin, bufpos);
- buffer = newbuffer;
-
- System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
- System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
- bufline = newbufline;
-
- System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
- System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
- bufcolumn = newbufcolumn;
-
- maxNextCharInd = (bufpos += (bufsize - tokenBegin));
- }
- else
- {
- System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
- buffer = newbuffer;
-
- System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
- bufline = newbufline;
-
- System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
- bufcolumn = newbufcolumn;
-
- maxNextCharInd = (bufpos -= tokenBegin);
- }
- }
- catch (Throwable t)
- {
- throw new Error(t.getMessage());
- }
-
-
- bufsize += 2048;
- available = bufsize;
- tokenBegin = 0;
- }
-
- private final void FillBuff() throws java.io.IOException
- {
- if (maxNextCharInd == available)
- {
- if (available == bufsize)
- {
- if (tokenBegin > 2048)
- {
- bufpos = maxNextCharInd = 0;
- available = tokenBegin;
- }
- else if (tokenBegin < 0)
- bufpos = maxNextCharInd = 0;
- else
- ExpandBuff(false);
- }
- else if (available > tokenBegin)
- available = bufsize;
- else if ((tokenBegin - available) < 2048)
- ExpandBuff(true);
- else
- available = tokenBegin;
- }
-
- int i;
- try {
- if ((i = inputStream.read(buffer, maxNextCharInd,
- available - maxNextCharInd)) == -1)
- {
- inputStream.close();
- throw new java.io.IOException();
- }
- else
- maxNextCharInd += i;
- return;
- }
- catch(java.io.IOException e) {
- --bufpos;
- backup(0);
- if (tokenBegin == -1)
- tokenBegin = bufpos;
- throw e;
- }
- }
-
- public final char BeginToken() throws java.io.IOException
- {
- tokenBegin = -1;
- char c = readChar();
- tokenBegin = bufpos;
-
- return c;
- }
-
- private final void UpdateLineColumn(char c)
- {
- column++;
-
- if (prevCharIsLF)
- {
- prevCharIsLF = false;
- line += (column = 1);
- }
- else if (prevCharIsCR)
- {
- prevCharIsCR = false;
- if (c == '\n')
- {
- prevCharIsLF = true;
- }
- else
- line += (column = 1);
- }
-
- switch (c)
- {
- case '\r' :
- prevCharIsCR = true;
- break;
- case '\n' :
- prevCharIsLF = true;
- break;
- case '\t' :
- column--;
- column += (8 - (column & 07));
- break;
- default :
- break;
- }
-
- bufline[bufpos] = line;
- bufcolumn[bufpos] = column;
- }
-
- public final char readChar() throws java.io.IOException
- {
- if (inBuf > 0)
- {
- --inBuf;
-
- if (++bufpos == bufsize)
- bufpos = 0;
-
- return buffer[bufpos];
- }
-
- if (++bufpos >= maxNextCharInd)
- FillBuff();
-
- char c = buffer[bufpos];
-
- UpdateLineColumn(c);
- return (c);
- }
-
- /**
- * @deprecated
- * @see #getEndColumn
- */
-
- public final int getColumn() {
- return bufcolumn[bufpos];
- }
-
- /**
- * @deprecated
- * @see #getEndLine
- */
-
- public final int getLine() {
- return bufline[bufpos];
- }
-
- public final int getEndColumn() {
- return bufcolumn[bufpos];
- }
-
- public final int getEndLine() {
- return bufline[bufpos];
- }
-
- public final int getBeginColumn() {
- return bufcolumn[tokenBegin];
- }
-
- public final int getBeginLine() {
- return bufline[tokenBegin];
- }
-
- public final void backup(int amount) {
-
- inBuf += amount;
- if ((bufpos -= amount) < 0)
- bufpos += bufsize;
- }
-
- public SimpleCharStream(java.io.Reader dstream, int startline,
- int startcolumn, int buffersize)
- {
- inputStream = dstream;
- line = startline;
- column = startcolumn - 1;
-
- available = bufsize = buffersize;
- buffer = new char[buffersize];
- bufline = new int[buffersize];
- bufcolumn = new int[buffersize];
- }
-
- public SimpleCharStream(java.io.Reader dstream, int startline,
- int startcolumn)
- {
- this(dstream, startline, startcolumn, 4096);
- }
-
- public SimpleCharStream(java.io.Reader dstream)
- {
- this(dstream, 1, 1, 4096);
- }
- public void ReInit(java.io.Reader dstream, int startline,
- int startcolumn, int buffersize)
- {
- inputStream = dstream;
- line = startline;
- column = startcolumn - 1;
-
- if (buffer == null || buffersize != buffer.length)
- {
- available = bufsize = buffersize;
- buffer = new char[buffersize];
- bufline = new int[buffersize];
- bufcolumn = new int[buffersize];
- }
- prevCharIsLF = prevCharIsCR = false;
- tokenBegin = inBuf = maxNextCharInd = 0;
- bufpos = -1;
- }
-
- public void ReInit(java.io.Reader dstream, int startline,
- int startcolumn)
- {
- ReInit(dstream, startline, startcolumn, 4096);
- }
-
- public void ReInit(java.io.Reader dstream)
- {
- ReInit(dstream, 1, 1, 4096);
- }
- public SimpleCharStream(java.io.InputStream dstream, int startline,
- int startcolumn, int buffersize)
- {
- this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
- }
-
- public SimpleCharStream(java.io.InputStream dstream, int startline,
- int startcolumn)
- {
- this(dstream, startline, startcolumn, 4096);
- }
-
- public SimpleCharStream(java.io.InputStream dstream)
- {
- this(dstream, 1, 1, 4096);
- }
-
- public void ReInit(java.io.InputStream dstream, int startline,
- int startcolumn, int buffersize)
- {
- ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
- }
-
- public void ReInit(java.io.InputStream dstream)
- {
- ReInit(dstream, 1, 1, 4096);
- }
- public void ReInit(java.io.InputStream dstream, int startline,
- int startcolumn)
- {
- ReInit(dstream, startline, startcolumn, 4096);
- }
- public final String GetImage()
- {
- if (bufpos >= tokenBegin)
- return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
- else
- return new String(buffer, tokenBegin, bufsize - tokenBegin) +
- new String(buffer, 0, bufpos + 1);
- }
-
- public final char[] GetSuffix(int len)
- {
- char[] ret = new char[len];
-
- if ((bufpos + 1) >= len)
- System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
- else
- {
- System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
- len - bufpos - 1);
- System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
- }
-
- return ret;
- }
-
- public void Done()
- {
- buffer = null;
- bufline = null;
- bufcolumn = null;
- }
-
- /**
- * Method to adjust line and column numbers for the start of a token.<BR>
- */
- public void adjustBeginLineColumn(int newLine, int newCol)
- {
- int start = tokenBegin;
- int len;
-
- if (bufpos >= tokenBegin)
- {
- len = bufpos - tokenBegin + inBuf + 1;
- }
- else
- {
- len = bufsize - tokenBegin + bufpos + 1 + inBuf;
- }
-
- int i = 0, j = 0, k = 0;
- int nextColDiff = 0, columnDiff = 0;
-
- while (i < len &&
- bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
- {
- bufline[j] = newLine;
- nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
- bufcolumn[j] = newCol + columnDiff;
- columnDiff = nextColDiff;
- i++;
- }
-
- if (i < len)
- {
- bufline[j] = newLine++;
- bufcolumn[j] = newCol + columnDiff;
-
- while (i++ < len)
- {
- if (bufline[j = start % bufsize] != bufline[++start % bufsize])
- bufline[j] = newLine++;
- else
- bufline[j] = newLine;
- }
- }
-
- line = bufline[j];
- column = bufcolumn[j];
- }
+public final class SimpleCharStream {
+ public static final boolean staticFlag = false;
+ int bufsize;
+ int available;
+ int tokenBegin;
+ public int bufpos = -1;
+ private int bufline[];
+ private int bufcolumn[];
+
+ private int column = 0;
+ private int line = 1;
+
+ private boolean prevCharIsCR = false;
+ private boolean prevCharIsLF = false;
+
+ private java.io.Reader inputStream;
+
+ private char[] buffer;
+ private int maxNextCharInd = 0;
+ private int inBuf = 0;
+
+ private final void ExpandBuff(boolean wrapAround) {
+ char[] newbuffer = new char[bufsize + 2048];
+ int newbufline[] = new int[bufsize + 2048];
+ int newbufcolumn[] = new int[bufsize + 2048];
+
+ try {
+ if (wrapAround) {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ System.arraycopy(buffer, 0, newbuffer,
+ bufsize - tokenBegin, bufpos);
+ buffer = newbuffer;
+
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
+ bufline = newbufline;
+
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
+ bufcolumn = newbufcolumn;
+
+ maxNextCharInd = (bufpos += (bufsize - tokenBegin));
+ } else {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ buffer = newbuffer;
+
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ bufline = newbufline;
+
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ bufcolumn = newbufcolumn;
+
+ maxNextCharInd = (bufpos -= tokenBegin);
+ }
+ }
+ catch (Throwable t) {
+ throw new Error(t.getMessage());
+ }
+
+
+ bufsize += 2048;
+ available = bufsize;
+ tokenBegin = 0;
+ }
+
+ private final void FillBuff() throws java.io.IOException {
+ if (maxNextCharInd == available) {
+ if (available == bufsize) {
+ if (tokenBegin > 2048) {
+ bufpos = maxNextCharInd = 0;
+ available = tokenBegin;
+ } else if (tokenBegin < 0) {
+ bufpos = maxNextCharInd = 0;
+ } else {
+ ExpandBuff(false);
+ }
+ } else if (available > tokenBegin) {
+ available = bufsize;
+ } else if ((tokenBegin - available) < 2048) {
+ ExpandBuff(true);
+ } else {
+ available = tokenBegin;
+ }
+ }
+
+ int i;
+ try {
+ if ((i = inputStream.read(buffer, maxNextCharInd,
+ available - maxNextCharInd)) == -1) {
+ inputStream.close();
+ throw new java.io.IOException();
+ } else {
+ maxNextCharInd += i;
+ }
+ return;
+ }
+ catch (java.io.IOException e) {
+ --bufpos;
+ backup(0);
+ if (tokenBegin == -1) {
+ tokenBegin = bufpos;
+ }
+ throw e;
+ }
+ }
+
+ public final char BeginToken() throws java.io.IOException {
+ tokenBegin = -1;
+ char c = readChar();
+ tokenBegin = bufpos;
+
+ return c;
+ }
+
+ private final void UpdateLineColumn(char c) {
+ column++;
+
+ if (prevCharIsLF) {
+ prevCharIsLF = false;
+ line += (column = 1);
+ } else if (prevCharIsCR) {
+ prevCharIsCR = false;
+ if (c == '\n') {
+ prevCharIsLF = true;
+ } else {
+ line += (column = 1);
+ }
+ }
+
+ switch (c) {
+ case '\r':
+ prevCharIsCR = true;
+ break;
+ case '\n':
+ prevCharIsLF = true;
+ break;
+ case '\t':
+ column--;
+ column += (8 - (column & 07));
+ break;
+ default:
+ break;
+ }
+
+ bufline[bufpos] = line;
+ bufcolumn[bufpos] = column;
+ }
+
+ public final char readChar() throws java.io.IOException {
+ if (inBuf > 0) {
+ --inBuf;
+
+ if (++bufpos == bufsize) {
+ bufpos = 0;
+ }
+
+ return buffer[bufpos];
+ }
+
+ if (++bufpos >= maxNextCharInd) {
+ FillBuff();
+ }
+
+ char c = buffer[bufpos];
+
+ UpdateLineColumn(c);
+ return (c);
+ }
+
+ /**
+ * @see #getEndColumn
+ * @deprecated
+ */
+
+ public final int getColumn() {
+ return bufcolumn[bufpos];
+ }
+
+ /**
+ * @see #getEndLine
+ * @deprecated
+ */
+
+ public final int getLine() {
+ return bufline[bufpos];
+ }
+
+ public final int getEndColumn() {
+ return bufcolumn[bufpos];
+ }
+
+ public final int getEndLine() {
+ return bufline[bufpos];
+ }
+
+ public final int getBeginColumn() {
+ return bufcolumn[tokenBegin];
+ }
+
+ public final int getBeginLine() {
+ return bufline[tokenBegin];
+ }
+
+ public final void backup(int amount) {
+
+ inBuf += amount;
+ if ((bufpos -= amount) < 0) {
+ bufpos += bufsize;
+ }
+ }
+
+ public SimpleCharStream(java.io.Reader dstream, int startline,
+ int startcolumn, int buffersize) {
+ inputStream = dstream;
+ line = startline;
+ column = startcolumn - 1;
+
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ bufcolumn = new int[buffersize];
+ }
+
+ public SimpleCharStream(java.io.Reader dstream, int startline,
+ int startcolumn) {
+ this(dstream, startline, startcolumn, 4096);
+ }
+
+ public SimpleCharStream(java.io.Reader dstream) {
+ this(dstream, 1, 1, 4096);
+ }
+
+ public void ReInit(java.io.Reader dstream, int startline,
+ int startcolumn, int buffersize) {
+ inputStream = dstream;
+ line = startline;
+ column = startcolumn - 1;
+
+ if (buffer == null || buffersize != buffer.length) {
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ bufcolumn = new int[buffersize];
+ }
+ prevCharIsLF = prevCharIsCR = false;
+ tokenBegin = inBuf = maxNextCharInd = 0;
+ bufpos = -1;
+ }
+
+ public void ReInit(java.io.Reader dstream, int startline,
+ int startcolumn) {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+
+ public void ReInit(java.io.Reader dstream) {
+ ReInit(dstream, 1, 1, 4096);
+ }
+
+ public SimpleCharStream(java.io.InputStream dstream, int startline,
+ int startcolumn, int buffersize) {
+ this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
+ }
+
+ public SimpleCharStream(java.io.InputStream dstream, int startline,
+ int startcolumn) {
+ this(dstream, startline, startcolumn, 4096);
+ }
+
+ public SimpleCharStream(java.io.InputStream dstream) {
+ this(dstream, 1, 1, 4096);
+ }
+
+ public void ReInit(java.io.InputStream dstream, int startline,
+ int startcolumn, int buffersize) {
+ ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
+ }
+
+ public void ReInit(java.io.InputStream dstream) {
+ ReInit(dstream, 1, 1, 4096);
+ }
+
+ public void ReInit(java.io.InputStream dstream, int startline,
+ int startcolumn) {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+
+ public final String GetImage() {
+ if (bufpos >= tokenBegin) {
+ return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
+ } else {
+ return new String(buffer, tokenBegin, bufsize - tokenBegin) +
+ new String(buffer, 0, bufpos + 1);
+ }
+ }
+
+ public final char[] GetSuffix(int len) {
+ char[] ret = new char[len];
+
+ if ((bufpos + 1) >= len) {
+ System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
+ } else {
+ System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
+ len - bufpos - 1);
+ System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
+ }
+
+ return ret;
+ }
+
+ public void Done() {
+ buffer = null;
+ bufline = null;
+ bufcolumn = null;
+ }
+
+ /**
+ * Method to adjust line and column numbers for the start of a token.<BR>
+ */
+ public void adjustBeginLineColumn(int newLine, int newCol) {
+ int start = tokenBegin;
+ int len;
+
+ if (bufpos >= tokenBegin) {
+ len = bufpos - tokenBegin + inBuf + 1;
+ } else {
+ len = bufsize - tokenBegin + bufpos + 1 + inBuf;
+ }
+
+ int i = 0, j = 0, k = 0;
+ int nextColDiff = 0, columnDiff = 0;
+
+ while (i < len &&
+ bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) {
+ bufline[j] = newLine;
+ nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
+ bufcolumn[j] = newCol + columnDiff;
+ columnDiff = nextColDiff;
+ i++;
+ }
+
+ if (i < len) {
+ bufline[j] = newLine++;
+ bufcolumn[j] = newCol + columnDiff;
+
+ while (i++ < len) {
+ if (bufline[j = start % bufsize] != bufline[++start % bufsize]) {
+ bufline[j] = newLine++;
+ } else {
+ bufline[j] = newLine;
+ }
+ }
+ }
+
+ line = bufline[j];
+ column = bufcolumn[j];
+ }
}
Modified: tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/Token.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/Token.java?rev=1037284&r1=1037283&r2=1037284&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/Token.java (original)
+++ tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/Token.java Sat Nov 20 18:14:00 2010
@@ -7,75 +7,73 @@ package org.apache.taglibs.standard.lang
public class Token {
- /**
- * An integer that describes the kind of this token. This numbering
- * system is determined by JavaCCParser, and a table of these numbers is
- * stored in the file ...Constants.java.
- */
- public int kind;
-
- /**
- * beginLine and beginColumn describe the position of the first character
- * of this token; endLine and endColumn describe the position of the
- * last character of this token.
- */
- public int beginLine, beginColumn, endLine, endColumn;
-
- /**
- * The string image of the token.
- */
- public String image;
-
- /**
- * A reference to the next regular (non-special) token from the input
- * stream. If this is the last token from the input stream, or if the
- * token manager has not read tokens beyond this one, this field is
- * set to null. This is true only if this token is also a regular
- * token. Otherwise, see below for a description of the contents of
- * this field.
- */
- public Token next;
-
- /**
- * This field is used to access special tokens that occur prior to this
- * token, but after the immediately preceding regular (non-special) token.
- * If there are no such special tokens, this field is set to null.
- * When there are more than one such special token, this field refers
- * to the last of these special tokens, which in turn refers to the next
- * previous special token through its specialToken field, and so on
- * until the first special token (whose specialToken field is null).
- * The next fields of special tokens refer to other special tokens that
- * immediately follow it (without an intervening regular token). If there
- * is no such token, this field is null.
- */
- public Token specialToken;
-
- /**
- * Returns the image.
- */
- public final String toString()
- {
- return image;
- }
-
- /**
- * Returns a new Token object, by default. However, if you want, you
- * can create and return subclass objects based on the value of ofKind.
- * Simply add the cases to the switch for all those special cases.
- * For example, if you have a subclass of Token called IDToken that
- * you want to create if ofKind is ID, simlpy add something like :
- *
- * case MyParserConstants.ID : return new IDToken();
- *
- * to the following switch statement. Then you can cast matchedToken
- * variable to the appropriate type and use it in your lexical actions.
- */
- public static final Token newToken(int ofKind)
- {
- switch(ofKind)
- {
- default : return new Token();
- }
- }
+ /**
+ * An integer that describes the kind of this token. This numbering
+ * system is determined by JavaCCParser, and a table of these numbers is
+ * stored in the file ...Constants.java.
+ */
+ public int kind;
+
+ /**
+ * beginLine and beginColumn describe the position of the first character
+ * of this token; endLine and endColumn describe the position of the
+ * last character of this token.
+ */
+ public int beginLine, beginColumn, endLine, endColumn;
+
+ /**
+ * The string image of the token.
+ */
+ public String image;
+
+ /**
+ * A reference to the next regular (non-special) token from the input
+ * stream. If this is the last token from the input stream, or if the
+ * token manager has not read tokens beyond this one, this field is
+ * set to null. This is true only if this token is also a regular
+ * token. Otherwise, see below for a description of the contents of
+ * this field.
+ */
+ public Token next;
+
+ /**
+ * This field is used to access special tokens that occur prior to this
+ * token, but after the immediately preceding regular (non-special) token.
+ * If there are no such special tokens, this field is set to null.
+ * When there are more than one such special token, this field refers
+ * to the last of these special tokens, which in turn refers to the next
+ * previous special token through its specialToken field, and so on
+ * until the first special token (whose specialToken field is null).
+ * The next fields of special tokens refer to other special tokens that
+ * immediately follow it (without an intervening regular token). If there
+ * is no such token, this field is null.
+ */
+ public Token specialToken;
+
+ /**
+ * Returns the image.
+ */
+ public final String toString() {
+ return image;
+ }
+
+ /**
+ * Returns a new Token object, by default. However, if you want, you
+ * can create and return subclass objects based on the value of ofKind.
+ * Simply add the cases to the switch for all those special cases.
+ * For example, if you have a subclass of Token called IDToken that
+ * you want to create if ofKind is ID, simlpy add something like :
+ * <p/>
+ * case MyParserConstants.ID : return new IDToken();
+ * <p/>
+ * to the following switch statement. Then you can cast matchedToken
+ * variable to the appropriate type and use it in your lexical actions.
+ */
+ public static final Token newToken(int ofKind) {
+ switch (ofKind) {
+ default:
+ return new Token();
+ }
+ }
}
Modified: tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/TokenMgrError.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/TokenMgrError.java?rev=1037284&r1=1037283&r2=1037284&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/TokenMgrError.java (original)
+++ tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/lang/jstl/parser/TokenMgrError.java Sat Nov 20 18:14:00 2010
@@ -1,133 +1,131 @@
/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 2.1 */
package org.apache.taglibs.standard.lang.jstl.parser;
-public class TokenMgrError extends Error
-{
- /*
+public class TokenMgrError extends Error {
+ /*
* Ordinals for various reasons why an Error of this type can be thrown.
*/
- /**
- * Lexical error occured.
- */
- static final int LEXICAL_ERROR = 0;
-
- /**
- * An attempt wass made to create a second instance of a static token manager.
- */
- static final int STATIC_LEXER_ERROR = 1;
-
- /**
- * Tried to change to an invalid lexical state.
- */
- static final int INVALID_LEXICAL_STATE = 2;
-
- /**
- * Detected (and bailed out of) an infinite loop in the token manager.
- */
- static final int LOOP_DETECTED = 3;
-
- /**
- * Indicates the reason why the exception is thrown. It will have
- * one of the above 4 values.
- */
- int errorCode;
-
- /**
- * Replaces unprintable characters by their espaced (or unicode escaped)
- * equivalents in the given string
- */
- protected static final String addEscapes(String str) {
- StringBuffer retval = new StringBuffer();
- char ch;
- for (int i = 0; i < str.length(); i++) {
- switch (str.charAt(i))
- {
- case 0 :
- continue;
- case '\b':
- retval.append("\\b");
- continue;
- case '\t':
- retval.append("\\t");
- continue;
- case '\n':
- retval.append("\\n");
- continue;
- case '\f':
- retval.append("\\f");
- continue;
- case '\r':
- retval.append("\\r");
- continue;
- case '\"':
- retval.append("\\\"");
- continue;
- case '\'':
- retval.append("\\\'");
- continue;
- case '\\':
- retval.append("\\\\");
- continue;
- default:
- if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
- String s = "0000" + Integer.toString(ch, 16);
- retval.append("\\u" + s.substring(s.length() - 4, s.length()));
- } else {
- retval.append(ch);
- }
- continue;
+ /**
+ * Lexical error occured.
+ */
+ static final int LEXICAL_ERROR = 0;
+
+ /**
+ * An attempt wass made to create a second instance of a static token manager.
+ */
+ static final int STATIC_LEXER_ERROR = 1;
+
+ /**
+ * Tried to change to an invalid lexical state.
+ */
+ static final int INVALID_LEXICAL_STATE = 2;
+
+ /**
+ * Detected (and bailed out of) an infinite loop in the token manager.
+ */
+ static final int LOOP_DETECTED = 3;
+
+ /**
+ * Indicates the reason why the exception is thrown. It will have
+ * one of the above 4 values.
+ */
+ int errorCode;
+
+ /**
+ * Replaces unprintable characters by their espaced (or unicode escaped)
+ * equivalents in the given string
+ */
+ protected static final String addEscapes(String str) {
+ StringBuffer retval = new StringBuffer();
+ char ch;
+ for (int i = 0; i < str.length(); i++) {
+ switch (str.charAt(i)) {
+ case 0:
+ continue;
+ case '\b':
+ retval.append("\\b");
+ continue;
+ case '\t':
+ retval.append("\\t");
+ continue;
+ case '\n':
+ retval.append("\\n");
+ continue;
+ case '\f':
+ retval.append("\\f");
+ continue;
+ case '\r':
+ retval.append("\\r");
+ continue;
+ case '\"':
+ retval.append("\\\"");
+ continue;
+ case '\'':
+ retval.append("\\\'");
+ continue;
+ case '\\':
+ retval.append("\\\\");
+ continue;
+ default:
+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+ String s = "0000" + Integer.toString(ch, 16);
+ retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ continue;
+ }
}
- }
- return retval.toString();
- }
-
- /**
- * Returns a detailed message for the Error when it is thrown by the
- * token manager to indicate a lexical error.
- * Parameters :
- * EOFSeen : indicates if EOF caused the lexicl error
- * curLexState : lexical state in which this error occured
- * errorLine : line number when the error occured
- * errorColumn : column number when the error occured
- * errorAfter : prefix that was seen before this error occured
- * curchar : the offending character
- * Note: You can customize the lexical error message by modifying this method.
- */
- private static final String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
- return("Lexical error at line " +
- errorLine + ", column " +
- errorColumn + ". Encountered: " +
- (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
- "after : \"" + addEscapes(errorAfter) + "\"");
- }
-
- /**
- * You can also modify the body of this method to customize your error messages.
- * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
- * of end-users concern, so you can return something like :
- *
- * "Internal Error : Please file a bug report .... "
- *
- * from this method for such cases in the release version of your parser.
- */
- public String getMessage() {
- return super.getMessage();
- }
+ return retval.toString();
+ }
+
+ /**
+ * Returns a detailed message for the Error when it is thrown by the
+ * token manager to indicate a lexical error.
+ * Parameters :
+ * EOFSeen : indicates if EOF caused the lexicl error
+ * curLexState : lexical state in which this error occured
+ * errorLine : line number when the error occured
+ * errorColumn : column number when the error occured
+ * errorAfter : prefix that was seen before this error occured
+ * curchar : the offending character
+ * Note: You can customize the lexical error message by modifying this method.
+ */
+ private static final String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
+ return ("Lexical error at line " +
+ errorLine + ", column " +
+ errorColumn + ". Encountered: " +
+ (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int) curChar + "), ") +
+ "after : \"" + addEscapes(errorAfter) + "\"");
+ }
+
+ /**
+ * You can also modify the body of this method to customize your error messages.
+ * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
+ * of end-users concern, so you can return something like :
+ * <p/>
+ * "Internal Error : Please file a bug report .... "
+ * <p/>
+ * from this method for such cases in the release version of your parser.
+ */
+ public String getMessage() {
+ return super.getMessage();
+ }
- /*
+ /*
* Constructors of various flavors follow.
*/
- public TokenMgrError() {
- }
+ public TokenMgrError() {
+ }
- public TokenMgrError(String message, int reason) {
- super(message);
- errorCode = reason;
- }
-
- public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
- this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
- }
+ public TokenMgrError(String message, int reason) {
+ super(message);
+ errorCode = reason;
+ }
+
+ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
+ this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
+ }
}
Modified: tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/lang/support/ExpressionEvaluator.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/lang/support/ExpressionEvaluator.java?rev=1037284&r1=1037283&r2=1037284&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/lang/support/ExpressionEvaluator.java (original)
+++ tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/lang/support/ExpressionEvaluator.java Sat Nov 20 18:14:00 2010
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.apache.taglibs.standard.lang.support;
@@ -25,7 +25,7 @@ import javax.servlet.jsp.tagext.Tag;
* <p>The interface for an expression-language validator and evaluator.
* Classes that implement an expression language expose their functionality
* via this interface.</p>
- *
+ * <p/>
* <p>The validate() and evaluate() methods must be thread-safe. That is,
* multiple threads may call these methods on the same ExpressionEvaluator
* object simultaneously. Implementations should synchronize access if
@@ -34,7 +34,7 @@ import javax.servlet.jsp.tagext.Tag;
* instantiated; global caching should therefore be static. No release()
* mechanism or robust lifecycle is specified, for language-interpreter
* pluggability is experimental in EA2.</p>
- *
+ * <p/>
* <p><b>WARNING</b>: This class supports experimentation for the EA2
* release of JSTL; it is not expected to be part of the final RI or
* specification.</p>
@@ -43,21 +43,21 @@ import javax.servlet.jsp.tagext.Tag;
*/
public interface ExpressionEvaluator {
- /**
- * Translation time validation of an expression.
- * This method will return a null String if the expression
- * is valid; otherwise an error message.
- */
- public String validate(String attributeName,
- String expression);
+ /**
+ * Translation time validation of an expression.
+ * This method will return a null String if the expression
+ * is valid; otherwise an error message.
+ */
+ public String validate(String attributeName,
+ String expression);
- /**
- * Evaluates the expression at request time.
- */
- public Object evaluate(String attributeName,
- String expression,
- Class expectedType,
- Tag tag,
- PageContext pageContext)
- throws JspException;
+ /**
+ * Evaluates the expression at request time.
+ */
+ public Object evaluate(String attributeName,
+ String expression,
+ Class expectedType,
+ Tag tag,
+ PageContext pageContext)
+ throws JspException;
}
Modified: tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/lang/support/ExpressionEvaluatorManager.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/lang/support/ExpressionEvaluatorManager.java?rev=1037284&r1=1037283&r2=1037284&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/lang/support/ExpressionEvaluatorManager.java (original)
+++ tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/lang/support/ExpressionEvaluatorManager.java Sat Nov 20 18:14:00 2010
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.apache.taglibs.standard.lang.support;
@@ -29,7 +29,7 @@ import org.apache.taglibs.standard.lang.
/**
* <p>A conduit to the JSTL EL. Based on...</p>
- *
+ * <p/>
* <p>An implementation of the ExpressionEvaluatorManager called for by
* the JSTL rev1 draft. This class is responsible for delegating a
* request for expression evaluating to the particular, "active"
@@ -38,13 +38,13 @@ import org.apache.taglibs.standard.lang.
*
* @author Shawn Bayern
*/
-public class ExpressionEvaluatorManager {
+public class ExpressionEvaluatorManager {
//*********************************************************************
// Constants
public static final String EVALUATOR_CLASS =
- "org.apache.taglibs.standard.lang.jstl.Evaluator";
+ "org.apache.taglibs.standard.lang.jstl.Evaluator";
// private static final String EVALUATOR_PARAMETER =
// "javax.servlet.jsp.jstl.temp.ExpressionEvaluatorClass";
@@ -57,51 +57,48 @@ public class ExpressionEvaluatorManager
//*********************************************************************
// Public static methods
- /**
+ /**
* Invokes the evaluate() method on the "active" ExpressionEvaluator
* for the given pageContext.
- */
- public static Object evaluate(String attributeName,
- String expression,
- Class expectedType,
- Tag tag,
- PageContext pageContext)
- throws JspException
- {
+ */
+ public static Object evaluate(String attributeName,
+ String expression,
+ Class expectedType,
+ Tag tag,
+ PageContext pageContext)
+ throws JspException {
// the evaluator we'll use
ExpressionEvaluator target = getEvaluatorByName(EVALUATOR_CLASS);
// delegate the call
return (target.evaluate(
- attributeName, expression, expectedType, tag, pageContext));
+ attributeName, expression, expectedType, tag, pageContext));
}
- /**
+ /**
* Invokes the evaluate() method on the "active" ExpressionEvaluator
* for the given pageContext.
- */
- public static Object evaluate(String attributeName,
- String expression,
- Class expectedType,
- PageContext pageContext)
- throws JspException
- {
+ */
+ public static Object evaluate(String attributeName,
+ String expression,
+ Class expectedType,
+ PageContext pageContext)
+ throws JspException {
// the evaluator we'll use
ExpressionEvaluator target = getEvaluatorByName(EVALUATOR_CLASS);
// delegate the call
return (target.evaluate(
- attributeName, expression, expectedType, null, pageContext));
+ attributeName, expression, expectedType, null, pageContext));
}
/**
* Gets an ExpressionEvaluator from the cache, or seeds the cache
* if we haven't seen a particular ExpressionEvaluator before.
*/
- public static
- ExpressionEvaluator getEvaluatorByName(String name)
+ public static ExpressionEvaluator getEvaluatorByName(String name)
throws JspException {
Object oEvaluator = nameMap.get(name);
@@ -115,36 +112,38 @@ public class ExpressionEvaluatorManager
return ((ExpressionEvaluator) oEvaluator);
}
ExpressionEvaluator e = (ExpressionEvaluator)
- Class.forName(name).newInstance();
+ Class.forName(name).newInstance();
nameMap.put(name, e);
return (e);
}
} catch (ClassCastException ex) {
// just to display a better error message
throw new JspException("invalid ExpressionEvaluator: " +
- ex.toString(), ex);
+ ex.toString(), ex);
} catch (ClassNotFoundException ex) {
throw new JspException("couldn't find ExpressionEvaluator: " +
- ex.toString(), ex);
+ ex.toString(), ex);
} catch (IllegalAccessException ex) {
throw new JspException("couldn't access ExpressionEvaluator: " +
- ex.toString(), ex);
+ ex.toString(), ex);
} catch (InstantiationException ex) {
throw new JspException(
- "couldn't instantiate ExpressionEvaluator: " +
- ex.toString(), ex);
+ "couldn't instantiate ExpressionEvaluator: " +
+ ex.toString(), ex);
}
}
- /** Performs a type conversion according to the EL's rules. */
+ /**
+ * Performs a type conversion according to the EL's rules.
+ */
public static Object coerce(Object value, Class classe)
throws JspException {
- try {
- // just delegate the call
- return Coercions.coerce(value, classe, logger);
- } catch (ELException ex) {
- throw new JspException(ex);
- }
+ try {
+ // just delegate the call
+ return Coercions.coerce(value, classe, logger);
+ } catch (ELException ex) {
+ throw new JspException(ex);
+ }
}
}
Modified: tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/ExpressionUtil.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/ExpressionUtil.java?rev=1037284&r1=1037283&r2=1037284&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/ExpressionUtil.java (original)
+++ tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/ExpressionUtil.java Sat Nov 20 18:14:00 2010
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.apache.taglibs.standard.tag.el.core;
@@ -33,25 +33,28 @@ import org.apache.taglibs.standard.tag.c
public class ExpressionUtil {
- /** Evaluates an expression if present, but does not allow the expression
- * to evaluate to 'null', throwing a NullAttributeException if it
- * does. The function <b>can</b> return null, however, if the
- * expression itself is null.
+ /**
+ * Evaluates an expression if present, but does not allow the expression
+ * to evaluate to 'null', throwing a NullAttributeException if it
+ * does. The function <b>can</b> return null, however, if the
+ * expression itself is null.
*/
public static Object evalNotNull(String tagName,
- String attributeName,
- String expression,
- Class expectedType,
- Tag tag,
- PageContext pageContext)
- throws JspException {
+ String attributeName,
+ String expression,
+ Class expectedType,
+ Tag tag,
+ PageContext pageContext)
+ throws JspException {
if (expression != null) {
Object r = ExpressionEvaluatorManager.evaluate(
- attributeName, expression, expectedType, tag, pageContext);
- if (r == null)
+ attributeName, expression, expectedType, tag, pageContext);
+ if (r == null) {
throw new NullAttributeException(tagName, attributeName);
- return r;
- } else
- return null;
+ }
+ return r;
+ } else {
+ return null;
+ }
}
}
Modified: tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/ForEachTag.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/ForEachTag.java?rev=1037284&r1=1037283&r2=1037284&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/ForEachTag.java (original)
+++ tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/ForEachTag.java Sat Nov 20 18:14:00 2010
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.apache.taglibs.standard.tag.el.core;
@@ -35,9 +35,8 @@ import org.apache.taglibs.standard.tag.c
*/
public class ForEachTag
- extends ForEachSupport
- implements LoopTag, IterationTag
-{
+ extends ForEachSupport
+ implements LoopTag, IterationTag {
//*********************************************************************
// 'Private' state (implementation details)
@@ -45,7 +44,7 @@ public class ForEachTag
private String begin_; // stores EL-based property
private String end_; // stores EL-based property
private String step_; // stores EL-based property
- private String items_; // stores EL-based property
+ private String items_; // stores EL-based property
//*********************************************************************
@@ -61,17 +60,19 @@ public class ForEachTag
// Tag logic
/* Begins iterating by processing the first item. */
+
public int doStartTag() throws JspException {
// evaluate any expressions we were passed, once per invocation
evaluateExpressions();
- // chain to the parent implementation
- return super.doStartTag();
+ // chain to the parent implementation
+ return super.doStartTag();
}
// Releases any resources we may have (or inherit)
+
public void release() {
super.release();
init();
@@ -82,18 +83,21 @@ public class ForEachTag
// Accessor methods
// for EL-based attribute
+
public void setBegin(String begin_) {
this.begin_ = begin_;
this.beginSpecified = true;
}
// for EL-based attribute
+
public void setEnd(String end_) {
this.end_ = end_;
this.endSpecified = true;
}
// for EL-based attribute
+
public void setStep(String step_) {
this.step_ = step_;
this.stepSpecified = true;
@@ -107,15 +111,17 @@ public class ForEachTag
// Private (utility) methods
// (re)initializes state (during release() or construction)
+
private void init() {
// defaults for interface with page author
begin_ = null; // (no expression)
end_ = null; // (no expression)
step_ = null; // (no expression)
- items_ = null; // (no expression)
+ items_ = null; // (no expression)
}
/* Evaluates expressions as necessary */
+
private void evaluateExpressions() throws JspException {
/*
* Note: we don't check for type mismatches here; we assume
@@ -127,37 +133,41 @@ public class ForEachTag
if (begin_ != null) {
Object r = ExpressionEvaluatorManager.evaluate(
- "begin", begin_, Integer.class, this, pageContext);
- if (r == null)
- throw new NullAttributeException("forEach", "begin");
+ "begin", begin_, Integer.class, this, pageContext);
+ if (r == null) {
+ throw new NullAttributeException("forEach", "begin");
+ }
begin = ((Integer) r).intValue();
validateBegin();
}
if (end_ != null) {
Object r = ExpressionEvaluatorManager.evaluate(
- "end", end_, Integer.class, this, pageContext);
- if (r == null)
- throw new NullAttributeException("forEach", "end");
+ "end", end_, Integer.class, this, pageContext);
+ if (r == null) {
+ throw new NullAttributeException("forEach", "end");
+ }
end = ((Integer) r).intValue();
validateEnd();
}
if (step_ != null) {
Object r = ExpressionEvaluatorManager.evaluate(
- "step", step_, Integer.class, this, pageContext);
- if (r == null)
- throw new NullAttributeException("forEach", "step");
+ "step", step_, Integer.class, this, pageContext);
+ if (r == null) {
+ throw new NullAttributeException("forEach", "step");
+ }
step = ((Integer) r).intValue();
validateStep();
}
- if (items_ != null) {
+ if (items_ != null) {
rawItems = ExpressionEvaluatorManager.evaluate(
- "items", items_, Object.class, this, pageContext);
- // use an empty list to indicate "no iteration", if relevant
- if (rawItems == null)
- rawItems = new ArrayList();
+ "items", items_, Object.class, this, pageContext);
+ // use an empty list to indicate "no iteration", if relevant
+ if (rawItems == null) {
+ rawItems = new ArrayList();
+ }
}
}
}
Modified: tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/ForTokensTag.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/ForTokensTag.java?rev=1037284&r1=1037283&r2=1037284&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/ForTokensTag.java (original)
+++ tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/ForTokensTag.java Sat Nov 20 18:14:00 2010
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.apache.taglibs.standard.tag.el.core;
@@ -32,9 +32,8 @@ import org.apache.taglibs.standard.tag.c
* @author Shawn Bayern
*/
public class ForTokensTag
- extends ForTokensSupport
- implements LoopTag, IterationTag
-{
+ extends ForTokensSupport
+ implements LoopTag, IterationTag {
//*********************************************************************
// 'Private' state (implementation details)
@@ -42,8 +41,8 @@ public class ForTokensTag
private String begin_; // raw EL-based property
private String end_; // raw EL-based property
private String step_; // raw EL-based property
- private String items_; // raw EL-based property
- private String delims_; // raw EL-based property
+ private String items_; // raw EL-based property
+ private String delims_; // raw EL-based property
//*********************************************************************
@@ -59,17 +58,19 @@ public class ForTokensTag
// Tag logic
/* Begins iterating by processing the first item. */
+
public int doStartTag() throws JspException {
// evaluate any expressions we were passed, once per invocation
evaluateExpressions();
- // chain to the parent implementation
- return super.doStartTag();
+ // chain to the parent implementation
+ return super.doStartTag();
}
// Releases any resources we may have (or inherit)
+
public void release() {
super.release();
init();
@@ -80,31 +81,36 @@ public class ForTokensTag
// Accessor methods
// for EL-based attribute
+
public void setBegin(String begin_) {
this.begin_ = begin_;
this.beginSpecified = true;
}
// for EL-based attribute
+
public void setEnd(String end_) {
this.end_ = end_;
this.endSpecified = true;
}
// for EL-based attribute
+
public void setStep(String step_) {
this.step_ = step_;
this.stepSpecified = true;
}
// for EL-based attribute
+
public void setItems(String items_) {
this.items_ = items_;
}
// for EL-based attribute
+
public void setDelims(String delims_) {
- this.delims_ = delims_;
+ this.delims_ = delims_;
}
@@ -112,16 +118,18 @@ public class ForTokensTag
// Private (utility) methods
// (re)initializes state (during release() or construction)
+
private void init() {
// defaults for interface with page author
begin_ = null; // (no expression)
end_ = null; // (no expression)
step_ = null; // (no expression)
- items_ = null; // (no expression)
- delims_ = null; // (no expression)
+ items_ = null; // (no expression)
+ delims_ = null; // (no expression)
}
/* Evaluates expressions as necessary */
+
private void evaluateExpressions() throws JspException {
/*
* Note: we don't check for type mismatches here; we assume
@@ -131,47 +139,52 @@ public class ForTokensTag
* propagate up.
*/
- if (begin_ != null) {
+ if (begin_ != null) {
Object r = ExpressionEvaluatorManager.evaluate(
- "begin", begin_, Integer.class, this, pageContext);
- if (r == null)
+ "begin", begin_, Integer.class, this, pageContext);
+ if (r == null) {
throw new NullAttributeException("forTokens", "begin");
+ }
begin = ((Integer) r).intValue();
validateBegin();
}
if (end_ != null) {
Object r = ExpressionEvaluatorManager.evaluate(
- "end", end_, Integer.class, this, pageContext);
- if (r == null)
+ "end", end_, Integer.class, this, pageContext);
+ if (r == null) {
throw new NullAttributeException("forTokens", "end");
+ }
end = ((Integer) r).intValue();
validateEnd();
}
if (step_ != null) {
Object r = ExpressionEvaluatorManager.evaluate(
- "step", step_, Integer.class, this, pageContext);
- if (r == null)
+ "step", step_, Integer.class, this, pageContext);
+ if (r == null) {
throw new NullAttributeException("forTokens", "step");
+ }
step = ((Integer) r).intValue();
validateStep();
}
if (items_ != null) {
items = (String) ExpressionEvaluatorManager.evaluate(
- "items", items_, String.class, this, pageContext);
- // use the empty string to indicate "no iteration"
- if (items == null)
- items = "";
- }
+ "items", items_, String.class, this, pageContext);
+ // use the empty string to indicate "no iteration"
+ if (items == null) {
+ items = "";
+ }
+ }
if (delims_ != null) {
delims = (String) ExpressionEvaluatorManager.evaluate(
- "delims", delims_, String.class, this, pageContext);
- // use the empty string to cause monolithic tokenization
- if (delims == null)
- delims = "";
- }
+ "delims", delims_, String.class, this, pageContext);
+ // use the empty string to cause monolithic tokenization
+ if (delims == null) {
+ delims = "";
+ }
+ }
}
}
Modified: tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/IfTag.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/IfTag.java?rev=1037284&r1=1037283&r2=1037284&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/IfTag.java (original)
+++ tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/IfTag.java Sat Nov 20 18:14:00 2010
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.apache.taglibs.standard.tag.el.core;
@@ -25,7 +25,7 @@ import org.apache.taglibs.standard.lang.
import org.apache.taglibs.standard.tag.common.core.NullAttributeException;
/**
- * <p>Tag handler for <if> in JSTL's expression-evaluating library.
+ * <p>Tag handler for <if> in JSTL's expression-evaluating library.
* Because of the support provided by the ConditionalTagSupport class,
* thistag is trivial enough not to require a separate base supporting
* class common to both libraries.</p>
@@ -39,12 +39,14 @@ public class IfTag extends ConditionalTa
// Constructor and lifecycle management
// initialize inherited and local state
+
public IfTag() {
super();
init();
}
// Releases any resources we may have (or inherit)
+
public void release() {
super.release();
init();
@@ -55,16 +57,17 @@ public class IfTag extends ConditionalTa
// Supplied conditional logic
protected boolean condition() throws JspTagException {
- try {
+ try {
Object r = ExpressionEvaluatorManager.evaluate(
- "test", test, Boolean.class, this, pageContext);
- if (r == null)
+ "test", test, Boolean.class, this, pageContext);
+ if (r == null) {
throw new NullAttributeException("if", "test");
- else
- return (((Boolean) r).booleanValue());
+ } else {
+ return (((Boolean) r).booleanValue());
+ }
} catch (JspException ex) {
- throw new JspTagException(ex.toString(), ex);
- }
+ throw new JspTagException(ex.toString(), ex);
+ }
}
@@ -78,6 +81,7 @@ public class IfTag extends ConditionalTa
// Accessors
// receives the tag's 'test' attribute
+
public void setTest(String test) {
this.test = test;
}
@@ -87,6 +91,7 @@ public class IfTag extends ConditionalTa
// Private utility methods
// resets internal state
+
private void init() {
test = null;
}
Modified: tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/ImportTag.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/ImportTag.java?rev=1037284&r1=1037283&r2=1037284&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/ImportTag.java (original)
+++ tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/ImportTag.java Sat Nov 20 18:14:00 2010
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.apache.taglibs.standard.tag.el.core;
@@ -35,8 +35,8 @@ public class ImportTag extends ImportSup
// 'Private' state (implementation details)
private String context_; // stores EL-based property
- private String charEncoding_; // stores EL-based property
- private String url_; // stores EL-based property
+ private String charEncoding_; // stores EL-based property
+ private String url_; // stores EL-based property
//*********************************************************************
@@ -57,17 +57,19 @@ public class ImportTag extends ImportSup
// Tag logic
// evaluates expression and chains to parent
+
public int doStartTag() throws JspException {
// evaluate any expressions we were passed, once per invocation
evaluateExpressions();
- // chain to the parent implementation
- return super.doStartTag();
+ // chain to the parent implementation
+ return super.doStartTag();
}
// Releases any resources we may have (or inherit)
+
public void release() {
super.release();
init();
@@ -78,6 +80,7 @@ public class ImportTag extends ImportSup
// Accessor methods
// for EL-based attribute
+
public void setUrl(String url_) {
this.url_ = url_;
}
@@ -94,12 +97,14 @@ public class ImportTag extends ImportSup
// Private (utility) methods
// (re)initializes state (during release() or construction)
+
private void init() {
// null implies "no expression"
- url_ = context_ = charEncoding_ = null;
+ url_ = context_ = charEncoding_ = null;
}
/* Evaluates expressions as necessary */
+
private void evaluateExpressions() throws JspException {
/*
* Note: we don't check for type mismatches here; we assume
@@ -109,15 +114,16 @@ public class ImportTag extends ImportSup
* propagate up.
*/
- url = (String) ExpressionUtil.evalNotNull(
- "import", "url", url_, String.class, this, pageContext);
- if (url == null || url.equals(""))
- throw new NullAttributeException("import", "url");
-
- context = (String) ExpressionUtil.evalNotNull(
- "import", "context", context_, String.class, this, pageContext);
- charEncoding = (String) ExpressionUtil.evalNotNull(
- "import", "charEncoding", charEncoding_, String.class, this,
- pageContext);
+ url = (String) ExpressionUtil.evalNotNull(
+ "import", "url", url_, String.class, this, pageContext);
+ if (url == null || url.equals("")) {
+ throw new NullAttributeException("import", "url");
+ }
+
+ context = (String) ExpressionUtil.evalNotNull(
+ "import", "context", context_, String.class, this, pageContext);
+ charEncoding = (String) ExpressionUtil.evalNotNull(
+ "import", "charEncoding", charEncoding_, String.class, this,
+ pageContext);
}
}
Modified: tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/OutTag.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/OutTag.java?rev=1037284&r1=1037283&r2=1037284&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/OutTag.java (original)
+++ tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/OutTag.java Sat Nov 20 18:14:00 2010
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.apache.taglibs.standard.tag.el.core;
@@ -34,9 +34,9 @@ public class OutTag extends OutSupport {
//*********************************************************************
// 'Private' state (implementation details)
- private String valueExpression; // stores EL-based property
- private String defaultExpression; // stores EL-based property
- private String escapeXmlExpression; // stores EL-based property
+ private String valueExpression; // stores EL-based property
+ private String defaultExpression; // stores EL-based property
+ private String escapeXmlExpression; // stores EL-based property
//*********************************************************************
Modified: tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/ParamTag.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/ParamTag.java?rev=1037284&r1=1037283&r2=1037284&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/ParamTag.java (original)
+++ tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/ParamTag.java Sat Nov 20 18:14:00 2010
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.apache.taglibs.standard.tag.el.core;
@@ -34,7 +34,7 @@ public class ParamTag extends ParamSuppo
// 'Private' state (implementation details)
private String name_; // stores EL-based property
- private String value_; // stores EL-based property
+ private String value_; // stores EL-based property
//*********************************************************************
@@ -55,17 +55,19 @@ public class ParamTag extends ParamSuppo
// Tag logic
// evaluates expression and chains to parent
+
public int doStartTag() throws JspException {
// evaluate any expressions we were passed, once per invocation
evaluateExpressions();
- // chain to the parent implementation
- return super.doStartTag();
+ // chain to the parent implementation
+ return super.doStartTag();
}
// Releases any resources we may have (or inherit)
+
public void release() {
super.release();
init();
@@ -76,6 +78,7 @@ public class ParamTag extends ParamSuppo
// Accessor methods
// for EL-based attribute
+
public void setName(String name_) {
this.name_ = name_;
}
@@ -89,12 +92,14 @@ public class ParamTag extends ParamSuppo
// Private (utility) methods
// (re)initializes state (during release() or construction)
+
private void init() {
// null implies "no expression"
- name_ = value_ = null;
+ name_ = value_ = null;
}
/* Evaluates expressions as necessary */
+
private void evaluateExpressions() throws JspException {
/*
* Note: we don't check for type mismatches here; we assume
@@ -104,9 +109,9 @@ public class ParamTag extends ParamSuppo
* propagate up.
*/
- name = (String) ExpressionUtil.evalNotNull(
- "import", "name", name_, String.class, this, pageContext);
- value = (String) ExpressionUtil.evalNotNull(
- "import", "value", value_, String.class, this, pageContext);
+ name = (String) ExpressionUtil.evalNotNull(
+ "import", "name", name_, String.class, this, pageContext);
+ value = (String) ExpressionUtil.evalNotNull(
+ "import", "value", value_, String.class, this, pageContext);
}
}
Modified: tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/RedirectTag.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/RedirectTag.java?rev=1037284&r1=1037283&r2=1037284&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/RedirectTag.java (original)
+++ tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/RedirectTag.java Sat Nov 20 18:14:00 2010
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.apache.taglibs.standard.tag.el.core;
@@ -33,8 +33,8 @@ public class RedirectTag extends Redirec
//*********************************************************************
// 'Private' state (implementation details)
- private String url_; // stores EL-based property
- private String context_; // stores EL-based property
+ private String url_; // stores EL-based property
+ private String context_; // stores EL-based property
//*********************************************************************
@@ -55,17 +55,19 @@ public class RedirectTag extends Redirec
// Tag logic
// evaluates expression and chains to parent
+
public int doStartTag() throws JspException {
// evaluate any expressions we were passed, once per invocation
evaluateExpressions();
- // chain to the parent implementation
- return super.doStartTag();
+ // chain to the parent implementation
+ return super.doStartTag();
}
// Releases any resources we may have (or inherit)
+
public void release() {
super.release();
init();
@@ -87,12 +89,14 @@ public class RedirectTag extends Redirec
// Private (utility) methods
// (re)initializes state (during release() or construction)
+
private void init() {
// null implies "no expression"
- url_ = context_ = null;
+ url_ = context_ = null;
}
/* Evaluates expressions as necessary */
+
private void evaluateExpressions() throws JspException {
/*
* Note: we don't check for type mismatches here; we assume
@@ -102,9 +106,9 @@ public class RedirectTag extends Redirec
* propagate up.
*/
- url = (String) ExpressionUtil.evalNotNull(
- "redirect", "url", url_, String.class, this, pageContext);
- context = (String) ExpressionUtil.evalNotNull(
- "redirect", "context", context_, String.class, this, pageContext);
+ url = (String) ExpressionUtil.evalNotNull(
+ "redirect", "url", url_, String.class, this, pageContext);
+ context = (String) ExpressionUtil.evalNotNull(
+ "redirect", "context", context_, String.class, this, pageContext);
}
}
Modified: tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/UrlTag.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/UrlTag.java?rev=1037284&r1=1037283&r2=1037284&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/UrlTag.java (original)
+++ tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/UrlTag.java Sat Nov 20 18:14:00 2010
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.apache.taglibs.standard.tag.el.core;
@@ -33,8 +33,8 @@ public class UrlTag extends UrlSupport {
//*********************************************************************
// 'Private' state (implementation details)
- private String value_; // stores EL-based property
- private String context_; // stores EL-based property
+ private String value_; // stores EL-based property
+ private String context_; // stores EL-based property
//*********************************************************************
@@ -55,17 +55,19 @@ public class UrlTag extends UrlSupport {
// Tag logic
// evaluates expression and chains to parent
+
public int doStartTag() throws JspException {
// evaluate any expressions we were passed, once per invocation
evaluateExpressions();
- // chain to the parent implementation
- return super.doStartTag();
+ // chain to the parent implementation
+ return super.doStartTag();
}
// Releases any resources we may have (or inherit)
+
public void release() {
super.release();
init();
@@ -88,12 +90,14 @@ public class UrlTag extends UrlSupport {
// Private (utility) methods
// (re)initializes state (during release() or construction)
+
private void init() {
// null implies "no expression"
- value_ = null;
+ value_ = null;
}
/* Evaluates expressions as necessary */
+
private void evaluateExpressions() throws JspException {
/*
* Note: we don't check for type mismatches here; we assume
@@ -103,9 +107,9 @@ public class UrlTag extends UrlSupport {
* propagate up.
*/
- value = (String) ExpressionUtil.evalNotNull(
- "url", "value", value_, String.class, this, pageContext);
- context = (String) ExpressionUtil.evalNotNull(
- "url", "context", context_, String.class, this, pageContext);
+ value = (String) ExpressionUtil.evalNotNull(
+ "url", "value", value_, String.class, this, pageContext);
+ context = (String) ExpressionUtil.evalNotNull(
+ "url", "context", context_, String.class, this, pageContext);
}
}
Modified: tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/WhenTag.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/WhenTag.java?rev=1037284&r1=1037283&r2=1037284&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/WhenTag.java (original)
+++ tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/core/WhenTag.java Sat Nov 20 18:14:00 2010
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.apache.taglibs.standard.tag.el.core;
@@ -37,12 +37,14 @@ public class WhenTag extends WhenTagSupp
// Constructor and lifecycle management
// initialize inherited and local state
+
public WhenTag() {
super();
init();
}
// Releases any resources we may have (or inherit)
+
public void release() {
super.release();
init();
@@ -53,16 +55,17 @@ public class WhenTag extends WhenTagSupp
// Supplied conditional logic
protected boolean condition() throws JspTagException {
- try {
+ try {
Object r = ExpressionEvaluatorManager.evaluate(
- "test", test, Boolean.class, this, pageContext);
- if (r == null)
- throw new NullAttributeException("when", "test");
- else
+ "test", test, Boolean.class, this, pageContext);
+ if (r == null) {
+ throw new NullAttributeException("when", "test");
+ } else {
return (((Boolean) r).booleanValue());
- } catch (JspException ex) {
- throw new JspTagException(ex.toString(), ex);
- }
+ }
+ } catch (JspException ex) {
+ throw new JspTagException(ex.toString(), ex);
+ }
}
@@ -76,6 +79,7 @@ public class WhenTag extends WhenTagSupp
// Accessors
// receives the tag's 'test' attribute
+
public void setTest(String test) {
this.test = test;
}
@@ -85,6 +89,7 @@ public class WhenTag extends WhenTagSupp
// Private utility methods
// resets internal state
+
private void init() {
test = null;
}
Modified: tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/fmt/BundleTag.java
URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/fmt/BundleTag.java?rev=1037284&r1=1037283&r2=1037284&view=diff
==============================================================================
--- tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/fmt/BundleTag.java (original)
+++ tomcat/taglibs/standard/trunk/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/fmt/BundleTag.java Sat Nov 20 18:14:00 2010
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.apache.taglibs.standard.tag.el.fmt;
@@ -36,7 +36,7 @@ public class BundleTag extends BundleSup
// 'Private' state (implementation details)
private String basename_; // stores EL-based property
- private String prefix_; // stores EL-based property
+ private String prefix_; // stores EL-based property
//*********************************************************************
@@ -57,16 +57,18 @@ public class BundleTag extends BundleSup
// Tag logic
// evaluates expression and chains to parent
+
public int doStartTag() throws JspException {
// evaluate any expressions we were passed, once per invocation
evaluateExpressions();
- // chain to the parent implementation
- return super.doStartTag();
+ // chain to the parent implementation
+ return super.doStartTag();
}
// Releases any resources we may have (or inherit)
+
public void release() {
super.release();
init();
@@ -77,11 +79,13 @@ public class BundleTag extends BundleSup
// Accessor methods
// for EL-based attribute
+
public void setBasename(String basename_) {
this.basename_ = basename_;
}
// for EL-based attribute
+
public void setPrefix(String prefix_) {
this.prefix_ = prefix_;
}
@@ -91,22 +95,24 @@ public class BundleTag extends BundleSup
// Private (utility) methods
// (re)initializes state (during release() or construction)
+
private void init() {
// null implies "no expression"
- basename_ = prefix_ = null;
+ basename_ = prefix_ = null;
}
// Evaluates expressions as necessary
+
private void evaluateExpressions() throws JspException {
- // 'basename' attribute (mandatory)
- basename = (String) ExpressionEvaluatorManager.evaluate(
- "basename", basename_, String.class, this, pageContext);
-
- // 'prefix' attribute (optional)
- if (prefix_ != null) {
- prefix = (String) ExpressionEvaluatorManager.evaluate(
- "prefix", prefix_, String.class, this, pageContext);
- }
+ // 'basename' attribute (mandatory)
+ basename = (String) ExpressionEvaluatorManager.evaluate(
+ "basename", basename_, String.class, this, pageContext);
+
+ // 'prefix' attribute (optional)
+ if (prefix_ != null) {
+ prefix = (String) ExpressionEvaluatorManager.evaluate(
+ "prefix", prefix_, String.class, this, pageContext);
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org