STC work in progress

Change-Id: Ie5e444e3b560b605b066899289cdee7a5fe8338c
diff --git a/utils/misc/src/main/java/org/onlab/util/Tools.java b/utils/misc/src/main/java/org/onlab/util/Tools.java
index 61d3c56..d9eb111 100644
--- a/utils/misc/src/main/java/org/onlab/util/Tools.java
+++ b/utils/misc/src/main/java/org/onlab/util/Tools.java
@@ -231,7 +231,6 @@
         }
     }
 
-
     /**
      * Purges the specified directory path. Use with great caution since
      * no attempt is made to check for symbolic links, which could result in
@@ -242,9 +241,12 @@
      */
     public static void removeDirectory(String path) throws IOException {
         DirectoryDeleter visitor = new DirectoryDeleter();
-        walkFileTree(Paths.get(path), visitor);
-        if (visitor.exception != null) {
-            throw visitor.exception;
+        File dir = new File(path);
+        if (dir.exists() && dir.isDirectory()) {
+            walkFileTree(Paths.get(path), visitor);
+            if (visitor.exception != null) {
+                throw visitor.exception;
+            }
         }
     }
 
@@ -258,9 +260,11 @@
      */
     public static void removeDirectory(File dir) throws IOException {
         DirectoryDeleter visitor = new DirectoryDeleter();
-        walkFileTree(Paths.get(dir.getAbsolutePath()), visitor);
-        if (visitor.exception != null) {
-            throw visitor.exception;
+        if (dir.exists() && dir.isDirectory()) {
+            walkFileTree(Paths.get(dir.getAbsolutePath()), visitor);
+            if (visitor.exception != null) {
+                throw visitor.exception;
+            }
         }
     }