ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1572466 - /ace/trunk/org.apache.ace.test/src/org/apache/ace/it/gogo/TestDataCommands.java
Date Thu, 27 Feb 2014 08:37:28 GMT
Author: jawi
Date: Thu Feb 27 08:37:28 2014
New Revision: 1572466

URL: http://svn.apache.org/r1572466
Log:
Close writer before the output stream.


Modified:
    ace/trunk/org.apache.ace.test/src/org/apache/ace/it/gogo/TestDataCommands.java

Modified: ace/trunk/org.apache.ace.test/src/org/apache/ace/it/gogo/TestDataCommands.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.test/src/org/apache/ace/it/gogo/TestDataCommands.java?rev=1572466&r1=1572465&r2=1572466&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.test/src/org/apache/ace/it/gogo/TestDataCommands.java (original)
+++ ace/trunk/org.apache.ace.test/src/org/apache/ace/it/gogo/TestDataCommands.java Thu Feb
27 08:37:28 2014
@@ -31,6 +31,7 @@ import java.util.jar.JarOutputStream;
 import java.util.jar.Manifest;
 
 import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.felix.service.command.Descriptor;
@@ -152,10 +153,8 @@ public class TestDataCommands {
             return dataFile.toURI().toURL();
         }
         finally {
+            closeSilently(writer);
             closeSilently(fos);
-            if (writer != null) {
-                writer.close();
-            }
         }
     }
 
@@ -170,6 +169,17 @@ public class TestDataCommands {
         }
     }
 
+    private static void closeSilently(XMLStreamWriter resource) {
+        try {
+            if (resource != null) {
+                resource.close();
+            }
+        }
+        catch (XMLStreamException exception) {
+            // Ignore...
+        }
+    }
+
     private static Manifest getBundleManifest(String name, String bsn, String version, Map<String,
String> additionalHeaders) {
         Manifest manifest = new Manifest();
 



Mime
View raw message