* 1.5 and 1.4 build options\r
* SAXTreeViewer\r
* minor bug and information message fixes.\r
+* legacy import of vamsas 0.1 sessions\r
\r
The SAXTreeViewer was added to the uk.ac.vamsas.test.document package - it is\r
a simple debug tool which will monitor a specific VAMSAS document archive, and\r
import java.io.FileOutputStream;\r
import java.io.ObjectInputStream;\r
import java.io.ObjectOutputStream;\r
+import java.net.URL;\r
\r
import org.apache.commons.logging.Log;\r
import org.apache.commons.logging.LogFactory;\r
o = is.readObject();\r
if (o != null) {\r
try {\r
- sessions = (SimpleSessionHandle[]) o;\r
+ if (o instanceof SimpleSessionHandle[]) {\r
+ sessions = (SimpleSessionHandle[]) o;\r
+ } else {\r
+ // legacy support or incorrect path.\r
+ if (o instanceof SessionHandle[]) {\r
+ log.info("Importing VAMSAS 0.1 clientHandle list.");\r
+ SessionHandle[] oldsess = (SessionHandle[]) o;\r
+ File sessdir;\r
+ sessions = new SimpleSessionHandle[oldsess.length];\r
+ for (int s=0;s<oldsess.length;s++)\r
+ {\r
+ try {\r
+ sessdir = new SessionUrn(oldsess[s].getSessionUrn()).asFile();\r
+ // try to locate it.\r
+ sessions[s] = new SimpleSessionHandle(oldsess[s].getSessionUrn(), sessdir);\r
+ } catch (Exception e)\r
+ {\r
+ // give up and report an error.\r
+ sessions = null;\r
+ throw new Exception("Legacy SessionFile problem. Couldn't locate "+oldsess[s]+" as a file.",e);\r
+ }\r
+ }\r
+ }\r
+ }\r
} catch (Exception e) {\r
log.error("Garbage in the clientHandle list " + this.sessionFile,\r
e);\r