tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Danno Ferrin" <DFER...@novell.com>
Subject Re:PATCH:jakarta-tomcat/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java
Date Sat, 13 Nov 1999 21:25:15 GMT
What is happening is while decoding the .tld file TagLibraryInfoImpl.parseTLD(...) is stepping
though the XML Children nodes, expecting all of them to be elements.  TextNodes are also being
stored in the array because whitsepace is preserved.  Any tld that uses whitespace in the
tag, taglib, or attribute elements would cause the class cast exception.  However if you patch
it and get a verification error, then that is a separate bug I have posted to the list.


Ok, same test file as the verifier error.  Put the jar and jsp in the root web directory,
and try and run test.jsp.  The error shown on the web page is 
org.apache.jasper.JasperException: Unable to open taglibrary /verify.jar : com.sun.xml.tree.TextNode
	at org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEventListener.java:655)
	at org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingListener.java:110)
	at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:202)
	at org.apache.jasper.compiler.Parser.parse(Parser.java:966)
	at org.apache.jasper.compiler.Parser.parse(Parser.java:954)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:140)
	at org.apache.jasper.runtime.JspLoader.loadJSP(JspLoader.java:226)
	at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:142)
	at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:153)
	at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:239)
	at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:343)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:868)
	at org.apache.tomcat.core.ServiceInvocationHandler.method(ServletWrapper.java:624)
	at org.apache.tomcat.core.ServletWrapper.handleInvocation(ServletWrapper.java:532)
	at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:376)
	at org.apache.tomcat.core.Context.handleRequest(Context.java:640)
	at org.apache.tomcat.server.ConnectionHandler.run(ConnectionHandler.java:209)

The error shown on the console is 
java.lang.ClassCastException: com.sun.xml.tree.TextNode
        at org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:327)
        at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:284)
        at org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEventListener.java:648)
        at org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingListener.java:110)
        at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:202)
        at org.apache.jasper.compiler.Parser.parse(Parser.java:966)
        at org.apache.jasper.compiler.Parser.parse(Parser.java:954)
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:140)
        at org.apache.jasper.runtime.JspLoader.loadJSP(JspLoader.java:226)
        at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:142)
        at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:153)
        at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:239)
        at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:343)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:868)
        at org.apache.tomcat.core.ServiceInvocationHandler.method(ServletWrapper.java:624)
        at org.apache.tomcat.core.ServletWrapper.handleInvocation(ServletWrapper.java:532)
        at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:376)
        at org.apache.tomcat.core.Context.handleRequest(Context.java:640)
        at org.apache.tomcat.server.ConnectionHandler.run(ConnectionHandler.java:209)


>>> anilv@pacbell.net 11/12/99 05:08PM >>>
Hi Danno,

Am not sure what exactly you are trying to fix here. Can you please explain a bit? A test
case that causes the
class cast exception would be nice too.

Thanks.

Danno Ferrin wrote:

> The XML Parser makes whitspace exposed as content data at the same level =
> as elements, simple fix, just only look at elements
>
> diff -w TagLibraryImpl.java TagLibraryInfoImpl.java.1.5
> 327,329c327
> <             Object o =3D list.item(i);
> <             if (o instanceof Element) {
> <                 Element e =3D (Element) o;
> ---
> >             Element e =3D (Element) list.item(i);
> 360d357
> <             };
> 375,377c372
> <             Object o =3D list.item(i);
> <             if (o instanceof Element) {
> <                   Element e =3D (Element) o;
> ---
> >             Element e =3D (Element) list.item(i);
> 408d402
> <             };
> 457,458d450
> <             Object o =3D list.item(i);
> <             if (o instanceof Element) {
> 488d479
> <             };

--
Peace, Anil +<:-)




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org 
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org 


Mime
View raw message