Looks good. Not surprising no one ever noticed, since the code is
intentionally trying to reduce the number of buckets. I would encapsulate
serialization mechanics in a separate serialClone method, as done elsewhere
e.g.
@SuppressWarnings("unchecked")
private static <T> T serialClone(T o) throws Exception {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(o);
oos.flush();
oos.close();
ByteArrayInputStream bin =
new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bin);
return (T) ois.readObject();
}
On Sun, Jan 4, 2015 at 9:58 AM, Peter Levart <[email protected]> wrote:
> Hi,
>
> While investigating the following issue:
>
> https://bugs.openjdk.java.net/browse/JDK-8029891
>
> I noticed there's a bug in deserialization code of java.util.Hashtable
> (from day one probably):
>
> https://bugs.openjdk.java.net/browse/JDK-8068427
>
> The fix is a trivial one-character replacement: '*' -> '/', but I also
> corrected some untruthful comments in the neighbourhood (which might have
> been true from day one, but are not any more):
>
> http://cr.openjdk.java.net/~plevart/jdk9-dev/Hashtable.8068427/webrev.01/
>
>
> Regards, Peter
>
>