diff options
author | Omair Majid <[email protected]> | 2011-01-12 12:50:13 -0500 |
---|---|---|
committer | Omair Majid <[email protected]> | 2011-01-12 12:50:13 -0500 |
commit | 89f754862df381147217093df8eb241feb62aaf4 (patch) | |
tree | 55add0e1b8bba245ab6261f841892f08580f1e61 /netx | |
parent | 9679f89fa9b4db346cf898924e20e630c509838c (diff) |
fix problems in control panel caused by removing JNLPRuntime.initialize()
2011-01-12 Omair Majid <[email protected]>
* netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java
(main): Set look and feel. Set config object to use with KeyStores.
* netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
(initialize): Set config object to use with KeyStores.
* netx/net/sourceforge/jnlp/security/KeyStores.java: Add new member
config.
(setConfiguration): New method. Sets the value of config after security
check.
(getKeyStoreLocation): Use config object instead of querying JNLPRuntime.
Diffstat (limited to 'netx')
-rw-r--r-- | netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java | 9 | ||||
-rw-r--r-- | netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java | 3 | ||||
-rw-r--r-- | netx/net/sourceforge/jnlp/security/KeyStores.java | 15 |
3 files changed, 25 insertions, 2 deletions
diff --git a/netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java b/netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java index 24abb06..17b811e 100644 --- a/netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java +++ b/netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java @@ -53,6 +53,7 @@ import javax.swing.event.ListSelectionListener; import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.Translator; +import net.sourceforge.jnlp.security.KeyStores; import net.sourceforge.jnlp.security.viewer.CertificatePane; /** @@ -354,6 +355,14 @@ public class ControlPanel extends JFrame { e.printStackTrace(); } + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (Exception e) { + // ignore; not a big deal + } + + KeyStores.setConfiguration(config); + SwingUtilities.invokeLater(new Runnable() { @Override public void run() { diff --git a/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java b/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java index 393b3cb..61417a4 100644 --- a/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java +++ b/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java @@ -37,6 +37,7 @@ import net.sourceforge.jnlp.*; import net.sourceforge.jnlp.cache.*; import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.security.JNLPAuthenticator; +import net.sourceforge.jnlp.security.KeyStores; import net.sourceforge.jnlp.security.SecurityDialogMessageHandler; import net.sourceforge.jnlp.security.VariableX509TrustManager; import net.sourceforge.jnlp.services.*; @@ -160,6 +161,8 @@ public class JNLPRuntime { } } + KeyStores.setConfiguration(config); + initializeStreams(); isWebstartApplication = isApplication; diff --git a/netx/net/sourceforge/jnlp/security/KeyStores.java b/netx/net/sourceforge/jnlp/security/KeyStores.java index e7a83d5..12da0c8 100644 --- a/netx/net/sourceforge/jnlp/security/KeyStores.java +++ b/netx/net/sourceforge/jnlp/security/KeyStores.java @@ -51,7 +51,6 @@ import java.util.List; import java.util.StringTokenizer; import net.sourceforge.jnlp.config.DeploymentConfiguration; -import net.sourceforge.jnlp.runtime.JNLPRuntime; import net.sourceforge.jnlp.runtime.Translator; import net.sourceforge.jnlp.util.FileUtils; @@ -76,6 +75,8 @@ public final class KeyStores { CLIENT_CERTS, } + private static DeploymentConfiguration config = null; + private static final String KEYSTORE_TYPE = "JKS"; /** the default password used to protect the KeyStores */ private static final String DEFAULT_PASSWORD = "changeit"; @@ -84,6 +85,16 @@ public final class KeyStores { return DEFAULT_PASSWORD.toCharArray(); } + /** Set the configuration object to use for getting KeyStore paths */ + public static void setConfiguration(DeploymentConfiguration newConfig) { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkPermission(new AllPermission()); + } + + config = newConfig; + } + /** * Returns a KeyStore corresponding to the appropriate level level (user or * system) and type. @@ -272,7 +283,7 @@ public final class KeyStores { throw new RuntimeException("Unspported"); } - return JNLPRuntime.getConfiguration().getProperty(configKey); + return config.getProperty(configKey); } /** |