changeset 1274:894d50f03bc4

Clean up output shown in non debug mode -- it is now shown only if the debug var is set.
author Deepak Bhole <dbhole@redhat.com>
date Thu, 11 Dec 2008 14:11:45 -0500
parents 88c957e14fdd
children edaae21dab0b
files ChangeLog IcedTeaPlugin.cc plugin/icedtea/netscape/javascript/JSObject.java rt/net/sourceforge/jnlp/NetxPanel.java rt/net/sourceforge/jnlp/PluginBridge.java
diffstat 5 files changed, 46 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Dec 11 00:35:05 2008 +0100
+++ b/ChangeLog	Thu Dec 11 14:11:45 2008 -0500
@@ -1,3 +1,10 @@
+2008-12-11  Deepak Bhole <dbhole@redhat.com>
+
+	* IcedTeaPlugin.cc: Clean up output shown in non debug mode.
+	* plugin/icedtea/netscape/javascript/JSObject.java: Same.
+	* rt/net/sourceforge/jnlp/NetxPanel.java: Same.
+	* rt/net/sourceforge/jnlp/PluginBridge.java: Same.
+
 2008-12-10  Matthias Klose  <doko@ubuntu.com>
 
 	* patches/hotspot/*/icedtea-text-relocations.patch: Update for PARISC.
--- a/IcedTeaPlugin.cc	Thu Dec 11 00:35:05 2008 +0100
+++ b/IcedTeaPlugin.cc	Thu Dec 11 14:11:45 2008 -0500
@@ -88,7 +88,7 @@
 #define TIMEOUT 20
 
 #define NOT_IMPLEMENTED() \
-  printf ("NOT IMPLEMENTED: %s\n", __PRETTY_FUNCTION__)
+  PLUGIN_DEBUG_1ARG ("NOT IMPLEMENTED: %s\n", __PRETTY_FUNCTION__)
 
 #define ID(object) \
   (object == NULL ? (PRUint32) 0 : reinterpret_cast<JNIReference*> (object)->identifier)
@@ -103,7 +103,7 @@
   {                                         \
     if (plugin_debug)                       \
     {                                       \
-      printf (str);                         \
+      fprintf (stderr, str);                \
     }                                       \
   } while (0)
 
@@ -112,35 +112,35 @@
   {                                         \
     if (plugin_debug)                       \
     {                                       \
-      printf (str, arg1);                   \
+      fprintf (stderr, str, arg1);          \
     }                                       \
   } while (0)
 
-#define PLUGIN_DEBUG_2ARG(str, arg1, arg2) \
+#define PLUGIN_DEBUG_2ARG(str, arg1, arg2)  \
   do                                        \
   {                                         \
     if (plugin_debug)                       \
     {                                       \
-      printf (str, arg1, arg2);             \
+      fprintf (stderr, str, arg1, arg2);    \
     }                                       \
   } while (0)
 
 #define PLUGIN_DEBUG_3ARG(str, arg1, arg2, arg3) \
-  do                                        \
-  {                                         \
-    if (plugin_debug)                       \
-    {                                       \
-      printf (str, arg1, arg2, arg3);       \
-    }                                       \
+  do                                           \
+  {                                            \
+    if (plugin_debug)                          \
+    {                                          \
+      fprintf (stderr, str, arg1, arg2, arg3); \
+    }                                          \
   } while (0)
 
 #define PLUGIN_DEBUG_4ARG(str, arg1, arg2, arg3, arg4) \
-  do                                        \
-  {                                         \
-    if (plugin_debug)                       \
-    {                                       \
-      printf (str, arg1, arg2, arg3, arg4); \
-    }                                       \
+  do                                                 \
+  {                                                  \
+    if (plugin_debug)                                \
+    {                                                \
+      fprintf (stderr, str, arg1, arg2, arg3, arg4); \
+    }                                                \
   } while (0)
 
 #define PLUGIN_DEBUG(message)                                           \
@@ -504,7 +504,7 @@
 #define PROCESS_PENDING_EVENTS_REF(reference) \
     if (jvm_attached == PR_FALSE) \
 	{ \
-	    fprintf(stderr, "Error on Java side detected. Abandoning wait and returning.\n"); \
+	    PLUGIN_DEBUG_0ARG("Error on Java side detected. Abandoning wait and returning.\n"); \
 		return NS_ERROR_FAILURE; \
 	} \
 	if (g_main_context_pending (NULL)) { \
@@ -1500,7 +1500,7 @@
   js_cleared_handles.Init();
   result_map.Init();
   PLUGIN_DEBUG_0ARG ("CONSTRUCTING FACTORY\n");
-  printf("ICEDTEAPLUGIN_DEBUG = %s\n", getenv ("ICEDTEAPLUGIN_DEBUG"));
+  PLUGIN_DEBUG_1ARG("ICEDTEAPLUGIN_DEBUG = %s\n", getenv ("ICEDTEAPLUGIN_DEBUG"));
 }
 
 IcedTeaPluginFactory::~IcedTeaPluginFactory ()
@@ -1617,7 +1617,7 @@
   if (jvm_attached == PR_FALSE)
   {
     // using printf on purpose.. this should happen rarely
-    printf("Initializing JVM...\n");
+    PLUGIN_DEBUG_0ARG("Initializing JVM...\n");
 
     // mark attached right away, in case another initialize() call 
     //is made (happens if multiple applets are present on the same page)
@@ -2295,7 +2295,7 @@
   if (jvm_attached == PR_FALSE)
   {
     // using printf on purpose.. this should happen rarely
-    fprintf(stderr, "WARNING: Looks like the JVM is not up. Attempting to re-initialize...\n");
+    PLUGIN_DEBUG_0ARG("WARNING: Looks like the JVM is not up. Attempting to re-initialize...\n");
 
     // mark attached right away, in case another initialize() call 
     //is made (happens if multiple applets are present on the same page)
@@ -2668,7 +2668,7 @@
 
   PLUGIN_DEBUG_1ARG ("GOT JAVA OBJECT IDENTIFIER: %d\n", object_identifier_return);
   if (object_identifier_return == 0)
-    printf ("WARNING: received object identifier 0\n");
+    PLUGIN_DEBUG_0ARG ("WARNING: received object identifier 0\n");
 
   *object = references.ReferenceObject (object_identifier_return);
 
@@ -4360,7 +4360,7 @@
   PLUGIN_TRACE_LISTENER ();
 
   nsCString shutdownStr("shutdown");
-  printf("stop listening: %uld\n", aStatus);
+  PLUGIN_DEBUG_1ARG("stop listening: %uld\n", aStatus);
 
   nsresult result = NS_OK;
 
@@ -4374,7 +4374,7 @@
     PLUGIN_CHECK_RETURN ("clear async wait", result);
     break;
   default:
-    printf ("ERROR %x\n", aStatus);
+    PLUGIN_DEBUG_1ARG ("ERROR %x\n", aStatus);
     PLUGIN_DEBUG ("Listener: Unknown status value.");
   }
   return NS_OK;
@@ -4740,7 +4740,7 @@
       retval.i = 0;
       break;
     default:
-      printf ("WARNING: didn't handle parse type\n");
+      PLUGIN_DEBUG_0ARG ("WARNING: didn't handle parse type\n");
       break;
     }
 
@@ -4830,7 +4830,7 @@
           break;
         default:
           PLUGIN_ERROR_TWO ("Failed to parse signature", id->signature);
-          printf ("FAILED ID: %d\n", id->identifier);
+          PLUGIN_DEBUG_1ARG ("FAILED ID: %d\n", id->identifier);
           break;
         }
 	
--- a/plugin/icedtea/netscape/javascript/JSObject.java	Thu Dec 11 00:35:05 2008 +0100
+++ b/plugin/icedtea/netscape/javascript/JSObject.java	Thu Dec 11 14:11:45 2008 -0500
@@ -188,9 +188,9 @@
     	if (args == null)
     		args = new Object[0];
 
-        System.err.print ("JSObject.call " + methodName);
+    	PluginDebug.debug ("JSObject.call " + methodName);
         for (int i = 0; i < args.length; i++)
-            System.err.print (" " + args[i]);
+            PluginDebug.debug (" " + args[i]);
         PluginDebug.debug("");
         return PluginAppletViewer.call(internal, methodName, args);
     }
--- a/rt/net/sourceforge/jnlp/NetxPanel.java	Thu Dec 11 00:35:05 2008 +0100
+++ b/rt/net/sourceforge/jnlp/NetxPanel.java	Thu Dec 11 14:11:45 2008 -0500
@@ -70,10 +70,13 @@
     		synchronized(JNLPRuntime.initMutex) {
     			//The custom NetX Policy and SecurityManager are set here.
     			if (!JNLPRuntime.isInitialized()) {
-    				System.out.println("initializing JNLPRuntime...");
+    			    if (JNLPRuntime.isDebug())
+    			        System.out.println("initializing JNLPRuntime...");
+
     				JNLPRuntime.initialize();
     			} else {
-    				System.out.println("JNLPRuntime already initialized");
+    			    if (JNLPRuntime.isDebug())
+    			        System.out.println("JNLPRuntime already initialized");
     			}
     		}
 
--- a/rt/net/sourceforge/jnlp/PluginBridge.java	Thu Dec 11 00:35:05 2008 +0100
+++ b/rt/net/sourceforge/jnlp/PluginBridge.java	Thu Dec 11 14:11:45 2008 -0500
@@ -29,6 +29,8 @@
 import java.util.List;
 import java.util.ArrayList;
 
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+
 
 public class PluginBridge extends JNLPFile
 {
@@ -76,9 +78,11 @@
         }
 
         if (jar != null && jar.length() > 0) {
-            System.err.println("Jar string: " + jar);
             this.jars = jar.split(",");
-            System.err.println("jars length: " + jars.length);
+            if (JNLPRuntime.isDebug()) {
+                System.err.println("Jar string: " + jar);
+                System.err.println("jars length: " + jars.length);
+            }
         }
         this.atts = atts;