aizu-m opened a new pull request, #153:
URL: https://github.com/apache/poi-xmlbeans/pull/153

   Differential run, XmlObject.validate() against the JDK Xerces validator, 
xs:unique on an xs:duration field:
   
       <u><d>P1D</d><d>PT24H</d></u>
       xerces:   cvc-identity-constraint.4.1: Duplicate unique value 
[P0Y0M0DT24H0M0S] declared for identity constraint "u"
       xmlbeans: valid
       (same for PT60S / PT1M, P1Y / P12M, PT1.5S / PT1.50S)
   
   How I got there:
   - Probe validated edge values for every builtin type and identity 
constraints over each type. Only duration disagreed on equality.
   - Enumeration was fine: enum P1D accepts PT24H. So the facet code already 
compares by value.
   - IdentityConstraint keeps field values in a set keyed on 
valueEquals/valueHashCode.
   - JavaGDurationHolderEx.equal_to and value_hash_code delegate to 
GDuration.equals/hashCode. Those compare the parsed fields one by one, and the 
fraction with BigDecimal.equals.
   
   Observation: equal xs:duration values written in different forms are not 
valueEquals. XmlObject.valueEquals is documented as a value space comparison.
   
   Consequences: xs:unique and xs:key let a duplicate duration through, and 
xs:keyref rejects a valid reference written in another form 
(cvc-identity-constraint.4.3). Store validation and ValidatingXMLStreamReader 
both hit it.
   
   Fix: equal_to uses compareToGDuration == 0, the same test validateValue uses 
for enumeration. value_hash_code hashes the month total and the second total so 
it agrees with that. GDuration.equals itself is left alone. P1M against P30D 
stays unequal (incomparable). Regression test added; the gradle test suite 
passes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to