Replace your ParametersInterceptor by this one.

Cheers,
Mathias

-----Original Message-----
From: Francisco Hernandez [mailto:[EMAIL PROTECTED] 
Sent: woensdag 8 oktober 2003 11:28
To: [EMAIL PROTECTED]
Subject: Re: [OS-webwork] TypeConverter - exception for Long values when
given empty string


anyone happen to know of a workaround or patch for this problem?

Cameron Braid wrote:
> I am getting an exception from the params interceptor.
>  
> I have an action with a setId(Long), and a hidden form field called id
> that initially has an empty string value.
>  
> This used to work, until the exception handeling was improved with the
> type converters.  Now, I get this error :
>  
>  id - [Invalid field value for field "id".]
>  
> which is because of  java.lang.NumberFormatException: For input 
> string: "" in XWorkBasicConverter.super.convertValue(context, value, 
> toType); at line 85.
>  
> I can see a couple of soloutions
>  
> a) in my forms, don't render the hidden input if there is no value for
> id (fair bit of work)
> b) create a custom type converter for Long (and other numeric types) 
> that convert empty string to null (fairly easy)
> c) modify the XWorkBasicConverter to support the empty string to null 
> conversion for Number types.  (every one can use this)
>  
> What are your thoughts ?
>  
> Cameron





-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf _______________________________________________
Opensymphony-webwork mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Attachment: ParametersInterceptor.java
Description: Binary data

Reply via email to