usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject [19/27] incubator-usergrid git commit: add more validation
Date Wed, 03 Dec 2014 22:32:03 GMT
add more validation


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

Branch: refs/heads/USERGRID-252
Commit: d28af0d8fa4fb97cdad51504f825d8cb3baec93a
Parents: e2c1a53
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Tue Dec 2 15:19:26 2014 -0700
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Tue Dec 2 15:19:26 2014 -0700

----------------------------------------------------------------------
 .../usergrid/persistence/index/impl/EsEntityIndexImpl.java    | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d28af0d8/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
index 588a5a1..0b1cb0c 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
@@ -140,11 +140,12 @@ public class EsEntityIndexImpl implements EntityIndex {
 
     @Override
     public void addIndex(final String indexSuffix, final Map<String,Object> config)
{
-        if(!config.containsKey("replicas") || !config.containsKey("shards")){
-            throw new IllegalArgumentException("config must contains 'replicas' and 'shards'");
+        if(!config.containsKey("replicas") || !config.containsKey("shards") ||
+                !(config.get("replicas") instanceof Integer) || !(config.get("shards") instanceof
Integer)){
+            throw new IllegalArgumentException("config must contains 'replicas' of type int
and 'shards' of type int");
         }
        String normalizedSuffix =  StringUtils.isNotEmpty(indexSuffix) ? indexSuffix : null;
-       addIndex(normalizedSuffix, (int) config.get("shards"),(int)config.get("replicas"));
+       addIndex(normalizedSuffix,(int) config.get("shards"),(int)config.get("replicas"));
     }
 
     private void addIndex(final String indexSuffix,final int numberOfShards, final int numberOfReplicas)
{


Mime
View raw message