aboutsummaryrefslogtreecommitdiffstats
path: root/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
diff options
context:
space:
mode:
authorJiri Vanek <jvanek@redhat.com>2012-06-26 10:11:53 +0200
committerJiri Vanek <jvanek@redhat.com>2012-06-26 10:11:53 +0200
commite244107f1186e9943bcb69d504413991692b37df (patch)
tree761e82965e53aba2f742d86d2c36f1ab0037bab1 /netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
parent66e55100f348e6ac78a90da87761776240aa0131 (diff)
Last hope for not downloaded resources to be verified
Diffstat (limited to 'netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java')
-rw-r--r--netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
index a5c8403..78dc30d 100644
--- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
@@ -172,6 +172,9 @@ public class JNLPClassLoader extends URLClassLoader {
/** Map of specific original (remote) CodeSource Urls to securitydesc */
private HashMap<URL, SecurityDesc> jarLocationSecurityMap =
new HashMap<URL, SecurityDesc>();
+
+ /*Set to prevent once tried-to-get resources to be tried again*/
+ private Set<URL> alreadyTried = Collections.synchronizedSet(new HashSet<URL>());
/** Loader for codebase (which is a path, rather than a file) */
private CodeBaseClassLoader codeBaseLoader;
@@ -1810,11 +1813,27 @@ public class JNLPClassLoader extends URLClassLoader {
protected SecurityDesc getCodeSourceSecurity(URL source) {
SecurityDesc sec=jarLocationSecurityMap.get(source);
+ if (sec == null && !alreadyTried.contains(source)) {
+ alreadyTried.add(source);
+ //try to load the jar which is requesting the permissions, but was NOT downloaded by standard way
+ if (JNLPRuntime.isDebug()) {
+ System.out.println("Application is trying to get permissions for " + source.toString() + ", which was not added by standard way. Trying to download and verify!");
+ }
+ try {
+ JARDesc des = new JARDesc(source, null, null, false, false, false, false);
+ addNewJar(des);
+ sec = jarLocationSecurityMap.get(source);
+ } catch (Throwable t) {
+ if (JNLPRuntime.isDebug()) {
+ t.printStackTrace();
+ }
+ sec = null;
+ }
+ }
if (sec == null){
System.out.println(Translator.R("LNoSecInstance",source.toString()));
}
return sec;
-
}
/**