Deal with file: protocol that doesn't populate the path part of the URL

git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@788055 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
slaws 2009-06-24 15:39:38 +00:00
parent 8d10ce8362
commit 318f5abfc5
2 changed files with 7 additions and 6 deletions

View file

@ -38,7 +38,7 @@ public class ContributionHelper {
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).isDirectory();
boolean isFolderContribution = !isZipContribution && uri.getScheme().equals("file") && new File(uri.getSchemeSpecificPart()).isDirectory();
if (isZipContribution || isFolderContribution) {
for (Artifact a : contribution.getArtifacts()) {
if (a.getLocation().endsWith(".jar")) {

View file

@ -115,15 +115,16 @@ public class ContributionContentProcessor implements ExtendedURLArtifactProcesso
// Create a contribution scanner
ContributionScanner scanner = scanners.getContributionScanner(contributionURL.getProtocol());
if (scanner == null) {
try {
if ("file".equals(contributionURL.getProtocol()) && new File(contributionURL.toURI().getPath()).isDirectory()) {
//try {
if ("file".equals(contributionURL.getProtocol()) &&
new File(contributionURL.getFile()).isDirectory()) {
scanner = new DirectoryContributionScanner();
} else {
scanner = new JarContributionScanner();
}
} catch (URISyntaxException e) {
throw new ContributionReadException(e);
}
//} catch (URISyntaxException e) {
// throw new ContributionReadException(e);
//}
}
// Scan the contribution and list the artifacts contained in it