From 1d837a835c04078ec66325e9fb9de21ac401874e Mon Sep 17 00:00:00 2001 From: Alexander Alexeev Date: Wed, 30 Nov 2016 15:10:15 +0700 Subject: prevent string concatenation for disabled loggers --- .../src/main/java/com/juick/components/CleanUp.java | 2 +- .../src/main/java/com/juick/components/Notifications.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'juick-notifications/src/main/java/com/juick/components') diff --git a/juick-notifications/src/main/java/com/juick/components/CleanUp.java b/juick-notifications/src/main/java/com/juick/components/CleanUp.java index 06d96471..924d6134 100644 --- a/juick-notifications/src/main/java/com/juick/components/CleanUp.java +++ b/juick-notifications/src/main/java/com/juick/components/CleanUp.java @@ -36,7 +36,7 @@ public class CleanUp { Collection devices = apns.getInactiveDevices().keySet(); int count = devices.size(); if (count > 0) { - logger.info(String.format("%d tokens to delete", count)); + logger.info("{} tokens to delete", count); TokensList list = new TokensList(); list.setType("apns"); list.setTokens(new ArrayList<>(devices)); diff --git a/juick-notifications/src/main/java/com/juick/components/Notifications.java b/juick-notifications/src/main/java/com/juick/components/Notifications.java index dac4d22e..f98fdcce 100644 --- a/juick-notifications/src/main/java/com/juick/components/Notifications.java +++ b/juick-notifications/src/main/java/com/juick/components/Notifications.java @@ -133,12 +133,12 @@ public class Notifications implements AutoCloseable { MulticastResult result = GCMSender.send(message, regids, 3); List results = result.getResults(); for (int i = 0; i < results.size(); i++) { - logger.info("RES " + i + ": " + results.get(i).toString()); + logger.info("RES {}: {}", i, results.get(i)); } } catch (IOException ex) { logger.error(ex.getMessage(), ex); } catch (IllegalArgumentException err) { - logger.warn("Android: Invalid API Key"); + logger.warn("Android: Invalid API Key", err); } } else { logger.info("GMS: no recipients"); @@ -183,7 +183,7 @@ public class Notifications implements AutoCloseable { + ""; logger.trace(xml); for (String url : urls) { - logger.info("WNS: " + url); + logger.info("WNS: {}", url); sendWNS(wnsToken, url, xml); } } catch (IOException | IllegalStateException ex) { @@ -207,7 +207,7 @@ public class Notifications implements AutoCloseable { if (!tokens.isEmpty()) { for (String token : tokens) { String payload = APNS.newPayload().alertTitle("@" + jmsg.getUser().getName()).alertBody(jmsg.getText()).build(); - logger.info("APNS: " + token); + logger.info("APNS: {}", token); apns.push(token, payload); } } else { -- cgit v1.2.3