[Groonga-commit] droonga/droonga-engine at 66250f7 [master] Don't parse non-JSON string as a JSON

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Jul 23 17:15:42 JST 2014


YUKI Hiroshi	2014-07-23 17:15:42 +0900 (Wed, 23 Jul 2014)

  New Revision: 66250f748a2bec9c060aa42815847d6a2af9bb49
  https://github.com/droonga/droonga-engine/commit/66250f748a2bec9c060aa42815847d6a2af9bb49

  Message:
    Don't parse non-JSON string as a JSON

  Modified files:
    lib/droonga/serf.rb

  Modified: lib/droonga/serf.rb (+9 -1)
===================================================================
--- lib/droonga/serf.rb    2014-07-23 17:06:37 +0900 (c3025c7)
+++ lib/droonga/serf.rb    2014-07-23 17:15:42 +0900 (5f8e37f)
@@ -119,7 +119,15 @@ module Droonga
       if payload["node"]
         responses = result[:result]["Responses"]
         response = responses[payload["node"]]
-        result[:response] = JSON.parse(response)
+        if response.is_a?(String)
+          begin
+            result[:response] = JSON.parse(response)
+          rescue JSON::ParserError
+            result[:response] = response
+          end
+        else
+          result[:response] = response
+        end
       end
       result
     end
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index