aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);