[ 
https://issues.apache.org/jira/browse/XERCESJ-1418?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12830769#action_12830769
 ] 

Michele Vivoda commented on XERCESJ-1418:
-----------------------------------------

I changed the flow to an easier one, impl now works with leap years

-in parsing loop: 
  - possibly check if 24h is present, in case set 24h flag and use 0 as hour. 
-at the end of loop: 
  - if 24h flag is set, 
     - check min,sec are zero 
     - if has date add one day using add(Duration("P1D"))


using add(Duration) works okay, also if the XMLGregorianCalendar is still being 
parsed when called,
at least in my tests, but not sure if is safe. Otherwise should create a new 
XMLGregorianCalendar
to calculate the new date and then store it.

> XMLGregorianCalendarImpl should parse "24:00:00"
> ------------------------------------------------
>
>                 Key: XERCESJ-1418
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1418
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: JAXP (javax.xml.datatype)
>    Affects Versions: 2.9.1
>         Environment: any
>            Reporter: Michele Vivoda
>             Fix For: 2.10.0
>
>         Attachments: TestTime24.java, XMLGregorianCalendarImpl.java
>
>
> The lexical value of a xs:dateTime and a xs:time allow the
> time to be in the form "(24:00:00(\.0+)?)". In short if it is
> a xs:dateTime that lexical represents "00:00:00" of the day after
> while if is a xs:time it is the same as "00:00:00"
> References:
> http://www.w3.org/TR/xmlschema-2/#dateTime
> http://www.w3.org/TR/xmlschema11-2/#rf-lexicalMappings-datetime
> http://www.w3.org/TR/xpath-functions/#date-time-values
> Xerces reports "24:00:00" as unparsable, 
> internal.xerces (java4 & java6) parses it but then 
> the hour field is 24, that should not be correct.
> Probably related to 
> https://issues.apache.org/jira/browse/XERCESJ-683
> http://marc.info/?l=xerces-cvs&m=105578736117117&w=2
> The fix I propose is for XMLGregorianCalendarImpl.Parser#parse(), the flow is:
> -in parsing loop:
>   - possibly retain y,m,d to set them at the end
>   - possibly check if 24h is present, in case set flag and use 0 as hour.
> -at the end of loop:
>   - if 24h flag is set, check min,sec are zero
>   - if has date 
>    - Add one day if 24h flag set
>    - set date components

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to