diff options
author | 2016-01-10 16:56:51 +0300 | |
---|---|---|
committer | 2016-01-10 16:56:51 +0300 | |
commit | c37ed56f884661666b964e47efd23a36be9b24d4 (patch) | |
tree | 64917e400d9c97fac185b4f34fd0063314bb7937 /src/main/java/com/juick/server/PushQueries.java | |
parent | 439d42ef6d60f0a535fdfa2457da8417b70d966a (diff) |
logger, diamond and arraylist refactoring
Diffstat (limited to 'src/main/java/com/juick/server/PushQueries.java')
-rw-r--r-- | src/main/java/com/juick/server/PushQueries.java | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/main/java/com/juick/server/PushQueries.java b/src/main/java/com/juick/server/PushQueries.java index bf7505ca..c17972b0 100644 --- a/src/main/java/com/juick/server/PushQueries.java +++ b/src/main/java/com/juick/server/PushQueries.java @@ -10,6 +10,8 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; /** * @@ -17,12 +19,14 @@ import java.util.List; */ public class PushQueries { + private static final Logger logger = Logger.getLogger(PushQueries.class.getName()); + public static String getAndroidRegID(Connection sql, int uid) { return SQLHelpers.getString(sql, "SELECT regid FROM android WHERE user_id=?", uid); } - public static ArrayList<String> getAndroidSubscribers(Connection sql, int uid) { - ArrayList<String> regids = new ArrayList<String>(); + public static List<String> getAndroidSubscribers(Connection sql, int uid) { + List<String> regids = new ArrayList<>(); PreparedStatement stmt = null; ResultSet rs = null; @@ -35,7 +39,7 @@ public class PushQueries { regids.add(rs.getString(1)); } } catch (SQLException e) { - System.err.println(e); + logger.log(Level.SEVERE, "sql exception", e); } finally { Utils.finishSQL(rs, stmt); } @@ -46,8 +50,8 @@ public class PushQueries { return SQLHelpers.getString(sql, "SELECT url FROM winphone WHERE user_id=?", uid); } - public static ArrayList<String> getWinPhoneSubscribers(Connection sql, int uid) { - ArrayList<String> urls = new ArrayList<String>(); + public static List<String> getWinPhoneSubscribers(Connection sql, int uid) { + List<String> urls = new ArrayList<>(); PreparedStatement stmt = null; ResultSet rs = null; @@ -60,7 +64,7 @@ public class PushQueries { urls.add(rs.getString(1)); } } catch (SQLException e) { - System.err.println(e); + logger.log(Level.SEVERE, "sql exception", e); } finally { Utils.finishSQL(rs, stmt); } @@ -72,7 +76,7 @@ public class PushQueries { } public static List<String> getAPNSSubscribers(Connection sql, int uid) { - List<String> urls = new ArrayList<String>(); + List<String> urls = new ArrayList<>(); PreparedStatement stmt = null; ResultSet rs = null; @@ -85,7 +89,7 @@ public class PushQueries { urls.add(rs.getString(1)); } } catch (SQLException e) { - System.err.println(e); + logger.log(Level.SEVERE, "sql exception", e); } finally { Utils.finishSQL(rs, stmt); } |