aboutsummaryrefslogtreecommitdiff
path: root/juick-notifications/src/main/java/com/juick
diff options
context:
space:
mode:
Diffstat (limited to 'juick-notifications/src/main/java/com/juick')
-rw-r--r--juick-notifications/src/main/java/com/juick/components/Notifications.java13
1 files changed, 9 insertions, 4 deletions
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 53bf8684..a42f23cb 100644
--- a/juick-notifications/src/main/java/com/juick/components/Notifications.java
+++ b/juick-notifications/src/main/java/com/juick/components/Notifications.java
@@ -229,10 +229,15 @@ public class Notifications extends TextWebSocketHandler implements NotificationC
invalidAPNSTokens.add(token);
}
}
- if (pushNotificationResponse.getTokenInvalidationTimestamp().before(new Date())) {
- logger.info("Token invalidated: {}", token);
- invalidAPNSTokens.add(token);
- }
+ Optional<Date> invalidationDate = Optional.ofNullable(
+ pushNotificationResponse.getTokenInvalidationTimestamp());
+ invalidationDate.ifPresent(date -> {
+ if (date.before(new Date())) {
+ logger.info("Token invalidated: {}", token);
+ invalidAPNSTokens.add(token);
+ }
+ });
+
} catch (final ExecutionException | InterruptedException ex) {
logger.info("APNS exception", ex);
}