You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Daniel Baldes <db...@open.ch> on 2008/12/16 14:01:09 UTC

TypeConversionException and the conversionError interceptor

Hello,

I got a problem with type conversion errors.

I have several custom type converters which throw a 
TypeConversionException in case the conversion fails. However, the 
conversionError interceptor does not add any field errors to the action 
in that case; furthermore, it seems that struts rather tries to set the 
un-converted String, leading to an error message from the parameters 
interceptor:

SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception 
caught setting 'xxx.ipAddress' on 'class 
xxx.NidsCustomerApplicationAction: Error setting expression 
'xxx.ipAddress' with value '[Ljava.lang.String;@6dafa36'

(There is no setIpAddress(String) method, which is correct; I think this 
should never happen in the first place)

When there is no TypeConversionException, everything works fine (=> the 
type converter is called and works).

I have verified (using a debugger) that the ConversionErrorInterceptor 
gets called. It calls invocationContext.getConversionErrors(), but that 
method returns an empty map. However, after the TypeConversionException 
is thrown, an error message is added to the context in 
XworkConverter.handleConversionException(...). It must get lost 
somewhere on the way to the ConversionErrorInterceptor (?).

So my questions:

- Why does struts or xwork try to set the non-converted value as string
   after conversion fails?
- Where are my error messages?
- What am I doing wrong?

Maybe there is an incompatibility among the libraries I use?

Environment:

  struts 2.0.12
  xwork 2.0.6
  ognl 2.6.11

  (tomcat 6.0.16, java 1.6.0_10 ...)

interceptor stack:

   staticParams
   prepare
   chain
   checkbox
   params
   conversionError
   validation
   workflow

(This list is reduced to the possibly relevant interceptors; there are 
several custom interceptors before and after these in my stack, but I 
think they should not interfere with this problem)

I would appreciate any help on with issue - thanks in advance!

Regards,
Daniel



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org