I realize that I may have been stingy on the exception stack trace.  Here is
more of it.
Notice that, nowhere in there is my StringToIntegerConverter actually
called.  (It would have logged the occurrence.)

15:22:37,762 DEBUG ParametersInterceptor:58 - Setting params propertyId => [
295 ]
15:22:37,777 DEBUG XWorkConverter:58 - key from method name... propertyId -
setPropertyId
15:22:37,778 DEBUG XWorkConverter:58 - propertyId:propertyId
15:22:37,862 DEBUG XWorkConverter:58 -
propertyId:[EMAIL PROTECTED]
15:22:37,869 DEBUG XWorkConverter:58 - Class:
com.mywebapp.actions2.GroupContribAction
15:22:37,873 DEBUG XWorkConverter:58 - key from method name... propertyId -
setPropertyId
15:22:37,875 DEBUG XWorkConverter:58 - propertyId:propertyId
15:22:37,906 DEBUG XWorkConverter:58 -
propertyId:[EMAIL PROTECTED]
ognl.MethodFailedException: Method "setPropertyId" failed for object
[EMAIL PROTECTED]:
[Ljava.lang.String; cannot be cast to
java.lang.Integer]
    at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:823)
    at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:964)
    at
ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:75)
    at
ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:131)
    at
com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:27)
    at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)
    at
com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor.setProperty(CompoundRootAccessor.java:59)
    at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)
    at ognl.ASTProperty.setValueBody(ASTProperty.java:101)
    at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
    at ognl.SimpleNode.setValue(SimpleNode.java:246)
    at ognl.Ognl.setValue(Ognl.java:476)
    at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:197)
    at
com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:150)
    at
com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:138)
    at
com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:205)
    at
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:162)
    ... and 40 more lines
/-- Encapsulated exception ------------\
java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to
java.lang.Integer
    at
com.mywebapp.actions2.GroupContribAction.setPropertyId(GroupContribAction.java:1)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:517)
    ...
\--------------------------------------/
expr: propertyId val: [Ljava.lang.String;@76a247 context:
[EMAIL PROTECTED]:[EMAIL PROTECTED],
[EMAIL PROTECTED] value:
[Ljava.lang.String;@76a247
15:22:37,949 ERROR ParametersInterceptor:24 - ParametersInterceptor -
[setParameters]: Unexpected Exception caught setting 'propertyId' on 'class
com.infloox.contrib.actions2.NaturalizationContribAction: Error setting
expression 'propertyId' with value '[Ljava.lang.String;@76a247'


2008/6/26 Pierre Thibaudeau <[EMAIL PROTECTED]>:

> I am aware that, when applying request parameters to an action, Struts
> cannot guess the actual type of parameters determined by a generic type
> (because of erasure at compile time).
>
> However, I am assuming that if a non-generic action class extends an
> abstract generic one, it should be possible in the non-generic child to
> force the type conversion explicitely.  Isn't that the case?  At the moment,
> I seemingly cannot get Struts to realize that I did specify a type
> conversion and I keeping getting the following exception (whether my forced
> conversion is in place or not):
> java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to
> java.lang.Integer
> ...
>

Reply via email to