You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Nils-Helge Garli (JIRA)" <ji...@apache.org> on 2006/06/15 19:43:16 UTC

[jira] Commented: (WW-1286) ClassCastException in LocalizedTextUtils in Portlet when doing a submit to a model driven action

    [ http://issues.apache.org/struts/browse/WW-1286?page=comments#action_37532 ] 

Nils-Helge Garli commented on WW-1286:
--------------------------------------

The patch for WW-1313 will also resolve this issue.

> ClassCastException in LocalizedTextUtils in Portlet when doing a submit to a model driven action
> ------------------------------------------------------------------------------------------------
>
>          Key: WW-1286
>          URL: http://issues.apache.org/struts/browse/WW-1286
>      Project: Struts Action 2
>         Type: Bug

>   Components: Portlet Integration
>     Versions: WW 2.2.2
>     Reporter: Nils-Helge Garli
>     Assignee: Rainer Hermanns
>      Fix For: 2.0.0

>
> Problem with ww:text when a ModelDriven action is invoked in the event phase of a portlet request cycle, and the result is a jsp, causing the DirectRenderFromEventAction to execute. Root cause is that the Jsr168Dispatcher pushes the action executed in the event phase on the  top of the stack when executing in the render phase (to preserve form parameters and possible error/validation messages).
> This causes a NPE in the following code in LocalizedTextUtils:
> [code]
> if (ModelDriven.class.isAssignableFrom(aClass)) {
>             ActionContext context = ActionContext.getContext();
>             // search up model's class hierarchy
>             ActionInvocation actionInvocation = context.getActionInvocation();
>             // ActionInvocation may be null if we're being run from a Sitemesh filter, so we won't get model texts if this is null
>             if (actionInvocation != null) {
>                 Object action = actionInvocation.getAction();
>                 Object model = ((ModelDriven) action).getModel();
>                 if (model != null) {
>                     msg = findMessage(model.getClass(), aTextName, indexedTextName, locale, args, null, valueStack);
>                     if (msg != null) {
>                         return msg;
>                     }
>                 }
>             }
>         }
> [/code]
> ww:text evaluates the action on the top of the stack, which is the model driven action previously pushed onto the stack, but actionInvocation.getAction() returns the DirectRenderFromEventAction which is not a model driven action.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira