Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMykola Nikishov2018-02-14 20:29:14 +0000
committerMykola Nikishov2018-02-14 22:58:47 +0000
commite5de7889121fc2c05563d4b198be4ddabfc529a2 (patch)
treeb54854175e150da086dcd7074a50f708f6bd9e51
parent96587d0026176e10c2e40dca6fc34dde5acd7733 (diff)
downloadrt.equinox.p2-e5de7889121fc2c05563d4b198be4ddabfc529a2.tar.gz
rt.equinox.p2-e5de7889121fc2c05563d4b198be4ddabfc529a2.tar.xz
rt.equinox.p2-e5de7889121fc2c05563d4b198be4ddabfc529a2.zip
Bug 423715 - ArtifactComparatorFactory reports available comparators
Method getArtifactComparator(String) should report which artifact comparators are available. When troubleshooting, user of standalone applications and Ant tasks will have more information. Change-Id: Iba7ea48c139c5ae365bc898804b38dc7cd75cc55 Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/messages.properties2
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/repository/tools/comparator/ArtifactComparatorFactory.java7
2 files changed, 6 insertions, 3 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/messages.properties b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/messages.properties
index 33689fcb8..ada52de67 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/messages.properties
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/messages.properties
@@ -40,7 +40,7 @@ mirror_alreadyExists=Artifact: {0} already exists in repository: {1}.
message_artifactsFromChildRepos=Messages while reading artifacts from child repositories
message_problemReadingArtifact=Problems while reading artifacts from {0}
-exception_comparatorNotFound = The Artifact Comparator {0} was not found.
+exception_comparatorNotFound = The Artifact Comparator {0} was not found. Available artifact comparators: {1}.
exception_noComparators = No Artifact Comparators are available.
MirrorLog_Console_Log=Logging to the console instead.
MirrorLog_Exception_Occurred=An exception occurred while writing to the log:
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 49bdf7302..b8a6dcbff 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
@@ -13,6 +13,7 @@
package org.eclipse.equinox.p2.repository.tools.comparator;
import java.util.*;
+import java.util.stream.Collectors;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.RegistryFactory;
import org.eclipse.equinox.internal.p2.artifact.repository.Messages;
@@ -40,8 +41,10 @@ public class ArtifactComparatorFactory {
if (artifactComparator.isPresent())
return artifactComparator.get();
- if (comparatorID != null)
- throw new IllegalArgumentException(NLS.bind(Messages.exception_comparatorNotFound, comparatorID));
+ if (comparatorID != null) {
+ String comparators = extensions.stream().map(extension -> extension.getAttribute(ATTR_ID)).collect(Collectors.joining(", ")); //$NON-NLS-1$
+ throw new IllegalArgumentException(NLS.bind(Messages.exception_comparatorNotFound, comparatorID, comparators));
+ }
throw new IllegalArgumentException(Messages.exception_noComparators);
}

Back to the top