You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Kevin Jones <ke...@develop.com> on 2000/06/13 11:56:51 UTC
Ugly bug in taglibs
I came across this last week and thought it was either me or the latest
drop, but this also appears in the 3.1 release.
I have a custom tag lib which I use in a page - if I do this
<foo:myTag attr="a" >
</foo >
^
|
<%-- SPACE HERE --%>
then I get an error (which is extremly unhelpful) at translation time. It
essentially amounts to an array out of bounds exception -
java.lang.ArrayIndexOutOfBoundsException: -1 < 0
at java.util.Vector.elementAt(Vector.java:451)
at org.apache.jasper.compiler.JspReader.getFile(JspReader.java:96)
at org.apache.jasper.compiler.JspReader.popFile(JspReader.java:235)
at
org.apache.jasper.compiler.JspReader.hasMoreInput(JspReader.java:260)
at org.apache.jasper.compiler.JspReader.nextChar(JspReader.java:269)
at org.apache.jasper.compiler.JspReader.advance(JspReader.java:370)
at org.apache.jasper.compiler.Parser$Tag.accept(Parser.java:831)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1067)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1032)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1028)
at
org.apache.jasper.compiler.Compiler.compile_context(Compiler.java:219)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:108)
at org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:416)
at
org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspSe
rvlet.java:149)
at
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja
va:161)
at
org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:370)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:549)
at
org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcherImpl
.java:186)
at
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:413)
at
_0002fDoLogon_0002ejspDoLogon_jsp_0._jspService(_0002fDoLogon_0002ejspDoLogo
n_jsp_0.java:98)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja
va:174)
at
org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:370)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:549)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:639)
at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
(Ajp12ConnectionHandler.java:166)
at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:383)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:484)
at java.lang.Thread.run(Thread.java:484)
The problem is the space in the closing tag. The tag has to look like this
to work
<foo:myTag attr="a" >
</foo> <%-- NO SPACE HERE --%>
This has taken me the best part of two days to track down.
The spec. doesn't say (or at least I couldn't see it) that spaces aren't
allowed there, and the XML spec specifically allows spaces there -
End-tag
[42] ETag ::= '</' Name S? '>'
where 'S' is
S ::= (#x20 | #x9 | #xD | #xA)+
Kevin Jones
DevelopMentor
www.develop.com