From 9e00161260a402cf322f4b964956bb72d20cd4ef Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 12 Dec 2016 17:56:57 +0300 Subject: juick-ws: NumberUtils --- juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'juick-ws/src/main') 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); -- cgit v1.2.3