The class com.google.cloud.storage.spi.v1.HttpStorageRpc in google-cloud-storage provides two methods named open() that return the location header from the HTTP response. Both methods fail to properly close the underlying HTTP response returned from com.google.api.client.http.HttpRequest.
The javadoc on com.google.api.client.http.HttpRequest.execute() states:
Callers should call HttpResponse.disconnect when the
returned HTTP response object is no longer needed.
However, HttpResponse.disconnect does not have to be
called if the response stream is properly closed
However the usage in HttpStorageRpc.open() extracts the location header and returns it directly without closing the http response:
HttpResponse response = httpRequest.execute();
if (response.getStatusCode() != 200) {
throw buildStorageException(response.getStatusCode(), response.getStatusMessage());
}
return response.getHeaders().getLocation();
The class
com.google.cloud.storage.spi.v1.HttpStorageRpcingoogle-cloud-storageprovides two methods namedopen()that return the location header from the HTTP response. Both methods fail to properly close the underlying HTTP response returned fromcom.google.api.client.http.HttpRequest.The javadoc on
com.google.api.client.http.HttpRequest.execute()states:However the usage in
HttpStorageRpc.open()extracts the location header and returns it directly without closing the http response: