Skip to content

Commit

Permalink
Merge pull request #10 from DevFactory/release/multiple-code-improvem…
Browse files Browse the repository at this point in the history
…ents-fix-1

Multiple code improvements - squid:S1118, squid:S00108
  • Loading branch information
mlaccetti committed Apr 4, 2016
2 parents 21e9ae8 + 2e1e149 commit 08c7347
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/javapns/Push.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import javapns.notification.transmission.NotificationThread;
import javapns.notification.transmission.NotificationThreads;
import javapns.notification.transmission.PushQueue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;
import java.util.Vector;
Expand All @@ -32,6 +34,9 @@
* @see NotificationThreads
*/
public class Push {

private static final Logger logger = LoggerFactory.getLogger(Push.class);

private Push() {
// empty
}
Expand Down Expand Up @@ -184,6 +189,7 @@ private static PushedNotifications sendPayload(final Payload payload, final Obje
try {
pushManager.stopConnection();
} catch (final Exception e) {
logger.error(e.getMessage(), e);
}
}
return notifications;
Expand Down Expand Up @@ -212,6 +218,7 @@ public static PushedNotifications payload(final Payload payload, final Object ke
try {
threads.waitForAllThreads(true);
} catch (final InterruptedException e) {
logger.error(e.getMessage(), e);
}
return threads.getPushedNotifications();
}
Expand Down Expand Up @@ -272,6 +279,7 @@ public static PushedNotifications payloads(final Object keystore, final String p
try {
threads.waitForAllThreads(true);
} catch (final InterruptedException e) {
logger.error(e.getMessage(), e);
}
return threads.getPushedNotifications();
}
Expand Down Expand Up @@ -312,6 +320,7 @@ private static PushedNotifications sendPayloads(final Object keystore, final Str
try {
pushManager.stopConnection();
} catch (final Exception e) {
logger.error(e.getMessage(), e);
}
}
return notifications;
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/javapns/communication/KeystoreManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
public class KeystoreManager {
private static final String REVIEW_MESSAGE = " Please review the procedure for generating a keystore for JavaPNS.";

private KeystoreManager() {}

/**
* Loads a keystore.
*
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/javapns/devices/Devices.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import java.util.Vector;

public class Devices {

private Devices() {}

public static List<Device> asDevices(final Object rawList) {
final List<Device> list = new Vector<>();
if (rawList == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public static PushNotificationPayload sound(final String sound) {
try {
payload.addSound(sound);
} catch (final JSONException e) {
logger.error(e.getMessage(), e);
}
return payload;
}
Expand Down Expand Up @@ -153,6 +154,7 @@ public static PushNotificationPayload combined(final String message, final int b
payload.addSound(sound);
}
} catch (final JSONException e) {
logger.error(e.getMessage(), e);
}
return payload;
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/javapns/notification/ResponsePacketReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class ResponsePacketReader {
/* The number of seconds to wait for a response */
private static final int TIMEOUT = 5 * 1000;

private ResponsePacketReader() {}

/**
* Read response packets from the current APNS connection and process them.
*
Expand Down

0 comments on commit 08c7347

Please sign in to comment.