UDPSocket.bind throws a Java Error when already bound on Java 5
---------------------------------------------------------------
Key: JRUBY-2891
URL: http://jira.codehaus.org/browse/JRUBY-2891
Project: JRuby
Issue Type: Bug
Affects Versions: JRuby 1.1.3
Reporter: Charles Oliver Nutter
Assignee: Charles Oliver Nutter
Fix For: JRuby 1.1.4
This is due to a bug in Java 5:
{noformat}
~/NetBeansProjects/jruby ➔ jruby spec/mspec/bin/mspec ci
spec/ruby/1.8/library/socket/udpsocket/
java.lang.Error: Untranslated exception
at sun.nio.ch.Net.translateToSocketException(Net.java:63)
at sun.nio.ch.DatagramSocketAdaptor.bind(DatagramSocketAdaptor.java:83)
at org.jruby.ext.socket.RubyUDPSocket.bind(RubyUDPSocket.java:121)
at
org.jruby.ext.socket.RubyUDPSocket$i_method_2_0$RUBYINVOKER$bind.call(org/jruby/ext/socket/RubyUDPSocket$i_method_2_0$RUBYINVOKER$bind.gen)
...
at org.jruby.Ruby.runScript(Ruby.java:542)
at org.jruby.Ruby.runNormally(Ruby.java:455)
at org.jruby.Ruby.runFromMain(Ruby.java:328)
at org.jruby.Main.run(Main.java:203)
at org.jruby.Main.run(Main.java:100)
at
org.jruby.util.ShellLauncher$ScriptThreadProcess.run(ShellLauncher.java:96)
at java.lang.Thread.run(Thread.java:613)
Caused by: java.net.SocketException: Already bound
at sun.nio.ch.Net.translateToSocketException(Net.java:49)
... 215 more
Caused by: sun.nio.ch.AlreadyBoundException
at sun.nio.ch.DatagramChannelImpl.bind(DatagramChannelImpl.java:497)
at sun.nio.ch.DatagramSocketAdaptor.bind(DatagramSocketAdaptor.java:81)
... 214 more
{noformat}
See this bug report: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6303753
I'm fixing it by catching Error and checking for a wrapped SocketException.
--
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