Applied patch (FELIX-1203) to check for uninstalled bundle.


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@784160 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/fileinstall/src/main/java/org/apache/felix/fileinstall/DirectoryWatcher.java b/fileinstall/src/main/java/org/apache/felix/fileinstall/DirectoryWatcher.java
index 22a6698..046c954 100644
--- a/fileinstall/src/main/java/org/apache/felix/fileinstall/DirectoryWatcher.java
+++ b/fileinstall/src/main/java/org/apache/felix/fileinstall/DirectoryWatcher.java
@@ -714,6 +714,11 @@
 
             // old can't be null because of the way we calculate deleted list.
             Bundle bundle = context.getBundle(old.getBundleId());
+            if ( bundle == null )
+            {
+            	log( "Failed to uninstall bundle: " + jar.getPath() + " with id: "+old.getBundleId() + ". The bundle has already been uninstalled", null );
+            	return null;
+            }
             bundle.uninstall();
             startupFailures.remove(bundle);
             log("Uninstalled " + jar.getPath(), null);
@@ -734,6 +739,14 @@
             File file = new File(jar.getPath());
             in = new FileInputStream(file);
             Bundle bundle = context.getBundle(jar.getBundleId());
+            if (bundle == null)
+            {
+            	log("Failed to update bundle: "
+                    + jar.getPath() + " with ID "
+                    + jar.getBundleId()
+                    + ". The bundle has been uninstalled", null);
+            	return null;
+            }
             bundle.update(in);
             startupFailures.remove(bundle);
             jar.setLastModified(bundle.getLastModified());