IO#readpartial is non-functional on files
-----------------------------------------

                 Key: JRUBY-2586
                 URL: http://jira.codehaus.org/browse/JRUBY-2586
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.1.2
         Environment: Latest JRuby 1.1.2
            Reporter: Vladimir Sizikov


jruby -e "p File.open('/dev/urandom', 'r').readpartial(16)" # ==> ""

And JRuby always returns an empty string from readpartial call, if IO object is 
a File.

In ChannelStream.readPartial(), we check if the channel is a selectable channel.
And if it's not, then we just return null.

Since, in Java, FileChannels are not selectable, we always return null.

It would be better to print out some warning, or even NotImplementedError, to 
notify users.

At the top of RubyIO.readPartial(), we have some checks that the stream is a 
ChannelStream and raise NotImplementedError. Maybe, we should check for  
selectable channel there in a similar manner?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to