try {
Class<?> updateClass = getUpdateClass(updateType);
if (updateClass == null) {
errmsg = "No class registered for update type [sceneId=" + sceneId +
", sceneVersion=" + sceneVersion + ", updateType=" + updateType + "].";
throw new PersistenceException(errmsg);
}
// create the update
SceneUpdate update = (SceneUpdate)updateClass.newInstance();
update.init(sceneId, sceneVersion);
// decode its contents from the serialized data
ByteArrayInputStream bin = new ByteArrayInputStream(data);
update.unpersistFrom(new ObjectInputStream(bin));
return update;
} catch (IOException ioe) {
error = ioe;
errmsg = "Unable to decode update";
} catch (ClassNotFoundException cnfe) {
error = cnfe;
errmsg = "Unable to instantiate update";
} catch (InstantiationException ie) {
error = ie;
errmsg = "Unable to instantiate update";
} catch (IllegalAccessException iae) {
error = iae;
errmsg = "Unable to instantiate update";
}
errmsg += " [sceneId=" + sceneId + ", sceneVersion=" + sceneVersion +
", updateType=" + updateType + "].";
throw new PersistenceException(errmsg, error);
}