Details
-
Bug
-
Resolution: Fixed
-
P3
-
8, 11, 17
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8277715 | 17.0.3-oracle | Roger Riggs | P3 | Resolved | Fixed | b01 |
JDK-8278193 | 11.0.16-oracle | Evan Whelan | P3 | Resolved | Fixed | b02 |
JDK-8284346 | 11.0.16 | Goetz Lindenmaier | P3 | Resolved | Fixed | b01 |
JDK-8278195 | 8u341 | Evan Whelan | P3 | Resolved | Fixed | b02 |
Description
Vector checks the deserialized 'data' field for null and throws StreamCorruptedException.
The null can be a reflection of more than one condition, including the field is null, the field is not present in the stream, and the field is null because one of the array elements could not be deserialized due to a missing class.
The first two cases reflect a corrupted stream but the third should be treated as ClassNotFoundException.
Currently, there is a bug in ObjectInputStream.FieldValues.get(name, val).
public Object get(String name, Object val) {
int off = getFieldOffset(name, Object.class);
if (off >= 0) {
int objHandle = objHandles[off];
handles.markDependency(passHandle, objHandle);
return (handles.lookupException(objHandle) == null) ?
objValues[off] : null;
} else {
return val;
}
Here, a call to handles.lookupException is made, however rather than throwing the associated exception, the method simply returns null.
This is causing ClassNotFoundExceptions to be buried by the stack and the exception being thrown further up the stack by the caller of the method.
The method signature for FieldValues.get cannot be changed. However, given that FieldValues implements the GetField interface, the GetField.get(name, value) method throws an IOException.
The CNFE exception could be wrapped in an IOException and get thrown here, rather than incorrectly further up the stack.
Attachments
Issue Links
- backported by
-
JDK-8277715 Vector should throw ClassNotFoundException for a missing class of an element
- Resolved
-
JDK-8278193 Vector should throw ClassNotFoundException for a missing class of an element
- Resolved
-
JDK-8278195 Vector should throw ClassNotFoundException for a missing class of an element
- Resolved
-
JDK-8284346 Vector should throw ClassNotFoundException for a missing class of an element
- Resolved
- clones
-
JDK-8273660 ObjectInputStream.GetField.get returns null instead of handling ClassNotFoundException
- Resolved
- csr for
-
JDK-8277153 Vector should throw ClassNotFoundException for a missing class of an element
- Closed
- links to
-
Commit openjdk/jdk11u-dev/132c6c42
-
Commit openjdk/jdk17u/85716333
-
Review openjdk/jdk11u-dev/985
-
Review openjdk/jdk17u/279