From b8a3cfd6d6679342cad7b2cfa49aa45cd39245f9 Mon Sep 17 00:00:00 2001 From: Chrriis Date: Thu, 25 Oct 2012 19:02:31 +0200 Subject: [PATCH] Closing streams that were not properly closed. --- .../jooq/debug/impl/LocalStatementExecutor.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/jOOQ-console/src/main/java/org/jooq/debug/impl/LocalStatementExecutor.java b/jOOQ-console/src/main/java/org/jooq/debug/impl/LocalStatementExecutor.java index c96ff57f0b..84f5211413 100644 --- a/jOOQ-console/src/main/java/org/jooq/debug/impl/LocalStatementExecutor.java +++ b/jOOQ-console/src/main/java/org/jooq/debug/impl/LocalStatementExecutor.java @@ -240,8 +240,12 @@ class LocalStatementExecutor implements QueryExecutor { StringWriter stringWriter = new StringWriter(); char[] chars = new char[1024]; Reader reader = new BufferedReader(clob.getCharacterStream()); - for(int count; (count=reader.read(chars))>=0; ) { - stringWriter.write(chars, 0, count); + try { + for(int count; (count=reader.read(chars))>=0; ) { + stringWriter.write(chars, 0, count); + } + } finally { + reader.close(); } rowData[i] = stringWriter.toString(); } else { @@ -255,8 +259,12 @@ class LocalStatementExecutor implements QueryExecutor { ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] bytes = new byte[1024]; InputStream in = new BufferedInputStream(blob.getBinaryStream()); - for(int count; (count=in.read(bytes))>=0; ) { - baos.write(bytes, 0, count); + try { + for(int count; (count=in.read(bytes))>=0; ) { + baos.write(bytes, 0, count); + } + } finally { + in.close(); } rowData[i] = baos.toByteArray(); } else {