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

LinkedCaseInsensitiveMap does not correctly implement putAll() [SPR-7969] #12624

Closed
spring-issuemaster opened this issue Feb 17, 2011 · 5 comments
Assignees
Milestone

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Feb 17, 2011

Kristian Andersen opened SPR-7969 and commented

org.springframework.util.LinkedCaseInsensitiveMap does not override the putAll() method.

The inherited java.util.HashMap.putAll() calls an internal method putImpl() and this leads to inconsistent data in LinkedCaseInsensitiveMap.
Entries added by calling LinkedCaseInsensitiveMap.putAll() can not be retrieved by LinkedCaseInsensitiveMap.get()

The attached testcase demonstrates this behaviour.


Affects: 3.0.5, 3.1 RC1

Attachments:

Issue Links:

  • #21465 LinkedCaseInsensitiveMap should explicitly implement putIfAbsent and computeIfAbsent

Referenced from: commits b391629, 5856db6

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Mar 25, 2011

Kristian Andersen commented

This bug breaks functionality in org.springframework.jdbc.core.JdbcTemplate since LinkedCaseInsensitiveMap is used from there. See line 1011-1013 (in the 3.0.5 release.)

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Nov 28, 2011

Juergen Hoeller commented

As far as my research showed, this issue only comes up on IBM JDK 1.6 where putAll indeed does not delegate to put but rather calls a putImpl method. On Sun JDK 1.6, the code does work as expected. We'll fix this through overriding putAll for a guarantee that delegation to put will happen, independent from the implementation strategy in java.util.HashMap.

Juergen

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Nov 28, 2011

Kristian Andersen commented

You're right, I am on IBM 1.6, sorry for the sloppy report. And thanks for fixing this!

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Aug 10, 2015

Sergey Ponomarev commented

Hi guys,

In the but description said that it was fixed in 3.0.7 but as I see this commit it only contains starting from v3.1.0.RC2.

Also please move this unit test attached to issue to the LinkedCaseInsensitiveMapTests.

This is important to mention that this issue is happens after switching from OpenJDK 7 to OpenJDK 8.
The putAll() method in OpenJDK 7-b147 calls put(), but in the OpenJDK /8-b132 it not doing this anymore

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Aug 11, 2015

Sergey Ponomarev commented

In the but description said that it was fixed in 3.0.7 but as I see this commit it only contains starting from v3.1.0.RC2.

Sorry guys, I checked 3.0.7 fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.