You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@twill.apache.org by ch...@apache.org on 2015/01/09 01:28:05 UTC
[2/3] incubator-twill git commit: (TWILL-108) Do not fail with
exception if same jar is added twice during bundle jar creation
(TWILL-108) Do not fail with exception if same jar is added twice during bundle jar creation
Signed-off-by: Terence Yim <ch...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-twill/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-twill/commit/36577aee
Tree: http://git-wip-us.apache.org/repos/asf/incubator-twill/tree/36577aee
Diff: http://git-wip-us.apache.org/repos/asf/incubator-twill/diff/36577aee
Branch: refs/heads/branch-0.4.1
Commit: 36577aee4144d15f366107e992702331977856bb
Parents: 7da6e6a
Author: Mike Walch <mw...@gmail.com>
Authored: Wed Nov 5 11:13:49 2014 -0500
Committer: Terence Yim <ch...@apache.org>
Committed: Thu Jan 8 16:27:38 2015 -0800
----------------------------------------------------------------------
.../apache/twill/internal/ApplicationBundler.java | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-twill/blob/36577aee/twill-core/src/main/java/org/apache/twill/internal/ApplicationBundler.java
----------------------------------------------------------------------
diff --git a/twill-core/src/main/java/org/apache/twill/internal/ApplicationBundler.java b/twill-core/src/main/java/org/apache/twill/internal/ApplicationBundler.java
index dcc4dbd..3f2d073 100644
--- a/twill-core/src/main/java/org/apache/twill/internal/ApplicationBundler.java
+++ b/twill-core/src/main/java/org/apache/twill/internal/ApplicationBundler.java
@@ -343,13 +343,15 @@ public final class ApplicationBundler {
String prefix = path.endsWith(".jar") ? SUBDIR_LIB : SUBDIR_RESOURCES;
path = prefix + path.substring(path.lastIndexOf('/') + 1);
- saveDirEntry(prefix, entries, jarOut);
- jarOut.putNextEntry(new JarEntry(path));
- InputStream is = url.openStream();
- try {
- ByteStreams.copy(is, jarOut);
- } finally {
- is.close();
+ if (entries.add(path)) {
+ saveDirEntry(prefix, entries, jarOut);
+ jarOut.putNextEntry(new JarEntry(path));
+ InputStream is = url.openStream();
+ try {
+ ByteStreams.copy(is, jarOut);
+ } finally {
+ is.close();
+ }
}
}