diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/AbstractODataResponse.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/AbstractODataResponse.java index 4e8ba49242..a2f2c5492d 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/AbstractODataResponse.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/AbstractODataResponse.java @@ -20,6 +20,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; +import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.PipedInputStream; @@ -282,6 +283,14 @@ public ODataResponse initFromEnclosedPart(final InputStream part) { public void close() { odataClient.getConfiguration().getHttpClientFactory().close(httpClient); + if (res instanceof Closeable){ + try { + ((Closeable)res).close(); + } catch (IOException e) { + LOG.error("Error closing HttpResponse", e); + throw new IllegalStateException(e); + } + } if (batchInfo != null) { batchInfo.setValidBatch(false); }