From 27e4beeb2ed195985942262f3f94a8c5b069ba66 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 17 Jan 2016 01:06:42 +0300 Subject: fix bl query --- src/main/java/com/juick/server/UserQueries.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/main/java/com/juick/server') diff --git a/src/main/java/com/juick/server/UserQueries.java b/src/main/java/com/juick/server/UserQueries.java index 21373b7d..948b42d4 100644 --- a/src/main/java/com/juick/server/UserQueries.java +++ b/src/main/java/com/juick/server/UserQueries.java @@ -293,10 +293,13 @@ public class UserQueries { } public static boolean isInBLAny(JdbcTemplate sql, int uid, int uid2) { - List res = sql.queryForList("SELECT 1 FROM bl_users " - + "WHERE (user_id=? AND bl_user_id=?) " - + "OR (user_id=? AND bl_user_id=?)", Integer.class, new Object[] {uid, uid2, uid2, uid}); - return res.get(0) == 1; + try { + return sql.queryForObject("SELECT 1 FROM bl_users " + + "WHERE (user_id=? AND bl_user_id=?) " + + "OR (user_id=? AND bl_user_id=?)", new Object[]{uid, uid2, uid2, uid}, Integer.class) == 1; + } catch (EmptyResultDataAccessException e) { + return false; + } } public static List checkBL(Connection sql, int visitor, List uids) { -- cgit v1.2.3