Encode file paths when creating resource URLs - #865
Merged
Merged
Conversation
Encode filesystem paths through URI before constructing a resource URL. The old unescaped form treats filename characters as URL syntax. All eight focused cases and full Java 8/21 verify pass. The tests reject both develop's broken filename handling and #846's extra symlink canonicalisation policy. Preserve classpath lookup and fallback behaviour. Extract the URL encoding fix from #846 without real-path resolution.
The topic branch lacks commits from its current base. Merge the fetched base without rewriting history and retain the PR-specific behaviour alongside upstream fixes.
peter-lawrey-admin
approved these changes
Sep 14, 2026
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.
Refresh on 12 September 2026
Merged develop
9c26a484f3150c7f079aea626abffac22e53a506into the existing branch without rewriting history. Updated head:65a3751bcb73bb88b8336f9106ad1bdd7f207a91. Both the declared base and develop are ancestors of this head.Fresh Linux/OpenJDK 21 full Maven verify passed: 1882 reported tests, no failures or errors.
Platform CI and repository merge gates remain separate. Earlier implementation and validation details follow; their recorded results apply to the revisions stated there.
Why and scope
Each branch starts directly from current develop
ebcf76e91cb7a57b3626c1de7e0a67fc42a514a8. This is an independent behavioural extraction from #846, not a JUnit migration or annotation/checker rewrite.Constructing a file URL from an unescaped pathname treats a literal # as a fragment and can misinterpret percent signs, so the returned URL does not reliably open the requested file.
Use toAbsolutePath().toUri().toURL() for the existing filesystem fallback. Keep resource lookup, compressed-resource fallback and missing-file behaviour unchanged. Do not introduce the separate toRealPath policy from #846; a symlink URL retains its supplied path.
Verification performed
Actual Chronicle-Core Maven builds on Linux x64, using Maven 3.9.11 and
mvn -B -nsu clean verify -Dsurefire.rerunFailingTestsCount=0 -l <log>:The five Java 8 skips are existing JDK-specific tests; none of the added cases skipped. Full verify includes licence and binary-compatibility checks. Test retries were disabled.
All eight focused cases pass: actual reads of filenames with #, spaces, percent signs and plus signs, a plain filename, link-path preservation, resource lookup/fallback and missing files. TempDir and try-with-resources provide failure-path cleanup.
Three cases fail/error against develop. Against #846's exact head (73ab2a6), the symlink-path test fails because toRealPath substitutes the target. All pass with this one-line behavioural fix.
The unchanged POM resolves Chronicle Test Framework 2026.2, JUnit Jupiter 5.10.0, Affinity 2026.2 and POSIX 2026.2. No dependency bump is included. Platform CI remains a separate gate; Windows, Mac and ARM hardware were not run locally. Java 26+ results are informational under the project review policy.
Boundaries
Only URL encoding changes in release code, with an adjacent //! reason. No canonicalisation/security-policy claim, public API or POM/version changes, annotations or unrelated I/O cleanup.