Code Review Request for 7107613, 7107616, 7185471 (original) (raw)

Xuelei Fan xuelei.fan at oracle.com
Thu Jul 26 12:54:52 UTC 2012



The ObjectOutputStream.PutField and ObjectInputStream.GetField will call:

(fields.get("perms", null));

(fields.get("perms", null));

As will try to get the field offset of "perms" from the instance of this class, CryptoPermissions. Because "perms" has been declared as transient, a exception is properly thrown, java.lang.IllegalArgumentException: no such field perms with type class java.lang.Object

I think we may need to override the "serialPersistentFields" of ObjectStreamField, as [1][2]:

Alternatively, I was wondering maybe we reserver the hashtable variable, "perms", and add a new transient ConcurrentHashMap variable, "transientPerms":

 private Hashtable<String, PermissionCollection> perms;

Then we will not need to override the serialPersistentFields variable any more. The readObject and writeObject looks like:


Xuelei

[1] http://docs.oracle.com/javase/6/docs/platform/serialization/spec/input.html#4936 [2] http://docs.oracle.com/javase/6/docs/platform/serialization/spec/class.html#3127

http://cr.openjdk.java.net/~valeriep/7107616 http://cr.openjdk.java.net/~valeriep/7185471

The changes are for JDK 8. May be backported to 7u later if necessary, Thanks, Valerie



More information about the security-dev mailing list