api: fix inverted value comparison in ImageStoreDetailResponse.equals - #14023
Open
nagaboinaramgopal wants to merge 1 commit into
Open
api: fix inverted value comparison in ImageStoreDetailResponse.equals#14023nagaboinaramgopal wants to merge 1 commit into
nagaboinaramgopal wants to merge 1 commit into
Conversation
equals() returned false when the two responses had the SAME value and true
when the values DIFFERED (the value branch was inverted):
else if (this.getValue().equals(other.getValue()))
return false;
So two identical details were treated as unequal and two details differing
only by value were treated as equal, corrupting any Set/Map/dedup keyed on
ImageStoreDetailResponse. It also NPEd when value was null.
Compare with !Objects.equals(getValue(), other.getValue()), which restores
the correct result and is null-safe.
Adds tests for equal name+value, differing value, and differing name.
DaanHoogland
approved these changes
Sep 1, 2026
DaanHoogland
left a comment
Contributor
There was a problem hiding this comment.
seems this is unused code as no error reports have ever been filed, but changed clgtm
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #14023 +/- ##
=========================================
Coverage 19.73% 19.74%
- Complexity 19955 19966 +11
=========================================
Files 6371 6371
Lines 575784 575784
Branches 70478 70478
=========================================
+ Hits 113632 113686 +54
+ Misses 449805 449740 -65
- Partials 12347 12358 +11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Description
ImageStoreDetailResponse.equals()had the value comparison inverted - itreturned
falsewhen the two responses had the same value andtruewhenthe values differed:
So two identical details were treated as unequal, and two details differing only
by value were treated as equal — which corrupts any Set/Map/dedup keyed on
ImageStoreDetailResponse. It also threw an NPE when the value was null.Fixed by comparing with
!Objects.equals(getValue(), other.getValue()), whichrestores the correct result and is null-safe.
Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
How Has This Been Tested?
Added unit tests covering equal name+value, differing value, and differing name.
Also built the standard packages and deployed on a KVM advanced zone.