diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-04-05 07:13:04 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-04-05 07:13:04 +0000 |
commit | a7004c1784ce875db8adbeb7c9d294c1d5e16479 (patch) | |
tree | 8fca6cf6ffcea78295c4be4004223651b90e8e7b /java/sca | |
parent | 006c514795d2deff4c2a60fc40e4c7a669f871b9 (diff) |
Update for zip and folders and fix for nested jars in sub folders
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@762051 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca')
-rw-r--r-- | java/sca/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ContributionHelper.java | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/java/sca/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ContributionHelper.java b/java/sca/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ContributionHelper.java index 38e2795841..54554bcc4e 100644 --- a/java/sca/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ContributionHelper.java +++ b/java/sca/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ContributionHelper.java @@ -18,12 +18,17 @@ public class ContributionHelper { public static List<URL> getNestedJarUrls(final Contribution contribution) throws IOException { List<URL> urls = new ArrayList<URL>(); - for (Artifact a : contribution.getArtifacts()) { - if (a.getLocation().endsWith(".jar")) { - if (contribution.getLocation().endsWith(".zip")) { - urls.add(createTempJar(a, contribution)); - } else { - urls.add(new URL(a.getLocation())); + boolean isZipContribution = contribution.getLocation().endsWith(".zip"); + URI uri = URI.create(contribution.getLocation()); + boolean isFolderContribution = !isZipContribution && uri.getScheme().equals("file") && new File(uri).isDirectory(); + if (isZipContribution || isFolderContribution) { + for (Artifact a : contribution.getArtifacts()) { + if (a.getLocation().endsWith(".jar")) { + if (isZipContribution) { + urls.add(createTempJar(a, contribution)); + } else { + urls.add(new URL(a.getLocation())); + } } } } @@ -42,7 +47,7 @@ public class ContributionHelper { while (zipEntry != null) { if (artifact.getLocation().endsWith(zipEntry.getName())) { - String tempName = "tmp." + artifact.getURI().substring(0, artifact.getURI().length() - 3); + String tempName = ("tmp." + artifact.getURI().substring(0, artifact.getURI().length() - 3)).replace('/', '.'); File tempFile = File.createTempFile(tempName, ".jar"); tempFile.deleteOnExit(); fileOutputStream = new FileOutputStream(tempFile); |