diff options
author | Vitaly Takmazov | 2018-08-26 09:46:39 +0000 |
---|---|---|
committer | Vitaly Takmazov | 2018-08-26 09:46:39 +0000 |
commit | b8f55bc41ddbeb9e274436534fd4eb58706f73a9 (patch) | |
tree | bb3ac3ec001868d7c38418bb000b53e79c91fe9b /juick-server/src/main | |
parent | 4e9b933a720d68a6fc898633f8c8f744ae5e84e5 (diff) |
do not throw on invalid link from telegram
Diffstat (limited to 'juick-server/src/main')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/TelegramBotManager.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/juick-server/src/main/java/com/juick/server/TelegramBotManager.java b/juick-server/src/main/java/com/juick/server/TelegramBotManager.java index b4865dfb..9f5be577 100644 --- a/juick-server/src/main/java/com/juick/server/TelegramBotManager.java +++ b/juick-server/src/main/java/com/juick/server/TelegramBotManager.java @@ -181,7 +181,13 @@ public class TelegramBotManager implements NotificationListener { juickLink.get().url()).build(); String path = uriComponents.getPath(); if (StringUtils.isNotEmpty(path) && path.length() > 1) { - int mid = Integer.valueOf(path.substring(3)); + int mid = 0; + try { + mid = Integer.valueOf(path.substring(3)); + } catch (NumberFormatException e) { + logger.warn("wrong mid received"); + return; + } String prefix = String.format("#%d ", mid); if (StringUtils.isNotEmpty(uriComponents.getFragment())) { int rid = Integer.valueOf(uriComponents.getFragment()); |