[#10174] Improvement(POConverters): possible NPE for null lastVersion in fileset version update#10389
Closed
pandeysambhi wants to merge 1 commit intoapache:mainfrom
Closed
[#10174] Improvement(POConverters): possible NPE for null lastVersion in fileset version update#10389pandeysambhi wants to merge 1 commit intoapache:mainfrom
pandeysambhi wants to merge 1 commit intoapache:mainfrom
Conversation
Code Coverage Report
Files
|
jerryshao
reviewed
Mar 12, 2026
| @@ -702,6 +702,9 @@ public static FilesetPO updateFilesetPOWithVersion( | |||
| FilesetPO oldFilesetPO, FilesetEntity newFileset, boolean needUpdateVersion) { | |||
| try { | |||
| Long lastVersion = oldFilesetPO.getLastVersion(); | |||
Contributor
There was a problem hiding this comment.
In which scenario will the return value here be null?
Contributor
|
I don't think this is a valid case mentioned in the issue. I'm going to close this PR and issue. You can always reopen this PR and issue if you find this problem in the real scenario. Thanks @pandeysambhi for your contribution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changes were proposed in this pull request?
In updateFilesetPOWithVersion, validate oldFilesetPO.getLastVersion() and normalize null to a safe baseline version ( INIT_VERSION) before incrementing to avoid NPE.
Why are the changes needed?
POConverters.updateFilesetPOWithVersion reads Long lastVersion = oldFilesetPO.getLastVersion(); and then executes lastVersion++ when needUpdateVersion is true. If lastVersion is null, Java auto-unboxing triggers a NullPointerException.
Fix: (#10174 )
Does this PR introduce any user-facing change?
no
How was this patch tested?
unit test