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

revert iteration over Map to iteration over EntrySet #606

Conversation

Yauhenich
Copy link

Currently on 3.5.0 version I have a ClassCastException when reading a property with type Map<Integer, Object>, because when iterate over source map lambda expression expects only String and Object arguments.

java.lang.ClassCastException: class java.lang.Long cannot be cast to class java.lang.String (java.lang.Long and java.lang.String are in module java.base of loader 'bootstrap')
  at java.base/java.util.HashMap.forEach(HashMap.java:1421)
  at org.springframework.data.aerospike.convert.MappingAerospikeReadConverter.convertMap(MappingAerospikeReadConverter.java:184)
  at org.springframework.data.aerospike.convert.MappingAerospikeReadConverter.readValue(MappingAerospikeReadConverter.java:145)

Seems that iteration over source.entrySet() should solve the issue

@reugn
Copy link
Member

reugn commented Jul 31, 2023

@Yauhenich, could you add a unit test for your particular case.

@Yauhenich Yauhenich force-pushed the fix/revertMapIterationToEntrySet branch from b87422f to 79d9bbd Compare September 4, 2023 15:18
@Yauhenich
Copy link
Author

@Yauhenich, could you add a unit test for your particular case.

@reugn hello, I have added a test

@agrgr
Copy link

agrgr commented Sep 5, 2023

Merging this PR into another branch to add few changes

@agrgr agrgr changed the base branch from main to FMWK-239-read-non-String-map-keys September 5, 2023 15:33
@agrgr agrgr merged commit 50f021d into aerospike:FMWK-239-read-non-String-map-keys Sep 5, 2023
4 checks passed
reugn pushed a commit that referenced this pull request Sep 6, 2023
* revert iteration over Map to iteration over EntrySet (#606)

* update read converter and tests for reading maps with supported non-String keys

* update tests

* Update test

---------

Co-authored-by: Yauhenich <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants