Forum: JRuby jruby-1.7.10 - IO.read().size changes after the first access

D128be21af2894373cd9bb1fb0bed5d6?d=identicon&s=25 Aymeric Brisse (Guest)
on 2014-01-28 12:17
(Received via mailing list)
Hi,

I am using jruby-1.7.10. I am having an issue that I don't understand.
The
simple following test does not pass on jruby but works well on MRI. Any
idea ?

describe "IO.read" do
    it "return the same value twice" do
      obj = IO.read(File.join(File.dirname(__FILE__), "fixtures",
'img.jpg'))
      obj.size.should eq obj.size
    end
  end

The first time obj.size returns 314. But after that it returns 311.

Thanks

Aymeric BRISSE
D128be21af2894373cd9bb1fb0bed5d6?d=identicon&s=25 Aymeric Brisse (Guest)
on 2014-01-28 12:34
(Received via mailing list)
FYI, the bug is not reproducible when using the BINARY mode.

So in conclusion :

obj = IO.read(File.join(File.dirname(__FILE__), "fixtures", 'img.jpg'),
encoding: 'UTF-8')
obj.size # returns 314
obj.size # returns 311

obj = IO.read(File.join(File.dirname(__FILE__), "fixtures", 'img.jpg'),
encoding: 'BINARY')
obj.size # returns 314
obj.size # returns 311


Aymeric BRISSE

*R&D Manager*

*Phone : (+33) 6 76 05 66 69*


 <http://perfect-memory.com>



*
<http://www.ibc.org/page.cfm/Action=Exhib/ExhibID=1...
IBC Innovation Finalist Award 2013SEMTECH San Francisco Top 10 Semantic
Startup 2013 *


On Tue, Jan 28, 2014 at 12:13 PM, Aymeric Brisse <
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.