aboutsummaryrefslogtreecommitdiff
path: root/juick-server
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-08-26 09:46:39 +0000
committerGravatar Vitaly Takmazov2018-08-26 09:46:39 +0000
commitb8f55bc41ddbeb9e274436534fd4eb58706f73a9 (patch)
treebb3ac3ec001868d7c38418bb000b53e79c91fe9b /juick-server
parent4e9b933a720d68a6fc898633f8c8f744ae5e84e5 (diff)
do not throw on invalid link from telegram
Diffstat (limited to 'juick-server')
-rw-r--r--juick-server/src/main/java/com/juick/server/TelegramBotManager.java8
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());