Bug 54011 - Code generation error in jstl tagPlugin "Out" when has "escapeXml" on the tagPlugin
Code generation error in jstl tagPlugin "Out" when has "escapeXml" on the tag...
Product: Tomcat 7
Classification: Unclassified
Component: Jasper
PC All
: P2 normal (vote)
: ---
Assigned To: Tomcat Developers Mailing List
Depends on:
  Show dependency tree
Reported: 2012-10-16 07:31 UTC by Sheldon Shao
Modified: 2012-11-16 22:49 UTC (History)
0 users

Patch for org.apache.jasper.tagplugins.jstl.core.Out.java (1.97 KB, text/plain)
2012-10-16 07:31 UTC, Sheldon Shao
Patch for org.apache.jasper.tagplugins.jstl.Util.java (1006 bytes, patch)
2012-10-16 07:32 UTC, Sheldon Shao
Details | Diff
Patch for org.apache.jasper.tagplugins.jstl.core.Out.java (1.97 KB, patch)
2012-10-16 07:35 UTC, Sheldon Shao
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sheldon Shao 2012-10-16 07:31:26 UTC
Created attachment 29482 [details]
Patch for org.apache.jasper.tagplugins.jstl.core.Out.java

When setting up org.apache.jasper.tagplugins.jstl.core.Out as a tagplugin and trying to make code generation for the following code, 

<c:out escapeXml="false" value="test"/>

It will generate an error.

It has a typo in it 

   ctxt.generateJavaSource(strEscapeXmlName + " = Boolean.parseBoolean((");

The attribute name should be "escapeXml".
Even change the right name,  it occurs an error because of "(false).toString()".

Attached two patchs for this bug fix and code simplified.
Comment 1 Sheldon Shao 2012-10-16 07:32:50 UTC
Created attachment 29483 [details]
Patch for org.apache.jasper.tagplugins.jstl.Util.java
Comment 2 Sheldon Shao 2012-10-16 07:35:23 UTC
Created attachment 29484 [details]
Patch for org.apache.jasper.tagplugins.jstl.core.Out.java
Comment 3 Mark Thomas 2012-10-24 19:16:50 UTC
Many thanks for the patches. I modified the clean-up slightly and added some test cases for trunk.

The fix was applied to trunk and 7.0.x and will be included in 7.0.33 onwards.
Comment 4 Konstantin Kolinko 2012-11-15 08:51:58 UTC
See bug 54144 for review of r1401816 and other missing features of tagplugin implementation of the <c:out> tag.

Essentially, this patch has to be reverted, as it broke a feature of the <c:out> tag that the tag body is used as the default if none is specified.

Those were the following lines:
-        ctxt.generateJavaSource("    }else{");
-        ctxt.generateBody();
-        ctxt.generateJavaSource("    }");
Comment 5 Mark Thomas 2012-11-16 22:49:44 UTC
I've fixed using body as the default issue in trunk and 7.0.x.