hi amir

i think i see your point now. this is about the copyProperties and you'd like to ignore any conversions that fail (rather than throwing an exception and stopping as it does now), right?

i'd suggest that the easiest way to solve this is by upgrading to CVS HEAD and taking advantage of the new beans. i think that subclassing BeanUtilsBean so that copyProperty is overridden and exceptions are trapped would probably do the trick.

this is a little related to other issues that beanutils has about exception handling. it's not really flexible enough to give users all the options they want. as yet, no one's stepped up with the energy to solve them, though.

- robert

On 8 Mar 2004, at 21:57, Amir Nashat wrote:



Hello,



I am aware that there is a switch to allow for a default value but if
you use the BeanUtils component this switch is not available to set. I
am wondering if there is any way to:

1) Specify a default value and use that value

2) If not the first option then to ignore the conversion all together
and move on with the next conversion



I am curious as to whether or not the BeanUtils component has created a
bug in its implementation or missed this fact?



Anybody out there have any suggestions?



Thanks!



Amir







hi



i think that the idea is that if you don't want a conversion exception

to be thrown, you should specify a default.



- robert





Hello All,







I've been having a small problem with the BeanUtils utility. I'm

attempting to perform a copy of a java.sql.Date field, which can be

null, to a bean. The problem I am getting is that when the field is

null

I get a ConverstionException. After inspecting the code I found that

the

SqlConverter class is called and the convert() checks the following :







if (value == null) {



if (useDefault) {



return (defaultValue);



} else {



throw new ConversionException("No value specified");



}



}







I am wondering why the conversion exception is thrown in the first

place. Couldn't the check for null return the default value else no

value at all and skip that attribute? Also, for anyone out there that

has to perform type conversion and copy properties (of which some
date

attributes can be null) to a bean what is your implementation? How
are

you avoiding my problem?







Thank you for your help.







Amir











---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to