JRuby

TCPSocket.open will not accept a string for the port parameter

Details

  • Number of attachments :
    1

Description

Ruby's TCPSocket.open method will happily accept a string as the port parameter:

socket = TCPSocket.open("waldorf", "7500")
socket.close

This code generates an exception in JRuby:
socket = TCPSocket.open("waldorf", "7500")
TypeError: can't convert String into Integer
from (irb):4:in `open'
from (irb):4:in `binding'
from /Users/fletcher/Desktop/jruby-1.0/lib/ruby/1.8/irb.rb:150:in `eval_input'
from /Users/fletcher/Desktop/jruby-1.0/lib/ruby/1.8/irb.rb:70:in `signal_status'
from /Users/fletcher/Desktop/jruby-1.0/lib/ruby/1.8/irb.rb:189:in `eval_input'
from /Users/fletcher/Desktop/jruby-1.0/lib/ruby/1.8/irb.rb:70:in `each_top_level_statement'
from /Users/fletcher/Desktop/jruby-1.0/lib/ruby/1.8/irb.rb:190:in `loop'
from /Users/fletcher/Desktop/jruby-1.0/lib/ruby/1.8/irb.rb:190:in `catch'
from /Users/fletcher/Desktop/jruby-1.0/lib/ruby/1.8/irb.rb:190:in `eval_input'
from /Users/fletcher/Desktop/jruby-1.0/lib/ruby/1.8/irb.rb:70:in `start'
from :-1:in `catch'
from /Users/fletcher/Desktop/jruby-1.0/lib/ruby/1.8/irb.rb:71:in `start'
from :-1

Activity

Hide
Nicolas Modrzyk added a comment -

attaching ftpsocket.diff to allow to parse a string for the port number.
This is fixing the noticed behavior.

Show
Nicolas Modrzyk added a comment - attaching ftpsocket.diff to allow to parse a string for the port number. This is fixing the noticed behavior.
Hide
Thomas E Enebo added a comment -

Applied on 1.0 branch as well.

Show
Thomas E Enebo added a comment - Applied on 1.0 branch as well.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: