From f1f6491a5635f9e0d8115bee0d6fc3316c9330bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francesco=20Chicchiricc=C3=B2?= <--global> Date: Sun, 13 Jul 2014 07:56:24 +0200 Subject: [PATCH] Removing all leaks on Android --- .../request/batch/AbstractODataBatchRequest.java | 12 ++++++------ .../request/batch/ODataSingleResponseItem.java | 9 +++++++++ .../request/batch/v3/ODataBatchRequestImpl.java | 8 ++++++++ .../request/batch/v4/ODataBatchRequestImpl.java | 9 +++++++++ 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractODataBatchRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractODataBatchRequest.java index df03f49c4..428dbf59c 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractODataBatchRequest.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/AbstractODataBatchRequest.java @@ -49,10 +49,6 @@ public abstract class AbstractODataBatchRequest expectedResItems = new ArrayList(); - protected void addExpectedResItem(ODataBatchResponseItem item) { - expectedResItems.add(item); - } - /** * Constructor. * @@ -69,6 +65,10 @@ public abstract class AbstractODataBatchRequest getBody() { return new ODataBatchResponseManager(this, expectedResItems); } + + @Override + public void close() { + for (ODataBatchResponseItem resItem : expectedResItems) { + resItem.close(); + } + super.close(); + } } } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v4/ODataBatchRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v4/ODataBatchRequestImpl.java index f7dc70797..52d5194ad 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v4/ODataBatchRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v4/ODataBatchRequestImpl.java @@ -124,5 +124,14 @@ public class ODataBatchRequestImpl public Iterator getBody() { return new ODataBatchResponseManager(this, expectedResItems, continueOnError); } + + @Override + public void close() { + for (ODataBatchResponseItem resItem : expectedResItems) { + resItem.close(); + } + super.close(); + } + } }