aboutsummaryrefslogtreecommitdiffstats
path: root/netx/net
diff options
context:
space:
mode:
authorJiri Vanek <[email protected]>2012-05-23 18:33:29 +0200
committerJiri Vanek <[email protected]>2012-05-23 18:33:29 +0200
commite42314895bb715fdcdcdcf5b5653ba18fa7eb050 (patch)
tree7bdd642b2b8d6e1787a5e265c4e3c08ba1224715 /netx/net
parent2582f888083334cc50a7348efb2c4cada1f049b5 (diff)
Added more debugging outputs (especially paths to keystores) for JNLPClassLoader and CertificateUtils
Diffstat (limited to 'netx/net')
-rw-r--r--netx/net/sourceforge/jnlp/resources/Messages.properties4
-rw-r--r--netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java7
-rw-r--r--netx/net/sourceforge/jnlp/security/CertificateUtils.java3
-rw-r--r--netx/net/sourceforge/jnlp/security/KeyStores.java15
4 files changed, 26 insertions, 3 deletions
diff --git a/netx/net/sourceforge/jnlp/resources/Messages.properties b/netx/net/sourceforge/jnlp/resources/Messages.properties
index 9866fe7..91e47b8 100644
--- a/netx/net/sourceforge/jnlp/resources/Messages.properties
+++ b/netx/net/sourceforge/jnlp/resources/Messages.properties
@@ -81,7 +81,9 @@ LUnsignedJarWithSecurityInfo=Application requested security permissions, but jar
LSignedAppJarUsingUnsignedJar=Signed application using unsigned jars.
LSignedAppJarUsingUnsignedJarInfo=The main application jar is signed, but some of the jars it is using aren't.
LSignedJNLPFileDidNotMatch=The signed JNLP file did not match the launching JNLP file.
-
+LNoSecInstance=Error: No security instance for {0}. The application may have trouble continuing
+LCertFoundIn={0} found in cacerts ({1})
+
JNotApplet=File is not an applet.
JNotApplication=File is not an application.
JNotComponent=File is not a component.
diff --git a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
index d2458af..52333eb 100644
--- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
@@ -1754,7 +1754,12 @@ public class JNLPClassLoader extends URLClassLoader {
*/
protected SecurityDesc getCodeSourceSecurity(URL source) {
- return jarLocationSecurityMap.get(source);
+ SecurityDesc sec=jarLocationSecurityMap.get(source);
+ if (sec == null){
+ System.out.println(Translator.R("LNoSecInstance",source.toString()));
+ }
+ return sec;
+
}
/**
diff --git a/netx/net/sourceforge/jnlp/security/CertificateUtils.java b/netx/net/sourceforge/jnlp/security/CertificateUtils.java
index 41ae228..6987d8c 100644
--- a/netx/net/sourceforge/jnlp/security/CertificateUtils.java
+++ b/netx/net/sourceforge/jnlp/security/CertificateUtils.java
@@ -60,6 +60,7 @@ import java.util.Enumeration;
import java.util.Random;
import net.sourceforge.jnlp.runtime.JNLPRuntime;
+import net.sourceforge.jnlp.runtime.Translator;
import net.sourceforge.jnlp.util.replacements.BASE64Encoder;
import sun.security.provider.X509Factory;
@@ -173,7 +174,7 @@ public class CertificateUtils {
if (c.equals(keyStores[i].getCertificate(alias))) {
if (JNLPRuntime.isDebug()) {
- System.out.println(c.getSubjectX500Principal().getName() + " found in cacerts");
+ System.out.println(Translator.R("LCertFoundIn", c.getSubjectX500Principal().getName(), KeyStores.getPathToKeystore(keyStores[i].hashCode())));
}
return true;
diff --git a/netx/net/sourceforge/jnlp/security/KeyStores.java b/netx/net/sourceforge/jnlp/security/KeyStores.java
index 12da0c8..a0b2895 100644
--- a/netx/net/sourceforge/jnlp/security/KeyStores.java
+++ b/netx/net/sourceforge/jnlp/security/KeyStores.java
@@ -47,7 +47,9 @@ import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.StringTokenizer;
import net.sourceforge.jnlp.config.DeploymentConfiguration;
@@ -75,6 +77,8 @@ public final class KeyStores {
CLIENT_CERTS,
}
+ public static final Map<Integer,String> keystoresPaths=new HashMap<Integer, String>();
+
private static DeploymentConfiguration config = null;
private static final String KEYSTORE_TYPE = "JKS";
@@ -133,12 +137,23 @@ public final class KeyStores {
KeyStore ks = null;
try {
ks = createKeyStoreFromFile(new File(location), create, DEFAULT_PASSWORD);
+ //hashcode is used instead of instance so when no references are left
+ //to keystore, then this will not be blocker for garbage collection
+ keystoresPaths.put(ks.hashCode(),location);
} catch (Exception e) {
e.printStackTrace();
}
return ks;
}
+ public static String getPathToKeystore(int k) {
+ String s = keystoresPaths.get(k);
+ if (s == null) {
+ return "unknown keystore location";
+ }
+ return s;
+ }
+
/**
* Returns an array of KeyStore that contain certificates that are trusted.
* The KeyStores contain certificates from different sources.