[Groonga-commit] groonga/fluent-plugin-groonga at 2925d8a [master] Ignore invalid JSON for response in the input groonga plugin

Back to archive index

Masafumi Yokoyama null+****@clear*****
Mon Oct 3 15:18:32 JST 2016


Masafumi Yokoyama	2016-10-03 15:18:32 +0900 (Mon, 03 Oct 2016)

  New Revision: 2925d8a950ea1659a8e5d88c33b962a5321fceec
  https://github.com/groonga/fluent-plugin-groonga/commit/2925d8a950ea1659a8e5d88c33b962a5321fceec

  Message:
    Ignore invalid JSON for response in the input groonga plugin

  Modified files:
    lib/fluent/plugin/in_groonga.rb

  Modified: lib/fluent/plugin/in_groonga.rb (+9 -1)
===================================================================
--- lib/fluent/plugin/in_groonga.rb    2016-10-03 12:50:22 +0900 (f5be304)
+++ lib/fluent/plugin/in_groonga.rb    2016-10-03 15:18:32 +0900 (955f6ef)
@@ -376,7 +376,15 @@ module Fluent
 
           case @content_type
           when /\Aapplication\/json\z/
-            response = JSON.parse(@body)
+            begin
+              response = JSON.parse(@body)
+            rescue JSON::ParserError
+              $log.warn("[input][groonga][response][warn] " +
+                         "failed to parse response JSON:",
+                         :error => "#{$!.class}: #{$!}",
+                         :json => @body)
+              response = nil
+            end
           when /\Aapplication\/x-msgpack\z/
             response = MessagePack.unpack(@body)
           when /\Atext\/x-groonga-command-list/
-------------- next part --------------
HTML����������������������������...
Download 



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