incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [2/3] git commit: Fixing bug with gathering of parameters in trace.
Date Tue, 28 Oct 2014 13:26:50 GMT
Fixing bug with gathering of parameters in trace.


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

Branch: refs/heads/master
Commit: 1fac39cbe2c99d586fda879fb8815c7f807b52cc
Parents: c2dcfbf
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Tue Oct 28 09:25:49 2014 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Tue Oct 28 09:25:49 2014 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/blur/trace/Trace.java   |  4 ++--
 .../java/org/apache/blur/trace/TracerImpl.java   | 19 ++++++++-----------
 2 files changed, 10 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/1fac39cb/blur-util/src/main/java/org/apache/blur/trace/Trace.java
----------------------------------------------------------------------
diff --git a/blur-util/src/main/java/org/apache/blur/trace/Trace.java b/blur-util/src/main/java/org/apache/blur/trace/Trace.java
index 0e20317..65c2bfa 100644
--- a/blur-util/src/main/java/org/apache/blur/trace/Trace.java
+++ b/blur-util/src/main/java/org/apache/blur/trace/Trace.java
@@ -61,10 +61,10 @@ public class Trace {
 
   public static class Parameter {
 
-    final Object _name;
+    final String _name;
     final Object _value;
 
-    public Parameter(Object name, Object value) {
+    public Parameter(String name, Object value) {
       _name = name;
       _value = value;
     }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/1fac39cb/blur-util/src/main/java/org/apache/blur/trace/TracerImpl.java
----------------------------------------------------------------------
diff --git a/blur-util/src/main/java/org/apache/blur/trace/TracerImpl.java b/blur-util/src/main/java/org/apache/blur/trace/TracerImpl.java
index 3e37c19..dc132c6 100644
--- a/blur-util/src/main/java/org/apache/blur/trace/TracerImpl.java
+++ b/blur-util/src/main/java/org/apache/blur/trace/TracerImpl.java
@@ -19,6 +19,7 @@ package org.apache.blur.trace;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.blur.trace.Trace.Parameter;
+import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
 
@@ -98,23 +99,19 @@ public class TracerImpl implements Tracer {
       jsonObject.put("collector", _traceCollector.toJsonObject());
     }
     if (_parameters != null) {
-      jsonObject.put("parameters", getParametersJsonObject());
+      jsonObject.put("parameters", getParametersJSONArray());
     }
     return jsonObject;
   }
 
-  private JSONObject getParametersJsonObject() throws JSONException {
-    JSONObject jsonObject = new JSONObject();
+  private JSONArray getParametersJSONArray() throws JSONException {
+    JSONArray jsonArray = new JSONArray();
     for (Parameter parameter : _parameters) {
-      jsonObject.put(toString(parameter._name), parameter._value);
+      JSONObject jsonObject = new JSONObject();
+      jsonObject.put(parameter._name, parameter._value);
+      jsonArray.put(jsonObject);
     }
-    return jsonObject;
+    return jsonArray;
   }
 
-  private String toString(Object o) {
-    if (o == null) {
-      return null;
-    }
-    return o.toString();
-  }
 }


Mime
View raw message