From 66317deee263f3bd6190230583b4afdf8a136213 Mon Sep 17 00:00:00 2001 From: Ed Merks Date: Sun, 17 Dec 2023 11:22:52 +0100 Subject: [PATCH] Fix bug in requirement sorting --- .../p2repo/aggregator/analyzer/RequirementAnalysis.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/org.eclipse.cbi.p2repo.aggregator.analyzer/src/org/eclipse/cbi/p2repo/aggregator/analyzer/RequirementAnalysis.java b/plugins/org.eclipse.cbi.p2repo.aggregator.analyzer/src/org/eclipse/cbi/p2repo/aggregator/analyzer/RequirementAnalysis.java index 938257e54..647695eda 100644 --- a/plugins/org.eclipse.cbi.p2repo.aggregator.analyzer/src/org/eclipse/cbi/p2repo/aggregator/analyzer/RequirementAnalysis.java +++ b/plugins/org.eclipse.cbi.p2repo.aggregator.analyzer/src/org/eclipse/cbi/p2repo/aggregator/analyzer/RequirementAnalysis.java @@ -54,6 +54,9 @@ public int compare(RequirementAnalysis ra1, RequirementAnalysis ra2) { if (ra1 == null) { return -1; } + if (ra2 == null) { + return 1; + } return REQUIREMENT_COMPARATOR.compare(ra1.getRequirement(), ra2.getRequirement()); } @@ -69,6 +72,9 @@ public int compare(IRequirement r1, IRequirement r2) { if (r1 == null) { return -1; } + if (r2 == null) { + return 1; + } int compare; if (r1 instanceof IRequiredCapability && r2 instanceof IRequiredCapability) { @@ -101,7 +107,7 @@ public int compare(IRequirement r1, IRequirement r2) { compare = pm1.toString().compareTo(pm2.toString()); } } else { - compare = r1.getClass().getName().compareTo(r1.getClass().getName()); + compare = r1.getClass().getName().compareTo(r2.getClass().getName()); } } return compare;