+ if (cdocument==null)
+ throw new Error("Client Error - updateDocument() called before getClientDocument().");
+ if (newdoc!=cdocument)
+ throw new Error("Client Error - SimpleClient.updateDocument() can only take the IClientDocument instance returned from SimpleClient.getClientDocument()");
+ if (!cdocument.isModified()) {
+ if (log.isDebugEnabled())
+ log.debug("updateDocument for "+session.getSessionUrn()+" with unmodified IClientDocument.");
+ } else {
+ try {
+ if (!cdocument.updateSessionDocument()) {
+ log.warn("Session document did not update properly for session directory "+_session.sessionDir);
+ // cdocument.archive.cancelArchive(); // LATER: could be done - would need to prevent updateSessionDocument closing the archive.
+ _session.slog.warn("Session Document updated but may not be valid (false return from org.vamsas.simpleclient.ClientDocument.updateSessionDocument()");
+ }
+ }
+ catch (IOException e) {
+ log.warn("IO Problems when updating document!",e);
+ _session.slog.error("IO problems when attempting to update document.");
+ }
+ }
+ // garbage collect the ClientDocument instance.
+ try {
+ cdocument.finalize();
+
+ } catch (Throwable e) {
+ log.error("Exception when trying to garbage collect ClientDocument for "+session.getSessionUrn(), e);
+ }
+ cdocument = null; // this is probably done by finalize