changeset 268:450aa9042b21

PR778: Jar download and server certificate verification deadlock
author Deepak Bhole <dbhole@redhat.com>
date Thu, 27 Oct 2011 18:24:46 -0400
parents 9ba6b6a5d241
children f968cbeaac0b
files ChangeLog NEWS netx/net/sourceforge/jnlp/GuiLaunchHandler.java
diffstat 3 files changed, 37 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Sep 28 16:28:18 2011 -0400
+++ b/ChangeLog	Thu Oct 27 18:24:46 2011 -0400
@@ -1,3 +1,10 @@
+2011-10-27  Deepak Bhole <dbhole@redhat.com>
+
+	PR778: Jar download and server certificate verification deadlock
+	* NEWS: Updates
+	* netx/net/sourceforge/jnlp/GuiLaunchHandler.java (launchInitialized):
+	Moved as much code as possible out of the invokeLater block. 
+
 2011-09-28  Deepak Bhole <dbhole@redhat.com>
 
 	* NEWS: Prepare for 1.1.4
--- a/NEWS	Wed Sep 28 16:28:18 2011 -0400
+++ b/NEWS	Thu Oct 27 18:24:46 2011 -0400
@@ -14,6 +14,7 @@
 * Plugin
   - PR782: Support building against npapi-sdk as well
 * Common
+  - PR778: Jar download and server certificate verification deadlock
   - PR794: IcedTea-Web does not work if a Web Start app jar has a Class-Path element in the manifest
 
 New in release 1.1.2 (2011-08-31):
--- a/netx/net/sourceforge/jnlp/GuiLaunchHandler.java	Wed Sep 28 16:28:18 2011 -0400
+++ b/netx/net/sourceforge/jnlp/GuiLaunchHandler.java	Thu Oct 27 18:24:46 2011 -0400
@@ -37,6 +37,7 @@
 
 package net.sourceforge.jnlp;
 
+import java.lang.reflect.InvocationTargetException;
 import java.net.URL;
 
 import javax.swing.SwingUtilities;
@@ -87,19 +88,38 @@
 
     @Override
     public void launchInitialized(final JNLPFile file) {
+        
+        final int preferredWidth = 500;
+        final int preferredHeight = 400;
+
+        final URL splashImageURL = file.getInformation().getIconLocation(
+                IconDesc.SPLASH, preferredWidth, preferredHeight);
+
+        if (splashImageURL != null) {
+            final ResourceTracker resourceTracker = new ResourceTracker(true);
+            resourceTracker.addResource(splashImageURL, file.getFileVersion(), null, policy);
+
+            try {
+                SwingUtilities.invokeAndWait(new Runnable() {
+                    @Override
+                    public void run() {
+                        splashScreen = new JNLPSplashScreen(resourceTracker, null, null);
+                    }
+                });
+            } catch (InterruptedException ie) {
+                // Wait till splash screen is created
+                while (splashScreen == null);
+            } catch (InvocationTargetException ite) {
+                ite.printStackTrace();
+            }
+
+            splashScreen.setSplashImageURL(splashImageURL);
+        }
+
         SwingUtilities.invokeLater(new Runnable() {
             @Override
             public void run() {
-                final int preferredWidth = 500;
-                final int preferredHeight = 400;
-
-                URL splashImageURL = file.getInformation().getIconLocation(
-                        IconDesc.SPLASH, preferredWidth, preferredHeight);
                 if (splashImageURL != null) {
-                    ResourceTracker resourceTracker = new ResourceTracker(true);
-                    resourceTracker.addResource(splashImageURL, file.getFileVersion(), null, policy);
-                    splashScreen = new JNLPSplashScreen(resourceTracker, null, null);
-                    splashScreen.setSplashImageURL(splashImageURL);
                     if (splashScreen.isSplashScreenValid()) {
                         splashScreen.setVisible(true);
                     }