You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by gr...@apache.org on 2015/03/25 21:46:02 UTC

incubator-usergrid git commit: General error checking and exception throwing

Repository: incubator-usergrid
Updated Branches:
  refs/heads/two-dot-o_exception_verification 5937f9fb0 -> e4a9c742f


General error checking and exception throwing


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

Branch: refs/heads/two-dot-o_exception_verification
Commit: e4a9c742fa8d3e5bcd84980002cf3db2b1a2cef6
Parents: 5937f9f
Author: GERey <gr...@apigee.com>
Authored: Wed Mar 25 13:46:01 2015 -0700
Committer: GERey <gr...@apigee.com>
Committed: Wed Mar 25 13:46:01 2015 -0700

----------------------------------------------------------------------
 .../org/apache/usergrid/corepersistence/CpEntityManager.java   | 5 ++++-
 .../persistence/collection/mvcc/stage/write/WriteCommit.java   | 6 +++---
 .../usergrid/persistence/collection/util/EntityUtils.java      | 6 +++++-
 3 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e4a9c742/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
index 789e640..4126186 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
@@ -2658,11 +2658,14 @@ public class CpEntityManager implements EntityManager {
             handleWriteUniqueVerifyException( entity, wuve );
         }
         catch ( HystrixRuntimeException hre ) {
-
+            logger.error( "HystrixRuntimeException found during batch create " ,hre.getFailureType() );
             if ( hre.getCause() instanceof WriteUniqueVerifyException ) {
                 WriteUniqueVerifyException wuve = ( WriteUniqueVerifyException ) hre.getCause();
                 handleWriteUniqueVerifyException( entity, wuve );
+            }else{
+                throw hre;
             }
+
         }
 
         // Index CP entity into default collection scope

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e4a9c742/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteCommit.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteCommit.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteCommit.java
index d3c8193..ffd7f87 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteCommit.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteCommit.java
@@ -51,9 +51,9 @@ import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
 
 import rx.functions.Func1;
 
-
+//TODO: can write commit fail and everything else still work.
 /**
- * This phase should invoke any finalization, and mark the entity as committed in the 
+ * This phase should invoke any finalization, and mark the entity as committed in the
  * data store before returning
  */
 @Singleton
@@ -137,7 +137,7 @@ public class WriteCommit implements Func1<CollectionIoEvent<MvccEntity>, Entity>
                 "Failed to execute write asynchronously ", e );
         }
 
-
+        ValidationUtils.verifyTimeUuid( mvccEntity.getVersion(),"version" );
         return mvccEntity.getEntity().get();
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e4a9c742/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/util/EntityUtils.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/util/EntityUtils.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/util/EntityUtils.java
index cf964a3..5571a57 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/util/EntityUtils.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/util/EntityUtils.java
@@ -12,6 +12,8 @@ import org.apache.commons.lang3.reflect.FieldUtils;
 import org.apache.usergrid.persistence.model.entity.Entity;
 import org.apache.usergrid.persistence.model.entity.Id;
 
+import com.google.common.base.Preconditions;
+
 
 /**
  * @author tnine
@@ -23,7 +25,7 @@ public class EntityUtils {
 
     private static final java.lang.reflect.Field ID = FieldUtils.getField( Entity.class, "id", true );
 
-
+    //TODO: what does this do? Why are we using FieldUtils to set versions and id's.
     /**
      * Set the version into the entity
      */
@@ -35,6 +37,8 @@ public class EntityUtils {
         catch ( IllegalAccessException e ) {
             throw new RuntimeException( "Unable to set the field " + VERSION + " into the entity", e );
         }
+
+        Preconditions.checkArgument( entity.getVersion().equals( version ), "version didn't get set" );
     }