Bug 43758 - java.lang.NullPointerException from org.apache.jasper.compiler.ServletWriter.printMultiLn() on validation of JSPX with empty <jsp:scriptlet> element
java.lang.NullPointerException from org.apache.jasper.compiler.ServletWriter....
Status: RESOLVED FIXED
Product: Tomcat 6
Classification: Unclassified
Component: Jasper
6.0.13
PC Windows XP
: P3 minor (vote)
: default
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2007-10-31 11:58 UTC by Alexander Chernikov
Modified: 2008-01-10 13:36 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Chernikov 2007-10-31 11:58:06 UTC
Provided a JSPX with empty jsp:scriptlet element:

<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns="http://www.w3.org/1999/xhtml" version="2.0">
<jsp:scriptlet></jsp:scriptlet>
<html>
<head><title>Simple jspx page</title></head>
<body>Place content here</body>
</html>
</jsp:root>

Validated this with Jasper using ant task, similar to one described in
http://tomcat.apache.org/tomcat-4.1-doc/jasper-howto.html (adjusted to Tomcat 6,
of course). Got the trace:

java.lang.NullPointerException
	at org.apache.jasper.compiler.ServletWriter.printMultiLn(ServletWriter.java:169)
	at org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:883)
	at org.apache.jasper.compiler.Node$Scriptlet.accept(Node.java:915)
	at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)
	at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2386)
	at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2397)
	at org.apache.jasper.compiler.Node$JspRoot.accept(Node.java:566)
	at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)
	at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2386)
	at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2392)
	at org.apache.jasper.compiler.Node$Root.accept(Node.java:489)
	at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)
	at org.apache.jasper.compiler.Generator.generate(Generator.java:3374)
	at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:210)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:306)
	at org.apache.jasper.JspC.processFile(JspC.java:1007)
	at org.apache.jasper.JspC.execute(JspC.java:1156)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
	at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:134)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:357)
	at org.apache.tools.ant.Target.performTasks(Target.java:385)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
	at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
	at org.apache.tools.ant.Main.runBuild(Main.java:698)
	at org.apache.tools.ant.Main.startAnt(Main.java:199)
	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:17)

Without <jsp:scriptlet></jsp:scriptlet> there is no problem.
Comment 1 Mark Thomas 2008-01-01 12:06:51 UTC
Thanks for the report and test case.

This has been fixed in svn and proposed for 6.0.x
Comment 2 Mark Thomas 2008-01-10 13:36:29 UTC
Thsi has been fixed in svn and will be included in 6.0.16 onwards.