/**
* Read the EPR to the specified InputStream.
*/
public void readExternal(java.io.ObjectInput inObject)
throws IOException, ClassNotFoundException {
SafeObjectInputStream in = SafeObjectInputStream.install(inObject);
// revision ID
int revID = in.readInt();
// make sure the object data is in a revision level we can handle
if (revID != REVISION_2) {
throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_REVID);
}
// String object id
logCorrelationIDString = (String) in.readObject();
// Read xml content
in.readUTF(); // read marker
int numBytes = in.readInt();
byte[] serBytes = new byte[numBytes];
// read the data from the input stream
int bytesRead = 0;
int numberOfBytesLastRead;
while (bytesRead < numBytes) {
numberOfBytesLastRead = in.read(serBytes, bytesRead, numBytes - bytesRead);
if (numberOfBytesLastRead == -1) {
// TODO: What should we do if the reconstitution fails?
// For now, log the event and throw an exception
if (log.isDebugEnabled()) {
log.debug("readObject(): EPR logCorrelationID ["+logCorrelationIDString+"] "
+ " ***WARNING*** unexpected end to data: data read from input stream ["
+ bytesRead + "] expected data size [" + numBytes + "]");
}
IOException ioe = new IOException("Unable to deserialize the EndpointReference with logCorrelationID ["
+logCorrelationIDString+"]"
+" Cause: Unexpected end to data from input stream");
throw ioe;
}
bytesRead += numberOfBytesLastRead;
}
if (bytesRead == 0) {
IOException ioe = new IOException("Unable to deserialize the EndpointReference with logCorrelationID ["
+logCorrelationIDString+"]"
+" Cause: No data from input stream");
throw ioe;
}
in.readUTF(); // read marker
ByteArrayInputStream bais = new ByteArrayInputStream(serBytes);
if (log.isDebugEnabled()) {
String content = new String(serBytes);