-
Bug
-
Resolution: Fixed
-
P3
-
1.4.1_03
-
07
-
generic
-
generic
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2075376 | 5.0 | Michael Warres | P3 | Resolved | Fixed | b28 |
JDK-2075375 | 1.4.2_04 | Michael Warres | P3 | Resolved | Fixed | 04 |
Many of us have came across lot of crs that has StreamCorruptedExceptions from the following code in java.io.ObjectInputStream:
private ObjectStreamClass readNonProxyDesc(boolean unshared)
throws IOException
{
if (bin.readByte() != TC_CLASSDESC) {
throw new StreamCorruptedException();
}
ObjectStreamClass desc = new ObjectStreamClass();
int descHandle = handles.assign(unshared ? unsharedMarker : desc);
passHandle = NULL_HANDLE;
ObjectStreamClass readDesc = null;
try {
readDesc = readClassDescriptor();
} catch (ClassNotFoundException ex) {
// REMIND: do something less drastic here?
throw new StreamCorruptedException();
}
Class cl = null;
ClassNotFoundException resolveEx = null;
bin.setBlockDataMode(true);
try {
if ((cl = resolveClass(readDesc)) == null) {
throw new ClassNotFoundException("null class");
}
} catch (ClassNotFoundException ex) {
resolveEx = ex;
}
skipCustomData();
desc.initNonProxy(readDesc, cl, resolveEx, readClassDesc(false));
handles.finish(descHandle);
passHandle = descHandle;
return desc;
}
I highligted the place where it is throwing StreamCorruptedException. It is throwing StreamCorruptedException when it gets ClassNotFoundException while reading ClassDescriptor. Many of us actually gone through crs that has StreamCorruptedExceptions from this code and we were little confused intially that why we would experience this exception. Later on after looking at the code we realized that it is result of ClassCastException.
There is also a reminder that says 'do something less drastic here'. This wasn't like this in 1.3.1_x. In 1.3.1_x, it is using inputClassDescriptor() method and that method throws ClassNotFoundException. From 1.4.1 onwards they changed the code and calling this readNonProxyDesc() method and it doesn't have ClassNotFoundException in the throws class and hence they are throwing StreamCorruptedExceptions.
crs -> customer complaints received by BEA
private ObjectStreamClass readNonProxyDesc(boolean unshared)
throws IOException
{
if (bin.readByte() != TC_CLASSDESC) {
throw new StreamCorruptedException();
}
ObjectStreamClass desc = new ObjectStreamClass();
int descHandle = handles.assign(unshared ? unsharedMarker : desc);
passHandle = NULL_HANDLE;
ObjectStreamClass readDesc = null;
try {
readDesc = readClassDescriptor();
} catch (ClassNotFoundException ex) {
// REMIND: do something less drastic here?
throw new StreamCorruptedException();
}
Class cl = null;
ClassNotFoundException resolveEx = null;
bin.setBlockDataMode(true);
try {
if ((cl = resolveClass(readDesc)) == null) {
throw new ClassNotFoundException("null class");
}
} catch (ClassNotFoundException ex) {
resolveEx = ex;
}
skipCustomData();
desc.initNonProxy(readDesc, cl, resolveEx, readClassDesc(false));
handles.finish(descHandle);
passHandle = descHandle;
return desc;
}
I highligted the place where it is throwing StreamCorruptedException. It is throwing StreamCorruptedException when it gets ClassNotFoundException while reading ClassDescriptor. Many of us actually gone through crs that has StreamCorruptedExceptions from this code and we were little confused intially that why we would experience this exception. Later on after looking at the code we realized that it is result of ClassCastException.
There is also a reminder that says 'do something less drastic here'. This wasn't like this in 1.3.1_x. In 1.3.1_x, it is using inputClassDescriptor() method and that method throws ClassNotFoundException. From 1.4.1 onwards they changed the code and calling this readNonProxyDesc() method and it doesn't have ClassNotFoundException in the throws class and hence they are throwing StreamCorruptedExceptions.
crs -> customer complaints received by BEA
- backported by
-
JDK-2075375 java.io.StreamCorruptedException thrown due to java.lang.ClassNotFoundException
- Resolved
-
JDK-2075376 java.io.StreamCorruptedException thrown due to java.lang.ClassNotFoundException
- Resolved