From d6f1aa70db41dc696010fb24751fc0a9d09652cb Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Sat, 29 Jan 2022 12:29:58 +0100 Subject: [PATCH] Disable stacktrace in validation exception --- .../TelegramApiValidationException.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/exceptions/TelegramApiValidationException.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/exceptions/TelegramApiValidationException.java index 1cab9ad3..ca21a1ad 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/exceptions/TelegramApiValidationException.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/exceptions/TelegramApiValidationException.java @@ -26,24 +26,28 @@ import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod; * Exception from method validations */ public class TelegramApiValidationException extends TelegramApiException { - private PartialBotApiMethod method; + + public static final StackTraceElement[] EMPTY_STACK_TRACE = new StackTraceElement[0]; + private PartialBotApiMethod method; private BotApiObject object; - public TelegramApiValidationException(String message, PartialBotApiMethod method) { + public TelegramApiValidationException(String message, PartialBotApiMethod method) { super(message); this.method = method; + this.setStackTrace(new StackTraceElement[0]); } public TelegramApiValidationException(String message, BotApiObject object) { super(message); this.object = object; + this.setStackTrace(EMPTY_STACK_TRACE); } public BotApiObject getObject() { return object; } - public PartialBotApiMethod getMethod() { + public PartialBotApiMethod getMethod() { return method; } @@ -57,4 +61,9 @@ public class TelegramApiValidationException extends TelegramApiException { } return super.toString(); } + + @Override + public Throwable fillInStackTrace() { + return this; + } }