Fixes missing observer update

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

Branch: refs/heads/USERGRID-933
Commit: 29c1a12dd1a1f070b1c8523e6213f1bf5ac12931
Parents: 521fc03
Author: Todd Nine <tn...@apigee.com>
Authored: Thu Sep 24 12:45:20 2015 -0600
Committer: Todd Nine <tn...@apigee.com>
Committed: Thu Sep 24 12:45:20 2015 -0600

----------------------------------------------------------------------
 .../management/AppInfoMigrationPlugin.java      | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/29c1a12d/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 d0f39e9..ff6bbe3 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
@@ -150,20 +150,10 @@ public class AppInfoMigrationPlugin implements 
MigrationPlugin {
         //get old app infos to migrate
         final Observable<Entity> oldAppInfos = getOldAppInfos();
         oldAppInfos.doOnNext( oldAppInfoEntity -> {
-            try {
-                migrateAppInfo( oldAppInfoEntity, observer );
-                count.incrementAndGet();
-            }
-            catch ( Exception e ) {
-                if ( e.getCause() instanceof ApplicationAlreadyExistsException 
) {
-                    count.incrementAndGet();
-                    logger.info( "Application already migrated", 
oldAppInfoEntity.getId().getUuid() );
-                }
-                else {
-                    logger.error( "Failed to migrate app info" + 
oldAppInfoEntity.getId().getUuid(), e );
-                    throw new RuntimeException( e );
-                }
-            }
+
+
+            migrateAppInfo( oldAppInfoEntity, observer );
+            count.incrementAndGet();
         } )
             //we want a doOnError to catch something going wrong, otherwise 
we'll mark as complete
             .doOnError( error -> {
@@ -196,7 +186,6 @@ public class AppInfoMigrationPlugin implements 
MigrationPlugin {
             //get app info from graph to see if it has been migrated already
 
 
-
             // create org->app connections, but not for apps in dummy 
"usergrid" internal organization
             //avoid management org
 
@@ -209,6 +198,7 @@ public class AppInfoMigrationPlugin implements 
MigrationPlugin {
         //swallow
         catch ( ApplicationAlreadyExistsException appExists ) {
             logger.info( "Application {} already migrated.  Ignoring.", name );
+            observer.update( getMaxVersion(), "Skipping application " + name + 
" it already exists" );
         }
         catch ( Exception e ) {
             throw new RuntimeException( e );

Reply via email to