United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 7173432 Fix issue with null key at resize of HashMap
7173432 : Fix issue with null key at resize of HashMap

Details
Type:
Bug
Submit Date:
2012-06-01
Status:
Closed
Updated Date:
2012-06-25
Project Name:
JDK
Resolved Date:
2012-06-25
Component:
core-libs
OS:
generic
Sub-Component:
java.util
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
7-pool,8
Fixed Versions:
8

Related Reports
Backport:
Duplicate:

Sub Tasks

Description
If the key to be insterted into a HashMap is null and the table needs to be resized as part of the insertion then addEntry will try to recalculate the hash of a null key. This will fail with an NPE.

                                    

Comments
SUGGESTED FIX

as per evaulation
                                     
2012-06-01
EVALUATION

use the same logic for calls to hash() as elsewhere:

hash = (null != key) ? hash(key) : 0;
                                     
2012-06-01
WORK AROUND

http://hg.openjdk.java.net/jdk8/tl/jdk/rev/7baa22e6a6b3
                                     
2012-06-01
WORK AROUND

http://hg.openjdk.java.net/jdk7u/jdk7u-dev/jdk/rev/421b71e31687
                                     
2012-06-01



Hardware and Software, Engineered to Work Together