aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSangeetha Jayakumar2011-07-20 08:20:29 (EDT)
committerjsievers2011-09-23 05:20:13 (EDT)
commite546790b3beec6ba42d297a8152bf365e2fc3c05 (patch)
treedfdab6bd29e9a37feda7265cd924baecc67cdf9c
parent6d0fd4580a448c87906c4c905780f386cbb86abb (diff)
downloadorg.eclipse.tycho-e546790b3beec6ba42d297a8152bf365e2fc3c05.zip
org.eclipse.tycho-e546790b3beec6ba42d297a8152bf365e2fc3c05.tar.gz
org.eclipse.tycho-e546790b3beec6ba42d297a8152bf365e2fc3c05.tar.bz2
352733 Do not hide OOM error when downloading artifacts
- Show the return status if downloading an artifact fails with a caught exception. Before, an OutOfMemoryError only yielded the generic message "Could not download artifacts from any repository".
-rw-r--r--tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/impl/resolver/ResolutionContextImpl.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/impl/resolver/ResolutionContextImpl.java b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/impl/resolver/ResolutionContextImpl.java
index 727a82c..694a9e1 100644
--- a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/impl/resolver/ResolutionContextImpl.java
+++ b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/impl/resolver/ResolutionContextImpl.java
@@ -30,6 +30,7 @@ import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.SubMonitor;
@@ -72,6 +73,7 @@ import org.eclipse.tycho.p2.repository.LocalRepositoryReader;
import org.eclipse.tycho.p2.repository.LocalTychoRepositoryIndex;
import org.eclipse.tycho.p2.repository.RepositoryReader;
import org.eclipse.tycho.p2.resolver.facade.ResolutionContext;
+import org.eclipse.tycho.p2.util.StatusTool;
// This class has been split off from P2Resolver; TODO divide even further
@SuppressWarnings("restriction")
@@ -441,16 +443,21 @@ public class ResolutionContextImpl implements ResolutionContext {
}
}
+ CompositeArtifactRepository allArtifactRepositories = CompositeArtifactRepository.createMemoryComposite(agent);
for (IArtifactRepository artifactRepository : artifactRepositories) {
- artifactRepository.getArtifacts(requests.toArray(ARTIFACT_REQUEST_ARRAY), monitor);
-
- requests = filterCompletedRequests(requests);
+ allArtifactRepositories.addChild(artifactRepository.getLocation());
+ }
+ IStatus result = allArtifactRepositories.getArtifacts(requests.toArray(ARTIFACT_REQUEST_ARRAY), monitor);
+ if (!result.isOK()) {
+ throw new RuntimeException(StatusTool.collectProblems(result), result.getException()); // TODO find root exception - the MultiStatus probably doesn't have one
}
+ requests = filterCompletedRequests(requests);
localRepository.save();
localMetadataRepository.save();
// check for locally installed artifacts, which are not available from any remote repo
+ // TODO do this before downloading? (see enhancement request 342808)
for (Iterator<MavenMirrorRequest> iter = requests.iterator(); iter.hasNext();) {
MavenMirrorRequest request = iter.next();
if (localRepository.contains(request.getArtifactKey())) {