struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philippe Lagardere <>
Subject [2.3.8] Parameters interceptor tampering with file upload ?
Date Mon, 14 Jan 2013 14:09:28 GMT

I've been trying to set up a form to upload a .txt file to the server,
and met a curious exception doing so. The exception implies Struts
expects the setter method to use a String array instead of a Not that it would have been acceptable, but adding a
setter using a string array does not change anything (same exception
The action method itself is never reached, since the exception is
seemingly thrown during the ParametersInterceptor.doIntercept()

I had a similar exception a couple of months ago, due to conversion
problems, since then solved by overriding Number and Date converters.
It is probably just a coincidence though - I can't see why type
conversion would relate here.

Here are some informations regarding the context.


<s:form action="entreprise_charger_fichier" method="POST"
   <s:file name="upload" label="Parcourir" accept="text/plain" />
   <s:submit value="Valider" />

[Action declaration in struts.xml] - nothing fancy here

<action name="entreprise_charger_fichier"	class=""
   <result name="input" type="redirectAction">entreprise</result>
   <result type="redirectAction">entreprise</result>

[Miscellaneous information]

Interceptor stack is the default stack, with a couple custom
interceptors (the request goes through one, but the others aren't

The action class (DossiersEntrepriseAction) does have a field named
"upload", which is a (as seen here : The getter and
setter methods exist, but obviously they use or return a File, not a
String array.

Commons-IO and Commons-FileUpload are in the classpath, fetched as
transitive dependencies of the struts-core-2.3.8 artifact.

The problem also appears with Struts 2.3.7.

[Stack trace] - I trimmed it a bit but it's still not that edible, sorry

ognl.MethodFailedException: Method "setUpload" failed for object
    at ognl.OgnlRuntime.callAppropriateMethod(
    at ognl.OgnlRuntime.setMethodValue(
    at ognl.ObjectPropertyAccessor.setPossibleProperty(
    at ognl.ObjectPropertyAccessor.setProperty(
    at com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(
    at ognl.OgnlRuntime.setProperty(
    at com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor.setProperty(
    at ognl.OgnlRuntime.setProperty(
    at ognl.ASTProperty.setValueBody(
    at ognl.SimpleNode.evaluateSetValueBody(
    at ognl.SimpleNode.setValue(
    at ognl.Ognl.setValue(
    at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(
    at com.opensymphony.xwork2.ognl.OgnlValueStack.trySetValue(
    at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(
    at com.opensymphony.xwork2.ognl.OgnlValueStack.setParameter(
    at com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(
    at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(
    at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(

It is possible I missed something when setting up my classes/action,
but I can't find anything when double-checking.
At any rate, this doesn't explain why Struts (or OGNL) is asking for a
String[] at that point. I understand that strings are the standard way
to transfer data from a browser, but I can't see how it could apply to
file uploading.

Thank you in advance for your input,


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message