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 - Problem of wrong serialization of ComposedKey fields on the cache #4032

Merged
merged 2 commits into from
May 10, 2024

Conversation

Agnul97
Copy link
Contributor

@Agnul97 Agnul97 commented May 9, 2024

I discovered a bug regarding our use of ComposedKey classes and the serialization of some of their fields in the context of the Caching mechanism. One of its fields (scopeId) is of type KapuaId. The problem is that sometimes we create ComposedKeys using a ScopeId instance and then we try to perform a lookup of the same cache entry but using a KapuaEid. If this doesn’t seem a problem from an object-oriented perspective, considering that they have the same internal Id and the equals method would return true, it is from a “serialization” for the cache perspective, because the serialization of the 2 fields is different and, as so, the lookup cannot behave as want.

I fixed the issue in the constructor of the ComposedKey class casting the various KapuaId passed in input to be a fixed KapuaEid

@codecov-commenter
Copy link

codecov-commenter commented May 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 16.80%. Comparing base (f33457d) to head (6c6d62b).
Report is 12 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             develop    #4032   +/-   ##
==========================================
  Coverage      16.80%   16.80%           
  Complexity        10       10           
==========================================
  Files           1987     1987           
  Lines          51855    51855           
  Branches        4424     4424           
==========================================
  Hits            8716     8716           
  Misses         42736    42736           
  Partials         403      403           
Files Coverage Δ
...ua/commons/service/internal/cache/ComposedKey.java 94.11% <100.00%> (ø)
...ua/commons/service/internal/cache/EntityCache.java 22.78% <ø> (ø)

@Coduz Coduz added the Bug This is a bug or an unexpected behaviour. Fix it! label May 10, 2024
@Coduz Coduz merged commit 7a6099a into eclipse:develop May 10, 2024
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This is a bug or an unexpected behaviour. Fix it!
Projects
Development

Successfully merging this pull request may close these issues.

3 participants