You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2015/03/04 18:50:24 UTC

[5/6] incubator-usergrid git commit: [USERGRID-418] Add a catch to ensure that if the database runs with the application already existing it returns an ok. Also adds a logger debug telling people what happens if they have the debug flag.

[USERGRID-418] Add a catch to ensure that if the database runs with the application already existing it returns an ok.
Also adds a logger debug telling people what happens if they have the debug flag.


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

Branch: refs/heads/two-dot-o
Commit: 4588a01eba10e9868f2651de24469ed0b9672125
Parents: dcdb393
Author: grey <gr...@apigee.com>
Authored: Tue Mar 3 13:17:14 2015 -0800
Committer: grey <gr...@apigee.com>
Committed: Tue Mar 3 13:17:14 2015 -0800

----------------------------------------------------------------------
 .../usergrid/management/cassandra/ManagementServiceImpl.java  | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4588a01e/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java b/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
index c44a712..35ed091 100644
--- a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
+++ b/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
@@ -57,6 +57,7 @@ import org.apache.usergrid.persistence.Entity;
 import org.apache.usergrid.persistence.EntityManager;
 import org.apache.usergrid.persistence.EntityManagerFactory;
 import org.apache.usergrid.persistence.EntityRef;
+import org.apache.usergrid.persistence.exceptions.ApplicationAlreadyExistsException;
 import org.apache.usergrid.persistence.index.query.Identifier;
 import org.apache.usergrid.persistence.PagingResultsIterator;
 import org.apache.usergrid.persistence.Results;
@@ -310,7 +311,11 @@ public class ManagementServiceImpl implements ManagementService {
             }
 
             if ( !getApplicationsForOrganization( organization.getUuid() ).containsValue( test_app_name ) ) {
-                createApplication( organization.getUuid(), test_app_name );
+                try {
+                    createApplication( organization.getUuid(), test_app_name );
+                }catch(ApplicationAlreadyExistsException aaee){
+                    logger.debug("The database setup already found an existing application");
+                }
             }
         }
         else {