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

Fix NPE when using serialized Axivion Suite tool in newer versions where new field was not present #928

Merged
merged 1 commit into from
May 15, 2021

Conversation

arturbosch
Copy link
Contributor

@arturbosch arturbosch commented May 12, 2021

@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 Tools between runs. Loading such a serialized Tool 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.

@codecov
Copy link

codecov bot commented May 12, 2021

Codecov Report

Merging #928 (1a6cc28) into master (504ad0c) will decrease coverage by 0.09%.
The diff coverage is 36.36%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #928      +/-   ##
============================================
- Coverage     80.10%   80.01%   -0.10%     
- Complexity     1420     1423       +3     
============================================
  Files           237      237              
  Lines          5228     5239      +11     
  Branches        408      411       +3     
============================================
+ Hits           4188     4192       +4     
- Misses          890      893       +3     
- Partials        150      154       +4     
Impacted Files Coverage Δ Complexity Δ
...lugins/analysis/warnings/axivion/AxivionSuite.java 27.73% <36.36%> (+0.87%) 7.00 <3.00> (+3.00)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 504ad0c...1a6cc28. Read the comment docs.

Copy link
Member

@uhafner uhafner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move that code to a readResolve method.

@arturbosch arturbosch force-pushed the npe-due-to-serialization branch 2 times, most recently from 60d20df to 2a25f7e Compare May 14, 2021 12:13
@uhafner uhafner merged commit abaf615 into jenkinsci:master May 15, 2021
@arturbosch arturbosch deleted the npe-due-to-serialization branch May 16, 2021 08:02
@uhafner uhafner added the bug Bugs or performance problems label Jun 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugs or performance problems
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants