Object[] stateToWrite = (Object[]) state;
if (debugSerializedState) {
ByteArrayOutputStream discard = new ByteArrayOutputStream();
DebugObjectOutputStream out =
new DebugObjectOutputStream(discard);
try {
out.writeObject(stateToWrite[0]);
} catch (Exception e) {
throw new FacesException(
"Serialization error. Path to offending instance: "
+ out.getStack(), e);
}
}
//noinspection NonSerializableObjectPassedToObjectStream
oos.writeObject(stateToWrite[0]);
if (debugSerializedState) {
ByteArrayOutputStream discard = new ByteArrayOutputStream();
DebugObjectOutputStream out =
new DebugObjectOutputStream(discard);
try {
out.writeObject(stateToWrite[1]);
} catch (Exception e) {
DebugUtil.printState((Map)stateToWrite[1], LOGGER);
throw new FacesException(
"Serialization error. Path to offending instance: "
+ out.getStack(), e);
}
}
//noinspection NonSerializableObjectPassedToObjectStream