You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Filter the Validate class out of ValidationExceptions, to make it simpler to identify where the validation error originated.
Made malformed URL and empty selection error messages more explicit.
Simplified raising errors for null and empty parameters.
thrownewIllegalArgumentException(String.format("The supplied URL, '%s', is malformed. Make sure it is an absolute URL, and starts with 'http://' or 'https://'.", url), e);
187
187
}
188
188
returnthis;
189
189
}
@@ -199,7 +199,7 @@ public Connection proxy(String host, int port) {
199
199
}
200
200
201
201
publicConnectionuserAgent(StringuserAgent) {
202
-
Validate.notNull(userAgent, "User agent must not be null");
202
+
Validate.notNullParam(userAgent, "userAgent");
203
203
req.header(USER_AGENT, userAgent);
204
204
returnthis;
205
205
}
@@ -220,7 +220,7 @@ public Connection followRedirects(boolean followRedirects) {
220
220
}
221
221
222
222
publicConnectionreferrer(Stringreferrer) {
223
-
Validate.notNull(referrer, "Referrer must not be null");
Validate.notNull(cookies, "Cookie map must not be null");
327
+
Validate.notNullParam(cookies, "cookies");
328
328
for (Map.Entry<String, String> entry : cookies.entrySet()) {
329
329
req.cookie(entry.getKey(), entry.getValue());
330
330
}
@@ -432,7 +432,7 @@ public URL url() {
432
432
}
433
433
434
434
publicTurl(URLurl) {
435
-
Validate.notNull(url, "URL must not be null");
435
+
Validate.notNullParam(url, "url");
436
436
this.url = punyUrl(url); // if calling url(url) directly, does not go through encodeUrl, so we punycode it explicitly. todo - should we encode here as well?
437
437
return (T) this;
438
438
}
@@ -442,13 +442,13 @@ public Method method() {
442
442
}
443
443
444
444
publicTmethod(Methodmethod) {
445
-
Validate.notNull(method, "Method must not be null");
445
+
Validate.notNullParam(method, "method");
446
446
this.method = method;
447
447
return (T) this;
448
448
}
449
449
450
450
publicStringheader(Stringname) {
451
-
Validate.notNull(name, "Header name must not be null");
Validate.isFalse(req.executing, "Multiple threads were detected trying to execute the same request concurrently. Make sure to use Connection#newRequest() and do not share an executing request between threads.");
835
835
req.executing = true;
836
836
}
837
-
Validate.notNull(req, "Request must not be null");
837
+
Validate.notNullParam(req, "req");
838
838
URLurl = req.url();
839
839
Validate.notNull(url, "URL must be specified to connect");
0 commit comments