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/10/14 18:54:06 UTC
[10/39] usergrid git commit: Fixes NPE from missing org during testing
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/usergrid-1007-shiro-cache
Commit: 52335673b3f9b1dd63300654785a28c9278d22ea
Parents: 0b243c4
Author: Todd Nine <tn...@apigee.com>
Authored: Thu Sep 24 18:32:04 2015 -0600
Committer: Todd Nine <tn...@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 );