From b9f1dcbcd5a7c1db5890ee6ea2f7f9593d599ce6 Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Thu, 7 Jul 2016 21:05:41 -0400 Subject: [PATCH] Make method `getReportPrefix(Report)` simpler --- .../src/mineplex/core/report/ReportManager.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java index 73e5a90fc..8935edacc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java @@ -395,16 +395,10 @@ public class ReportManager */ public static String getReportPrefix(Report report) { - Optional reportIdOptional = report.getId(); + long reportId = report.getId().orElseThrow(() -> + new IllegalStateException("Report has not yet been assigned an id.")); - if (reportIdOptional.isPresent()) - { - return getReportPrefix(reportIdOptional.get()); - } - else - { - throw new IllegalStateException("Report has not yet been assigned an id."); - } + return getReportPrefix(reportId); } /**