Fix NPE when using serialized Axivion Suite tool in newer versions where new field was not present #928
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.
@uhafner I'm not sure if this is the best fix and how to handle such cases in the future.
In #853 I introduced a new configurable field
namedFilter
.As I found out stapler/jelly serializes
Tool
s between runs. Loading such a serializedTool
will not execute the code which initializes this new field (private String namedFilter = StringUtils.EMPTY;
) and will lead to a NPE later on.To avoid this I need to go to the configuration screen and just press save again for a new serialized copy.
The general idea is to check if new fields are null and if yes to patch them in the
run
method.