brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From drigod...@apache.org
Subject [1/3] brooklyn-server git commit: Handle empty-dir for `bundleMaker.createJarFromClasspathDir`
Date Mon, 02 Oct 2017 15:04:57 GMT
Repository: brooklyn-server
Updated Branches:
  refs/heads/master 0adf3fdd9 -> e2c0247b6


Handle empty-dir for `bundleMaker.createJarFromClasspathDir`

Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/c2f7cdce
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/c2f7cdce
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/c2f7cdce

Branch: refs/heads/master
Commit: c2f7cdceba0cdd7cd04673903f1d4fce5e092ee6
Parents: 0adf3fd
Author: Aled Sage <aled.sage@gmail.com>
Authored: Mon Oct 2 14:49:04 2017 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Mon Oct 2 14:49:04 2017 +0100

----------------------------------------------------------------------
 .../org/apache/brooklyn/util/core/osgi/BundleMaker.java     | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c2f7cdce/core/src/main/java/org/apache/brooklyn/util/core/osgi/BundleMaker.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/util/core/osgi/BundleMaker.java b/core/src/main/java/org/apache/brooklyn/util/core/osgi/BundleMaker.java
index 65b3aec..d87bcf8 100644
--- a/core/src/main/java/org/apache/brooklyn/util/core/osgi/BundleMaker.java
+++ b/core/src/main/java/org/apache/brooklyn/util/core/osgi/BundleMaker.java
@@ -359,7 +359,14 @@ public class BundleMaker {
         if (startPos<0) {
             throw new IllegalStateException("URL of "+item+" does not appear relative to
root "+root);
         }
-        String itemE = item.substring(startPos + root.length()+1);
+        String itemE = item.substring(startPos + root.length());
+        itemE = Strings.removeFromStart(itemE, "/");
+        
+        if (Strings.isEmpty(itemE)) {
+            // Can happen if we're given an empty folder. addUrlDirToZipRecursively will
have returned false, so 
+            // will try to add it as a file.
+            return; 
+        }
         if (!filter.apply(itemE)) {
             return;
         }


Mime
View raw message