You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2004/05/06 23:59:09 UTC
DO NOT REPLY [Bug 28817] New: -
ClassCastException in org.apache.struts.taglib.TagUtils.java
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28817>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=28817
ClassCastException in org.apache.struts.taglib.TagUtils.java
Summary: ClassCastException in
org.apache.struts.taglib.TagUtils.java
Product: Struts
Version: Nightly Build
Platform: Other
OS/Version: Linux
Status: NEW
Severity: Major
Priority: Other
Component: Utilities
AssignedTo: dev@struts.apache.org
ReportedBy: rickkw@yahoo.com
Hi, I verified this problem with nightlybuild version jakarta-struts-20040506.tar.gz
are.owm.widgets.search.filter_jsp threw exception
java.lang.ClassCastException
at
org.apache.struts.taglib.TagUtils.retrieveMessageResources(TagUtils.java:1211)
at org.apache.struts.taglib.TagUtils.message(TagUtils.java:1082)
at org.apache.struts.taglib.TagUtils.message(TagUtils.java:1057)
at
org.apache.struts.taglib.bean.WriteTag.retrieveFormatString(WriteTag.java:256)
at org.apache.struts.taglib.bean.WriteTag.formatValue(WriteTag.java:319)
at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:234)
This happens in TagUtils.retrieveMessageResources()
if (resources == null) {
resources =
(MessageResources) pageContext.getAttribute(
bundle,
PageContext.REQUEST_SCOPE);
}
When Struts tries to retrieve an INT format string (from a default bundle) to
display an Integer. This condition may be the result of the way my JSP page is
constructed.
Basically, I have two web application with each bundling and loading the Struts
library in its own class loader. My JSP page in Application X gets a
RequestDispatcher from application Y and does an Include. This may result in
the HttpServletRequest containing a MessageResources object loaded in
application X in the request scope, and passed along to application Y (due to
the Include). Since the MessageResources class is loaded in each of the
application classloader in X and Y, the casting results in ClassCastException.
At the moment, I am stuck. Could this be fixed by catching the
ClassCastException inside TagUtils.retrieveMessageResource()?
if (resources == null) {
try {
resources =
(MessageResources) pageContext.getAttribute(
bundle,
PageContext.REQUEST_SCOPE);
} catch (ClassCastException e) {}
}
Thanks!
--
Rick
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org