Skip to content

Commit

Permalink
Raise appropriate EADDR* for BindException in UDPSocket.
Browse files Browse the repository at this point in the history
Short term fix for #3659
headius committed May 2, 2016
1 parent 87f3963 commit a4721df
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/src/main/java/org/jruby/ext/socket/RubyUDPSocket.java
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@
package org.jruby.ext.socket;

import java.io.IOException;
import java.net.BindException;
import java.net.ConnectException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
@@ -155,6 +156,9 @@ public IRubyObject bind(ThreadContext context, IRubyObject host, IRubyObject _po

} catch (UnknownHostException e) {
throw SocketUtils.sockerr(runtime, "bind: name or service not known");

} catch (BindException e) {
throw runtime.newErrnoEADDRFromBindException(e);

} catch (SocketException e) {
throw SocketUtils.sockerr(runtime, "bind: name or service not known");

0 comments on commit a4721df

Please sign in to comment.