Skip to content

Commit 619bda4

Browse files
author
Stephane Landelle
committed
Make NPE message more explicit when passing a null hostname to avoid proxy, close #560, close #561
1 parent fadedec commit 619bda4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/main/java/com/ning/http/util/ProxyUtils.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,15 @@ public static boolean avoidProxy(final ProxyServer proxyServer, final Request re
108108
* See http://download.oracle.com/javase/1.4.2/docs/guide/net/properties.html
109109
*
110110
* @param proxyServer
111-
* @param target the hostname
111+
* @param hostname the hostname
112112
* @return true if we have to avoid proxy use (obeying non-proxy hosts settings), false otherwise.
113113
*/
114-
public static boolean avoidProxy(final ProxyServer proxyServer, final String target) {
114+
public static boolean avoidProxy(final ProxyServer proxyServer, final String hostname) {
115115
if (proxyServer != null) {
116-
final String targetHost = target.toLowerCase(Locale.ENGLISH);
116+
if (hostname == null)
117+
throw new NullPointerException("hostname");
118+
119+
final String targetHost = hostname.toLowerCase(Locale.ENGLISH);
117120

118121
List<String> nonProxyHosts = proxyServer.getNonProxyHosts();
119122

0 commit comments

Comments
 (0)