Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Arthorne2008-01-11 16:45:56 +0000
committerJohn Arthorne2008-01-11 16:45:56 +0000
commit0c26813151c77bda96fb1b35ffcf58e74aa05fd8 (patch)
treea7338e0dc3c573e3c2a84d60e22be3a15ea59b51 /bundles/org.eclipse.equinox.p2.console
parent30aecc5b3ad752b3021f0a6a512d6e9d50ae1ef6 (diff)
downloadrt.equinox.p2-0c26813151c77bda96fb1b35ffcf58e74aa05fd8.tar.gz
rt.equinox.p2-0c26813151c77bda96fb1b35ffcf58e74aa05fd8.tar.xz
rt.equinox.p2-0c26813151c77bda96fb1b35ffcf58e74aa05fd8.zip
Bug 212348 [prov] [repo] Find a way to better report the failure of repository addition
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.console')
-rw-r--r--bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java26
1 files changed, 17 insertions, 9 deletions
diff --git a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java
index 47d13b75f..43f5f76d7 100644
--- a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java
+++ b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java
@@ -36,23 +36,31 @@ public class ProvisioningHelper {
public static IMetadataRepository addMetadataRepository(URL location) {
IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName());
if (manager == null)
- throw new IllegalStateException("No metadata repository manager found");
- IMetadataRepository repository = manager.loadRepository(location, null);
- if (repository != null)
- return repository;
+ throw new IllegalStateException("No metadata repository manager found"); //$NON-NLS-1$
+ try {
+ return manager.loadRepository(location, null);
+ } catch (ProvisionException e) {
+ //fall through and create a new repository
+ }
- // for convenience create and add a repo here
- // TODO need to get rid o fthe factory method.
+ // for convenience create and add a repository here
String repositoryName = location + " - metadata"; //$NON-NLS-1$
- IMetadataRepository result = manager.createRepository(location, repositoryName, IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY);
- return result;
+ try {
+ return manager.createRepository(location, repositoryName, IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY);
+ } catch (ProvisionException e) {
+ return null;
+ }
}
public static IMetadataRepository getMetadataRepository(URL location) {
IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName());
if (manager == null)
throw new IllegalStateException("No metadata repository manager found");
- return manager.loadRepository(location, null);
+ try {
+ return manager.loadRepository(location, null);
+ } catch (ProvisionException e) {
+ return null;
+ }
}
public static void removeMetadataRepository(URL location) {

Back to the top