cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [1/2] cxf git commit: More stream work
Date Wed, 27 Apr 2016 13:30:53 GMT
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 <coheigea@apache.org>
Authored: Wed Apr 27 11:40:37 2016 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
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 "<soap:Envelope" to escape the apache licenses
header
         int beginIndex = input.indexOf("<soap:Envelope");
         input = input.substring(beginIndex);

http://git-wip-us.apache.org/repos/asf/cxf/blob/ae4e8cf0/tools/common/src/main/java/org/apache/cxf/tools/util/PropertyUtil.java
----------------------------------------------------------------------
diff --git a/tools/common/src/main/java/org/apache/cxf/tools/util/PropertyUtil.java b/tools/common/src/main/java/org/apache/cxf/tools/util/PropertyUtil.java
index e1e7a0a..02061cb 100644
--- a/tools/common/src/main/java/org/apache/cxf/tools/util/PropertyUtil.java
+++ b/tools/common/src/main/java/org/apache/cxf/tools/util/PropertyUtil.java
@@ -34,24 +34,24 @@ public class PropertyUtil {
     private Map<String, String>  maps = new HashMap<String, String>();
 
     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;
     }
 


Mime
View raw message