geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [08/20] incubator-geode git commit: GEODE-907: Incorporate review feedback
Date Wed, 24 Feb 2016 22:07:27 GMT
GEODE-907: Incorporate review feedback


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

Branch: refs/heads/feature/GEODE-953
Commit: c2363f7fc13fb99c373d245a1ba23170a2351d04
Parents: f42c86d
Author: Jens Deppe <jdeppe@pivotal.io>
Authored: Mon Feb 22 11:06:05 2016 -0800
Committer: Jens Deppe <jdeppe@pivotal.io>
Committed: Tue Feb 23 14:04:51 2016 -0800

----------------------------------------------------------------------
 .../tools/pulse/internal/data/Cluster.java      |  8 ++---
 .../tools/pulse/internal/data/DataBrowser.java  | 31 +++++++++++---------
 2 files changed, 21 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c2363f7f/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/Cluster.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/Cluster.java
b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/Cluster.java
index 7d5cac2..5390794 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/Cluster.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/Cluster.java
@@ -19,6 +19,7 @@
 
 package com.vmware.gemfire.tools.pulse.internal.data;
 
+import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -3516,7 +3517,7 @@ public class Cluster extends Thread {
     public ObjectNode executeQuery(String queryText, String members, int limit) {
 
       BufferedReader streamReader = null;
-      ObjectNode jsonObject = mapper.createObjectNode();
+      JsonNode jsonObject = null;
       Random rand = new Random();
       int min = 1, max = 5;
       int randomNum = rand.nextInt(max - min + 1) + min;
@@ -3641,8 +3642,7 @@ public class Cluster extends Thread {
           testQueryResultClusterSmallresponseStrBuilder.append(inputStr);
         }
 
-//        jsonObject = new JSONObject(
-//            testQueryResultClusterSmallresponseStrBuilder.toString());
+        jsonObject = mapper.readTree(testQueryResultClusterSmallresponseStrBuilder.toString());
 
         // close stream reader
         streamReader.close();
@@ -3650,7 +3650,7 @@ public class Cluster extends Thread {
         LOGGER.severe(ex.getMessage());
       }
 
-      return jsonObject;
+      return (ObjectNode) jsonObject;
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c2363f7f/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/DataBrowser.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/DataBrowser.java
b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/DataBrowser.java
index cb955e4..5214fec 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/DataBrowser.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/DataBrowser.java
@@ -109,12 +109,14 @@ public class DataBrowser {
       // Get user's query history list
       ObjectNode userQueries = (ObjectNode) queries.get(userId);
 
-      // Remove user's query
-      userQueries.remove(queryId);
-      queries.put(userId, userQueries);
+      if (userQueries != null) {
+        // Remove user's query
+        userQueries.remove(queryId);
+        queries.put(userId, userQueries);
 
-      // Store queries in file back
-      operationStatus = storeQueriesInFile(queries);
+        // Store queries in file back
+        operationStatus = storeQueriesInFile(queries);
+      }
     }
     
     return operationStatus;
@@ -139,15 +141,16 @@ public class DataBrowser {
       // Get user's query history list
       ObjectNode userQueries = (ObjectNode) queries.get(userId);
 
-      Iterator<String> it = userQueries.fieldNames();
-      while (it.hasNext()) {
-        String key = it.next();
-        ObjectNode queryItem = mapper.createObjectNode();
-        queryItem.put("queryId", key);
-        queryItem.put("queryText", userQueries.get(key).toString());
-        queryItem.put("queryDateTime",
-            simpleDateFormat.format(Long.valueOf(key)));
-        queryList.add(queryItem);
+      if (userQueries != null) {
+        Iterator<String> it = userQueries.fieldNames();
+        while (it.hasNext()) {
+          String key = it.next();
+          ObjectNode queryItem = mapper.createObjectNode();
+          queryItem.put("queryId", key);
+          queryItem.put("queryText", userQueries.get(key).toString());
+          queryItem.put("queryDateTime", simpleDateFormat.format(Long.valueOf(key)));
+          queryList.add(queryItem);
+        }
       }
     }
 


Mime
View raw message