felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r375557 - /incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/DefaultBundleArchive.java
Date Tue, 07 Feb 2006 10:03:18 GMT
Author: rickhall
Date: Tue Feb  7 02:03:16 2006
New Revision: 375557

URL: http://svn.apache.org/viewcvs?rev=375557&view=rev
Log:
Embedded JAR files are now cached with their full path information to
avoid the possibility of name clashes.

This will cause backwards compatibility issues with old profiles. To
remedy the issue either recreate the profile or simply perform an 'update'
on any impacted bundle.

Modified:
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/DefaultBundleArchive.java

Modified: incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/DefaultBundleArchive.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/DefaultBundleArchive.java?rev=375557&r1=375556&r2=375557&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/DefaultBundleArchive.java
(original)
+++ incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/DefaultBundleArchive.java
Tue Feb  7 02:03:16 2006
@@ -833,10 +833,7 @@
             }
             else
             {
-                String jarName = (classPathStrings[i].lastIndexOf('/') >= 0)
-                    ? classPathStrings[i].substring(classPathStrings[i].lastIndexOf('/')
+ 1)
-                    : classPathStrings[i];
-                classPath[i] = new JarContent(new File(embedDir, jarName));
+                classPath[i] = new JarContent(new File(embedDir, classPathStrings[i]));
             }
         }
 
@@ -1185,18 +1182,26 @@
     {
         // Remove leading slash if present.
         jarPath = (jarPath.charAt(0) == '/') ? jarPath.substring(1) : jarPath;
-        // Get only the JAR file name.
-// TODO: FIX THIS SO THAT IT CREATES DIRECTORIES TO AVOID NAME CLASHES,
-// DOING SO WILL IMPACT getContentLoaderUnchecked() METHOD ABOVE.
-        String jarName = (jarPath.lastIndexOf('/') >= 0)
-            ? jarPath.substring(jarPath.lastIndexOf('/') + 1) : jarPath;
 
         // If JAR is already extracted, then don't
         // re-extract it...
         File embedFile = new File(
-            revisionDir, EMBEDDED_DIRECTORY + File.separatorChar + jarName);
+            revisionDir, EMBEDDED_DIRECTORY + File.separatorChar + jarPath);
+
         if (!embedFile.exists())
         {
+            // Make sure that the embedded JAR's parent directory exists;
+            // it may be in a sub-directory.
+            File embedDir = embedFile.getParentFile();
+            if (!embedDir.exists())
+            {
+                if (!embedDir.mkdirs())
+                {
+                    throw new IOException("Unable to create embedded JAR directory.");
+                }
+            }
+
+            // Extract embedded JAR into its directory.
             JarFile jarFile = null;
             InputStream is = null;
 



Mime
View raw message