changeset 361:d5cec52b3c5b

Last hope for not downloaded resources to be verified
author Jiri Vanek <jvanek@redhat.com>
date Tue, 03 Jul 2012 13:51:29 +0200
parents 01ed07070c3c
children ad4c1debd54f
files ChangeLog NEWS netx/net/sourceforge/jnlp/resources/Messages.properties netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
diffstat 4 files changed, 41 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Jul 03 13:38:23 2012 +0200
+++ b/ChangeLog	Tue Jul 03 13:51:29 2012 +0200
@@ -1,4 +1,15 @@
-2012-05-18  Jiri Vanek  <jvanek@redhat.com>
+2012-07-23  Jiri Vanek  <jvanek@redhat.com>
+
+	Last hope for not downloaded resources to be verified
+	* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java:
+	(getCodeSourceSecurity): will now try to download and verify resource
+	which was downloaded outside of netx.
+	(alreadyTried) set for memory of once tried resources to not try again 
+	* NEWS: mentioned RH816592
+	* netx/net/sourceforge/jnlp/resources/Messages.properties: backported
+	necessary resources (LNoSecInstance) and (LCertFoundIn)
+
+2012-07-09  Jiri Vanek  <jvanek@redhat.com>
 
 	Fixed behavior when encoded/characters needed encoding included in url
 	* NEWS: mentioned PR811
--- a/NEWS	Tue Jul 03 13:38:23 2012 +0200
+++ b/NEWS	Tue Jul 03 13:51:29 2012 +0200
@@ -12,6 +12,7 @@
 * NetX
   - PR898: signed applications with big jnlp-file doesn't start (webstart affect like "frozen")
   - PR811: javaws is not handling urls with spaces (and other characters needing encoding) correctly
+  - 816592: icedtea-web not loading GeoGebra java applets in Firefox or Chrome
 * Plugin
   - PR863: Error passing strings to applet methods in Chromium
   - PR895: IcedTea-Web searches for missing classes on each loadClass or findClass
--- a/netx/net/sourceforge/jnlp/resources/Messages.properties	Tue Jul 03 13:38:23 2012 +0200
+++ b/netx/net/sourceforge/jnlp/resources/Messages.properties	Tue Jul 03 13:51:29 2012 +0200
@@ -81,7 +81,9 @@
 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.
--- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java	Tue Jul 03 13:38:23 2012 +0200
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java	Tue Jul 03 13:51:29 2012 +0200
@@ -167,6 +167,9 @@
     /** 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;
@@ -1732,7 +1735,28 @@
      */
 
     protected SecurityDesc getCodeSourceSecurity(URL source) {
-        return jarLocationSecurityMap.get(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;
     }
 
     /**