Postmodern created JRUBY-6574:
---------------------------------
Summary: Socket#bind does not convert nil to 0
Key: JRUBY-6574
URL: https://jira.codehaus.org/browse/JRUBY-6574
Project: JRuby
Issue Type: Bug
Components: Standard Library
Affects Versions: JRuby 1.6.7
Environment: jruby 1.6.7 (ruby-1.8.7-p357) (2012-02-22 3e82bc8)
(OpenJDK 64-Bit Server VM 1.6.0_24) [linux-amd64-java]
Reporter: Postmodern
Assignee: Thomas E Enebo
`Socket#bind` does not accept `nil` for the local port to bind to. Both MRI
1.8.7 and Rubinius seem to convert a `nil` port value to `0`.
Reproduction:
{code}
require 'socket'
socket = UDPSocket.new
socket.bind('localhost',nil)
{code}
Expected Results:
{code}
# => 0
{code}
Actual Results:
{noformat}
TypeError: no implicit conversion from nil to integer
from org/jruby/ext/socket/RubyUDPSocket.java:131:in `bind'
from (irb):3:in `evaluate'
from org/jruby/RubyKernel.java:1083:in `eval'
from /home/hal/.rvm/rubies/jruby-1.6.7/lib/ruby/1.8/irb.rb:158:in
`eval_input'
from /home/hal/.rvm/rubies/jruby-1.6.7/lib/ruby/1.8/irb.rb:271:in
`signal_status'
from /home/hal/.rvm/rubies/jruby-1.6.7/lib/ruby/1.8/irb.rb:155:in
`eval_input'
from org/jruby/RubyKernel.java:1410:in `loop'
from org/jruby/RubyKernel.java:1183:in `catch'
from /home/hal/.rvm/rubies/jruby-1.6.7/lib/ruby/1.8/irb.rb:154:in
`eval_input'
from /home/hal/.rvm/rubies/jruby-1.6.7/lib/ruby/1.8/irb.rb:71:in `start'
from org/jruby/RubyKernel.java:1183:in `catch'
from /home/hal/.rvm/rubies/jruby-1.6.7/lib/ruby/1.8/irb.rb:70:in `start'
from /home/hal/.rvm/rubies/jruby-1.6.7/bin/irb:17:in `(root)'
{noformat}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://jira.codehaus.org/secure/ContactAdministrators!default.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