Skip to content
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

Prevent NPE #5831

Merged
merged 1 commit into from
Jan 9, 2024
Merged

Prevent NPE #5831

merged 1 commit into from
Jan 9, 2024

Conversation

matthias-ronge
Copy link
Collaborator

@matthias-ronge matthias-ronge commented Nov 3, 2023

Do not crash the building of error messages it an argument is null.

The message building checks the result string, if all insertions have been inserted in the string. If not, they are appended. Example:
“Metadata entry {0} not allowed for division {1}” ["TitleDocMain", "ephemera", "ruleset_default", "IOException: Cannot read ruleset_default.xml"] → “Metadata TitleDocMain not allowed for division ephemera: ruleset_default: IOException: Cannot read ruleset_default.xml”.

If an insertion is null, the test if (!messageBuilder.toString().contains(insertion)) (next line) will throw a NullPointerException. Error message building shouldn’t throw an exception by itself.

@solth
Copy link
Member

solth commented Nov 3, 2023

Does this fix or is related to #3762 or #5217 ? Could you provide some description?

@matthias-ronge
Copy link
Collaborator Author

matthias-ronge commented Nov 28, 2023

Does this fix or is related to #3762 or #5217 ?

No.

Could you provide some description?

See above

@solth solth added the bug label Nov 30, 2023
@solth solth merged commit d3bba5c into kitodo:master Jan 9, 2024
2 checks passed
@solth solth mentioned this pull request Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants