From a7004c1784ce875db8adbeb7c9d294c1d5e16479 Mon Sep 17 00:00:00 2001 From: antelder Date: Sun, 5 Apr 2009 07:13:04 +0000 Subject: 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 --- .../contribution/java/impl/ContributionHelper.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'java/sca') 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 getNestedJarUrls(final Contribution contribution) throws IOException { List urls = new ArrayList(); - 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); -- cgit v1.2.3