Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMykola Nikishov2018-02-11 08:35:01 -0500
committerAlexander Kurtakov2018-02-12 07:01:06 -0500
commite819e1b82f257d1fa94d397482004cf6852320b4 (patch)
treeeda63dbba81c3dea154bee38e8eb6f690074a95e
parentcee6e4ad430448d69e94cbf8bd65466a7cfba31f (diff)
downloadrt.equinox.p2-e819e1b82f257d1fa94d397482004cf6852320b4.tar.gz
rt.equinox.p2-e819e1b82f257d1fa94d397482004cf6852320b4.tar.xz
rt.equinox.p2-e819e1b82f257d1fa94d397482004cf6852320b4.zip
Bug 423715 - ArtifactRepositoryValidator should catch IAE in order to
throw ProvisionException Check for comparatorId == null is useless because ArtifactComparatorFactory's getArtifactComparator never returns null but throws IllegalArgumentException instead. This way the underlying IAE is leaking to caller and ProvisionException (expected by client) is never thrown. Change-Id: Ib590f6259e31713f7f9601061deef34e56a0552d Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/ArtifactRepositoryValidator.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/repository/tools/comparator/ArtifactComparatorFactory.java2
2 files changed, 5 insertions, 4 deletions
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/ArtifactRepositoryValidator.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/ArtifactRepositoryValidator.java
index 72c0211dc..7380098cb 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/ArtifactRepositoryValidator.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/ArtifactRepositoryValidator.java
@@ -27,10 +27,11 @@ public class ArtifactRepositoryValidator {
private IArtifactComparator comparator;
public ArtifactRepositoryValidator(String comparatorId) throws ProvisionException {
- comparator = ArtifactComparatorFactory.getArtifactComparator(comparatorId);
- if (comparatorId == null)
+ try {
+ comparator = ArtifactComparatorFactory.getArtifactComparator(comparatorId);
+ } catch (IllegalArgumentException e) {
throw new ProvisionException(Messages.invalidComparatorId);
-
+ }
}
public IStatus validateRepository(IArtifactRepository repository) {
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/repository/tools/comparator/ArtifactComparatorFactory.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/repository/tools/comparator/ArtifactComparatorFactory.java
index e0d1216f3..a4beebc4d 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/repository/tools/comparator/ArtifactComparatorFactory.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/repository/tools/comparator/ArtifactComparatorFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2016 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at

Back to the top