Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Socket.pack_sockaddr_in fails for nil port (MRI doesn't) #3156

grddev opened this issue Jul 21, 2015 · 0 comments

Socket.pack_sockaddr_in fails for nil port (MRI doesn't) #3156

grddev opened this issue Jul 21, 2015 · 0 comments


Copy link

@grddev grddev commented Jul 21, 2015

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, "")'

> jruby-1.7.19 -rsocket -e 'p Socket.pack_sockaddr_in(nil, "")'
TypeError: no implicit conversion from nil to integer
  pack_sockaddr_in at org/jruby/ext/socket/
            (root) at -e:1

I'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

reuben-sutton added a commit to reuben-sutton/jruby that referenced this issue Aug 3, 2015
Ensure compatability with MRI Ruby

closes jruby#3156
@kares kares closed this in #3219 Aug 6, 2015
@enebo enebo added this to the JRuby 1.7.22 milestone Aug 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants