Fix some warnings
[nikiroo-utils.git] / src / be / nikiroo / fanfix / test / Test.java
index 0dc544b8d71d93ba4a74b9fdd903b81ecfb19d50..c5d852d397c5c746a6f2cd34b161b030aaa0496f 100644 (file)
@@ -17,6 +17,13 @@ import be.nikiroo.utils.test.TestLauncher;
  * @author niki
  */
 public class Test extends TestLauncher {
+       /**
+        * Create the Fanfix {@link TestLauncher}.
+        * 
+        * @param args
+        *            the arguments to configure the number of columns and the ok/ko
+        *            {@link String}s
+        */
        public Test(String[] args) {
                super("Fanfix", args);
                Instance.setTraceHandler(null);
@@ -30,6 +37,7 @@ public class Test extends TestLauncher {
         * @param args
         *            the arguments passed to the {@link TestLauncher}s.
         * @throws IOException
+        *             in case of I/O error
         */
        static public void main(String[] args) throws IOException {
                File tmpConfig = File.createTempFile("fanfix-config_", ".test");
@@ -39,12 +47,17 @@ public class Test extends TestLauncher {
                tmpCache.delete();
                tmpCache.mkdir();
 
-               FileOutputStream out = new FileOutputStream(new File(tmpConfig,
-                               "config.properties"));
-               Properties props = new Properties();
-               props.setProperty("CACHE_DIR", tmpCache.getAbsolutePath());
-               props.store(out, null);
-               out.close();
+               FileOutputStream out = null;
+               try {
+                       out = new FileOutputStream(new File(tmpConfig, "config.properties"));
+                       Properties props = new Properties();
+                       props.setProperty("CACHE_DIR", tmpCache.getAbsolutePath());
+                       props.store(out, null);
+               } finally {
+                       if (out != null) {
+                               out.close();
+                       }
+               }
 
                ConfigBundle config = new ConfigBundle();
                Bundles.setDirectory(tmpConfig.getAbsolutePath());