The GitHub Actions job "CodeQL" on poi-xmlbeans.git/trunk has succeeded.
Run started by GitHub user pjfanning (triggered by pjfanning).

Head commit for run:
1117cd02a38633f064aaa1324924b97f956a90ea / PJ Fanning 
<[email protected]>
Compare complex values by structure in valueEquals (XMLBEANS-658) (#106)

Compare complex values by structure in valueEquals

valueEquals answered true for any two complex values whose schema types matched,
whatever they contained: XmlComplexContentImpl.equal_to compared the two schema
types and left a "BUGBUG: by-value structure comparison undone" behind it. Two
documents built from the same type are reported equal even when one carries a
child the other does not (XMLBEANS-658).

Compare the values instead. equal_to now walks both trees: the attributes,
regardless of their order, and the child elements in document order, each
compared by value in turn - so a child written in a different lexical form but
with the same value still matches. For mixed content the text between the
children is compared as well; comments, processing instructions and whitespace
outside of mixed content carry no value and are skipped.

A complex type with simple content inherits its comparison from the simple value
implementation, which sees only the text - the attributes that the type adds to
that value were ignored, and the tree walk would have inherited that hole for
every such child. valueEquals compares those attributes once the text matches.

The walk runs under the monitors valueEquals has already taken, and every object
in a tree shares the monitor of its root, so children are compared without
locking again - which for two trees in different synchronization domains would
mean taking the global lock once per child.

A value whose text does not fit its type has no value space to be compared in,
and computing it throws: the CarLocationMessage test document has 12:34 in an
xs:time, which is not a valid time. Comparing such a child falls back to the 
text
as the document wrote it, so one bad value cannot turn a comparison into a 
throw.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>

Report URL: https://github.com/apache/poi-xmlbeans/actions/runs/35907949222

With regards,
GitHub Actions via GitBox


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

Reply via email to