diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-10-03 07:26:18 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-10-03 07:26:18 +0000 |
commit | 1f450514612928a3134617f1477fbaf05919d728 (patch) | |
tree | 30ffc8c000a65d25dec8229437be5da1c3ee6b99 /sca-java-2.x/trunk | |
parent | b80b45fe8304f3a6e7cc910f1c0de90aac48298d (diff) |
TUSCANY-3956: Fix Java2 Security exception in ContributionHelper.getNestedJarUrls method
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1178314 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk')
-rw-r--r-- | sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ContributionHelper.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ContributionHelper.java b/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ContributionHelper.java index be175d000e..372607193c 100644 --- a/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ContributionHelper.java +++ b/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ContributionHelper.java @@ -24,6 +24,8 @@ import java.io.FileOutputStream; import java.io.IOException; import java.net.URI; import java.net.URL; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.List; import java.util.zip.ZipEntry; @@ -36,9 +38,13 @@ public class ContributionHelper { public static List<URL> getNestedJarUrls(final Contribution contribution) throws IOException { List<URL> urls = new ArrayList<URL>(); - boolean isZipContribution = contribution.getLocation().endsWith(".zip"); - URI uri = URI.create(contribution.getLocation()); - boolean isFolderContribution = !isZipContribution && uri.getScheme().equals("file") && new File(uri.getSchemeSpecificPart()).isDirectory(); + final boolean isZipContribution = contribution.getLocation().endsWith(".zip"); + final URI uri = URI.create(contribution.getLocation()); + boolean isFolderContribution = AccessController.doPrivileged(new PrivilegedAction<Boolean>() { + public Boolean run() { + return !isZipContribution && uri.getScheme().equals("file") && new File(uri.getSchemeSpecificPart()).isDirectory(); + } + }); if (isZipContribution || isFolderContribution) { for (Artifact a : contribution.getArtifacts()) { if (a.getLocation().endsWith(".jar")) { |