[infrastructure] add external null-annotations (#8848)

Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
J-N-K
2020-10-31 00:29:03 +01:00
committed by GitHub
parent 47d05055db
commit bd664ff0c8
162 changed files with 933 additions and 575 deletions

View File

@@ -408,7 +408,7 @@ public class TelegramHandler extends BaseThingHandler {
return replyIdToCallbackId.get(new ReplyKey(chatId, replyId));
}
public Integer removeMessageId(Long chatId, String replyId) {
public @Nullable Integer removeMessageId(Long chatId, String replyId) {
return replyIdToMessageId.remove(new ReplyKey(chatId, replyId));
}

View File

@@ -255,6 +255,9 @@ public class TelegramActions implements ThingActions {
public boolean sendTelegram(@ActionInput(name = "chatId") @Nullable Long chatId,
@ActionInput(name = "message") @Nullable String message,
@ActionInput(name = "args") @Nullable Object... args) {
if (message == null) {
return false;
}
return sendTelegram(chatId, String.format(message, args));
}
@@ -444,7 +447,14 @@ public class TelegramActions implements ThingActions {
public static boolean sendTelegramAnswer(ThingActions actions, @Nullable String chatId, @Nullable String replyId,
@Nullable String message) {
return ((TelegramActions) actions).sendTelegramAnswer(Long.valueOf(chatId), replyId, message);
if (actions instanceof TelegramActions) {
if (chatId == null) {
return false;
}
return ((TelegramActions) actions).sendTelegramAnswer(Long.valueOf(chatId), replyId, message);
} else {
throw new IllegalArgumentException("Actions is not an instance of TelegramActions");
}
}
@Override