You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2010/10/17 11:26:25 UTC
DO NOT REPLY [Bug 50105] New: Violation of JSP-EL spec version 2.1
when coerce Enum to String
https://issues.apache.org/bugzilla/show_bug.cgi?id=50105
Summary: Violation of JSP-EL spec version 2.1 when coerce Enum
to String
Product: Tomcat 6
Version: 6.0.29
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Jasper
AssignedTo: dev@tomcat.apache.org
ReportedBy: oliver@siegmar.net
Section 1.18.2 of the 2.1 JSP-EL spec (Coerce A to String) says "if A is Enum,
return A.name()". This is not always the case in Tomcat 6.0.29. To demonstrate
the bug, I created some custom code (enum, Tag, JSP):
Tag:
public class MyCustomTag implements Tag {
public void setValue(String value) {
System.out.println(value);
}
@Override public void setPageContext(PageContext pc) {}
@Override public void setParent(Tag t) {}
@Override public Tag getParent() { return null; }
@Override public int doStartTag() throws JspException { return SKIP_BODY; }
@Override public int doEndTag() throws JspException { return EVAL_PAGE; }
@Override public void release() {}
}
TLD:
<?xml version="1.0" encoding="UTF-8" ?>
<taglib xsi:schemaLocation="http://java.sun.com/xml/ns/javaeeweb-
jsptaglibrary_2_1.xsd" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1">
<tlibversion>1.0</tlibversion>
<uri>http://my-domain.org/customLib</uri>
<tag>
<name>customTag</name>
<tagclass>mypackage.MyCustomTag</tagclass>
<bodycontent>empty</bodycontent>
<attribute>
<name>value</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>
Enum:
public enum MyEnum {
APPLE, ORANGE;
@Override
public String toString() {
return "this is a " + name();
}
}
JSP:
<%@taglib prefix="myLib" uri="http://my-domain.org/customLib"%>
<myLib:customTag value="${myEnum}"/>
<myLib:customTag value="foo.${myEnum}.bar"/>
Because the value myEnum is was set to MyEnum.ORANGE, i would expect, that this
outputs:
ORANGE
foo.ORANGE.bar
But the output in catalina.out instead is:
ORANGE
foo.this is a ORANGE.bar
Which is a violation of the JSP-EL spec (if I understood it right).
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
DO NOT REPLY [Bug 50105] Violation of JSP-EL spec version 2.1 when
coerce Enum to String
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50105
--- Comment #1 from Mark Thomas <ma...@apache.org> 2010-10-19 09:06:18 EDT ---
You understood it right.
I have fixed this in trunk which will be included in 7.0.5 onwards. I have also
proposed the same fix for 6.0.x.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
DO NOT REPLY [Bug 50105] Violation of JSP-EL spec version 2.1 when
coerce Enum to String
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50105
Mark Thomas <ma...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #2 from Mark Thomas <ma...@apache.org> 2010-10-25 12:03:37 EDT ---
This has been fixed in 6.0.x and will be included in 6.0.30 onwards.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org