loading user settings before generating executable jar, added debugging output

This commit is contained in:
fros4943 2010-03-19 11:32:59 +00:00
parent c5c6c3b775
commit aa41f9218a
2 changed files with 13 additions and 12 deletions

View File

@ -24,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: GUI.java,v 1.164 2010/03/15 11:04:37 fros4943 Exp $
* $Id: GUI.java,v 1.165 2010/03/19 11:32:59 fros4943 Exp $
*/
package se.sics.cooja;
@ -2734,8 +2734,6 @@ public class GUI extends Observable {
filename = GUI.EXTERNAL_TOOLS_LINUX_SETTINGS_FILENAME;
}
logger.info("Loading external tools user settings from: " + filename);
try {
InputStream in = GUI.class.getResourceAsStream(filename);
if (in == null) {
@ -2747,10 +2745,9 @@ public class GUI extends Observable {
currentExternalToolsSettings = settings;
defaultExternalToolsSettings = (Properties) currentExternalToolsSettings.clone();
logger.info("External tools default settings: " + filename);
} catch (IOException e) {
// Error while importing default properties
logger.warn(
"Error when reading external tools settings from " + filename, e);
logger.warn("Error when reading external tools settings from " + filename, e);
} finally {
if (currentExternalToolsSettings == null) {
defaultExternalToolsSettings = new Properties();
@ -2773,17 +2770,16 @@ public class GUI extends Observable {
settings.load(in);
in.close();
Enumeration en = settings.keys();
Enumeration<Object> en = settings.keys();
while (en.hasMoreElements()) {
String key = (String) en.nextElement();
setExternalToolsSetting(key, settings.getProperty(key));
}
logger.info("External tools user settings: " + externalToolsUserSettingsFile);
} catch (FileNotFoundException e) {
// No default configuration file found, using default
logger.warn("Error when reading user settings from: " + externalToolsUserSettingsFile);
} catch (IOException e) {
// Error while importing saved properties, using default
logger.warn("Error when reading default settings from " + externalToolsUserSettingsFile);
logger.warn("Error when reading user settings from: " + externalToolsUserSettingsFile);
}
}

View File

@ -24,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: ExecuteJAR.java,v 1.7 2010/03/19 09:08:38 fros4943 Exp $
* $Id: ExecuteJAR.java,v 1.8 2010/03/19 11:32:59 fros4943 Exp $
*/
package se.sics.cooja.util;
@ -97,6 +97,9 @@ public class ExecuteJAR {
/* Load simulation */
logger.info("Loading " + config);
GUI.externalToolsUserSettingsFile = new File(
System.getProperty("user.home"),
GUI.EXTERNAL_TOOLS_USER_SETTINGS_FILENAME);
Simulation s = GUI.quickStartSimulationConfig(config, false);
if (s == null) {
throw new RuntimeException(
@ -108,6 +111,8 @@ public class ExecuteJAR {
try {
buildExecutableJAR(s.getGUI(), jar);
} catch (RuntimeException e) {
logger.fatal(e.getMessage());
System.exit(1);
}
System.exit(0);
}