-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
JRuby raises a TypeError when the port is nil, whereas MRI treats nil the same way as zero.
> ruby-2.2.2 -rsocket -e 'p Socket.pack_sockaddr_in(nil, "127.0.0.1")'
"\x10\x02\x00\x00\x7F\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00"
> jruby-1.7.19 -rsocket -e 'p Socket.pack_sockaddr_in(nil, "127.0.0.1")'
TypeError: no implicit conversion from nil to integer
pack_sockaddr_in at org/jruby/ext/socket/RubySocket.java:272
(root) at -e:1I'm using 1.7.19 in my example, but it seems the code in SocketUtils hasn't changed since 2012 in master, so I'm guessing it still applies to both 1.7.x and 9k. See https://github.com/jruby/jruby/blame/26d0b20ca324d082468bbcbc9d71709b142aa77b/core/src/main/java/org/jruby/ext/socket/SocketUtils.java#L131-L140
Reactions are currently unavailable