public final class PreSerializeChecker extends ObjectOutputStream
check(Object) with the object you want to check. When a non-serializable object is
found, a WicketSerializableCheckException is thrown with a message that shows the trace up
to the not-serializable object. The exception is thrown for the first non-serializable instance
it encounters, so multiple problems will not be shown.
As this class depends heavily on JDK's serialization internals using introspection, analyzing may
not be possible, for instance when the runtime environment does not have sufficient rights to set
fields accessible that would otherwise be hidden. You should call
isAvailable() to see whether this class can operate properly. If it
doesn't, you should fall back to e.g. re-throwing/ printing the NotSerializableException
you probably got before using this class.
This class is from wicket sources because its final and thats the only way i can do the modifications...
ObjectOutputStream.PutFieldbaseWireHandle, PROTOCOL_VERSION_1, PROTOCOL_VERSION_2, SC_BLOCK_DATA, SC_ENUM, SC_EXTERNALIZABLE, SC_SERIALIZABLE, SC_WRITE_METHOD, STREAM_MAGIC, STREAM_VERSION, SUBCLASS_IMPLEMENTATION_PERMISSION, SUBSTITUTION_PERMISSION, TC_ARRAY, TC_BASE, TC_BLOCKDATA, TC_BLOCKDATALONG, TC_CLASS, TC_CLASSDESC, TC_ENDBLOCKDATA, TC_ENUM, TC_EXCEPTION, TC_LONGSTRING, TC_MAX, TC_NULL, TC_OBJECT, TC_PROXYCLASSDESC, TC_REFERENCE, TC_RESET, TC_STRING| Constructor and Description |
|---|
PreSerializeChecker(ISerializableCheck serializableCheck)
Construct.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
static boolean |
isAvailable()
Gets whether we can execute the tests.
|
void |
reset() |
protected void |
writeObjectOverride(Object obj) |
annotateClass, annotateProxyClass, defaultWriteObject, drain, enableReplaceObject, flush, putFields, replaceObject, useProtocolVersion, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeClassDescriptor, writeDouble, writeFields, writeFloat, writeInt, writeLong, writeObject, writeShort, writeStreamHeader, writeUnshared, writeUTFpublic PreSerializeChecker(ISerializableCheck serializableCheck) throws IOException
serializableCheck - exception - exception that should be set as the cause when throwing a new exceptionIOExceptionpublic static boolean isAvailable()
check(Object) will just
return and you are advised to rely on the NotSerializableException. Clients are
advised to call this method prior to calling the check method.public void reset()
throws IOException
reset in class ObjectOutputStreamIOExceptionObjectOutputStream.reset()public void close()
throws IOException
close in interface Closeableclose in interface ObjectOutputclose in interface AutoCloseableclose in class ObjectOutputStreamIOExceptionprotected final void writeObjectOverride(Object obj) throws IOException
writeObjectOverride in class ObjectOutputStreamIOExceptionObjectOutputStream.writeObjectOverride(java.lang.Object)Copyright © 2014. All Rights Reserved.