You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Eduard Gurskiy (JIRA)" <ji...@apache.org> on 2013/11/07 19:53:23 UTC

[jira] [Commented] (WW-4239) Using ParameterAware with FileUploadInterceptor leads to ClassCastException

    [ https://issues.apache.org/jira/browse/WW-4239?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13816247#comment-13816247 ] 

Eduard Gurskiy commented on WW-4239:
------------------------------------

I would say more:
This ParameterAware with its: public void setParameters(Map<String, String[]> parameters); - is complete fail!

If you open ServletConfigInterceptor you will find:

        if (action instanceof ParameterAware) {
            ((ParameterAware) action).setParameters((Map)context.getParameters());
        }

So it copies map <String,Object> from ActionContext to map <String,String[]> of ParameterAware interface setter.
So any code which put anything in ActionContext other than String[] will cause ClassCast runtime exceptions in instance of ParameterAware. :(

> Using ParameterAware with FileUploadInterceptor leads to ClassCastException
> ---------------------------------------------------------------------------
>
>                 Key: WW-4239
>                 URL: https://issues.apache.org/jira/browse/WW-4239
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.3.15.1
>            Reporter: Ilya
>             Fix For: 2.3.17
>
>
> Ljava.io.File; cannot be cast to [Ljava.lang.String;
> ---------
> According to ParameterAware I should have method
> {code}
> public void setParameters(Map<String, String[]> parameters);
> {code}
> But I also have _File_ field and FileUploadInterceptor  sets file there.
> So, I am getting File[] instead of String[].



--
This message was sent by Atlassian JIRA
(v6.1#6144)