-
Notifications
You must be signed in to change notification settings - Fork 390
fix: read encrypted xlsx file exception #394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
fastexcel-test/src/test/java/cn/idev/excel/test/core/encrypt/EncryptDataTest.java
Show resolved
Hide resolved
fastexcel-test/src/test/java/cn/idev/excel/test/core/encrypt/EncryptDataTest.java
Show resolved
Hide resolved
fastexcel-test/src/test/java/cn/idev/excel/test/core/encrypt/EncryptDataTest.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances Excel type detection for password-protected files and refactors the encryption-related test cases to support XLSX, XLS, and CSV in both file and stream modes.
- Enhanced
ExcelTypeEnum.valueOf
to recognize file type before and after password checks. - Refactored
EncryptDataTest
to parameterize read/write scenarios across XLSX, XLS, and CSV. - Updated test listener and model to use Lombok logging and consistent data naming.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
fastexcel-test/src/test/java/cn/idev/excel/test/core/encrypt/EncryptDataTest.java | Refactored and parameterized encryption tests to support XLSX, XLS, and CSV with streaming options |
fastexcel-test/src/test/java/cn/idev/excel/test/core/encrypt/EncryptDataListener.java | Added logging with Lombok’s @Slf4j and updated assertions in data listener |
fastexcel-test/src/test/java/cn/idev/excel/test/core/encrypt/EncryptData.java | Added @ToString to test data model |
fastexcel-core/src/main/java/cn/idev/excel/support/ExcelTypeEnum.java | Enhanced ExcelTypeEnum recognition to handle password-protected files |
Comments suppressed due to low confidence (1)
fastexcel-core/src/main/java/cn/idev/excel/support/ExcelTypeEnum.java:55
StringUtils
is not imported; add the appropriate import (e.g.,import cn.idev.excel.util.StringUtils;
) to avoid compilation errors.
boolean hasPassword = !StringUtils.isEmpty(readWorkbook.getPassword());
fastexcel-test/src/test/java/cn/idev/excel/test/core/encrypt/EncryptDataTest.java
Show resolved
Hide resolved
fastexcel-test/src/test/java/cn/idev/excel/test/core/encrypt/EncryptDataTest.java
Show resolved
Hide resolved
fastexcel-test/src/test/java/cn/idev/excel/test/core/encrypt/EncryptDataListener.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+LGTM
If no one else has a problem with it, I'll merge it into the main branch this week :)
Close #393
What's changed?
Checklist