luehe 2002/11/11 11:26:29
Modified: jasper2/src/share/org/apache/jasper/compiler
JspDocumentParser.java
Log:
Fixed 14413: NPE while using jsp:attribute in JSP Document
Revision Changes Path
1.29 +22 -15
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java
Index: JspDocumentParser.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- JspDocumentParser.java 8 Nov 2002 19:55:47 -0000 1.28
+++ JspDocumentParser.java 11 Nov 2002 19:26:28 -0000 1.29
@@ -435,19 +435,26 @@
return;
}
- if (current instanceof Node.NamedAttribute
- && ((Node.NamedAttribute) current).isTrim()) {
- // Ignore any whitespace (including spaces, carriage returns,
- // line feeds, and tabs, that appear at the beginning and at the
- // end of the body of the <jsp:attribute> action.
+ if (current instanceof Node.NamedAttribute) {
Node.Nodes subelems = ((Node.NamedAttribute) current).getBody();
- Node firstNode = subelems.getNode(0);
- if (firstNode instanceof Node.TemplateText) {
- ((Node.TemplateText) firstNode).ltrim();
+ if (subelems == null) {
+ throw new SAXParseException(
+ err.getString("jsp.error.empty.body.not.allowed",
+ "<jsp:attribute"),
+ locator);
}
- Node lastNode = subelems.getNode(subelems.size() - 1);
- if (lastNode instanceof Node.TemplateText) {
- ((Node.TemplateText) lastNode).rtrim();
+ if (((Node.NamedAttribute) current).isTrim()) {
+ // Ignore any whitespace (including spaces, carriage returns,
+ // line feeds, and tabs, that appear at the beginning and at
+ // the end of the body of the <jsp:attribute> action.
+ Node firstNode = subelems.getNode(0);
+ if (firstNode instanceof Node.TemplateText) {
+ ((Node.TemplateText) firstNode).ltrim();
+ }
+ Node lastNode = subelems.getNode(subelems.size() - 1);
+ if (lastNode instanceof Node.TemplateText) {
+ ((Node.TemplateText) lastNode).rtrim();
+ }
}
} else if (current instanceof Node.ScriptingElement) {
checkScriptingBody((Node.ScriptingElement) current);
--
To unsubscribe, e-mail: <mailto:tomcat-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@;jakarta.apache.org>