Skip to content
Permalink
Browse files
1.8 does not have this read(0) short-circuit.
  • Loading branch information
headius committed Dec 24, 2014
1 parent b13ef5c commit 5c47af705cbd57ef5410234836022f34fc723966
Showing with 3 additions and 3 deletions.
  1. +2 −2 core/src/main/java/org/jruby/RubyIO.java
  2. +1 −1 test/test_socket.rb
@@ -3136,7 +3136,7 @@ private IRubyObject readNotAll(ThreadContext context, OpenFile myOpenFile, int l
Ruby runtime = context.runtime;
str.empty();

if (length == 0) return str;
if (runtime.is1_9() && length == 0) return str;

try {
ByteList newBuffer = readNotAllCommon(context, myOpenFile, length);
@@ -3163,7 +3163,7 @@ private IRubyObject readNotAll(ThreadContext context, OpenFile myOpenFile, int l
private IRubyObject readNotAll(ThreadContext context, OpenFile myOpenFile, int length) {
Ruby runtime = context.runtime;

if (length == 0) return RubyString.newEmptyString(runtime);
if (runtime.is1_9() && length == 0) return RubyString.newEmptyString(runtime);

try {
ByteList newBuffer = readNotAllCommon(context, myOpenFile, length);
@@ -530,6 +530,6 @@ def test_read_zero_never_blocks
ensure
server.close rescue nil
client.close rescue nil
end
end if RUBY_VERSION >= '1.9'
end

0 comments on commit 5c47af7

Please sign in to comment.