felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r785663 - /felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/DirectoryWatcher.java
Date Wed, 17 Jun 2009 15:22:18 GMT
Author: rickhall
Date: Wed Jun 17 15:22:17 2009
New Revision: 785663

URL: http://svn.apache.org/viewvc?rev=785663&view=rev
Log:
Apply patch (FELIX-1235) to handle misconfigured watch directory.

Modified:
    felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/DirectoryWatcher.java

Modified: felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/DirectoryWatcher.java
URL: http://svn.apache.org/viewvc/felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/DirectoryWatcher.java?rev=785663&r1=785662&r2=785663&view=diff
==============================================================================
--- felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/DirectoryWatcher.java
(original)
+++ felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/DirectoryWatcher.java
Wed Jun 17 15:22:17 2009
@@ -21,7 +21,6 @@
 import java.io.*;
 import java.util.*;
 import java.net.URISyntaxException;
-import java.net.URI;
 
 import org.apache.felix.fileinstall.util.Util;
 import org.osgi.framework.*;
@@ -90,8 +89,20 @@
         {
             dir = "./load";
         }
-        this.watchedDirectory = new File(dir);
-        this.watchedDirectory.mkdirs();
+        watchedDirectory = new File(dir);
+        
+        if (!watchedDirectory.exists() && !watchedDirectory.mkdirs())
+        {
+            log("Cannot create folder " + watchedDirectory + ". Is the folder write-protected?",
null);
+            throw new RuntimeException("Cannot create folder " + watchedDirectory);
+        }
+
+        if (!this.watchedDirectory.isDirectory())
+        {
+            log( "Cannot watch " + watchedDirectory + " because it's not a directory", null);
+            throw new RuntimeException("Cannot start FileInstall to watch something that
is not a directory");
+        }
+        
         Object value = properties.get(START_NEW_BUNDLES);
         if (value != null)
         {



Mime
View raw message