Use instanceof instead of Class#isInstance where feasible
Closes gh-25446
This commit is contained in:
@@ -185,7 +185,7 @@ public class SimpleClientHttpRequestFactory implements ClientHttpRequestFactory,
|
||||
*/
|
||||
protected HttpURLConnection openConnection(URL url, @Nullable Proxy proxy) throws IOException {
|
||||
URLConnection urlConnection = (proxy != null ? url.openConnection(proxy) : url.openConnection());
|
||||
if (!HttpURLConnection.class.isInstance(urlConnection)) {
|
||||
if (!(urlConnection instanceof HttpURLConnection)) {
|
||||
throw new IllegalStateException("HttpURLConnection required for [" + url + "] but got: " + urlConnection);
|
||||
}
|
||||
return (HttpURLConnection) urlConnection;
|
||||
|
||||
@@ -216,7 +216,7 @@ public class ServletServerHttpRequest implements ServerHttpRequest {
|
||||
@Override
|
||||
public ServerHttpAsyncRequestControl getAsyncRequestControl(ServerHttpResponse response) {
|
||||
if (this.asyncRequestControl == null) {
|
||||
if (!ServletServerHttpResponse.class.isInstance(response)) {
|
||||
if (!(response instanceof ServletServerHttpResponse)) {
|
||||
throw new IllegalArgumentException(
|
||||
"Response must be a ServletServerHttpResponse: " + response.getClass());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user