public SettingsManager() { FileInputStream in = null; try { in = new FileInputStream(FileUtil.getRobocodeConfigFile()); this.load(in); } catch (FileNotFoundException e) { logError("No " + FileUtil.getRobocodeConfigFile().getName() + ". Using defaults."); } catch (IOException e) { logError("Error while reading " + FileUtil.getRobocodeConfigFile().getName() + ": " + e); } finally { if (in != null) { // noinspection EmptyCatchBlock try { in.close(); } catch (IOException e) {} } } }
public void saveProperties() { FileOutputStream out = null; try { out = new FileOutputStream(FileUtil.getRobocodeConfigFile()); this.store(out, "Robocode Properties"); } catch (IOException e) { Logger.logError(e); } finally { if (out != null) { // noinspection EmptyCatchBlock try { out.close(); } catch (IOException e) {} } } }