}
Enumeration fvdsList = getOrderedDescriptions(repositoryID, sender).elements();
while((fvdsList.hasMoreElements()) && (spClass > spBase)) {
FullValueDescription fvd = (FullValueDescription)fvdsList.nextElement();
// d4365188: backward compatability
String repIDForFVD = vhandler.getClassName(fvd.id);
String repIDForClass = vhandler.getClassName(vhandler.getRMIRepositoryID(currentClass));
while ((spClass > spBase) &&
(!repIDForFVD.equals(repIDForClass))) {
int pos = findNextClass(repIDForFVD, classes, spClass, spBase);
if (pos != -1) {
spClass = pos;
currclass = currentClass = classes[spClass];
repIDForClass = vhandler.getClassName(vhandler.getRMIRepositoryID(currentClass));
}
else { // Read and throw away one level of the fvdslist
// This seems to mean that the sender had a superclass that
// we don't have
if (fvd.is_custom) {
readFormatVersion();
boolean calledDefaultWriteObject = readBoolean();
if (calledDefaultWriteObject)
inputClassFields(null, null, null, fvd.members, sender);
if (getStreamFormatVersion() == 2) {
((ValueInputStream)getOrbStream()).start_value();
((ValueInputStream)getOrbStream()).end_value();
}
// WARNING: If stream format version is 1 and there's
// optional data, we'll get some form of exception down
// the line or data corruption.
} else {
inputClassFields(null, currentClass, null, fvd.members, sender);
}
if (fvdsList.hasMoreElements()){
fvd = (FullValueDescription)fvdsList.nextElement();
repIDForFVD = vhandler.getClassName(fvd.id);
}
else return currentObject;
}
}
currdesc = currentClassDesc = ObjectStreamClass.lookup(currentClass);
if (!repIDForClass.equals("java.lang.Object")) {
// If the sender used custom marshaling, then it should have put
// the two bytes on the wire indicating stream format version
// and whether or not the writeObject method called
// defaultWriteObject/writeFields.
ReadObjectState oldState = readObjectState;
setState(DEFAULT_STATE);
try {
if (fvd.is_custom) {
// Read format version
readFormatVersion();
// Read defaultWriteObject indicator
boolean calledDefaultWriteObject = readBoolean();
readObjectState.beginUnmarshalCustomValue(this,
calledDefaultWriteObject,
(currentClassDesc.readObjectMethod
!= null));
}
boolean usedReadObject = false;
// Always use readObject if it exists, and fall back to default
// unmarshaling if it doesn't.
try {
if (!fvd.is_custom && currentClassDesc.hasReadObject())
setState(IN_READ_OBJECT_REMOTE_NOT_CUSTOM_MARSHALED);
// See the definition of defaultReadObjectFVDMembers
// for more information. This concerns making sure
// we use the remote FVD's members in defaultReadObject.
defaultReadObjectFVDMembers = fvd.members;
usedReadObject = invokeObjectReader(currentClassDesc,
currentObject,
currentClass);
} finally {
defaultReadObjectFVDMembers = null;
}
// Note that the !usedReadObject !calledDefaultWriteObject
// case is handled by the beginUnmarshalCustomValue method
// of the default state
if (!usedReadObject || readObjectState == IN_READ_OBJECT_DEFAULTS_SENT)
inputClassFields(currentObject, currentClass, currdesc, fvd.members, sender);
if (fvd.is_custom)
readObjectState.endUnmarshalCustomValue(this);
} finally {
setState(oldState);
}
currclass = currentClass = classes[--spClass];
} else {
// The remaining hierarchy of the local class does not match the sender's FVD.
// So, use remaining FVDs to read data off wire. If any remaining FVDs indicate
// custom marshaling, throw MARSHAL error.
inputClassFields(null, currentClass, null, fvd.members, sender);
while (fvdsList.hasMoreElements()){
fvd = (FullValueDescription)fvdsList.nextElement();
if (fvd.is_custom)
skipCustomUsingFVD(fvd.members, sender);
else
inputClassFields(null, currentClass, null, fvd.members, sender);
}
}
} // end : while(fvdsList.hasMoreElements())
while (fvdsList.hasMoreElements()){
FullValueDescription fvd = (FullValueDescription)fvdsList.nextElement();
if (fvd.is_custom)
skipCustomUsingFVD(fvd.members, sender);
else
throwAwayData(fvd.members, sender);
}