diff options
Diffstat (limited to 'src/java.base/share/classes/java/util/IdentityHashMap.java')
| -rw-r--r-- | src/java.base/share/classes/java/util/IdentityHashMap.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/java.base/share/classes/java/util/IdentityHashMap.java b/src/java.base/share/classes/java/util/IdentityHashMap.java index f749774e78e..e48cb354c6e 100644 --- a/src/java.base/share/classes/java/util/IdentityHashMap.java +++ b/src/java.base/share/classes/java/util/IdentityHashMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,7 @@ import java.lang.reflect.Array; import java.util.function.BiConsumer; import java.util.function.BiFunction; import java.util.function.Consumer; +import jdk.internal.misc.SharedSecrets; /** * This class implements the {@code Map} interface with a hash table, using @@ -1304,7 +1305,9 @@ public class IdentityHashMap<K,V> if (size < 0) throw new java.io.StreamCorruptedException ("Illegal mappings count: " + size); - init(capacity(size)); + int cap = capacity(size); + SharedSecrets.getJavaObjectInputStreamAccess().checkArray(s, Object[].class, cap); + init(cap); // Read the keys and values, and put the mappings in the table for (int i=0; i<size; i++) { |
