You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2015/04/17 17:26:35 UTC
[18/51] [abbrv] incubator-usergrid git commit: return exception
instead of null; add better error trapping for apns
return exception instead of null;add better error trapping for apns
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/90e20320
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/90e20320
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/90e20320
Branch: refs/heads/two-dot-o-import
Commit: 90e2032002df4e415ea9a3d4151a815f5101f4d3
Parents: 20eef25
Author: Shawn Feldman <sf...@apache.org>
Authored: Thu Apr 2 11:32:02 2015 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Thu Apr 2 11:32:02 2015 -0600
----------------------------------------------------------------------
.../corepersistence/CpEntityManagerFactory.java | 8 +++---
.../apns/FailedConnectionListener.java | 28 ++++++++++----------
2 files changed, 19 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/90e20320/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
index 07c0b40..4ffc92a 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
@@ -423,11 +423,13 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
Map<String, UUID> appMap = new HashMap<>();
- ApplicationScope appScope = CpNamingUtils.getApplicationScope( CpNamingUtils.SYSTEM_APP_ID );
- GraphManager gm = managerCache.getGraphManager( appScope );
+ ApplicationScope appScope = CpNamingUtils.getApplicationScope(CpNamingUtils.SYSTEM_APP_ID);
+ GraphManager gm = managerCache.getGraphManager(appScope);
- EntityManager em = getEntityManager( CpNamingUtils.SYSTEM_APP_ID );
+ EntityManager em = getEntityManager(CpNamingUtils.SYSTEM_APP_ID);
Application app = em.getApplication();
+ if(app == null)
+ throw new RuntimeException("System App "+CpNamingUtils.SYSTEM_APP_ID+" should never be null");
Id fromEntityId = new SimpleId( app.getUuid(), app.getType() );
final String edgeType;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/90e20320/stack/services/src/main/java/org/apache/usergrid/services/notifications/apns/FailedConnectionListener.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/notifications/apns/FailedConnectionListener.java b/stack/services/src/main/java/org/apache/usergrid/services/notifications/apns/FailedConnectionListener.java
index 9e3552f..817deab 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/notifications/apns/FailedConnectionListener.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/notifications/apns/FailedConnectionListener.java
@@ -66,22 +66,22 @@ public class FailedConnectionListener implements com.relayrides.pushy.apns.Faile
}
//mark all unsent notifications failed
if (notifications != null) {
- for (SimpleApnsPushNotification notification : notifications) {
- if (notification instanceof APNsNotification) {
- try {
- ((APNsNotification) notification).messageSendFailed(cause);//mark failed with bad token
- } catch (Exception e) {
- logger.error("failed to track notification in failed connection listener", e);
+ notifications.forEach(notification -> {
+ if (notification instanceof APNsNotification) {
+ try {
+ ((APNsNotification) notification).messageSendFailed(cause);//mark failed with bad token
+ } catch (Exception e) {
+ logger.error("failed to track notification in failed connection listener", e);
+ }
+ }
+ //if test this is a problem because you can't connect
+ if (notification instanceof TestAPNsNotification) {
+ TestAPNsNotification testAPNsNotification = ((TestAPNsNotification) notification);
+ testAPNsNotification.setReason(cause);
+ testAPNsNotification.countdown();
}
- }
- //if test this is a problem because you can't connect
- if (notification instanceof TestAPNsNotification) {
- TestAPNsNotification testAPNsNotification = ((TestAPNsNotification) notification);
- testAPNsNotification.setReason(cause);
- testAPNsNotification.countdown();
- }
- }
+ });
pushManager.getQueue().clear();
}
logger.error("Failed to register push connection", cause);