[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xml-cocoon-dev
Subject:    Re: cvs
From:       Bruno Dumon <bruno () outerthought ! org>
Date:       2003-12-02 21:35:09
[Download RAW message or body]

On Tue, 2003-12-02 at 18:02, Vadim Gritsenko wrote:
> Bruno Dumon wrote:
> 
> > On Tue, 2003-12-02 at 15:49, Vadim Gritsenko wrote:
> > 
> > 
> > > vgritsenko@apache.org wrote:
> > > 
> > > 
> > > 
> > > > Index: PlainBooleanConvertor.java
> > > > ===================================================================
> > > > RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/PlainBooleanConvertor.java,v
> > > >  retrieving revision 1.1
> > > > retrieving revision 1.2
> > > > diff -u -r1.1 -r1.2
> > > > --- PlainBooleanConvertor.java	12 Aug 2003 12:54:45 -0000	1.1
> > > > +++ PlainBooleanConvertor.java	2 Dec 2003 14:44:56 -0000	1.2
> > > > @@ -7,6 +7,9 @@
> > > > */
> > > > public class PlainBooleanConvertor implements Convertor {
> > > > public Object convertFromString(String value, Locale locale, \
> > > > Convertor.FormatCache formatCache) { +        if (value == null || \
> > > > value.length() == 0) { +            return "";
> > > > +        }
> > > > return Boolean.valueOf(value);
> > > > }
> > > > 
> > > > 
> > > Can somebody else confirm that this is ok? Works for me...
> > > 
> > > 
> > 
> > My intuition tells me that a BooleanConvertor should return a Boolean
> > object.
> > 
> > What's the purpose of this, IOW what is affected by this?
> > 
> > 
> 
> Commit log says it all: instead of null, JavaBean gets Boolean.FALSE, 
> which is, as I believe, wrong: you should not bind FALSE instead of null.

Still trying to understand how you're using it in order to fully
understand the problem:
Where exactly are you using the convertor? In the binding definition? If
the Javabean holds a Boolean property, why do you need the convertor
there?

Regardless of this, it seems to me that if there is no value to convert,
the convertor shouldn't be called in the first place.

> 
> I tried to return null from the convertor, but it caused exception down 
> the road, and empty string worked out Ok.
> 
> Vadim
-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic