cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dumon <br...@outerthought.org>
Subject Re: [CForms]FormattingDateConvertor can't convert blank to date in current cvs version.
Date Mon, 10 May 2004 15:50:28 GMT
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


Mime
View raw message