Project

Profile

Help

Bug #3490

closed

XSD identity constraints with exactly 4 fields will validate incorrectly

Added by Michael Kay about 7 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Schema conformance
Sprint/Milestone:
-
Start date:
2017-10-17
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.7, 9.8, trunk
Fix Committed on Branch:
9.7, 9.8, trunk
Fixed in Maintenance Release:
Platforms:

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.)

Actions #1

Updated by Michael Kay about 7 years ago

The condition

compareValues(value1, ((ValueEntry4) obj).value2) &&

is also obviously wrong.

Actions #2

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.

Actions #3

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

Actions #4

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

Also available in: Atom PDF