cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <vadim.gritse...@verizon.net>
Subject Re: cvs commit: cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor PlainBooleanConvertor.java
Date Tue, 02 Dec 2003 17:02:47 GMT
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.

I tried to return null from the convertor, but it caused exception down 
the road, and empty string worked out Ok.

Vadim



Mime
View raw message