changeset 17445:905c01632fa3

8191142: More refactoring for naming deserialization cases Reviewed-by: chegar, rriggs
author igerasim
date Wed, 29 Nov 2017 14:50:13 -0800
parents 44e9ee7b72ef
children a436b549c701
files src/java.naming/share/classes/javax/naming/directory/BasicAttributes.java
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.naming/share/classes/javax/naming/directory/BasicAttributes.java	Tue Nov 28 14:09:11 2017 -0800
+++ b/src/java.naming/share/classes/javax/naming/directory/BasicAttributes.java	Wed Nov 29 14:50:13 2017 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -302,8 +302,8 @@
         s.defaultReadObject();  // read in the ignoreCase flag
         int n = s.readInt();    // number of attributes
         attrs = (n >= 1)
-            ? new Hashtable<String,Attribute>(n * 2)
-            : new Hashtable<String,Attribute>(2); // can't have initial size of 0 (grrr...)
+                ? new Hashtable<>(1 + (int) (Math.min(768, n) / .75f))
+                : new Hashtable<>(2); // can't have initial size of 0 (grrr...)
         while (--n >= 0) {
             put((Attribute)s.readObject());
         }