changeset 48651:f2e87b6383af

8191142: More refactoring for naming deserialization cases Reviewed-by: chegar, rriggs
author vtewari
date Wed, 29 Nov 2017 13:56:06 +0530
parents 8877e857fdd7
children dda1a427b086
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	Mon Nov 27 17:30:49 2017 -0800
+++ b/src/java.naming/share/classes/javax/naming/directory/BasicAttributes.java	Wed Nov 29 13:56:06 2017 +0530
@@ -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());
         }