diff --git a/bundles/org.openhab.binding.pushbullet/src/main/java/org/openhab/binding/pushbullet/internal/action/PushbulletActions.java b/bundles/org.openhab.binding.pushbullet/src/main/java/org/openhab/binding/pushbullet/internal/action/PushbulletActions.java index 4cf67df8a9cd0..c8716bae1cdf1 100644 --- a/bundles/org.openhab.binding.pushbullet/src/main/java/org/openhab/binding/pushbullet/internal/action/PushbulletActions.java +++ b/bundles/org.openhab.binding.pushbullet/src/main/java/org/openhab/binding/pushbullet/internal/action/PushbulletActions.java @@ -52,13 +52,15 @@ public class PushbulletActions implements ThingActions { @ActionInput(name = "message", label = "@text/actionSendPushbulletNoteInputMessageLabel", description = "@text/actionSendPushbulletNoteInputMessageDesc") @Nullable String message) { logger.trace("sendPushbulletNote '{}', '{}', '{}'", recipient, title, message); - if (handler == null) { + // Use local variable so the SAT check can do proper flow analysis + PushbulletHandler localHandler = handler; + + if (localHandler == null) { logger.warn("Pushbullet service Handler is null!"); return false; } - // Ignore the SAT warning, we check for nullness just above this line. - return handler.sendPush(recipient, title, message, "note"); + return localHandler.sendPush(recipient, title, message, "note"); } public static boolean sendPushbulletNote(@Nullable ThingActions actions, @Nullable String recipient, @@ -76,13 +78,15 @@ public static boolean sendPushbulletNote(@Nullable ThingActions actions, @Nullab @ActionInput(name = "message", label = "@text/actionSendPushbulletNoteInputMessageLabel", description = "@text/actionSendPushbulletNoteInputMessageDesc") @Nullable String message) { logger.trace("sendPushbulletNote '{}', '{}'", recipient, message); - if (handler == null) { + // Use local variable so the SAT check can do proper flow analysis + PushbulletHandler localHandler = handler; + + if (localHandler == null) { logger.warn("Pushbullet service Handler is null!"); return false; } - // Ignore the SAT warning, we check for nullness just above this line. - return handler.sendPush(recipient, message, "note"); + return localHandler.sendPush(recipient, message, "note"); } public static boolean sendPushbulletNote(@Nullable ThingActions actions, @Nullable String recipient,