From 10566754c04861b4477cf193f6c11a65127acf9e Mon Sep 17 00:00:00 2001 From: Luis Pabon Date: Tue, 16 Jul 2024 18:04:42 -0400 Subject: [PATCH] Update ReportStreamSenderHelper.java Update getReportId to handle empty string cases --- .../external/reportstream/ReportStreamSenderHelper.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamSenderHelper.java b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamSenderHelper.java index 71dab320e..ed63a24f4 100644 --- a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamSenderHelper.java +++ b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamSenderHelper.java @@ -69,7 +69,10 @@ protected Optional getReportId(String rsResponseBody) { try { Map rsResponse = formatter.convertJsonToObject(rsResponseBody, new TypeReference<>() {}); - return Optional.ofNullable(rsResponse.get("reportId").toString()); + String reportId = rsResponse.get("reportId").toString(); + if (!reportId.isEmpty()) { + return Optional.of(reportId); + } } catch (FormatterProcessingException | NullPointerException e) { logger.logError("Unable to get the reportId", e); }