Skip to content

api: fix inverted value comparison in ImageStoreDetailResponse.equals - #14023

Open
nagaboinaramgopal wants to merge 1 commit into
apache:4.20from
nagaboinaramgopal:fix/imagestoredetail-equals
Open

api: fix inverted value comparison in ImageStoreDetailResponse.equals#14023
nagaboinaramgopal wants to merge 1 commit into
apache:4.20from
nagaboinaramgopal:fix/imagestoredetail-equals

Conversation

@nagaboinaramgopal

Copy link
Copy Markdown

Description

ImageStoreDetailResponse.equals() had the value comparison inverted - it
returned false when the two responses had the same value and true when
the values differed:

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 — 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()), which
restores the correct result and is null-safe.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Feature/Enhancement Scale or Bug Severity

Bug Severity

  • Minor

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.

@DaanHoogland DaanHoogland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

seems this is unused code as no error reports have ever been filed, but changed clgtm

@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 19.79%. Comparing base (2cd8c5e) to head (1415c74).

Additional details and impacted files
@@             Coverage Diff              @@
##               4.20   #14023      +/-   ##
============================================
+ Coverage     16.34%   19.79%   +3.44%     
- Complexity    13574    20000    +6426     
============================================
  Files          5669     6371     +702     
  Lines        501368   575899   +74531     
  Branches      60903    70495    +9592     
============================================
+ Hits          81964   113975   +32011     
- Misses       410219   449491   +39272     
- Partials       9185    12433    +3248     
Flag Coverage Δ
uitests 3.53% <ø> (-0.62%) ⬇️
unittests 21.06% <100.00%> (+3.85%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.
@nagaboinaramgopal
nagaboinaramgopal force-pushed the fix/imagestoredetail-equals branch from 6498f93 to 1415c74 Compare September 3, 2026 17:15
@nagaboinaramgopal
nagaboinaramgopal changed the base branch from main to 4.20 September 3, 2026 17:49
@DaanHoogland

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19089

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Ready

Development

Successfully merging this pull request may close these issues.

4 participants