if (getSerializationPolicy() instanceof TypeNameObfuscator) {
TypeNameObfuscator obfuscator = (TypeNameObfuscator) getSerializationPolicy();
String instanceClassName = obfuscator.getClassNameForTypeId(typeSignature);
instanceClass = Class.forName(instanceClassName, false, classLoader);
} else {
throw new SerializationException(
"The GWT module was compiled with RPC type name elision enabled, but "
+ getSerializationPolicy().getClass().getName()
+ " does not implement " + TypeNameObfuscator.class.getName());
}
} else {
SerializedInstanceReference serializedInstRef = SerializabilityUtil.decodeSerializedInstanceReference(typeSignature);
instanceClass = Class.forName(serializedInstRef.getName(), false,
classLoader);
validateTypeVersions(instanceClass, serializedInstRef);
}
assert (serializationPolicy != null);
serializationPolicy.validateDeserialize(instanceClass);
Class<?> customSerializer = SerializabilityUtil.hasCustomFieldSerializer(instanceClass);
int index = reserveDecodedObjectIndex();
instance = instantiate(customSerializer, instanceClass);
rememberDecodedObject(index, instance);
Object replacement = deserializeImpl(customSerializer, instanceClass,
instance);
// It's possible that deserializing an object requires the original proxy
// object to be replaced.
if (instance != replacement) {
rememberDecodedObject(index, replacement);
instance = replacement;
}
return instance;
} catch (ClassNotFoundException e) {
throw new SerializationException(e);
} catch (InstantiationException e) {
throw new SerializationException(e);
} catch (IllegalAccessException e) {
throw new SerializationException(e);
} catch (IllegalArgumentException e) {
throw new SerializationException(e);
} catch (InvocationTargetException e) {
throw new SerializationException(e.getTargetException());
} catch (NoSuchMethodException e) {
throw new SerializationException(e);
}
}