Skip to content

[#261] Format digests with java.util.HexFormat instead of JAXB - #262

Merged
vharseko merged 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:issue-261-hexformat
Oct 19, 2026
Merged

vharseko merged 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:issue-261-hexformat

Conversation

@vharseko

Copy link
Copy Markdown
Member

openidm-script and openidm-maintenance use javax.xml.bind without declaring JAXB: ScriptRegistryService names inline scripts with DatatypeConverter.printHexBinary, and ChecksumFile formats checksums with HexBinaryAdapter.marshal. JAXB reaches them only through commons json-resource → api-descriptor, which OpenIdentityPlatform/commons#362 removes JAXB from.

Both calls now use HexFormat.of().withUpperCase(). The output keeps the upper case of the JAXB methods, so inline script names and the update checksums (including the checksum field of the update archive listing) do not change. These were the only uses of javax.xml.bind in the repository.

Tests

  • ChecksumFileTest.testGetCurrentDigestIsUpperCaseHex (new) and ScriptRegistryServiceTest.testInlineScriptNameIsSha256OfSourceAndType compare against literals computed with md5 and shasum. The script test used to compute its expected value with HexFormat itself, which after this change would only compare the code with itself. Both tests pass on the base code, and both fail if withUpperCase() is dropped.
  • With commons#362 simulated (managed exclusions of jaxb-api, jaxb-core and jaxb-impl on api-descriptor and json-web-token), the base fails to compile with package javax.xml.bind does not exist (ScriptRegistryService.java:39) and package javax.xml.bind.annotation.adapters does not exist (ChecksumFile.java:32). With this change both modules build and pass their tests (16 and 117) with and without the simulation.
  • The generated Import-Package of both bundles differs from the base only by the removed javax.xml.bind;version="[2.3,3)" and javax.xml.bind.annotation.adapters;version="[2.3,3)".

Fixes #261

…stead of JAXB

openidm-script and openidm-maintenance used javax.xml.bind
(DatatypeConverter.printHexBinary, HexBinaryAdapter.marshal) without
declaring JAXB; it came only transitively through commons
api-descriptor, which OpenIdentityPlatform/commons#362 drops. Both now
use HexFormat.of().withUpperCase(), so inline script names and update
checksums keep their upper-case form.

The tests pin both outputs with literals computed outside the JVM; the
script test previously derived its expected value with HexFormat itself.

Fixes OpenIdentityPlatform#261
@vharseko
vharseko requested a review from maximthomas October 18, 2026 10:50
@vharseko vharseko added dependencies Pull requests that update a dependency file java Pull requests that update Java code build Maven build configuration (POMs, plugins, build tooling) test Tests and test infrastructure (unit, e2e, smoke) labels Oct 18, 2026

@maximthomas maximthomas 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.

praise: The change replaces exactly the two JAXB call sites and keeps their output byte for byte.

  • ChecksumFile.computeDigest (ChecksumFile.java:112) and ScriptRegistryService (ScriptRegistryService.java:608) were the only javax.xml.bind uses. In the rebuilt jars, Import-Package loses only javax.xml.bind;version="[2.3,3)" (openidm-script, 31 → 30) and javax.xml.bind.annotation.adapters;version="[2.3,3)" (openidm-maintenance, 25 → 24). Nothing else changes.
  • ScriptRegistryServiceTest now asserts a literal SHA-256 instead of recomputing it with HexFormat, so the test no longer checks the code against itself. The new ChecksumFileTest.testGetCurrentDigestIsUpperCaseHex also passes against the base HexBinaryAdapter code (7/7), so it pins the unchanged upper-case output.
  • With jaxb-api, jaxb-core and jaxb-impl excluded from api-descriptor 3.1.2, the base fails to compile at both imports. The head builds both modules with 16 and 117 tests green.

@vharseko
vharseko merged commit 169a8a8 into OpenIdentityPlatform:master Oct 19, 2026
31 checks passed
@vharseko
vharseko deleted the issue-261-hexformat branch October 19, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Maven build configuration (POMs, plugins, build tooling) dependencies Pull requests that update a dependency file java Pull requests that update Java code test Tests and test infrastructure (unit, e2e, smoke)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

openidm-script and openidm-maintenance compile against JAXB that only commons brings in

2 participants