diff --git a/wsclient/src/main/java/org/hpccsystems/ws/client/utils/Connection.java b/wsclient/src/main/java/org/hpccsystems/ws/client/utils/Connection.java index a28da183d..6b831f177 100644 --- a/wsclient/src/main/java/org/hpccsystems/ws/client/utils/Connection.java +++ b/wsclient/src/main/java/org/hpccsystems/ws/client/utils/Connection.java @@ -287,7 +287,22 @@ public static boolean isSslProtocol(String protocol) */ public Connection(String connectionstring) throws MalformedURLException { - URL theurl = new URL(connectionstring); + URL theurl = null; + try + { + theurl = new URL(connectionstring); + } + catch (MalformedURLException e) + { + if (connectionstring.contains("_")) + { + throw new MalformedURLException("Invalid URL: Check hostname for invalid underscores: '" + connectionstring + "': " + e.getMessage()); + } + else + { + throw e; + } + } setProtocol(theurl.getProtocol());