diff options
Diffstat (limited to 'juick-api/src/main/java/com/juick/api/Messages.java')
-rw-r--r-- | juick-api/src/main/java/com/juick/api/Messages.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/juick-api/src/main/java/com/juick/api/Messages.java b/juick-api/src/main/java/com/juick/api/Messages.java index e461ac07..b1c875d2 100644 --- a/juick-api/src/main/java/com/juick/api/Messages.java +++ b/juick-api/src/main/java/com/juick/api/Messages.java @@ -11,6 +11,7 @@ import com.juick.xmpp.JID; import com.juick.xmpp.Message; import com.juick.xmpp.Stream; import com.juick.xmpp.extensions.JuickMessage; +import org.apache.commons.lang3.math.NumberUtils; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.util.StringUtils; @@ -55,7 +56,7 @@ public class Messages { public void doGetHome(HttpServletRequest request, HttpServletResponse response, int vuid) throws ServletException, IOException { - int before_mid = Utils.parseInt(request.getParameter("before_mid"), 0); + int before_mid = NumberUtils.toInt(request.getParameter("before_mid"), 0); List<Integer> mids = MessagesQueries.getMyFeed(sql, vuid, before_mid); feedMessages(request, response, MessagesQueries.getMessages(sql, mids)); } @@ -63,7 +64,7 @@ public class Messages { public void doGet(HttpServletRequest request, HttpServletResponse response, int vuid) throws ServletException, IOException { - int before_mid = Utils.parseInt(request.getParameter("before_mid"), 0); + int before_mid = NumberUtils.toInt(request.getParameter("before_mid"), 0); String uname = request.getParameter("uname"); String popular = request.getParameter("popular"); String media = request.getParameter("media"); @@ -107,7 +108,7 @@ public class Messages { } public void doThreadGet(HttpServletRequest request, HttpServletResponse response, int vuid) throws IOException { - int mid = Utils.parseInt(request.getParameter("mid"), 0); + int mid = NumberUtils.toInt(request.getParameter("mid"), 0); com.juick.Message msg = MessagesQueries.getMessage(sql, mid); if (msg != null) { if (!MessagesQueries.canViewThread(sql, mid, vuid)) { @@ -125,7 +126,7 @@ public class Messages { public void doGetRecommended(HttpServletRequest request, HttpServletResponse response, int vuid) throws ServletException, IOException { - int before_mid = Utils.parseInt(request.getParameter("before_mid"), 0); + int before_mid = NumberUtils.toInt(request.getParameter("before_mid"), 0); List<Integer> mids = MessagesQueries.getUserRecommendations(sql, vuid, before_mid); if (mids != null && !mids.isEmpty()) { @@ -144,7 +145,7 @@ public class Messages { public void doSetPrivacy(HttpServletRequest request, HttpServletResponse response, Stream xmpp, int vuid) throws ServletException, IOException { - int mid = Utils.parseInt(request.getParameter("mid"), 0); + int mid = NumberUtils.toInt(request.getParameter("mid"), 0); com.juick.User user = MessagesQueries.getMessageAuthor(sql, mid); if (user != null && user.getUID() == vuid && MessagesQueries.setMessagePrivacy(sql, mid)) { Main.replyJSON(request, response, "{\"status\":\"ok\"}"); @@ -156,8 +157,8 @@ public class Messages { public void doSetPopular(HttpServletRequest request, HttpServletResponse response, Stream xmpp) throws ServletException, IOException { - int mid = Utils.parseInt(request.getParameter("mid"), 0); - int popular = Utils.parseInt(request.getParameter("popular"), 0); + int mid = NumberUtils.toInt(request.getParameter("mid"), 0); + int popular = NumberUtils.toInt(request.getParameter("popular"), 0); if (mid > 0) { boolean ret = MessagesQueries.setMessagePopular(sql, mid, popular); |