Bug #3490
closedXSD identity constraints with exactly 4 fields will validate incorrectly
100%
Description
The class ValueEntry4 is used to hold key values when there are exactly four fields in the constraint. The equals() method for ValueEntry4 says:
public boolean equals(Object obj) {
return obj instanceof ValueEntry3 &&
compareValues(value0, ((ValueEntry4) obj).value0) &&
compareValues(value1, ((ValueEntry4) obj).value1) &&
compareValues(value1, ((ValueEntry4) obj).value2) &&
compareValues(value2, ((ValueEntry4) obj).value3);
}
The first condition (obj instanceof ValueEntry3) will never be true, so the keys will never be equal, so xs:unique and xs:key will fail to report duplicates. Conversely, an xs:keyRef constraint with exactly four fields will never be satisfied.
(Spotted in the code; no test case has actually failed.)
Updated by Michael Kay about 7 years ago
The condition
compareValues(value1, ((ValueEntry4) obj).value2) &&
is also obviously wrong.
Updated by Michael Kay about 7 years ago
- Category set to Schema conformance
- Status changed from New to Resolved
- Priority changed from Low to Normal
- Applies to branch 9.7, 9.8, trunk added
- Fix Committed on Branch 9.7, 9.8, trunk added
Bug (and fix) verified with an ad-hoc test.
Fixed on 9.7, 9.8, and trunk.
Updated by O'Neil Delpratt about 7 years ago
- % Done changed from 0 to 100
- Fixed in Maintenance Release 9.8.0.6 added
Bug fix applied in the Saxon 9.8.0.6 maintenance release. Leave open until bug fix applied in the 9.7 maintenance release
Updated by O'Neil Delpratt almost 7 years ago
- Status changed from Resolved to Closed
- Fixed in Maintenance Release 9.7.0.21 added
Bug fix applied in the Saxon 9.7.0.21 maintenance release.
Please register to edit this issue