Bug 48627 - JasperException with JSF tags and value expressions
Summary: JasperException with JSF tags and value expressions
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 6.0.24
Hardware: All All
: P2 major (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-27 00:28 UTC by Michael Heinen
Modified: 2010-02-24 09:17 UTC (History)
1 user (show)



Attachments
Binary patch for testing purposes only (14.57 KB, application/octet-stream)
2010-01-30 17:56 UTC, Mark Thomas
Details
Updated source patch for Tomcat 6.0 (9.88 KB, patch)
2010-02-04 04:47 UTC, Konstantin Kolinko
Details | Diff
Updated binary patch for Tomcat 6.0.24 for testing purposes only (16.65 KB, application/octet-stream)
2010-02-04 05:03 UTC, Konstantin Kolinko
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Heinen 2010-01-27 00:28:18 UTC
I recently updated from Tomcat 6.0.20 to 6.0.24.
Now some jsps with jsf tags are not compiling anymore.

Following tag results in a JasperException in 6.0.24 but compiles fine with older versions:

<h:outputText value="\\">

Stack:
Caused by: org.apache.jasper.JasperException: /pages/preferences.jsp(147,100) According to TLD or attribute directive in tag file, attribute value does not accept any expressions
                at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
                at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
                at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
                at org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1165)
                at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:852)
                at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530)
                at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
                at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
                at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:871)
                at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530)
                at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
                at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
                at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:871)
                at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530)
                at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
                at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
                at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:871)
                at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530)
                at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
                at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
                at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:871)
                at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530)
                at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
                at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
                at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:871)
                at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530)
                at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
                at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
                at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:871)
                at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530)
                at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
                at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
                at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
                at org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
                at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
                at org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1775)
                at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:183)
                at org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
                at org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
                at org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
                at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
                at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
                at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
                at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
                at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551)
                at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488)
                at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968)
                at org.apache.jasper.runtime.PageContextImpl.doInclude(PageContextImpl.java:650)
                at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:644)
                at org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesRequestContext.java:80)
                ... 67 more
Comment 1 Jon Vincent 2010-01-27 16:58:01 UTC
We're also hitting this since upgrading to 6.0.24 -- in our case, the attribute value also contains a '\' character.

I'm updating the platform to "All" since we're running on various OS combinations and have seen the issue on both Windows and Mac so far. I also upgraded severity to "major" since it's a significant loss of functionality for those of us who do hit it. :)
Comment 2 Mark Thomas 2010-01-28 15:38:13 UTC
I have been able to reproduce this and have added a test case for it to Tomcat 7. I know exactly what caused it. My recent changes to address a number of issues with EL parsing made the incorrect assumption that EL would be valid for any attribute. Clearly that isn't a valid assumption.

I agree this is a nasty regression and I am working on a fix. Once I have a fix are either of you willing and able to test it? You'll either need to build Tomcat from source or I can provide a binary patch.
Comment 3 Jon Vincent 2010-01-28 16:39:19 UTC
Yeah, I'd be happy to test it. Thanks!
Comment 4 Michael Heinen 2010-01-28 23:59:11 UTC
I can also test it but I need a binary patch
Comment 5 Mark Thomas 2010-01-30 17:56:27 UTC
Created attachment 24910 [details]
Binary patch for testing purposes only

This has been fixed in trunk and proposed for 6.0.x.

To test if you are happy build from source, checkout tc6.0.x/trunk and apply this patch before building: http://svn.apache.org/viewvc?view=revision&revision=904949

To test with the binary patch, make the following changes to a 6.0.24 installation:

1. Create the following directory structure in $CATALINA_HOME/lib
org/apache/jasper/compiler

2. Download the binary patch attachment and extract the 2 class files to the directory you created in step 1.

You should now have:
$CATALINA_HOME/lib/org/apache/jasper/compiler/AttributeParser.class
$CATALINA_HOME/lib/org/apache/jasper/compiler/Parser.class

3. Empty the $CATALINA_BASE/work directory

4. Start Tomcat

Please be aware that this patch in both source and binary form is for testing purposes only and is not an official release from the ASF.

Let us know how you get on. Thanks in advance.
Comment 6 Jon Vincent 2010-02-01 13:38:57 UTC
The fix worked perfectly for me. I took your binary patch to make things a little faster -- let me know if you need extra verification and I can build it from source.

Thanks Mark!
Comment 7 Michael Heinen 2010-02-02 01:28:01 UTC
The initial JasperException does not occur anymore but I got a new one.
Maybe the patch is not fully compatible?

Caused by: java.lang.NoSuchMethodError: org.apache.jasper.compiler.PageInfo.isErrorOnUndeclaredNamespace()Z
	at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1175)
	at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1422)
	at org.apache.jasper.compiler.Parser.parse(Parser.java:131)
	at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255)
	at org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
	at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:170)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
	at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
	at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551)
	at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488)
	at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968)
	at org.apache.jasper.runtime.PageContextImpl.doInclude(PageContextImpl.java:650)
	at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:644)
	at org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesRequestContext.java:80)
	... 93 more
Cause:
Comment 8 Mark Thomas 2010-02-02 01:38:19 UTC
(In reply to comment #7)
> The initial JasperException does not occur anymore but I got a new one.
> Maybe the patch is not fully compatible?
> 
> Caused by: java.lang.NoSuchMethodError:
> org.apache.jasper.compiler.PageInfo.isErrorOnUndeclaredNamespace()Z

That method was introduced in Tomcat 7. 
>     at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1175)
>     at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1422)
>     at org.apache.jasper.compiler.Parser.parse(Parser.java:131)

and these line numbers are Tomact 7 line numbers.

The binary patch is only intended for testing with Tomcat 6.0.24.
Comment 9 Mark Thomas 2010-02-02 01:40:19 UTC
(In reply to comment #6)
> The fix worked perfectly for me. I took your binary patch to make things a
> little faster -- let me know if you need extra verification and I can build it
> from source.
> 
> Thanks Mark!

Thanks for the testing. I'll add a note to the STATUS file.
Comment 10 Michael Heinen 2010-02-02 01:49:36 UTC
I don't have Tomcat 7, I wasn't even aware of it. 
I am using 6.0.24 and used the binary patch applied to this bug.
Comment 11 Michael Heinen 2010-02-02 01:53:39 UTC
I decompiled the patch and it contains this line:
  if(pageInfo.isErrorOnUndeclaredNamespace())
Comment 12 Konstantin Kolinko 2010-02-04 04:47:49 UTC
Created attachment 24925 [details]
Updated source patch for Tomcat 6.0

Updated patch for Tomcat 6.0.24.
It is the result of merging revisions 904949, 905226, 906465 from trunk.
Comment 13 Konstantin Kolinko 2010-02-04 05:03:48 UTC
Created attachment 24926 [details]
Updated binary patch for Tomcat 6.0.24 for testing purposes only

Updated binary patch for Tomcat 6.0.24 that corresponds to the source patch from attachment 24925 [details]

Its usage is subject to the conditions stated in Comment 5.

Please be aware that this patch in both source and binary form is for testing purposes only and is not an official release from the ASF.
Comment 14 Mark Thomas 2010-02-24 09:17:07 UTC
This has been fixed in 6.0.x and will be included in 6.0.25 onwards.