Hi Shawn,

thanks for reporting this issue together with a patch. May I ask you to please create a new issue at jira (http://jira.codehaus.org/browse/CASTOR) and attach your description and a unified patch.

Regards
Ralf


Crook, Shawn schrieb:
<<DurationPatch.java>> <<DurationDiff.out>> Issue: The parseDuration(String) method does not respect the decimal place when
converting the string representation of milliseconds into an
integer/short. In cases where milliseconds are less than 100, the milliseconds are
reported wrong.

Eg. "0.001" milliseconds is wrongly reported as 100 milliseconds when
getMilli() is called after parseDuration(String)
"0.01" milliseconds is wrongly reported as 100 milliseconds when
getMilli() is called after parseDuration(String)
"1.001" milliseconds is wrongly reported as 1.1 seconds when getMilli()
is called after parseDuration(String)
"1.01" milliseconds is wrongly reported as 1.1 seconds when getMilli()
is called after parseDuration(String)

Root Cause:
When the milliseconds are converted from a string to integer, the
leading zero's after the decimal place are dropped.

Solution:
Prefix the string representation with a "1" prior to converting to
integer and then drop the "1" prior to setting the milliseconds numeric
value.

Recommendations:
This class should be refactored to perhaps use a float value to handle
intermediate millisecond logic.

Shawn Crook
Software Engineer, Enterprise Administration
COGNOS INCORPORATED
Office:  (613) 738-1338 x3833
[EMAIL PROTECTED]
www.cognos.com
This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you.


------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to