You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mb...@apache.org on 2020/10/02 01:07:38 UTC

[asterixdb] 02/11: [NO ISSUE] Close potentially leaking inputstream in TestExecutor

This is an automated email from the ASF dual-hosted git repository.

mblow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git

commit 10d44898a85d22f7bc88b8c5b59d6b5590828e88
Author: Hussain Towaileb <Hu...@Couchbase.com>
AuthorDate: Fri Aug 28 09:59:07 2020 +0300

    [NO ISSUE] Close potentially leaking inputstream in TestExecutor
    
    Details:
    - Close potentially leaking inputstream in TestExecutor.
    
    Change-Id: I61c0874bdb22a27f7462ef02acde3b8347342f33
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/7746
    Tested-by: Hussain Towaileb <hu...@gmail.com>
    Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Reviewed-by: Michael Blow <mb...@apache.org>
    Reviewed-by: Hussain Towaileb <hu...@gmail.com>
---
 .../src/test/java/org/apache/asterix/test/common/TestExecutor.java   | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
index 8bf2ee5..e586878 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
@@ -1569,8 +1569,9 @@ public class TestExecutor {
 
     private ExtractedResult executeUpdateOrDdl(String statement, OutputFormat outputFormat, URI serviceUri)
             throws Exception {
-        InputStream resultStream = executeQueryService(statement, serviceUri, outputFormat, UTF_8);
-        return ResultExtractor.extract(resultStream, UTF_8);
+        try (InputStream resultStream = executeQueryService(statement, serviceUri, outputFormat, UTF_8)) {
+            return ResultExtractor.extract(resultStream, UTF_8);
+        }
     }
 
     protected static boolean isExpected(Exception e, CompilationUnit cUnit) {