-
Notifications
You must be signed in to change notification settings - Fork 63
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
[3.8] Fix NPE when importing newspaper course with metadata #6393
base: 3.8.x
Are you sure you want to change the base?
Conversation
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.
Short note: This changes are difficult to review as there are no tests added nor I have some example data to test this changes with, so I need more time for reviewing this.
A team mate created a small newspaper course xml file for me which contains some meta data: <?xml version="1.0" encoding="UTF-8"?>
<course>
<description>Die Zeitung erschien vom 1. Februar 1757 bis zum 07. Februar 1757 regelmäßig an allen Montagen und Mittwochen.</description>
<processes>
<process>
<title index="1">
<appeared date="1757-02-02">
<metadata metadataType="slub_script" value="Fraktur"/>
<metadata metadataType="LegalNoteAndTermsOfUse" value="PDM1.0"/>
<metadata metadataType="DocLanguage" value="ger"/>
<metadata metadataType="slub_ownerDigi" value="SLUB Dresden"/>
</appeared>
</title>
</process>
<process>
<title index="1">
<appeared date="1757-02-07"/>
</title>
</process>
</processes>
</course> After uploading this file I got the following stack trace
While reading the code I found in the new introduced code a potential null pointer exception which I only see after the test execution was minimal adjusted (second parameter was set to |
@@ -382,6 +387,12 @@ private void processRecoveredMetadata(List<RecoveredMetadata> recoveredMetadata) | |||
} | |||
CountableMetadata metadata = new CountableMetadata(foundBlock, Pair.of(metaDatum.getDate(), foundIssue)); | |||
metadata.setMetadataType(metaDatum.getMetadataType()); | |||
ProcessSimpleMetadata processSimpleMetadata = possibleProcessDetails.get(metaDatum.getMetadataType()); |
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.
Potential null pointer exception if possibleProcessDetails
ist set to null
like in the test execution (see CourseTest.java line 34). The test code execution did not cover this peace of code.
Backported #6390 to 3.8.x branch