You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: separate merged fatjar service providers - #2709
jbang export fatjar appends duplicate META-INF/services/* entries byte-for-byte. If a provider file has no trailing newline, its last provider and the next file's first provider become one invalid class name.
Change
Write a newline before appending each subsequent service file. Blank lines are valid in service configuration files, so existing line endings remain intact.
Strengthen the export regression test to assert separate provider lines for files ending with no newline, LF, CRLF, or CR.
Confirmed the new no-trailing-newline test fails before the fix with com.example.Impl1com.example.Impl2 on one line.
./gradlew test --tests 'dev.jbang.cli.TestExport' formatCheck passed after the fix on the latest upstream main (29 tests passed, 3 skipped).
git diff --check passed.
The full unit and integration suites were not run locally.
The implementation and tests were prepared with AI assistance. The contributor discussed the fix approach and authorized this PR; human review of the final code and CI results is pending.
Summary by CodeRabbit
Bug Fixes
Fixed an issue in exported fat JARs where combining duplicate service-provider entries could join provider names when the existing entry had no trailing newline. Merged entries now keep providers separated across empty, LF, CRLF, and CR line-ending formats, helping ensure each provider remains available to applications using the exported archive.
No actionable comments were generated in the recent review.
Walkthrough
Fatjar export now writes a newline before appending duplicate META-INF/services/ entries. The service-file merge test covers empty, LF, CRLF, and CR line endings and checks that both providers remain separate and ordered.
Changes: Service-file merge
Layer / File(s)
Summary
Separate and validate merged providers src/main/java/dev/jbang/cli/Export.java, src/test/java/dev/jbang/cli/TestExport.java
handleZipFile writes a newline before appending duplicate service-file contents. The parameterized test checks provider order for empty, LF, CRLF, and CR line endings. Both providers use UTF-8 in the test.
Fatjar export now separates merged service provider entries, so a missing trailing newline no longer concatenates provider names. The change is small and tested for several line endings, and no merge-blocking risk remains.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the fix and the affected area: separating merged fatjar service providers. The change adds a newline before each appended META-INF/services/ entry in ExportFatjar.handleZipFile, which …
Linked Issues check
Directly linked issue #2704 requires a separator so appended META-INF/services/* providers cannot merge when a provider file lacks a trailing newline. The AI-generated summary of src/main/java/dev/jba…
Out of Scope Changes check
The changes touch two files: Export.java (newline separator in the fatjar service-file merge) and TestExport.java (service-file merge regression test). Both directly implement or verify issue #2704. T…
Full details: Title check
Explanation
The title names the fix and the affected area: separating merged fatjar service providers. The change adds a newline before each appended META-INF/services/ entry in ExportFatjar.handleZipFile, which keeps adjacent provider names from concatenating. The title is short, specific, and uses the conventional fix: prefix. It does not mention the newline mechanism or the test changes, which is acceptable because the title need not cover every detail.
Full details: Linked Issues check
Explanation
Directly linked issue #2704 requires a separator so appended META-INF/services/* providers cannot merge when a provider file lacks a trailing newline. The AI-generated summary of src/main/java/dev/jbang/cli/Export.java states that ExportFatjar.handleZipFile now writes a newline before appending each duplicate service entry (+2/-0). This matches the fix the issue suggests (ensure a newline between appended files). The test summary for src/test/java/dev/jbang/cli/TestExport.java states that the service-file merge test runs with empty, LF, CRLF, and CR endings and checks that both providers appear on separate lines. This covers the no-trailing-newline case from the issue example. The optional line-by-line trimming and deduplication in the issue is a suggestion ('Ideally'), not a stated requirement, and the PR does not claim it. Limitation: the repository diff tool returned no text for either changed file, and a file read of Export.java was truncated before handleZipFile. The code-level result therefore rests on the supplied summary and PR description, not on a direct read of the changed lines.
Full details: Out of Scope Changes check
Explanation
The changes touch two files: Export.java (newline separator in the fatjar service-file merge) and TestExport.java (service-file merge regression test). Both directly implement or verify issue #2704. The summary reports no changes to public or exported declarations. No unrelated changes appear in the supplied summary. Limitation: the diff tool could not return the text of either file, so the absence of other hunks rests on the supplied whole-PR summary.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Reviewing files that changed from the base of the PR and between e5af0ea and 6090cd6.
Files selected for processing: 2
src/main/java/dev/jbang/cli/Export.java
src/test/java/dev/jbang/cli/TestExport.java
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
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
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.
Problem
jbang export fatjarappends duplicateMETA-INF/services/*entries byte-for-byte. If a provider file has no trailing newline, its last provider and the next file's first provider become one invalid class name.Change
Fixes #2704.
Validation
com.example.Impl1com.example.Impl2on one line../gradlew test --tests 'dev.jbang.cli.TestExport' formatCheckpassed after the fix on the latest upstreammain(29 tests passed, 3 skipped).git diff --checkpassed.The full unit and integration suites were not run locally.
The implementation and tests were prepared with AI assistance. The contributor discussed the fix approach and authorized this PR; human review of the final code and CI results is pending.
Summary by CodeRabbit