diff options
Diffstat (limited to 'netx/net/sourceforge/jnlp/security')
11 files changed, 43 insertions, 54 deletions
diff --git a/netx/net/sourceforge/jnlp/security/CertWarningPane.java b/netx/net/sourceforge/jnlp/security/CertWarningPane.java index fff814c..f9273fa 100644 --- a/netx/net/sourceforge/jnlp/security/CertWarningPane.java +++ b/netx/net/sourceforge/jnlp/security/CertWarningPane.java @@ -70,6 +70,7 @@ import net.sourceforge.jnlp.security.KeyStores.Level; import net.sourceforge.jnlp.security.KeyStores.Type; import net.sourceforge.jnlp.security.SecurityDialogs.AccessType; import net.sourceforge.jnlp.util.FileUtils; +import net.sourceforge.jnlp.util.logging.OutputController; /** * Provides the panel for using inside a SecurityDialog. These dialogs are @@ -266,13 +267,11 @@ public class CertWarningPane extends SecurityDialogPanel { } finally { os.close(); } - if (JNLPRuntime.isDebug()) { - System.out.println("certificate is now permanently trusted"); - } + OutputController.getLogger().log("certificate is now permanently trusted"); } catch (Exception ex) { // TODO: Let NetX show a dialog here notifying user // about being unable to add cert to keystore - ex.printStackTrace(); + OutputController.getLogger().log(OutputController.Level.ERROR_ALL, ex); } } } diff --git a/netx/net/sourceforge/jnlp/security/CertificateUtils.java b/netx/net/sourceforge/jnlp/security/CertificateUtils.java index 6987d8c..a8984b3 100644 --- a/netx/net/sourceforge/jnlp/security/CertificateUtils.java +++ b/netx/net/sourceforge/jnlp/security/CertificateUtils.java @@ -61,6 +61,7 @@ import java.util.Random; import net.sourceforge.jnlp.runtime.JNLPRuntime; import net.sourceforge.jnlp.runtime.Translator; +import net.sourceforge.jnlp.util.logging.OutputController; import net.sourceforge.jnlp.util.replacements.BASE64Encoder; import sun.security.provider.X509Factory; @@ -77,9 +78,8 @@ public class CertificateUtils { */ public static final void addToKeyStore(File file, KeyStore ks) throws CertificateException, IOException, KeyStoreException { - if (JNLPRuntime.isDebug()) { - System.out.println("Importing certificate from " + file + " into " + ks); - } + + OutputController.getLogger().log("Importing certificate from " + file + " into " + ks); BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file)); CertificateFactory cf = CertificateFactory.getInstance("X509"); @@ -100,9 +100,8 @@ public class CertificateUtils { */ public static final void addToKeyStore(X509Certificate cert, KeyStore ks) throws KeyStoreException { - if (JNLPRuntime.isDebug()) { - System.out.println("Importing " + cert.getSubjectX500Principal().getName()); - } + + OutputController.getLogger().log("Importing " + cert.getSubjectX500Principal().getName()); String alias = null; @@ -173,16 +172,13 @@ public class CertificateUtils { String alias = aliases.nextElement(); if (c.equals(keyStores[i].getCertificate(alias))) { - if (JNLPRuntime.isDebug()) { - System.out.println(Translator.R("LCertFoundIn", c.getSubjectX500Principal().getName(), KeyStores.getPathToKeystore(keyStores[i].hashCode()))); - } - + OutputController.getLogger().log(Translator.R("LCertFoundIn", c.getSubjectX500Principal().getName(), KeyStores.getPathToKeystore(keyStores[i].hashCode()))); return true; } // else continue } } catch (KeyStoreException e) { - e.printStackTrace(); + OutputController.getLogger().log(OutputController.Level.ERROR_ALL, e); // continue } } diff --git a/netx/net/sourceforge/jnlp/security/HttpsCertVerifier.java b/netx/net/sourceforge/jnlp/security/HttpsCertVerifier.java index edd5899..e7a101d 100644 --- a/netx/net/sourceforge/jnlp/security/HttpsCertVerifier.java +++ b/netx/net/sourceforge/jnlp/security/HttpsCertVerifier.java @@ -52,6 +52,7 @@ import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import net.sourceforge.jnlp.util.logging.OutputController; import sun.security.util.DerValue; import sun.security.util.HostnameChecker; @@ -98,7 +99,7 @@ public class HttpsCertVerifier implements CertVerifier { try { certPaths.add(CertificateFactory.getInstance("X.509").generateCertPath(list)); } catch (CertificateException ce) { - ce.printStackTrace(); + OutputController.getLogger().log(OutputController.Level.ERROR_ALL, ce); // carry on } @@ -187,9 +188,9 @@ public class HttpsCertVerifier implements CertVerifier { names = names.substring(2); // remove proceeding ", " } catch (CertificateParsingException cpe) { - cpe.printStackTrace(); + OutputController.getLogger().log(OutputController.Level.ERROR_ALL, cpe); } catch (IOException ioe) { - ioe.printStackTrace(); + OutputController.getLogger().log(OutputController.Level.ERROR_ALL, ioe); } return names; diff --git a/netx/net/sourceforge/jnlp/security/KeyStores.java b/netx/net/sourceforge/jnlp/security/KeyStores.java index a0b2895..eb6fe1d 100644 --- a/netx/net/sourceforge/jnlp/security/KeyStores.java +++ b/netx/net/sourceforge/jnlp/security/KeyStores.java @@ -55,6 +55,7 @@ import java.util.StringTokenizer; import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.Translator; import net.sourceforge.jnlp.util.FileUtils; +import net.sourceforge.jnlp.util.logging.OutputController; /** * The <code>KeyStores</code> class allows easily accessing the various KeyStores @@ -141,7 +142,7 @@ public final class KeyStores { //to keystore, then this will not be blocker for garbage collection keystoresPaths.put(ks.hashCode(),location); } catch (Exception e) { - e.printStackTrace(); + OutputController.getLogger().log(OutputController.Level.ERROR_ALL, e); } return ks; } diff --git a/netx/net/sourceforge/jnlp/security/SecurityDialog.java b/netx/net/sourceforge/jnlp/security/SecurityDialog.java index e204f0e..03f2225 100644 --- a/netx/net/sourceforge/jnlp/security/SecurityDialog.java +++ b/netx/net/sourceforge/jnlp/security/SecurityDialog.java @@ -53,6 +53,7 @@ import java.security.cert.X509Certificate; import java.util.concurrent.CopyOnWriteArrayList; import java.util.List; +import net.sourceforge.jnlp.util.logging.OutputController; import net.sourceforge.jnlp.util.ScreenFinder; /** @@ -321,22 +322,18 @@ public class SecurityDialog extends JDialog { private void selectDefaultButton() { if (panel == null) { - System.out.println("initial value panel is null"); + OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, "initial value panel is null"); } panel.requestFocusOnDefaultButton(); } protected void setValue(Object value) { - if (JNLPRuntime.isDebug()) { - System.out.println("Setting value:" + value); - } + OutputController.getLogger().log("Setting value:" + value); this.value = value; } public Object getValue() { - if (JNLPRuntime.isDebug()) { - System.out.println("Returning value:" + value); - } + OutputController.getLogger().log("Returning value:" + value); return value; } diff --git a/netx/net/sourceforge/jnlp/security/SecurityDialogMessageHandler.java b/netx/net/sourceforge/jnlp/security/SecurityDialogMessageHandler.java index 2fbcb5b..a2f9588 100644 --- a/netx/net/sourceforge/jnlp/security/SecurityDialogMessageHandler.java +++ b/netx/net/sourceforge/jnlp/security/SecurityDialogMessageHandler.java @@ -45,6 +45,7 @@ import java.util.concurrent.LinkedBlockingQueue; import sun.awt.AppContext; import net.sourceforge.jnlp.runtime.JNLPRuntime; +import net.sourceforge.jnlp.util.logging.OutputController; /** * Handles {@link SecurityDialogMessage}s and shows appropriate security @@ -72,9 +73,7 @@ public final class SecurityDialogMessageHandler implements Runnable { */ @Override public void run() { - if (JNLPRuntime.isDebug()) { - System.out.println("Starting security dialog thread"); - } + OutputController.getLogger().log("Starting security dialog thread"); while (true) { try { SecurityDialogMessage msg = queue.take(); @@ -134,7 +133,7 @@ public final class SecurityDialogMessageHandler implements Runnable { try { queue.put(message); } catch (InterruptedException e) { - e.printStackTrace(); + OutputController.getLogger().log(OutputController.Level.ERROR_ALL, e); } } diff --git a/netx/net/sourceforge/jnlp/security/SecurityUtil.java b/netx/net/sourceforge/jnlp/security/SecurityUtil.java index 8b6dd9a..5948753 100644 --- a/netx/net/sourceforge/jnlp/security/SecurityUtil.java +++ b/netx/net/sourceforge/jnlp/security/SecurityUtil.java @@ -44,6 +44,7 @@ import java.security.KeyStore; import net.sourceforge.jnlp.security.KeyStores.Level; import net.sourceforge.jnlp.security.KeyStores.Type; +import net.sourceforge.jnlp.util.logging.OutputController; public class SecurityUtil { @@ -210,7 +211,7 @@ public class SecurityUtil { ks.load(fis, password); } } catch (Exception e) { - e.printStackTrace(); + OutputController.getLogger().log(OutputController.Level.ERROR_ALL, e); throw e; } finally { if (fis != null) diff --git a/netx/net/sourceforge/jnlp/security/VariableX509TrustManager.java b/netx/net/sourceforge/jnlp/security/VariableX509TrustManager.java index 4f508d8..b92f02c 100644 --- a/netx/net/sourceforge/jnlp/security/VariableX509TrustManager.java +++ b/netx/net/sourceforge/jnlp/security/VariableX509TrustManager.java @@ -58,6 +58,7 @@ import javax.net.ssl.X509TrustManager; import net.sourceforge.jnlp.runtime.JNLPRuntime; import net.sourceforge.jnlp.security.SecurityDialogs.AccessType; +import net.sourceforge.jnlp.util.logging.OutputController; import sun.security.util.HostnameChecker; import sun.security.validator.ValidatorException; @@ -110,7 +111,7 @@ final public class VariableX509TrustManager { } } } catch (Exception e) { - e.printStackTrace(); + OutputController.getLogger().log(OutputController.Level.ERROR_ALL, e); } /* @@ -135,7 +136,7 @@ final public class VariableX509TrustManager { } } } catch (Exception e) { - e.printStackTrace(); + OutputController.getLogger().log(OutputController.Level.ERROR_ALL, e); } /* @@ -159,7 +160,7 @@ final public class VariableX509TrustManager { } } } catch (Exception e) { - e.printStackTrace(); + OutputController.getLogger().log(OutputController.Level.ERROR_ALL, e); } } @@ -328,7 +329,7 @@ final public class VariableX509TrustManager { // finally check temp trusted certs if (!temporarilyTrusted.contains(chain[0])) { if (savedException == null) { - // System.out.println("IMPOSSIBLE!"); + // OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, "IMPOSSIBLE!"); throw new ValidatorException(ValidatorException.T_SIGNATURE_ERROR, chain[0]); } throw savedException; diff --git a/netx/net/sourceforge/jnlp/security/appletextendedsecurity/ExtendedAppletSecurityHelp.java b/netx/net/sourceforge/jnlp/security/appletextendedsecurity/ExtendedAppletSecurityHelp.java index e0da90a..0a11021 100644 --- a/netx/net/sourceforge/jnlp/security/appletextendedsecurity/ExtendedAppletSecurityHelp.java +++ b/netx/net/sourceforge/jnlp/security/appletextendedsecurity/ExtendedAppletSecurityHelp.java @@ -45,6 +45,7 @@ import javax.swing.JSeparator; import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; import net.sourceforge.jnlp.runtime.Translator; +import net.sourceforge.jnlp.util.logging.OutputController; public class ExtendedAppletSecurityHelp extends javax.swing.JDialog implements HyperlinkListener { @@ -77,7 +78,7 @@ public class ExtendedAppletSecurityHelp extends javax.swing.JDialog implements H mainHtmlPane.setPage(event.getURL()); } } catch (IOException ioe) { - ioe.printStackTrace(); + OutputController.getLogger().log(OutputController.Level.ERROR_ALL, ioe); } } } diff --git a/netx/net/sourceforge/jnlp/security/appletextendedsecurity/UnsignedAppletTrustConfirmation.java b/netx/net/sourceforge/jnlp/security/appletextendedsecurity/UnsignedAppletTrustConfirmation.java index d90a7c3..b869db8 100644 --- a/netx/net/sourceforge/jnlp/security/appletextendedsecurity/UnsignedAppletTrustConfirmation.java +++ b/netx/net/sourceforge/jnlp/security/appletextendedsecurity/UnsignedAppletTrustConfirmation.java @@ -52,9 +52,9 @@ import net.sourceforge.jnlp.PluginBridge; import net.sourceforge.jnlp.cache.ResourceTracker; import net.sourceforge.jnlp.security.SecurityDialogs; import net.sourceforge.jnlp.security.UnsignedAppletTrustWarningPanel.UnsignedWarningAction; +import net.sourceforge.jnlp.util.logging.OutputController; public class UnsignedAppletTrustConfirmation { - static private final boolean DEBUG = System.getenv().containsKey("ICEDTEAPLUGIN_DEBUG"); private static final AppletStartupSecuritySettings securitySettings = AppletStartupSecuritySettings.getInstance(); @@ -158,27 +158,21 @@ public class UnsignedAppletTrustConfirmation { userActionStorage.unlock(); } } - static private void debug(String logMessage) { - if (DEBUG) { - System.err.println(logMessage); - } - - } public static void checkUnsignedWithUserIfRequired(PluginBridge file) throws LaunchException { if (unsignedAppletsAreForbidden()) { - debug("Not running unsigned applet at " + file.getCodeBase() +" because unsigned applets are disallowed by security policy."); + OutputController.getLogger().log(OutputController.Level.ERROR_DEBUG, "Not running unsigned applet at " + file.getCodeBase() +" because unsigned applets are disallowed by security policy."); throw new LaunchException(file, null, R("LSFatal"), R("LCClient"), R("LUnsignedApplet"), R("LUnsignedAppletPolicyDenied")); } if (!unsignedConfirmationIsRequired()) { - debug("Running unsigned applet at " + file.getCodeBase() +" does not require confirmation according to security policy."); + OutputController.getLogger().log(OutputController.Level.ERROR_DEBUG, "Running unsigned applet at " + file.getCodeBase() +" does not require confirmation according to security policy."); return; } ExecuteUnsignedApplet storedAction = getStoredAction(file); - debug("Stored action for unsigned applet at " + file.getCodeBase() +" was " + storedAction); + OutputController.getLogger().log(OutputController.Level.ERROR_DEBUG, "Stored action for unsigned applet at " + file.getCodeBase() +" was " + storedAction); boolean appletOK; @@ -197,7 +191,7 @@ public class UnsignedAppletTrustConfirmation { updateAppletAction(file, executeAction, warningResponse.rememberForCodeBase()); } - debug("Decided action for unsigned applet at " + file.getCodeBase() +" was " + executeAction); + OutputController.getLogger().log(OutputController.Level.ERROR_DEBUG, "Decided action for unsigned applet at " + file.getCodeBase() +" was " + executeAction); } if (!appletOK) { diff --git a/netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java b/netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java index 36a809b..61123d7 100644 --- a/netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java +++ b/netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java @@ -80,6 +80,7 @@ import net.sourceforge.jnlp.security.SecurityUtil; import net.sourceforge.jnlp.security.SecurityDialog; import net.sourceforge.jnlp.security.KeyStores.Level; import net.sourceforge.jnlp.util.FileUtils; +import net.sourceforge.jnlp.util.logging.OutputController; public class CertificatePane extends JPanel { @@ -150,7 +151,7 @@ public class CertificatePane extends JPanel { try { keyStore = KeyStores.getKeyStore(currentKeyStoreLevel, currentKeyStoreType); } catch (Exception e) { - e.printStackTrace(); + OutputController.getLogger().log(OutputController.Level.ERROR_ALL, e); } } @@ -278,7 +279,7 @@ public class CertificatePane extends JPanel { } } catch (Exception e) { //TODO - e.printStackTrace(); + OutputController.getLogger().log(OutputController.Level.ERROR_ALL, e); } } @@ -404,7 +405,7 @@ public class CertificatePane extends JPanel { repopulateTables(); } catch (Exception ex) { // TODO: handle exception - ex.printStackTrace(); + OutputController.getLogger().log(OutputController.Level.ERROR_ALL, ex); } } } @@ -446,8 +447,7 @@ public class CertificatePane extends JPanel { } } } catch (Exception ex) { - // TODO - ex.printStackTrace(); + OutputController.getLogger().log(OutputController.Level.ERROR_ALL, ex); } } } @@ -491,8 +491,7 @@ public class CertificatePane extends JPanel { repopulateTables(); } } catch (Exception ex) { - // TODO - ex.printStackTrace(); + OutputController.getLogger().log(OutputController.Level.ERROR_ALL, ex); } } |