RFR: 8276665: ObjectInputStream.GetField.get(name, object) should throw ClassNotFoundException

Roger Riggs rriggs at openjdk.java.net
Thu Nov 18 15:33:28 UTC 2021


On Mon, 15 Nov 2021 17:28:30 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

> The ObjectInputStream.GetField.get(String name, Object val) method is returning null instead of throwing an exception when the class of the object is not found. The caller is not able to correctly handle the case where the class is not found. The signature of GetField.get(name, val) should have a throws ClassNotFoundException and a ClassNotFoundException exception should be thrown.

Note the addition of a system property "jdk.serialGetFieldCnfeReturnsNull" to revert to the old behavior
if there is an application dependency on the old behavior.

-------------

PR: https://git.openjdk.java.net/jdk/pull/6393


More information about the core-libs-dev mailing list