Fixes unhandled fatal error when EPUB content.opf date is badly formatted. #921
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.
We had an EPUB with this value in the content.opf metadata file:
The EPUB module checks for a valid date. In this case, it was pulling in the whitespace around the value and creating an invalid date. This revealed that the Exception resulting from a badly formatted date would cause the report to crash without proper handling. To replicate it, you can edit the content.opf for an EPUB file and replace the date with the one above.
The reason was that the ErrorMessages.properties file was on the wrong path for the EPUB module (it was with the harvard module messages). Most error messages generated by this module are handled in EpubChecker, which is why this wasn't caught previously... but there are a few generated in JhoveRepInfoReport that are handled separately - those were not working.
To fix, I moved the ErrorMessages.properties to the correct location, and also added a trim() to remove the extra whitespace around the date value, since I don't think this should cause a failure. I did not increment any versions for this yet.
Let me know if you need anything else!