]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - tim/prune/function/SaveConfig.java
Version 12, December 2010
[GpsPrune.git] / tim / prune / function / SaveConfig.java
index 0f2339f7ea84708cdd44eeb30d08927516d7cbc2..6c0e4d089cedcfc43e9b17ef7f5c0f328efcd6fb 100644 (file)
@@ -20,9 +20,9 @@ import javax.swing.JLabel;
 import javax.swing.JPanel;
 
 import tim.prune.App;
-import tim.prune.Config;
 import tim.prune.GenericFunction;
 import tim.prune.I18nManager;
+import tim.prune.config.Config;
 
 /**
  * Class to provide the function to save the config settings
@@ -135,14 +135,19 @@ public class SaveConfig extends GenericFunction
                if (response == JFileChooser.APPROVE_OPTION)
                {
                        File saveFile = chooser.getSelectedFile();
+                       FileOutputStream outStream = null;
                        try
                        {
-                               Config.getAllConfig().store(new FileOutputStream(saveFile), "Prune config file");
+                               outStream = new FileOutputStream(saveFile);
+                               Config.getAllConfig().store(outStream, "Prune config file");
                        }
                        catch (IOException ioe) {
                                _app.showErrorMessageNoLookup(getNameKey(),
                                        I18nManager.getText("error.save.failed") + " : " + ioe.getMessage());
                        }
+                       finally {
+                               try {outStream.close();} catch (Exception e) {}
+                       }
                }
                _dialog.dispose();
                _dialog = null;