# HG changeset patch # User vtewari # Date 1511943966 -19800 # Node ID f2e87b6383afbca14e76793f4ec3412c8f811ec6 # Parent 8877e857fdd715191ca73bb39a291e5c212a77a6 8191142: More refactoring for naming deserialization cases Reviewed-by: chegar, rriggs diff -r 8877e857fdd7 -r f2e87b6383af src/java.naming/share/classes/javax/naming/directory/BasicAttributes.java --- 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(n * 2) - : new Hashtable(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()); }