avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rskr...@apache.org
Subject [avro] branch master updated: AVRO-3180: Interop tests fail on force_encoding (#1296)
Date Sat, 31 Jul 2021 07:08:57 GMT
This is an automated email from the ASF dual-hosted git repository.

rskraba pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/master by this push:
     new fca3cb4  AVRO-3180: Interop tests fail on force_encoding (#1296)
fca3cb4 is described below

commit fca3cb41b40a0b048a43ca33c74262e89afa278b
Author: Tim Perkins <tjwp@users.noreply.github.com>
AuthorDate: Sat Jul 31 03:08:47 2021 -0400

    AVRO-3180: Interop tests fail on force_encoding (#1296)
---
 lang/ruby/lib/avro/ipc.rb | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lang/ruby/lib/avro/ipc.rb b/lang/ruby/lib/avro/ipc.rb
index 67eb10d..72520a5 100644
--- a/lang/ruby/lib/avro/ipc.rb
+++ b/lang/ruby/lib/avro/ipc.rb
@@ -104,7 +104,7 @@ module Avro::IPC
     def request(message_name, request_datum)
       # Writes a request message and reads a response or error message.
       # build handshake and call request
-      buffer_writer = StringIO.new(''.force_encoding('BINARY'))
+      buffer_writer = StringIO.new(String.new('', encoding: 'BINARY'))
       buffer_encoder = Avro::IO::BinaryEncoder.new(buffer_writer)
       write_handshake_request(buffer_encoder)
       write_call_request(message_name, request_datum, buffer_encoder)
@@ -248,7 +248,7 @@ module Avro::IPC
     # a response or error. Compare to 'handle()' in Thrift.
     def respond(call_request, transport=nil)
       buffer_decoder = Avro::IO::BinaryDecoder.new(StringIO.new(call_request))
-      buffer_writer = StringIO.new(''.force_encoding('BINARY'))
+      buffer_writer = StringIO.new(String.new('', encoding: 'BINARY'))
       buffer_encoder = Avro::IO::BinaryEncoder.new(buffer_writer)
       error = nil
       response_metadata = {}
@@ -510,7 +510,7 @@ module Avro::IPC
     def read_framed_message
       message = []
       loop do
-        buffer = ''.force_encoding('BINARY')
+        buffer = String.new('', encoding: 'BINARY')
         buffer_size = read_buffer_size
 
         return message.join if buffer_size == 0
@@ -546,7 +546,7 @@ module Avro::IPC
     end
 
     def transceive(message)
-      writer = FramedWriter.new(StringIO.new(''.force_encoding('BINARY')))
+      writer = FramedWriter.new(StringIO.new(String.new('', encoding: 'BINARY')))
       writer.write_framed_message(message)
       resp = @conn.post('/', writer.to_s, {'Content-Type' => 'avro/binary'})
       FramedReader.new(StringIO.new(resp.body)).read_framed_message

Mime
View raw message