Affected versions: Tomcat 4 version up to 4.0.3
Possible bugs:
1) handleComment is never called on the EventListener
handleComment should be called as far as i understand
because the parser can't really know if the code-gen backend
uses the comments.
diff for Parser.java
@@ -440,7 +440,10 @@
throw new
ParseException(Constants.getString("jsp.error.unterminated",
new Object[] {
OPEN_COMMENT }));
- parser.flushCharData(parser.tmplStart, parser.tmplStop);
+ listener.setTemplateInfo(parser.tmplStart, parser.tmplStop);
+ listener.handleComment(start, stop,reader.getChars(start, stop));
+
return true;
}
return false;
2) handleTagBegin is called with hasBody == true when a <prefix:myTag />
is encountered (similar to 2622).
I'm not entirely sure this is a bug, it all depends on what _exactly_ the
intended use of the hasBody parameter in handleTagBegin and handleTagEnd
in Parser.java, my assumption is that it is used to determine if a the tag
has indeed a body.
If so then it should be false when the codepath below is invoked.
Because an empty-element tag can't have a body.
diff for Parser.java
@@ -838,9 +841,9 @@
reader.advance(CLOSE_1.length());
listener.setTemplateInfo(parser.tmplStart, parser.tmplStop);
listener.handleTagBegin(start, reader.mark(), attrs, prefix,
- shortTagName, tli, ti, true);
+ shortTagName, tli, ti, false);
listener.handleTagEnd(start, reader.mark(), prefix,
- shortTagName, attrs, tli, ti, true);
+ shortTagName, attrs, tli, ti, false);
} else {
// Body can be either
// - empty
In the code handling the start-tag and end-tag case the following code is
excuted:
String bodyString = new String(reader.getChars(bodyStart, bodyStop));
hasBody = (bodyString.length() > 0);
Which seems to suggest that my assumption regarding the meaning of
hasBody is correct.
Resolution:
Se patch below.
/Regards Mikael Andersson
---
c:\src\jakarta-tomcat-4.0.1-src\jasper\src\share\org\apache\jasper\compiler\Parser.java
Sun Oct 14 11:14:32 2001
+++
+c:\src\jakarta-tomcat-4.0.1-src-changed\jasper\src\share\org\apache\jasper\compiler\Parser.java
+ Thu Apr 18 20:34:40 2002
@@ -440,7 +440,10 @@
throw new
ParseException(Constants.getString("jsp.error.unterminated",
new Object[] {
OPEN_COMMENT }));
- parser.flushCharData(parser.tmplStart, parser.tmplStop);
+ listener.setTemplateInfo(parser.tmplStart, parser.tmplStop);
+ listener.handleComment(start, stop,reader.getChars(start, stop));
+
return true;
}
return false;
@@ -838,9 +841,9 @@
reader.advance(CLOSE_1.length());
listener.setTemplateInfo(parser.tmplStart, parser.tmplStop);
listener.handleTagBegin(start, reader.mark(), attrs, prefix,
- shortTagName, tli, ti, true);
+ shortTagName, tli, ti, false);
listener.handleTagEnd(start, reader.mark(), prefix,
- shortTagName, attrs, tli, ti, true);
+ shortTagName, attrs, tli, ti, false);
} else {
// Body can be either
// - empty
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>