cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Lutz (JIRA)" <j...@apache.org>
Subject [jira] Commented: (COCOON-1606) [BUG+PATCH] FormattingDecimalConvertor.java does not parse in BigDecimal mode
Date Tue, 30 May 2006 21:03:31 GMT
    [ http://issues.apache.org/jira/browse/COCOON-1606?page=comments#action_12413901 ] 

Thomas Lutz commented on COCOON-1606:
-------------------------------------

Hi Antonio,

I retested in cocoon zones (latest 2.1 code, trunk was not working) and had a look at the
sources (trunk: see [1]) and still found the described BigDecimal problem not fixed.

Maybe my fault, my description is not very clear, the problem with the long value loosing
accuracy in form1 of the form samples is not fixed my by patch, it's just in the description
because I did not find a example with a BigDecimal in the samples.

Try the following to reproduce the problem:

Form definition:
<fd:field id="aBigDecimal" required="true">
<fd:label>aBigDecimal</fd:label>
    <fd:datatype base="decimal">
    <fd:convertor variant="number">
    <fd:patterns>
<fd:pattern>#.00</fd:pattern>
</fd:patterns>
</fd:convertor>
</fd:datatype>
</fd:field>

Form binding:
<fb:value id="aBigDecimal" path="field[@name='aBigDecimal']">
<fd:convertor datatype="decimal"/>
</fb:value> 

Basically only the decimalFormat.setParseBigDecimal(true) is missing. If you enter something
big enough to require a BigDecimal in the form, the entered value is "truncated"  while binding
takes place. As described in my original description, this can be seen if you trigger a validation
error, then the reloaded value is not equal to the original value.

Sorry, that's all I could "reconstruct" from memory and the patch, as I changed job/project,
I lost my cocoon environment... but if you need additional help, just send me a mail, then
I'll set up everything again.

kind regards,
tom

[1] http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/datatype/convertor/FormattingDecimalConvertor.java?revision=392574&view=markup

> [BUG+PATCH] FormattingDecimalConvertor.java does not parse in BigDecimal mode
> -----------------------------------------------------------------------------
>
>          Key: COCOON-1606
>          URL: http://issues.apache.org/jira/browse/COCOON-1606
>      Project: Cocoon
>         Type: Bug

>   Components: Blocks: Forms
>     Versions: 2.1.8
>  Environment: Operating System: other
> Platform: All
>     Reporter: Thomas Lutz
>     Assignee: Cocoon Developers Team
>  Attachments: FormattingDecimalConvertor.java.tar.gz
>
> This patch enables BigDecimal parsing in FormattingDecimalConvertor.
> Basically if you have a widget with datatype decimal and enter a very large
> number, something like 999999991999999999199999999919999999991 and submit
> the form you'll get someting like a rounded value in technical notation.
> same thing with datatype long, to be seen in the samples at
> http://cocoon.zones.apache.org/demos/release/samples/blocks/forms/form1
> click NumberFields to change tab and enter
> 999999991999999999199999999919999999991
> into "Enter another number, larger than the other number:"
> submit, then you get as value for the same field:
> 9,223,372,036,854,775,807
> which is quite the same, though its no BigDecimal problem.
> at least some kind of validation error should occur... but a webapp
> changing user submitted values without a hint is a rather hot thing :-).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message