You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by roy huang <li...@hotmail.com> on 2004/05/09 12:07:42 UTC

[CForms]FormattingDateConvertor can't convert blank to date in current cvs version.

Hi All:
  If I user xml as data to binding cocoon forms,I must using DateConvertor to convert string to date like:
  <fb:value id="date"   
            path="date" >
    <fd:convertor datatype="date" >
      <fd:patterns>
        <fd:pattern>yyyy-MM-dd</fd:pattern>
      </fd:patterns>
    </fd:convertor>
  </fb:value>

the data may looks like:
<date>1971-05-06</date>

But if the data is <date><date> it will error like:
org.apache.avalon.framework.CascadingRuntimeException: "resource://org/apache/cocoon/forms/flow/javascript/Form.js", line 160: uncaught JavaScript exception: at bindingSample (file:/D:/eclipse/workspace/cocoon-2.1/build/webapp/samples/blocks/forms/flow/bindings.js, Line 73) at (resource://org/apache/cocoon/forms/flow/javascript/Form.js, Line 160): java.lang.RuntimeException: Incorrect value type for "date" (expected class java.util.Date, got class java.lang.String.

But it works only several days ago,so I check the cvs and believe is Bruno's change in 5.6 makes it. Here's what he said in cvs comments:

Made Convertor.convertFromString contract more solid by letting it
return a ConversionResult object (instead of null/not-null to indicate
successful conversion). This also moves the responsibility
of creating the ValidationError to the Convertor, allowing convertors
to set more specialised messages in them.

What can I do to convert an blank ("") string to Date type? Or this should be considered in the FormattingDateConvert.java?I believe this function is need because date may be blank.

WDYT?

Roy Huang



Re: [CForms]FormattingDateConvertor can't convert blank to date in current cvs version.

Posted by Sylvain Wallez <sy...@apache.org>.
Joerg Heinicke wrote:

> On 09.05.2004 14:20, Upayavira wrote:
>
>>> I made a little error in my change, it simply needs an "else value =
>>> null" added. I'll fix it after the code freeze.
>>>
>> Why after? Surely the code freeze is intended to be a time for fixing 
>> bugs
>
>
> +1 That's what the code freeze is about. Otherwise we wouldn't need it 
> and could release today as it is.


+1 !

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }


Re: [CForms]FormattingDateConvertor can't convert blank to date in current cvs version.

Posted by roy huang <li...@hotmail.com>.
+1
----- Original Message ----- 
From: "Joerg Heinicke" <jo...@gmx.de>
To: <de...@cocoon.apache.org>
Sent: Sunday, May 09, 2004 9:05 PM
Subject: Re: [CForms]FormattingDateConvertor can't convert blank to date in current cvs version.


> On 09.05.2004 14:20, Upayavira wrote:
> 
> >> I made a little error in my change, it simply needs an "else value =
> >> null" added. I'll fix it after the code freeze.
> >>
> > Why after? Surely the code freeze is intended to be a time for fixing 
> > bugs
> 
> +1 That's what the code freeze is about. Otherwise we wouldn't need it 
> and could release today as it is.
> 
> Joerg
> 

Re: [CForms]FormattingDateConvertor can't convert blank to date in current cvs version.

Posted by Joerg Heinicke <jo...@gmx.de>.
On 09.05.2004 14:20, Upayavira wrote:

>> I made a little error in my change, it simply needs an "else value =
>> null" added. I'll fix it after the code freeze.
>>
> Why after? Surely the code freeze is intended to be a time for fixing 
> bugs

+1 That's what the code freeze is about. Otherwise we wouldn't need it 
and could release today as it is.

Joerg

Re: [CForms]FormattingDateConvertor can't convert blank to date in current cvs version.

Posted by Joerg Heinicke <jo...@gmx.de>.
On 10.05.2004 17:50, Bruno Dumon wrote:

>>>I made a little error in my change, it simply needs an "else value =
>>>null" added. I'll fix it after the code freeze.
>>
>>Why after? Surely the code freeze is intended to be a time for fixing 
>>bugs (but not for committing 'innovations')?
> 
> Code freeze is for fixing showstopper bugs. The above issue may fall
> into that category, especially since a user noticed and reported it, and
> that it was working before. I'll try to fix it one of the next days.

I don't want to discuss now what's allowed during code freeze 
extensively, but IMO it's just a evaluation of benefit and risk of a 
patch. In this case I guess the risk to break something is very low.

Joerg

Re: [CForms]FormattingDateConvertor can't convert blank to date in current cvs version.

Posted by Bruno Dumon <br...@outerthought.org>.
On Sun, 2004-05-09 at 14:20, Upayavira wrote:
> Bruno Dumon wrote:
> 
> >On Sun, 2004-05-09 at 12:07, roy huang wrote:
> >  
> >
> >>Hi All:
> >>  If I user xml as data to binding cocoon forms,I must using DateConvertor to convert string to date like:
> >>  <fb:value id="date"   
> >>            path="date" >
> >>    <fd:convertor datatype="date" >
> >>      <fd:patterns>
> >>        <fd:pattern>yyyy-MM-dd</fd:pattern>
> >>      </fd:patterns>
> >>    </fd:convertor>
> >>  </fb:value>
> >>
> >>the data may looks like:
> >><date>1971-05-06</date>
> >>
> >>But if the data is <date><date> it will error like:
> >>org.apache.avalon.framework.CascadingRuntimeException: "resource://org/apache/cocoon/forms/flow/javascript/Form.js", line 160: uncaught JavaScript exception: at bindingSample (file:/D:/eclipse/workspace/cocoon-2.1/build/webapp/samples/blocks/forms/flow/bindings.js, Line 73) at (resource://org/apache/cocoon/forms/flow/javascript/Form.js, Line 160): java.lang.RuntimeException: Incorrect value type for "date" (expected class java.util.Date, got class java.lang.String.
> >>
> >>But it works only several days ago,so I check the cvs and believe is Bruno's change in 5.6 makes it. Here's what he said in cvs comments:
> >>
> >>Made Convertor.convertFromString contract more solid by letting it
> >>return a ConversionResult object (instead of null/not-null to indicate
> >>successful conversion). This also moves the responsibility
> >>of creating the ValidationError to the Convertor, allowing convertors
> >>to set more specialised messages in them.
> >>
> >>What can I do to convert an blank ("") string to Date type? Or this should be considered in the FormattingDateConvert.java?I believe this function is need because date may be blank.
> >>
> >>WDYT?
> >>    
> >>
> >
> >I made a little error in my change, it simply needs an "else value =
> >null" added. I'll fix it after the code freeze.
> >  
> >
> Why after? Surely the code freeze is intended to be a time for fixing 
> bugs (but not for committing 'innovations')?

Code freeze is for fixing showstopper bugs. The above issue may fall
into that category, especially since a user noticed and reported it, and
that it was working before. I'll try to fix it one of the next days.

>  Otherwise, this bug will be 
> enshrined in 2.1.5, which would be a shame.
> 
> Regards, Upayavira
-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


Re: [CForms]FormattingDateConvertor can't convert blank to date in current cvs version.

Posted by Upayavira <uv...@upaya.co.uk>.
Bruno Dumon wrote:

>On Sun, 2004-05-09 at 12:07, roy huang wrote:
>  
>
>>Hi All:
>>  If I user xml as data to binding cocoon forms,I must using DateConvertor to convert string to date like:
>>  <fb:value id="date"   
>>            path="date" >
>>    <fd:convertor datatype="date" >
>>      <fd:patterns>
>>        <fd:pattern>yyyy-MM-dd</fd:pattern>
>>      </fd:patterns>
>>    </fd:convertor>
>>  </fb:value>
>>
>>the data may looks like:
>><date>1971-05-06</date>
>>
>>But if the data is <date><date> it will error like:
>>org.apache.avalon.framework.CascadingRuntimeException: "resource://org/apache/cocoon/forms/flow/javascript/Form.js", line 160: uncaught JavaScript exception: at bindingSample (file:/D:/eclipse/workspace/cocoon-2.1/build/webapp/samples/blocks/forms/flow/bindings.js, Line 73) at (resource://org/apache/cocoon/forms/flow/javascript/Form.js, Line 160): java.lang.RuntimeException: Incorrect value type for "date" (expected class java.util.Date, got class java.lang.String.
>>
>>But it works only several days ago,so I check the cvs and believe is Bruno's change in 5.6 makes it. Here's what he said in cvs comments:
>>
>>Made Convertor.convertFromString contract more solid by letting it
>>return a ConversionResult object (instead of null/not-null to indicate
>>successful conversion). This also moves the responsibility
>>of creating the ValidationError to the Convertor, allowing convertors
>>to set more specialised messages in them.
>>
>>What can I do to convert an blank ("") string to Date type? Or this should be considered in the FormattingDateConvert.java?I believe this function is need because date may be blank.
>>
>>WDYT?
>>    
>>
>
>I made a little error in my change, it simply needs an "else value =
>null" added. I'll fix it after the code freeze.
>  
>
Why after? Surely the code freeze is intended to be a time for fixing 
bugs (but not for committing 'innovations')? Otherwise, this bug will be 
enshrined in 2.1.5, which would be a shame.

Regards, Upayavira



Re: [CForms]FormattingDateConvertor can't convert blank to date in current cvs version.

Posted by Bruno Dumon <br...@outerthought.org>.
On Sun, 2004-05-09 at 12:07, roy huang wrote:
> Hi All:
>   If I user xml as data to binding cocoon forms,I must using DateConvertor to convert string to date like:
>   <fb:value id="date"   
>             path="date" >
>     <fd:convertor datatype="date" >
>       <fd:patterns>
>         <fd:pattern>yyyy-MM-dd</fd:pattern>
>       </fd:patterns>
>     </fd:convertor>
>   </fb:value>
> 
> the data may looks like:
> <date>1971-05-06</date>
> 
> But if the data is <date><date> it will error like:
> org.apache.avalon.framework.CascadingRuntimeException: "resource://org/apache/cocoon/forms/flow/javascript/Form.js", line 160: uncaught JavaScript exception: at bindingSample (file:/D:/eclipse/workspace/cocoon-2.1/build/webapp/samples/blocks/forms/flow/bindings.js, Line 73) at (resource://org/apache/cocoon/forms/flow/javascript/Form.js, Line 160): java.lang.RuntimeException: Incorrect value type for "date" (expected class java.util.Date, got class java.lang.String.
> 
> But it works only several days ago,so I check the cvs and believe is Bruno's change in 5.6 makes it. Here's what he said in cvs comments:
> 
> Made Convertor.convertFromString contract more solid by letting it
> return a ConversionResult object (instead of null/not-null to indicate
> successful conversion). This also moves the responsibility
> of creating the ValidationError to the Convertor, allowing convertors
> to set more specialised messages in them.
> 
> What can I do to convert an blank ("") string to Date type? Or this should be considered in the FormattingDateConvert.java?I believe this function is need because date may be blank.
> 
> WDYT?

I made a little error in my change, it simply needs an "else value =
null" added. I'll fix it after the code freeze.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org