You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ki...@apache.org on 2002/07/18 22:18:10 UTC
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler JspReader.java Parser.java
kinman 2002/07/18 13:18:10
Modified: jasper2/src/share/org/apache/jasper/compiler JspReader.java
Parser.java
Log:
- Fixed 10713. Modified on patch by H.Zeller@acm.org (Henner Zeller)
Revision Changes Path
1.7 +33 -2 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspReader.java
Index: JspReader.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspReader.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- JspReader.java 16 Jul 2002 19:30:51 -0000 1.6
+++ JspReader.java 18 Jul 2002 20:18:10 -0000 1.7
@@ -393,14 +393,45 @@
* otherwise.
*/
public Mark skipUntil(String limit) throws JasperException {
+ Mark ret = null;
+ int limlen = limit.length();
+ int ch;
+
+ skip:
+ for (ret = mark(), ch = nextChar() ; ch != -1 ;
+ ret = mark(), ch = nextChar()) {
+ if (ch == limit.charAt(0)) {
+ for (int i = 1 ; i < limlen ; i++) {
+ if (peekChar() == limit.charAt(i))
+ nextChar();
+ else
+ continue skip;
+ }
+ return ret;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Skip until the given string is matched in the stream, but ignoring
+ * chars initially escaped by a '\'.
+ * When returned, the context is positioned past the end of the match.
+ * @param s The String to match.
+ * @return A non-null <code>Mark</code> instance (positioned immediately
+ * before the search string) if found, <strong>null</strong>
+ * otherwise.
+ */
+ public Mark skipUntilIgnoreEsc(String limit) throws JasperException {
Mark ret = null;
int limlen = limit.length();
int ch;
+ int prev = 'x'; // Doesn't matter
skip:
for (ret = mark(), ch = nextChar() ; ch != -1 ;
- ret = mark(), ch = nextChar()) {
- if (ch == limit.charAt(0)) {
+ ret = mark(), prev = ch, ch = nextChar()) {
+ if (ch == limit.charAt(0) && prev != '\\') {
for (int i = 1 ; i < limlen ; i++) {
if (peekChar() == limit.charAt(i))
nextChar();
1.10 +4 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java
Index: Parser.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Parser.java 17 Jul 2002 20:06:59 -0000 1.9
+++ Parser.java 18 Jul 2002 20:18:10 -0000 1.10
@@ -224,7 +224,7 @@
*/
private String parseAttributeValue(String watch) throws JasperException {
Mark start = reader.mark();
- Mark stop = reader.skipUntil(watch);
+ Mark stop = reader.skipUntilIgnoreEsc(watch);
if (stop == null) {
err.jspError(start, "jsp.error.attribute.unterminated", watch);
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>