From 17ba7fb24293a725b2e76833b8ea5943226c331d Mon Sep 17 00:00:00 2001 From: Jym Dyer Date: Thu, 31 Aug 2023 14:35:19 -0700 Subject: [PATCH] Make public static methods contingent on setting PUSH_API_KEY/PUSH_API_URL. Make inner sendPush() method package scope. --- .../opentripplanner/middleware/utils/NotificationUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/opentripplanner/middleware/utils/NotificationUtils.java b/src/main/java/org/opentripplanner/middleware/utils/NotificationUtils.java index c84387da3..4b42d9efd 100644 --- a/src/main/java/org/opentripplanner/middleware/utils/NotificationUtils.java +++ b/src/main/java/org/opentripplanner/middleware/utils/NotificationUtils.java @@ -51,7 +51,7 @@ public class NotificationUtils { */ public static String sendPush(OtpUser otpUser, String textTemplate, Object templateData) { // If Push API config properties aren't set, do nothing. - if (PUSH_API_KEY.equals(null) || PUSH_API_URL.equals(null)) return null; + if (PUSH_API_KEY == null || PUSH_API_URL == null) return null; try { String body = TemplateUtils.renderTemplate(textTemplate, templateData); String toUser = otpUser.email; @@ -286,7 +286,7 @@ public static boolean sendEmailViaSparkpost( */ public static int getPushInfo(String toUser) { // If Push API config properties aren't set, no info can be obtained. - if (PUSH_API_KEY.equals(null) || PUSH_API_URL.equals(null)) return 0; + if (PUSH_API_KEY == null || PUSH_API_URL == null) return 0; try { Map headers = Map.of("Accept", "application/json"); var httpResponse = HttpUtils.httpRequestRawResponse(