Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Arthorne2008-01-11 19:44:52 +0000
committerJohn Arthorne2008-01-11 19:44:52 +0000
commit1f258fb6ac201453758093c8aefc9df97a8ad54d (patch)
tree4cf46b44734f7412328c02aac9fa506b20d01441 /bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/mirror
parenta88c0d834badddf3dd4a08fd15ba6b0519c9c90d (diff)
downloadrt.equinox.p2-1f258fb6ac201453758093c8aefc9df97a8ad54d.tar.gz
rt.equinox.p2-1f258fb6ac201453758093c8aefc9df97a8ad54d.tar.xz
rt.equinox.p2-1f258fb6ac201453758093c8aefc9df97a8ad54d.zip
Bug 212348 [prov] [repo] Find a way to better report the failure of repository addition
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/mirror')
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/mirror/MirrorApplication.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/mirror/MirrorApplication.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/mirror/MirrorApplication.java
index eced9e191..bd6d2de73 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/mirror/MirrorApplication.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/mirror/MirrorApplication.java
@@ -16,6 +16,7 @@ import org.eclipse.equinox.internal.p2.artifact.repository.Activator;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
import org.eclipse.equinox.p2.artifact.repository.IArtifactRepository;
import org.eclipse.equinox.p2.artifact.repository.IArtifactRepositoryManager;
+import org.eclipse.equinox.p2.core.ProvisionException;
public class MirrorApplication implements IApplication {
@@ -34,7 +35,7 @@ public class MirrorApplication implements IApplication {
return null;
}
- private void setupRepositories() {
+ private void setupRepositories() throws ProvisionException {
IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
if (manager == null)
// TODO log here
@@ -47,17 +48,18 @@ public class MirrorApplication implements IApplication {
destination = source;
}
- private IArtifactRepository initializeDestination() {
+ private IArtifactRepository initializeDestination() throws ProvisionException {
IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
- IArtifactRepository repository = manager.loadRepository(destinationLocation, null);
- if (repository != null) {
+ try {
+ IArtifactRepository repository = manager.loadRepository(destinationLocation, null);
if (!repository.isModifiable())
throw new IllegalArgumentException("Artifact repository not modifiable: " + destinationLocation); //$NON-NLS-1$
if (!append)
repository.removeAll();
return repository;
+ } catch (ProvisionException e) {
+ //fall through and create a new repository below
}
-
// the given repo location is not an existing repo so we have to create something
// TODO for now create a Simple repo by default.
String repositoryName = destinationLocation + " - artifacts"; //$NON-NLS-1$

Back to the top