[Bug] NullPointerException in consolidateLanguages when a book has no primary file #1386
Melantrix
started this conversation in
Issue Triage
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What went wrong?
full disclosure; this issue is created with the help of AI.
When using the Metadata Manager to merge/consolidate languages across the library, the operation fails with an "unexpected error occurred" in the UI. The backend throws a NullPointerException because MetadataManagementService.writeMetadataToFile() calls primaryFile.getBookType() without first checking whether primaryFile is null.
This happens when one or more books in the library have no associated primary file entry in the database.
What should have happend?
Books without a primary file should be skipped with a warning log rather than crashing the entire consolidation operation. Something like:
Any Ideas on How to Fix This? (Optional)
Add a null guard at line 68 of MetadataManagementService.java before calling primaryFile.getBookType(). This would make the operation resilient to orphaned book entries instead of aborting entirely.
How can we reproduce it?
What Build of Grimmory are you on?
Stable
Your setup
Grimmory v3.1.0
Installation: Docker
Screenshots or error messages (optional)
Error in docker logs.
Before submitting
Beta Was this translation helpful? Give feedback.
All reactions