null pointer exception on attempt to release lock explicitly.
[vamsas.git] / src / uk / ac / vamsas / client / simpleclient / FileLock.java
index c069d95..9201702 100644 (file)
@@ -40,7 +40,7 @@ public class FileLock extends Lock {
         throw new Error("Failed to create advisory lock file "+_lock);
       }
     }
-    return advisory.isLocked();
+    return (advisory!=null) && advisory.isLocked();
   }
   /**
    * call to clear up a filelock file after its been made
@@ -49,8 +49,8 @@ public class FileLock extends Lock {
   private void tidy() {
     if (_lock!=null) { 
       if ( advisory!=null) {
+        advisory.target.deleteOnExit(); // release will null the target
         advisory.release(true);
-        advisory.target.deleteOnExit();
       }
       advisory=null;
       _lock=null;