aboutsummaryrefslogtreecommitdiffstats
path: root/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
diff options
context:
space:
mode:
authorJiri Vanek <[email protected]>2014-01-27 16:17:07 +0100
committerJiri Vanek <[email protected]>2014-01-27 16:17:07 +0100
commitfac61336d7d4f342458a8c0905b0aec56911de70 (patch)
tree11de1b337a0e7ee31dc0585f92636b5ef5fda548 /netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
parent4394eef2518663d12672dbf593632cc29e6f37ec (diff)
Tuning of properties loading.
Jnlp runtime now correctly dies in case of ConfigurationException and initialisation of config is failing to defaults instead of die with NoClassDefFoundError
Diffstat (limited to 'netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java')
-rw-r--r--netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java21
1 files changed, 19 insertions, 2 deletions
diff --git a/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java b/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
index 12bcfa8..c9d7397 100644
--- a/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
@@ -42,6 +42,7 @@ import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
+import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.text.html.parser.ParserDelegator;
@@ -187,7 +188,13 @@ public class JNLPRuntime {
JavaConsole.getConsole().showConsoleLater();
}
/* exit if there is a fatal exception loading the configuration */
- if (isApplication && getConfiguration().getLoadingException() != null) {
+ if (getConfiguration().getLoadingException() != null) {
+ if (getConfiguration().getLoadingException() instanceof ConfigurationException){
+ // ConfigurationException is thrown only if deployment.config's field
+ // deployment.system.config.mandatory is true, and the destination
+ //where deployment.system.config points is not readable
+ throw new RuntimeException(getConfiguration().getLoadingException());
+ }
OutputController.getLogger().log(OutputController.Level.WARNING_ALL, getMessage("RConfigurationError")+": "+getConfiguration().getLoadingException().getMessage());
}
KeyStores.setConfiguration(getConfiguration());
@@ -364,9 +371,19 @@ public class JNLPRuntime {
config.load();
config.copyTo(System.getProperties());
} catch (ConfigurationException ex) {
- OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, getMessage("RConfigurationError"));
+ OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, Translator.R("RConfigurationError"));
//mark this exceptionas we can die on it later
config.setLoadingException(ex);
+ //to be sure - we MUST die - http://docs.oracle.com/javase/6/docs/technotes/guides/deployment/deployment-guide/properties.html
+ }catch(Exception t){
+ //all exceptions are causing InstantiatizationError so this do it much more readble
+ OutputController.getLogger().log(OutputController.Level.ERROR_ALL, t);
+ OutputController.getLogger().log(OutputController.Level.WARNING_ALL, Translator.R("RFailingToDefault"));
+ if (!JNLPRuntime.isHeadless()){
+ JOptionPane.showMessageDialog(null, getMessage("RFailingToDefault")+"\n"+t.toString());
+ }
+ //try to survive this unlikely exception
+ config.resetToDefaults();
} finally {
OutputController.getLogger().startConsumer();
}