Repository navigation
[#261] Format digests with java.util.HexFormat instead of JAXB - #262
Merged
vharseko merged 1 commit intoOct 19, 2026
Merged
Conversation
…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
maximthomas
approved these changes
Oct 19, 2026
maximthomas
left a comment
Contributor
There was a problem hiding this comment.
praise: The change replaces exactly the two JAXB call sites and keeps their output byte for byte.
ChecksumFile.computeDigest(ChecksumFile.java:112) andScriptRegistryService(ScriptRegistryService.java:608) were the onlyjavax.xml.binduses. In the rebuilt jars,Import-Packageloses onlyjavax.xml.bind;version="[2.3,3)"(openidm-script, 31 → 30) andjavax.xml.bind.annotation.adapters;version="[2.3,3)"(openidm-maintenance, 25 → 24). Nothing else changes.ScriptRegistryServiceTestnow asserts a literal SHA-256 instead of recomputing it withHexFormat, so the test no longer checks the code against itself. The newChecksumFileTest.testGetCurrentDigestIsUpperCaseHexalso passes against the baseHexBinaryAdaptercode (7/7), so it pins the unchanged upper-case output.- With
jaxb-api,jaxb-coreandjaxb-implexcluded fromapi-descriptor3.1.2, the base fails to compile at both imports. The head builds both modules with 16 and 117 tests green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
openidm-scriptandopenidm-maintenanceusejavax.xml.bindwithout declaring JAXB:ScriptRegistryServicenames inline scripts withDatatypeConverter.printHexBinary, andChecksumFileformats checksums withHexBinaryAdapter.marshal. JAXB reaches them only through commonsjson-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 thechecksumfield of the update archive listing) do not change. These were the only uses ofjavax.xml.bindin the repository.Tests
ChecksumFileTest.testGetCurrentDigestIsUpperCaseHex(new) andScriptRegistryServiceTest.testInlineScriptNameIsSha256OfSourceAndTypecompare against literals computed withmd5andshasum. The script test used to compute its expected value withHexFormatitself, which after this change would only compare the code with itself. Both tests pass on the base code, and both fail ifwithUpperCase()is dropped.jaxb-api,jaxb-coreandjaxb-implonapi-descriptorandjson-web-token), the base fails to compile withpackage javax.xml.bind does not exist(ScriptRegistryService.java:39) andpackage 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.Import-Packageof both bundles differs from the base only by the removedjavax.xml.bind;version="[2.3,3)"andjavax.xml.bind.annotation.adapters;version="[2.3,3)".Fixes #261