You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2012/04/27 16:26:01 UTC

svn commit: r1331439 - /geronimo/server/branches/3.0-beta/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationUpdateHelper.java

Author: gawor
Date: Fri Apr 27 14:26:00 2012
New Revision: 1331439

URL: http://svn.apache.org/viewvc?rev=1331439&view=rev
Log:
handle jars in subdirectories in eba

Modified:
    geronimo/server/branches/3.0-beta/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationUpdateHelper.java

Modified: geronimo/server/branches/3.0-beta/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationUpdateHelper.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationUpdateHelper.java?rev=1331439&r1=1331438&r2=1331439&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationUpdateHelper.java (original)
+++ geronimo/server/branches/3.0-beta/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationUpdateHelper.java Fri Apr 27 14:26:00 2012
@@ -538,15 +538,19 @@ public class ApplicationUpdateHelper {
         }
     }
     
-    private static String getBundleNameInArchive(Bundle bundle) {
-        // TODO: handle foo/bar.jar?
-        
+    private String getBundleNameInArchive(Bundle bundle) {
+        String baseLocation = applicationGBean.getBundle().getLocation();
         String location = bundle.getLocation();
-        int pos = location.lastIndexOf('/');
-        if (pos == -1) {
-            throw new RuntimeException("Unable to determine bundle name in application: " + location);
+        if (location.startsWith(baseLocation)) {
+            return location.substring(baseLocation.length());
+        } else {
+            URI bundleLocation = URI.create(location);
+            String bundleNameInApp = bundleLocation.getPath();
+            if (bundleNameInApp.startsWith("/")) {
+                bundleNameInApp = bundleNameInApp.substring(1);
+            }
+            return bundleNameInApp;
         }
-        return location.substring(pos + 1);
     }
 
     private static void close(ZipFile thing) {