File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,13 @@ def decode(data, &block)
6969 @buffer . extract ( data ) . each do |line |
7070 parse_json ( @converter . convert ( line ) , &block )
7171 end
72+ rescue java . lang . IllegalStateException => e
73+ if e . message == "input buffer full" && @decode_size_limit_bytes != "none"
74+ yield event_factory . new_event ( "message" => data [ 0 ..@decode_size_limit_bytes . to_i - 1 ] , "tags" => [ "_jsonparsetoobigfailure" ] ) #TODO check the failure tag
75+ else
76+ # re-raise the error if doesn't correspond to the buffer overflow condition
77+ raise e
78+ end
7279 end
7380
7481 def encode ( event )
Original file line number Diff line number Diff line change 132132
133133 it "should raise an error if the max bytes are exceeded" do
134134 subject . decode ( maximum_payload << "z" ) do |event |
135- expect ( event . get ( "tags" ) ) . to include ( "_jsonparse_too_big_failure " )
135+ expect ( event . get ( "tags" ) ) . to include ( "_jsonparsetoobigfailure " )
136136 expect ( event . get ( "message" ) . size ) . to eq ( decode_size_limit_bytes )
137137 end
138138 end
You can’t perform that action at this time.
0 commit comments