changeset 1670:9b85d9f17c40

Import from trunk. Fix race condition that resulted in NPE when panel was being initialized and a request for it came in. Remove newline from status messages.
author Deepak Bhole <dbhole@redhat.com>
date Tue, 25 Aug 2009 10:58:37 -0400
parents 20cd55dd027f
children 9f84fb766ec8
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:57:43 2009 -0400
+++ b/ChangeLog	Tue Aug 25 10:58:37 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:57:43 2009 -0400
+++ b/plugin/icedtea/sun/applet/PluginAppletViewer.java	Tue Aug 25 10:58:37 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