Properly dispose of the module if it is determined that its native library
entries do not exist; if they do not exist an exception is thrown which
was previously just leaving the invalid module in the module factory.
(FELIX-835)


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@727824 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/Felix.java b/framework/src/main/java/org/apache/felix/framework/Felix.java
index 0829d7e..e4567e1 100644
--- a/framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -3505,6 +3505,9 @@
                     // The content loader was opened when trying to find the libraries,
                     // so make sure to close it since it will be deleted.
                     contentLoader.close();
+                    // Remove the module we created, since it is not valid and
+                    // has not yet been added to the bundle to be removed later.
+                    m_factory.removeModule(module);
                     throw new BundleException("Native library does not exist: " + entryName);
                 }
             }