From 611cecae107980963979f71a756be3120000772a Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 21 Sep 2016 21:55:49 +0300 Subject: yet another NumberUtils fix --- juick-www/src/main/java/com/juick/www/Home.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'juick-www') diff --git a/juick-www/src/main/java/com/juick/www/Home.java b/juick-www/src/main/java/com/juick/www/Home.java index 462c47bb..d8688b68 100644 --- a/juick-www/src/main/java/com/juick/www/Home.java +++ b/juick-www/src/main/java/com/juick/www/Home.java @@ -20,6 +20,7 @@ package com.juick.www; import com.juick.server.AdsQueries; import com.juick.server.MessagesQueries; import org.apache.commons.lang3.StringEscapeUtils; +import org.apache.commons.lang3.math.NumberUtils; import org.springframework.jdbc.core.JdbcTemplate; import javax.servlet.ServletException; @@ -37,14 +38,7 @@ import java.util.List; public class Home { protected void doGet(JdbcTemplate sql, JdbcTemplate sqlSearch, HttpServletRequest request, HttpServletResponse response, com.juick.User visitor) throws ServletException, IOException { - int paramBefore = 0; - String paramBeforeStr = request.getParameter("before"); - if (paramBeforeStr != null) { - try { - paramBefore = Integer.parseInt(paramBeforeStr); - } catch (NumberFormatException e) { - } - } + int paramBefore = NumberUtils.toInt(request.getParameter("before"), 0); String paramSearch = request.getParameter("search"); if (paramSearch != null && paramSearch.length() > 64) { -- cgit v1.2.3