changeset 2002:be850f0b74e2

Fix NPE due to race condition when panel is still being initialized when a request for it comes in. Remove new-lines from status messages, as status bar is single line.
author Deepak Bhole <dbhole@redhat.com>
date Tue, 25 Aug 2009 10:34:09 -0400
parents 47802906c81f
children fbdb1c1ba782
files ChangeLog plugin/icedtea/sun/applet/PluginAppletViewer.java
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Aug 25 10:30:05 2009 -0400
+++ b/ChangeLog	Tue Aug 25 10:34:09 2009 -0400
@@ -1,3 +1,11 @@
+2009-08-25  Deepak Bhole <dbhole@redhat.com>
+
+	* plugin/icedtea/sun/applet/PluginAppletViewer.java
+	(handleMessage): Wait until panel is set before pinging it for
+	life status.
+	(showStatus): Replace new lines with spaces, as the status is
+	on a single line anyway.
+
 2009-08-25  Deepak Bhole <dbhole@redhat.com>
 
 	* plugin/icedtea/sun/applet/PluginCookieInfoRequest.java
--- a/plugin/icedtea/sun/applet/PluginAppletViewer.java	Tue Aug 25 10:30:05 2009 -0400
+++ b/plugin/icedtea/sun/applet/PluginAppletViewer.java	Tue Aug 25 10:34:09 2009 -0400
@@ -589,7 +589,7 @@
 
              // Wait for the panel to initialize
              // (happens in a separate thread)
-             while ((o = panel.getApplet()) == null && ((NetxPanel) panel).isAlive()) {
+             while (panel == null || (o = panel.getApplet()) == null && ((NetxPanel) panel).isAlive()) {
             	 try {
             		 Thread.sleep(2000);
             		 PluginDebug.debug("Waiting for applet to initialize...");
@@ -876,6 +876,8 @@
      public void showStatus(String status) {
  	try {
              // FIXME: change to postCallRequest
+ 		// For statuses, we cannot have a newline
+  	    status = status.replace("\n", " ");
  	    write("status " + status);
  	} catch (IOException exception) {
  	    // Deliberately ignore IOException.  showStatus may be