From de72f119fe909fdb87e2492966a8640ba5539285 Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Fri, 30 Sep 2016 01:28:07 +0100 Subject: [PATCH] Don't allow players to handle new accounts in exceptional cases --- .../src/mineplex/core/report/ReportManager.java | 13 ++++--------- .../mineplex/core/report/data/ReportRepository.java | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java index c9b95c904..0dca31d6d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java @@ -519,14 +519,6 @@ public class ReportManager CompletableFuture> future = _reportRepository.getReportsHandling(accountId); return future.thenApply(reportIds -> { - // if for some reason we cannot fetch the report a user is handling - // assume the worst and return true - // this means we do not end up allowing a user to handle multiple reports simultaneously - if (reportIds == null) - { - return true; - } - for (long reportId : reportIds) { if (isActiveReport(reportId).join()) @@ -536,7 +528,10 @@ public class ReportManager } return false; - }); + }).exceptionally(throwable -> true); + // ^ if for some reason we cannot fetch the report a user is handling + // assume the worst and return true + // this means we do not end up allowing a user to handle multiple reports simultaneously } /** diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java index e21a29c71..a90cc8f86 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java @@ -230,7 +230,7 @@ public class ReportRepository future.exceptionally(throwable -> { _logger.log(Level.SEVERE, "Error fetching reports being handled by specified account.", throwable); - return new ArrayList<>(); + return null; }); return future;