8015731: Subject java.security.auth.subject to improvements
Reviewed-by: skoivu, mullan
--- a/jdk/src/share/classes/javax/security/auth/Subject.java Thu Jun 13 10:21:06 2013 +0800
+++ b/jdk/src/share/classes/javax/security/auth/Subject.java Thu Jun 13 10:31:21 2013 +0800
@@ -1297,8 +1297,14 @@
{
ObjectInputStream.GetField fields = ois.readFields();
subject = (Subject) fields.get("this$0", null);
- elements = (LinkedList<E>) fields.get("elements", null);
which = fields.get("which", 0);
+
+ LinkedList<E> tmp = (LinkedList<E>) fields.get("elements", null);
+ if (tmp.getClass() != LinkedList.class) {
+ elements = new LinkedList<E>(tmp);
+ } else {
+ elements = tmp;
+ }
}
}