Skip to content

Replace ICU-based date/time comparison in TDML Runner with XMLGregorianCalendar#1677

Merged
stevedlawrence merged 1 commit into
apache:mainfrom
gdesrosiers1805:bugfix/daffodil-3077
Jun 9, 2026
Merged

Replace ICU-based date/time comparison in TDML Runner with XMLGregorianCalendar#1677
stevedlawrence merged 1 commit into
apache:mainfrom
gdesrosiers1805:bugfix/daffodil-3077

Conversation

@gdesrosiers1805

@gdesrosiers1805 gdesrosiers1805 commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

The TDML date/time comparison previously used the DFDLDate/Time/DateTimeConversion classes, which create ICU objects. This broke cross-testing against the IBM DFDL cross tester, which depends on an older ICU version (e.g. it lacks Calendar.clone()).

Compare xs:date/time/dateTime values by parsing into XMLGregorianCalendar and using its XSD order relation (compare()), keeping ICU off the comparison path entirely.

XMLGregorianCalendar implements XSD 1.0, which does not permit year zero, so it rejects values like "0000-01-01". Two tests whose data uses year zero (yearfromdate_03 and yearfromdatetime_03) are temporarily ignored as a result. These expose a pre-existing Daffodil bug: Daffodil produces year-zero values that are invalid under XSD 1.0, which needs to be addressed separately. The tests should be re-enabled (or converted to negative tests) once that is resolved.

Broaden the catch in verifyParserTestData from XMLDifferenceException back to Exception, so exceptions thrown transitively by compareAndReport's callees are wrapped as TDMLExceptions. Restores the generic catch that was in place beforecommit b9fb1e5, which narrowed it to XMLDifferenceException.

DAFFODIL-3077

@stevedlawrence stevedlawrence left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, just a number of really minor comments

Comment thread daffodil-core/src/main/scala/org/apache/daffodil/lib/xml/XMLUtils.scala Outdated
Comment thread daffodil-core/src/main/scala/org/apache/daffodil/lib/xml/XMLUtils.scala Outdated
Comment thread daffodil-core/src/main/scala/org/apache/daffodil/lib/xml/XMLUtils.scala Outdated

@olabusayoT olabusayoT left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 Looks good, but couple comments about the contexless ignore

…anCalendar

The TDML date/time comparison previously used the DFDLDate/Time/DateTimeConversion
classes, which create ICU objects. This broke cross-testing against the IBM DFDL
cross tester, which depends on an older ICU version (e.g. it lacks Calendar.clone()).

Compare xs:date/time/dateTime values by parsing into XMLGregorianCalendar and using
its XSD order relation (compare()), keeping ICU off the comparison path entirely.

XMLGregorianCalendar implements XSD 1.0, which does not permit year zero, so it
rejects values like "0000-01-01". Two tests whose data uses year zero
(yearfromdate_03 and yearfromdatetime_03) are temporarily ignored as a result.
These expose a pre-existing Daffodil bug: Daffodil produces year-zero values that
are invalid under XSD 1.0, which needs to be addressed separately. The tests should
be re-enabled (or converted to negative tests) once that is resolved.

Broaden the catch in verifyParserTestData from XMLDifferenceException back to
Exception, so exceptions thrown transitively by compareAndReport's callees are
wrapped as TDMLExceptions. Restores the generic catch that was in place before
commit b9fb1e5, which narrowed it to XMLDifferenceException.

DAFFODIL-3077
@stevedlawrence stevedlawrence merged commit c22dfe8 into apache:main Jun 9, 2026
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants