Conversation
- Fix IoUtil.getWriter() file corruption bug (WRITE without TRUNCATE_EXISTING) - Fix #ADRESS writing literal "null" for null subfields (now writes "") - Normalize getVALUTA() to return null when unset, matching other getters - Fix null-safety in SieDocumentComparer for VALUTA comparison - Rename SieVoucherMissmatchException to SieVoucherMismatchException - Encapsulate all public fields on SieDocumentReader with getters/setters - Wrap JAXBException in SieException in SIE 5 reader/writer public API - Remove dead commented-out code in IoUtil, Encoding, and SiePeriodValue - Remove redundant file.delete() in SieDocumentWriter.write() - Update README, DEVELOPER.md, and tests for API changes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…nd new tests - Wrap date parsing in SieDataItem.getDate() with try-catch for DateTimeException - Make Encoding.defaultCharset final and remove unused logger field - Add cause constructors to all 8 exception classes for proper exception chaining - Add 7 new tests covering ignoreRTRANS, streamValues, constructor params, invalid file detection, throwErrors collection, and invalid date handling Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…toring Add GitHub Actions CI workflow for build/test on push/PR to master. Eliminate Byte boxing in Encoding.getBytes() and SieCRC32 by using byte[] directly. Refactor SieDocumentReader to replace 35-branch if/else chain with a Map<String, Consumer<SieDataItem>> dispatch table. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The *.jar gitignore rule was excluding the Gradle wrapper jar needed by CI. Add a negation rule and track the wrapper jar. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This pull request modernizes the SIE parser API by improving encapsulation, simplifying utilities, and enhancing error handling. The primary changes convert public configuration fields in SieDocumentReader to private fields with accessor methods, refactor parsing logic from if-else chains to a handler map pattern, and add exception constructors that accept causes for better exception chaining.
Changes:
- Converted
SieDocumentReaderpublic fields to private with getter/setter methods, improving API encapsulation - Simplified
EncodingandIoUtilutilities by removing legacy code and changinggetBytes()to return byte arrays - Added cause-accepting constructors to multiple exception classes for better exception chaining
- Fixed typo: renamed
SieVoucherMissmatchExceptiontoSieVoucherMismatchException - Added GitHub Actions CI workflow for automated builds and testing
Reviewed changes
Copilot reviewed 24 out of 26 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/alipsa/sieparser/SieDocumentReader.java | Converted public fields to private with getters/setters; refactored parsing logic to use handler map pattern |
| src/test/java/alipsa/sieparser/SieDocumentReaderTest.java | Updated tests to use new accessor methods; added comprehensive tests for streaming, error handling, and invalid dates |
| src/test/java/alipsa/sieparser/TestSieDocument.java | Updated to use new setIgnoreMissingOMFATTNING() method |
| src/main/java/alipsa/sieparser/Encoding.java | Simplified by removing logging and changing getBytes() to return byte[] instead of Collection |
| src/main/java/alipsa/sieparser/IoUtil.java | Removed legacy commented code; simplified getWriter() to use CREATE and TRUNCATE_EXISTING options |
| src/main/java/alipsa/sieparser/SieCRC32.java | Updated to use new byte[] signature from Encoding.getBytes() |
| src/main/java/alipsa/sieparser/SieDocumentWriter.java | Removed manual file deletion (handled by IoUtil); improved ADRESS field handling with nullToEmpty helper |
| src/main/java/alipsa/sieparser/SieDocumentComparer.java | Changed VALUTA comparison to use null-safe StringUtil.equals() |
| src/main/java/alipsa/sieparser/SieDocument.java | Updated getVALUTA() documentation to clarify it returns null when not set |
| src/main/java/alipsa/sieparser/SieDataItem.java | Improved date parsing with try-catch for DateTimeException; updated to use getCallbacks() accessor |
| src/main/java/alipsa/sieparser/SieVoucherMismatchException.java | Fixed class name typo (Missmatch → Mismatch); added constructor accepting cause |
| src/main/java/alipsa/sieparser/SieDateException.java | Added constructor accepting cause for exception chaining |
| src/main/java/alipsa/sieparser/MissingFieldException.java | Added constructor accepting cause for exception chaining |
| src/main/java/alipsa/sieparser/SieMissingObjectException.java | Added constructor accepting cause for exception chaining |
| src/main/java/alipsa/sieparser/SieMissingMandatoryDateException.java | Added constructor accepting cause for exception chaining |
| src/main/java/alipsa/sieparser/SieInvalidFileException.java | Added constructor accepting cause for exception chaining |
| src/main/java/alipsa/sieparser/SieInvalidFeatureException.java | Added constructor accepting cause for exception chaining |
| src/main/java/alipsa/sieparser/SieInvalidChecksumException.java | Added constructor accepting cause for exception chaining |
| src/main/java/alipsa/sieparser/sie5/Sie5DocumentReader.java | Changed methods to throw SieException instead of JAXBException with proper error messages |
| src/main/java/alipsa/sieparser/sie5/Sie5DocumentWriter.java | Changed methods to throw SieException instead of JAXBException with proper error messages |
| src/main/java/alipsa/sieparser/SiePeriodValue.java | Removed commented-out legacy code |
| docs/DEVELOPER.md | Fixed class name typo in documentation |
| README.md | Updated examples to use new accessor methods |
| .github/workflows/ci.yml | Added GitHub Actions CI workflow for automated testing |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This pull request introduces several improvements and refactorings across the codebase, focusing on API modernization, code simplification, and enhanced error handling. The most significant changes are the conversion of public fields in
SieDocumentReaderto private fields with accessor methods, improvements to encoding and I/O utilities, and more robust exception handling.API modernization and encapsulation:
SieDocumentReaderby replacing public fields with private fields and adding getter/setter methods for all configuration options, callbacks, and state. This improves encapsulation and makes the API more idiomatic and maintainable.Encoding and I/O improvements:
Encodingutility: removed unnecessary imports and logging, changedgetBytesto return a byte array instead of a collection, and updated consumers to use the new signature. [1] [2] [3]IoUtilto remove legacy code and streamline reader/writer creation, ensuring files are always created or truncated appropriately. [1] [2] [3]Checksum and comparison logic:
SieCRC32to use the new encoding utilities, simplifying buffer handling and improving performance. [1] [2] [3]SieDocumentComparerby using a utility method for null-safe equality checks, and clarified the behavior ofSieDocument.getVALUTAto returnnullwhen not set. [1] [2]Error handling enhancements:
SieDateExceptionandMissingFieldExceptionthat accept a cause, enabling better exception chaining and debugging. [1] [2]SieVoucherMismatchExceptionand updated developer documentation.CI/CD automation: