Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit 43b29bf

Browse files
committed
fix Comparison method violates its general contract! issue
1 parent f4c9059 commit 43b29bf

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/main/java/com/appirio/service/challengefeeder/manager/ChallengeDetailMMFeederManager.java

+17
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,18 @@ private static void associateAllSubmissions(List<ChallengeDetailData> challenges
173173
}
174174

175175
userSubmissions.sort((UserSubmissionData usd1, UserSubmissionData usd2) -> {
176+
if (usd1 == null and usd2 == null) {
177+
return 0;
178+
}
179+
180+
if(usd1 == null) {
181+
return 1;
182+
}
183+
184+
if(usd2== null) {
185+
return -1;
186+
}
187+
176188
Double r1;
177189
Double r2;
178190
if (c.getIsSysTestCompleted()) {
@@ -182,6 +194,11 @@ private static void associateAllSubmissions(List<ChallengeDetailData> challenges
182194
r1 = (usd1.getSubmissions().size() > 0) ? usd1.getSubmissions().get(0).getFinalScore() : null;
183195
r2 = (usd2.getSubmissions().size() > 0) ? usd2.getSubmissions().get(0).getFinalScore() : null;
184196
}
197+
198+
if (r1 == null && r2 == null) {
199+
return 0;
200+
}
201+
185202
if (r1 == null) return 1;
186203
if (r2 == null) return -1;
187204
if (r1 > r2) {

0 commit comments

Comments
 (0)