Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D2FF81959B for ; Wed, 27 Apr 2016 13:30:53 +0000 (UTC) Received: (qmail 91028 invoked by uid 500); 27 Apr 2016 13:30:53 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 90964 invoked by uid 500); 27 Apr 2016 13:30:53 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 90955 invoked by uid 99); 27 Apr 2016 13:30:53 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Apr 2016 13:30:53 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6A20FDFC55; Wed, 27 Apr 2016 13:30:53 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: coheigea@apache.org To: commits@cxf.apache.org Date: Wed, 27 Apr 2016 13:30:53 -0000 Message-Id: <52f4039ddb0c45bbb5bd80b509ab2a86@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] cxf git commit: More stream work Repository: cxf Updated Branches: refs/heads/master 811f40df5 -> 896f1abec More stream work Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/ae4e8cf0 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/ae4e8cf0 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/ae4e8cf0 Branch: refs/heads/master Commit: ae4e8cf0c44b231d1068da304acbe5453f02e5ca Parents: 811f40d Author: Colm O hEigeartaigh Authored: Wed Apr 27 11:40:37 2016 +0100 Committer: Colm O hEigeartaigh Committed: Wed Apr 27 11:40:37 2016 +0100 ---------------------------------------------------------------------- .../org/apache/cxf/staxutils/StaxUtilsTest.java | 2 ++ .../org/apache/cxf/tools/util/PropertyUtil.java | 30 ++++++++++---------- .../tools/validator/internal/Stax2DOMTest.java | 6 ++-- 3 files changed, 20 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/ae4e8cf0/core/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java b/core/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java index 818d262..eda6049 100644 --- a/core/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java +++ b/core/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java @@ -111,6 +111,7 @@ public class StaxUtilsTest extends Assert { // write output to a string String output = baos.toString(); + baos.close(); // re-read the input xml doc to a string InputStreamReader inputStreamReader = new InputStreamReader(getTestStream(soapMessage)); @@ -123,6 +124,7 @@ public class StaxUtilsTest extends Assert { n = inputStreamReader.read(buffer); } String input = stringWriter.toString(); + stringWriter.close(); // seach for the first begin of " maps = new HashMap(); public void load(InputStream is, String delim) throws IOException { - BufferedReader br = new BufferedReader(new InputStreamReader(is)); - String line = br.readLine(); - while (!StringUtils.isEmpty(line)) { - StringTokenizer st = new StringTokenizer(line, delim); - String key = null; - String value = null; - if (st.hasMoreTokens()) { - key = st.nextToken().trim(); - } - if (st.hasMoreTokens()) { - value = st.nextToken().trim(); - } + try (BufferedReader br = new BufferedReader(new InputStreamReader(is))) { + String line = br.readLine(); + while (!StringUtils.isEmpty(line)) { + StringTokenizer st = new StringTokenizer(line, delim); + String key = null; + String value = null; + if (st.hasMoreTokens()) { + key = st.nextToken().trim(); + } + if (st.hasMoreTokens()) { + value = st.nextToken().trim(); + } - maps.put(key, value); + maps.put(key, value); - line = br.readLine(); + line = br.readLine(); + } } - br.close(); } public void load(InputStream is) throws IOException { http://git-wip-us.apache.org/repos/asf/cxf/blob/ae4e8cf0/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/Stax2DOMTest.java ---------------------------------------------------------------------- diff --git a/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/Stax2DOMTest.java b/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/Stax2DOMTest.java index c0b4141..7340fcc 100644 --- a/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/Stax2DOMTest.java +++ b/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/Stax2DOMTest.java @@ -83,9 +83,9 @@ public class Stax2DOMTest extends Assert { File wsdlFile = new File(getClass().getResource( "/validator_wsdl/jms_test.wsdl").toURI()); File tempFile = File.createTempFile("Stax2DOMTest", ".wsdl"); - FileOutputStream output = new FileOutputStream(tempFile); - IOUtils.copyAndCloseInput(new FileInputStream(wsdlFile), output); - output.close(); + try (FileOutputStream output = new FileOutputStream(tempFile)) { + IOUtils.copyAndCloseInput(new FileInputStream(wsdlFile), output); + } return tempFile; }