Repository navigation
[COMPRESS-643] Reset ZIP entry counts after draining previous entries - #838
Open
hutiefang76 wants to merge 2 commits into
Open
hutiefang76 wants to merge 2 commits into
hutiefang76 wants to merge 2 commits into
Conversation
Reset the uncompressed byte count after closing the previous entry so implicit draining does not leak its unread bytes into the next count. Preserve the zero count when advancing a closed or exhausted stream. Add DEFLATED data-descriptor regressions plus fully consumed, STORED, partial final entry, and closed-stream controls. Assisted-By: DeepSeek (deepseek-flash) Assisted-By: Codex
Remove the changes.xml entry as requested in review5843396090. The ZIP reader fix and its regression tests are unchanged. Assisted-By: Codex
Author
|
Removed the changes.xml entry in 06770b6. The PR now contains only the ZIP reader fix and its regression tests. The default Maven build passes again: 4788 reported tests, 4759 passed and 29 existing skips, with zero failures or errors. AI-assisted update. |
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.
Advancing to the next ZIP entry closes the previous entry implicitly. For a DEFLATED entry with a data descriptor, that close can drain unread data through
read(). The counter was reset before this drain, so the next entry inherited the previous entry's unread-byte count. A 100000-byte unread entry left the next entry starting at 100000 instead of zero.Reset the uncompressed count after closing the previous entry, while preserving a zero count when advancing a closed or exhausted stream. Add seven in-memory regression/control cases covering unread, one-byte, fully consumed and STORED entries, partial final-entry reads, and closed streams. This fixes the skipped-entry counter problem in COMPRESS-643; it does not require a partial-read compression ratio to equal the whole-entry ratio.
Validation on JDK 21 with the project's Java 8 compiler configuration:
Original production code: 67 ZIP tests, three expected assertion failures in the new regressions, zero errors.
Patched production code: all 67 ZIP tests pass.
Default
mvn -B -ntp: BUILD SUCCESS; Surefire reports 4788 tests, zero failures/errors, 29 pre-existing skipped tests (4759 passed). No additional skips or test exclusions were added.A separate six-case in-memory reproduction also passes against the patched classes.
Read the contribution guidelines.
Read the ASF Generative Tooling Guidance.
AI was used: DeepSeek assisted with diagnosis, test and fix generation, and first-pass review. Codex coordinated the work, corrected and reviewed the patch, independently ran the native validation, and prepared this description. The commit includes
Assisted-Bytrailers. No human review is claimed.Run a successful build using the default Maven goal.
Add behavioral tests that fail against the original production code.
Describe the problem, resulting behavior, and validation.
Use a meaningful commit message containing the existing Jira key.