From 4f6e7193c238b4833610fe75eca38a6e7416be79 Mon Sep 17 00:00:00 2001 From: rusefi Date: Thu, 13 Jul 2017 19:23:18 -0400 Subject: [PATCH] #461 --- README.md | 1 + .../com/romraider/util/SettingsManager.java | 32 ++++++++----------- java_console/ui/src/com/rusefi/Launcher.java | 2 +- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index b7946d0643..5b8a744fe7 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ current binaries are always available at http://rusefi.com/build_server/ | Release date | Revision | Details | | ------------ | --------- | ------- | +| 07/13/2017 | r14476 | bugdix #461: SAXParserException on console start-up due to damaged settings.xml file | | 07/09/2017 | r14473 | improvement: IAC solenoid frequencty changeable on the fly | | 06/19/2017 | r14393 | bugfix: pinMode, milMode | | 05/27/2017 | r14221 | improvement: ochGetCommand to support offset and count | diff --git a/java_console/romraider/src/com/romraider/util/SettingsManager.java b/java_console/romraider/src/com/romraider/util/SettingsManager.java index cb1d50aee4..2abb52a0df 100644 --- a/java_console/romraider/src/com/romraider/util/SettingsManager.java +++ b/java_console/romraider/src/com/romraider/util/SettingsManager.java @@ -19,28 +19,26 @@ package com.romraider.util; -import static com.romraider.Version.VERSION; -import static javax.swing.JOptionPane.INFORMATION_MESSAGE; -import static javax.swing.JOptionPane.showMessageDialog; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; - -import com.rusefi.FileLog; -import org.w3c.dom.Document; -import org.xml.sax.InputSource; - import com.romraider.Settings; import com.romraider.swing.JProgressPane; import com.romraider.xml.DOMSettingsBuilder; import com.romraider.xml.DOMSettingsUnmarshaller; +import com.rusefi.FileLog; import com.sun.org.apache.xerces.internal.parsers.DOMParser; +import org.w3c.dom.Document; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; + +import static com.romraider.Version.VERSION; public class SettingsManager { private static final String SETTINGS_FILE = "/settings.xml"; private static final String USER_HOME = - System.getProperty("user.home") + "/.RomRaider"; + System.getProperty("user.home") + "/.rusefi.RomRaider"; private static final String START_DIR = System.getProperty("user.dir"); private static String settingsDir = USER_HOME; @@ -56,7 +54,7 @@ public class SettingsManager { private static Settings load() { Settings loadedSettings; try { - FileInputStream settingsFileIn = null; + FileInputStream settingsFileIn; try { final File sf = new File(USER_HOME + SETTINGS_FILE); settingsFileIn = new FileInputStream(sf); @@ -72,11 +70,9 @@ public class SettingsManager { parser.parse(src); final Document doc = parser.getDocument(); loadedSettings = domUms.unmarshallSettings(doc.getDocumentElement()); - } catch (FileNotFoundException e) { - FileLog.MAIN.logLine("Settings file not found. Using default settings."); + } catch (SAXException | IOException e) { + FileLog.MAIN.logLine("Settings file not found or damaged. Using default settings."); loadedSettings = new Settings(); - } catch (Exception e) { - throw new RuntimeException(e); } return loadedSettings; } diff --git a/java_console/ui/src/com/rusefi/Launcher.java b/java_console/ui/src/com/rusefi/Launcher.java index cd912d04e4..37ee9aaab6 100644 --- a/java_console/ui/src/com/rusefi/Launcher.java +++ b/java_console/ui/src/com/rusefi/Launcher.java @@ -45,7 +45,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig; * @see EngineSnifferPanel */ public class Launcher { - public static final int CONSOLE_VERSION = 20170622; + public static final int CONSOLE_VERSION = 20170713; public static final boolean SHOW_STIMULATOR = false; private static final String TAB_INDEX = "main_tab"; protected static final String PORT_KEY = "port";