[ https://issues.apache.org/jira/browse/EL-9?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Christian Leskowsky updated EL-9: --------------------------------- Attachment: implicitobjects.patch I've updated the attribute key to refer to "org.apache.commons.el". The key ImplicitObjects is using now clashes with the same class from the JSTL. See http://opensource.atlassian.com/projects/spring/browse/SPR-3563 for more info on where this issue has been coming up. > [el] ClassCastException when using commons-el.jar and standard.jar el > evaluator > ------------------------------------------------------------------------------- > > Key: EL-9 > URL: https://issues.apache.org/jira/browse/EL-9 > Project: Commons EL > Issue Type: Bug > Affects Versions: 1.0 Final > Environment: Operating System: All > Platform: PC > Reporter: Francois Plouffe > Priority: Critical > Attachments: fix_bug_29402.txt, implicitobjects.patch > > > Runing Tomcat 5.0.14 and 5.0.25. Using Apache standard.jar taglibs. > I am writing a custom tag that accept el expression in attributes. My tag > class > is using pageContext.getExpressionEvaluator.evaluate to evaluate el > expressions. > In a jsp page, when using only my custom tag like this: > <mytag:setLocale value="${cookie.Language.value}"/>, it work fine and > evaluate > to the correct cookie value. > But when I am using any tag from standard.jar, problem occurs. For example, > when inserting <c:out value="${cookie.Language.value"}/> before > mytag:setLocale, pageContext.getExpressionEvaluator.evaluate throws a > ClassCastException. When c:out is inserted after mytag:setLocale, the > ClassCastException is thrown from standard.jar. > I have found the potential cause: when mytag:setLocale is called first, > pageContext.getExpressionEvaluator.evaluate appens to add in the pageContext > attributes hashMap an object of type org.apache.commons.el.ImplicitObjects > with > key "org.apache.taglibs.standard.ImplicitObjects". Then when c:out is called > next, it retreive the from the pageContext the > key "org.apache.taglibs.standard.ImplicitObjects", wich is not of type > org.apache.taglibs.standard.lang.jstl.ImplicitObjects. The reverse appens > when > c:out is called first; an object with the > key "org.apache.taglibs.standard.ImplicitObjects" of type > org.apache.taglibs.standard.lang.jstl.ImplicitObjects is added in the > pageContext attributes hashMap. And when mytag:setLocale is called, > org.apache.commons.el.ImplicitObjects.getImplicitObjects throws a > ClassCastException when pContext.getAttribute returns with an object of type > org.apache.taglibs.standard.lang.jstl.ImplicitObjects. > The source of the problem is that both package insert or retreive from the > pagecontext attributes hashMap the same key name > ("org.apache.taglibs.standard.ImplicitObjects"), but with different type. > Base > on the key name, I guess standard.jar is correct in using it, but commons- > el.jar is not. > I tested a modified commons-el.jar with member sAttributeName from > org.apache.commons.el.ImplicitObjects setted to, > well, "org.apache.commons.el.ImplicitObjects". It worked just fine both cases. > The problem would only occurs if el evaluator from both package are called in > the same jsp page with jsp's implicit objects. I dosen't have to be the same > implicit object. > Since I can't beleive I am the first one with this problem, I first tried > find > something wrong in my setup/code. But it seems not. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]