Previous changes to BundleArchive starting saving the revision location to
the revision directory, however, when installing exploded bundle directories
the revision directory was not created since it previously wasn't necessary.
Now it is necessary to create the revision directory for referenced
directories because bundle archive needs some place to save the revision
location. Thus, modified DirectoryRevision to create its revision directory.
git-svn-id: https://svn.apache.org/repos/asf/incubator/felix/trunk@423928 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java
index f4a45fb..340be6f 100644
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java
+++ b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java
@@ -44,6 +44,24 @@
m_refDir = new File(location.substring(
location.indexOf(BundleArchive.FILE_PROTOCOL)
+ BundleArchive.FILE_PROTOCOL.length()));
+
+ // If the revision directory exists, then we don't
+ // need to initialize since it has already been done.
+ if (BundleCache.getSecureAction().fileExists(getRevisionRootDir()))
+ {
+ return;
+ }
+
+ // Create revision directory, we only need this to store the
+ // revision location, since nothing else needs to be extracted
+ // since we are referencing a read directory already.
+ if (!BundleCache.getSecureAction().mkdir(getRevisionRootDir()))
+ {
+ getLogger().log(
+ Logger.LOG_ERROR,
+ getClass().getName() + ": Unable to create revision directory.");
+ throw new IOException("Unable to create archive directory.");
+ }
}
public synchronized Map getManifestHeader()