diff --git a/jolie/src/main/java/jolie/net/SocketCommChannelFactory.java b/jolie/src/main/java/jolie/net/SocketCommChannelFactory.java index 5114b39ec..e772e005b 100644 --- a/jolie/src/main/java/jolie/net/SocketCommChannelFactory.java +++ b/jolie/src/main/java/jolie/net/SocketCommChannelFactory.java @@ -26,6 +26,8 @@ import java.net.URI; import java.net.URISyntaxException; import java.nio.channels.SocketChannel; +import java.nio.channels.UnresolvedAddressException; + import jolie.net.ext.CommChannelFactory; import jolie.net.ports.OutputPort; @@ -42,7 +44,13 @@ public SocketCommChannelFactory( CommCore commCore ) { @Override public CommChannel createChannel( URI location, OutputPort port ) throws IOException { - SocketChannel channel = SocketChannel.open( new InetSocketAddress( location.getHost(), location.getPort() ) ); + + SocketChannel channel = null; + try { + channel = SocketChannel.open( new InetSocketAddress( location.getHost(), location.getPort() ) ); + } catch( UnresolvedAddressException e ) { + throw new IOException( "Unable to resolve address: " + location.toString(), e ); + } SocketCommChannel ret = null; try { ret = new SocketCommChannel( channel, location, port.getProtocol() );