usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject [10/36] usergrid git commit: Fixes NPE from missing org during testing
Date Thu, 01 Oct 2015 16:27:45 GMT
Fixes NPE from missing org during testing


Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/52335673
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/52335673
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/52335673

Branch: refs/heads/master
Commit: 52335673b3f9b1dd63300654785a28c9278d22ea
Parents: 0b243c4
Author: Todd Nine <tnine@apigee.com>
Authored: Thu Sep 24 18:32:04 2015 -0600
Committer: Todd Nine <tnine@apigee.com>
Committed: Thu Sep 24 18:34:14 2015 -0600

----------------------------------------------------------------------
 .../usergrid/management/AppInfoMigrationPlugin.java      | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/52335673/stack/services/src/main/java/org/apache/usergrid/management/AppInfoMigrationPlugin.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/management/AppInfoMigrationPlugin.java
b/stack/services/src/main/java/org/apache/usergrid/management/AppInfoMigrationPlugin.java
index ff6bbe3..b78b646 100644
--- a/stack/services/src/main/java/org/apache/usergrid/management/AppInfoMigrationPlugin.java
+++ b/stack/services/src/main/java/org/apache/usergrid/management/AppInfoMigrationPlugin.java
@@ -178,6 +178,8 @@ public class AppInfoMigrationPlugin implements MigrationPlugin {
 
         final String name = ( String ) oldAppInfoMap.get( PROPERTY_NAME );
 
+        logger.info( "Attempting to migrate app {}", name );
+
         try {
             final String orgName = name.split( "/" )[0];
             final String appName = name.split( "/" )[1];
@@ -190,6 +192,15 @@ public class AppInfoMigrationPlugin implements MigrationPlugin {
             //avoid management org
 
             EntityRef orgRef = managementEm.getAlias( Group.ENTITY_TYPE, orgName );
+
+            /**
+             * No op, we couldn't find the org, so we can't roll the app forward
+             */
+            if(orgRef == null){
+                logger.error( "Unable to retrieve ref for org {}.  Not migrating app {}",
orgName, appName );
+                return;
+            }
+
             // create and connect new APPLICATION_INFO oldAppInfo to Organization
             managementService.createApplication( orgRef.getUuid(), name, applicationId, null
);
 


Mime
View raw message