You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2009/06/17 17:22:18 UTC
svn commit: r785663 -
/felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/DirectoryWatcher.java
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)
{