aboutsummaryrefslogtreecommitdiff
path: root/juick-ws/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-12-12 17:56:57 +0300
committerGravatar Vitaly Takmazov2016-12-12 17:56:57 +0300
commit9e00161260a402cf322f4b964956bb72d20cd4ef (patch)
treec3d08c1ffdc305a5c118973bf671e429a3d7730d /juick-ws/src
parent1702d4f5e4eace80a1323e520b004a08497e3309 (diff)
juick-ws: NumberUtils
Diffstat (limited to 'juick-ws/src')
-rw-r--r--juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java6
1 files changed, 2 insertions, 4 deletions
diff --git a/juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java b/juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java
index adb39bb2..85f936b5 100644
--- a/juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java
+++ b/juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java
@@ -3,6 +3,7 @@ package com.juick.ws;
import com.juick.User;
import com.juick.service.MessagesService;
import com.juick.service.UserService;
+import org.apache.commons.lang3.math.NumberUtils;
import org.apache.http.NameValuePair;
import org.apache.http.client.utils.URLEncodedUtils;
import org.slf4j.Logger;
@@ -77,10 +78,7 @@ public class WebsocketComponent extends TextWebSocketHandler {
sockSubscr = new SocketSubscribed(session, hXRealIP, visitor, true);
sockSubscr.allReplies = true;
} else if (hLocation.getPath().matches("/\\d+$")) {
- try {
- MID = Integer.parseInt(hLocation.getPath().substring(1));
- } catch (Exception e) {
- }
+ MID = NumberUtils.toInt(hLocation.getPath().substring(1), 0);
if (MID > 0) {
if (messagesService.canViewThread(MID, visitor.getUid())) {
logger.info("user {} connected to legacy thread ({}) from {}", visitor.getUid(), MID, hXRealIP);