You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by mr...@apache.org on 2016/06/15 16:25:33 UTC

[40/50] [abbrv] usergrid git commit: bug fix - When cursor queryparam is passed in with an empty value then throw 400.

bug fix - When cursor queryparam is passed in with an empty value then throw 400.


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

Branch: refs/heads/master
Commit: 0eaea9890b5149f2e7203a90c1dd37a886bbd12c
Parents: 38909ad
Author: Ayesha Dastagiri <ay...@gmail.com>
Authored: Mon Jun 6 13:55:41 2016 -0700
Committer: Ayesha Dastagiri <ay...@gmail.com>
Committed: Mon Jun 6 13:55:41 2016 -0700

----------------------------------------------------------------------
 .../pipeline/cursor/RequestCursor.java            | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/0eaea989/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/cursor/RequestCursor.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/cursor/RequestCursor.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/cursor/RequestCursor.java
index dc6ae71..acd6e25 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/cursor/RequestCursor.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/cursor/RequestCursor.java
@@ -20,17 +20,15 @@
 package org.apache.usergrid.corepersistence.pipeline.cursor;
 
 
-import java.util.Base64;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import com.fasterxml.jackson.core.Base64Variant;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
 
 /**
  * A cursor that has been passed in with our request.  Adds utils for parsing values
@@ -76,13 +74,13 @@ public class RequestCursor {
      * Deserialize from the cursor as json nodes
      */
     private Map<Integer, JsonNode> fromCursor( final String cursor ) throws CursorParseException {
-        try {
-
-
+        if(cursor.isEmpty()){
+            throw new IllegalArgumentException("cursor cannot be empty");
+        }
 
+        try {
             JsonNode jsonNode = CursorSerializerUtil.fromString( cursor );
 
-
             Preconditions
                 .checkArgument( jsonNode.size() <= MAX_CURSOR_COUNT, " You cannot have more than " + MAX_CURSOR_COUNT + " cursors" );