Beispiel #1
0
  /**
   * Load settings from given settings file.
   *
   * @param settingsFile settings file to use
   */
  private void loadSettings(final String settingsFile) {

    if (settingsFile == null || "".equals(settingsFile)) {
      throw new IllegalArgumentException("Parameter settingsFile is invalid.");
    }

    this.settingsFile = settingsFile;
    final File file = new File(settingsFile);

    try {
      settings = settingsSerializer.load(file);

    } catch (final SettingsFormatException e) {
      // if SettingsFormatException was thrown file exists and can be
      // accessed
      file.delete();
      settings = new Settings();
      logger.error("SettingsFormatException when loading settings file.");
    }

    settings.setEventHelper(eventHelper);
  }
Beispiel #2
0
  /**
   * Save settings to file.
   *
   * @param file File to save the settings.
   */
  private void saveSettings(final File file) {

    settingsSerializer.save(this.settings, file);
  }