Avoid a null dereference and be clear what went wrong
package org.openqa.selenium.remote.internal;
+import static java.util.Objects.requireNonNull;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import com.google.common.base.Strings;
@@ -62,7 +63,7 @@ public HttpResponse execute(HttpRequest request) throws IOException {
rawUrl = baseUrl.toExternalForm().replaceAll("/$", "") + request.getUri();
}
- url = HttpUrl.parse(rawUrl).newBuilder();
+ url = requireNonNull(HttpUrl.parse(rawUrl), "Unable to parse: " + rawUrl).newBuilder();
} catch (NullPointerException e) {
throw new IOException("Unable to parse URL: " + baseUrl.toString() + request.getUri());
}
