diff options
-rw-r--r-- | juick-www/src/main/java/com/juick/www/Home.java | 10 |
1 files changed, 2 insertions, 8 deletions
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) { |