changeset 20806:d94588b7854d

8015731: Subject java.security.auth.subject to improvements Reviewed-by: skoivu, mullan
author weijun
date Thu, 13 Jun 2013 10:31:21 +0800
parents ae41216325dd
children 841e21c03f0f
files jdk/src/share/classes/javax/security/auth/Subject.java
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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;
+            }
         }
     }