Clearer message for illegal IP addresses

This commit is contained in:
md_5 2019-03-18 13:26:10 +11:00
parent 4428409d41
commit 771f1735e5

View File

@ -29,7 +29,12 @@ public class Util
uri = new URI( "tcp://" + hostline ); uri = new URI( "tcp://" + hostline );
} catch ( URISyntaxException ex ) } catch ( URISyntaxException ex )
{ {
throw new IllegalArgumentException( "Bad hostline", ex ); throw new IllegalArgumentException( "Bad hostline: " + hostline, ex );
}
if ( uri.getHost() == null )
{
throw new IllegalArgumentException( "Invalid host/address: " + hostline );
} }
return new InetSocketAddress( uri.getHost(), ( uri.getPort() ) == -1 ? DEFAULT_PORT : uri.getPort() ); return new InetSocketAddress( uri.getHost(), ( uri.getPort() ) == -1 ? DEFAULT_PORT : uri.getPort() );