You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Dominik Kacprzak (JIRA)" <ax...@ws.apache.org> on 2004/11/27 20:35:19 UTC
[jira] Updated: (AXIS-1017) org.apache.axis.types.Duration
[ http://nagoya.apache.org/jira/browse/AXIS-1017?page=history ]
Dominik Kacprzak updated AXIS-1017:
-----------------------------------
Attachment: patch-AXIS-1017.tar.gz
I created a patch to address issues reported in this ticket. A full list of changes includes:
- fixed Duration(String) constructor to enforce formatting rules imposed on a string representing xsd:duration
- added Duration(Calendar) constructor to allow for creating a duration object from Calendar
- added setSeconds(double) setter in addition to setSeconds(int). Marked setSeconds(int) deprecated.
- fixed parseDate(String)/parseTime(String) to enforce validation of passed attributes; added IllegalArgumentException to method signatures for handling invalid date/time formats. Marked both methods deprecated.
- documented in JavaDocs that Duration class supports a minimum fractional second precision of milliseconds.
- refactored equals method to do comparison using java.util.Calendar
- fixed hashCode() to utilize milliseconds while calculating the hash code value
- added a bunch of unit tests
I want to suggest that the following three methods should be marked as deprecated: setSeconds(int), parseDate(String), and parseTime(String). Since Duration class stores seconds as double, there is no point in providing a setSeconds(int) setter. Both parseDate(String) and parseTime(String) should be made private and not exposed via public API. There is no strong use case for having those methods - user can always create a new Duration object from xsd:duration string.
The attached tar file contains a short README file, modified files, and cvsdiff log.
I would appreciate if somebody with access to CVS could review this patch and apply it to CVS. Oh, and yes, all tests passed.
best regards,
- Dominik
> org.apache.axis.types.Duration
> ------------------------------
>
> Key: AXIS-1017
> URL: http://nagoya.apache.org/jira/browse/AXIS-1017
> Project: Axis
> Type: Bug
> Components: Basic Architecture
> Versions: 1.1
> Environment: Operating System: All
> Platform: All
> Reporter: Miko PIetilä
> Assignee: Axis Developers Mailing List
> Attachments: patch-AXIS-1017.tar.gz
>
> This class does not seem to fulfill the specs define in
> http://www.w3.org/TR/xmlschema-2/#duration. For example, following are not
> true: P-1347M is not allowed although -P1347M is allowed. P1Y2MT is not
> allowed. (Integer.parseInt() allows also negative values). For me the solution
> seems to be, that first check the minus in the beginning for isNegative and
> then search for it in rest of the string [if there is one, throw an exception].
> Also just using P works (resulting zero), which should not.
> It would be also very useful to have getter for epoch or Date/Calendar, which
> can be used instead of constructing the duration 'by hand'.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira