From 63844eaba88bbcde5e9ee51b111f849c2e71970d Mon Sep 17 00:00:00 2001 From: pmarguerite Date: Thu, 14 Dec 2006 21:13:31 +0000 Subject: [PATCH] VamsasSession Fix session constructor/initialisation if the session directory already exists git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@304 be28352e-c001-0410-b1a7-c7978e42abec --- .../vamsas/client/simpleclient/VamsasSession.java | 26 ++++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/uk/ac/vamsas/client/simpleclient/VamsasSession.java b/src/uk/ac/vamsas/client/simpleclient/VamsasSession.java index 34b69d7..e2e170c 100644 --- a/src/uk/ac/vamsas/client/simpleclient/VamsasSession.java +++ b/src/uk/ac/vamsas/client/simpleclient/VamsasSession.java @@ -150,32 +150,32 @@ public class VamsasSession { /** * sets up the vamsas session files and watchers in sessionDir - * @param sessionDir + * @param sessionDir1 */ - protected VamsasSession(File sessionDir) throws IOException { - if (sessionDir==null) + protected VamsasSession(File sessionDir1) throws IOException { + if (sessionDir1==null) throw new Error("Null directory for VamsasSession."); - if (sessionDir.exists()) { - if (!sessionDir.isDirectory() || !sessionDir.canWrite() || !sessionDir.canRead()) - throw new IOException("Cannot access '"+sessionDir+"' as a read/writable Directory."); - if (checkSessionFiles(sessionDir)) { + if (sessionDir1.exists()) { + if (!sessionDir1.isDirectory() || !sessionDir1.canWrite() || !sessionDir1.canRead()) + throw new IOException("Cannot access '"+sessionDir1+"' as a read/writable Directory."); + if (checkSessionFiles(sessionDir1)) { createSessionFiles(); } // session files exist in the directory - this.sessionDir = sessionDir; + this.sessionDir = sessionDir1; initSessionObjects(); slog.debug("Initialising additional VamsasSession instance"); - log.debug("Attached to VamsasSession in "+sessionDir); + log.debug("Attached to VamsasSession in "+sessionDir1); //} } else { // start from scratch - if (!sessionDir.mkdir()) - throw new IOException("Failed to make VamsasSession directory in "+sessionDir); - this.sessionDir = sessionDir; + if (!sessionDir1.mkdir()) + throw new IOException("Failed to make VamsasSession directory in "+sessionDir1); + this.sessionDir = sessionDir1; createSessionFiles(); initSessionObjects(); slog.debug("Session directory created."); - log.debug("Initialised VamsasSession in "+sessionDir); + log.debug("Initialised VamsasSession in "+sessionDir1); } } /** -- 1.7.10.2