8132249: Clean up JAB debugging code
authorptbrunet
Mon, 03 Aug 2015 15:48:33 -0500
changeset 32129 51464cf078d5
parent 32128 8506d9dade57
child 32130 28cc13849717
child 32134 91e37aced110
8132249: Clean up JAB debugging code Summary: remove dead code; replace DEBUG_CODE with PrintDebugString; fix typos, incorrect print args Reviewed-by: van Contributed-by: peter.brunet@oracle.com
jdk/src/jdk.accessibility/windows/native/libjavaaccessbridge/AccessBridgeATInstance.cpp
jdk/src/jdk.accessibility/windows/native/libjavaaccessbridge/AccessBridgeJavaEntryPoints.cpp
jdk/src/jdk.accessibility/windows/native/libjavaaccessbridge/JavaAccessBridge.cpp
jdk/src/jdk.accessibility/windows/native/libwindowsaccessbridge/AccessBridgeJavaVMInstance.cpp
jdk/src/jdk.accessibility/windows/native/libwindowsaccessbridge/AccessBridgeWindowsEntryPoints.cpp
jdk/src/jdk.accessibility/windows/native/libwindowsaccessbridge/WinAccessBridge.cpp
--- a/jdk/src/jdk.accessibility/windows/native/libjavaaccessbridge/AccessBridgeATInstance.cpp	Fri Jul 31 13:13:30 2015 +0300
+++ b/jdk/src/jdk.accessibility/windows/native/libjavaaccessbridge/AccessBridgeATInstance.cpp	Mon Aug 03 15:48:33 2015 -0500
@@ -87,7 +87,7 @@
 AccessBridgeATInstance::initiateIPC() {
     DWORD errorCode;
 
-    PrintDebugString("\r\nin AccessBridgeATInstance::initiateIPC()");
+    PrintDebugString("\r\nIn AccessBridgeATInstance::initiateIPC()");
 
     // open Windows-initiated IPC filemap & map it to a ptr
 
--- a/jdk/src/jdk.accessibility/windows/native/libjavaaccessbridge/AccessBridgeJavaEntryPoints.cpp	Fri Jul 31 13:13:30 2015 +0300
+++ b/jdk/src/jdk.accessibility/windows/native/libjavaaccessbridge/AccessBridgeJavaEntryPoints.cpp	Mon Aug 03 15:48:33 2015 -0500
@@ -40,7 +40,7 @@
                                                          jobject bridgeObject) {
     jniEnv = jniEnvironment;
     accessBridgeObject = (jobject)bridgeObject;
-    PrintDebugString("AccessBridgeJavaEntryPoints(%X, %X) called", jniEnv, accessBridgeObject);
+    PrintDebugString("AccessBridgeJavaEntryPoints(%p, %p) called", jniEnv, accessBridgeObject);
 }
 
 
--- a/jdk/src/jdk.accessibility/windows/native/libjavaaccessbridge/JavaAccessBridge.cpp	Fri Jul 31 13:13:30 2015 +0300
+++ b/jdk/src/jdk.accessibility/windows/native/libjavaaccessbridge/JavaAccessBridge.cpp	Mon Aug 03 15:48:33 2015 -0500
@@ -89,27 +89,6 @@
         theJavaAccessBridge->javaRun(env, obj);
     }
 
-#if 0 // SetDlgItemText has caused problems with JAWS
-    /**
-     * Append debug info to dialog
-     *
-     */
-    void AppendToCallInfo(char *s) {
-        char buffer[4096];
-
-        PrintDebugString(s);
-
-        GetDlgItemText(theDialogWindow, cCallInfo, buffer, sizeof(buffer));
-        if (strlen(buffer) < (sizeof(buffer) - strlen(s))) {
-            strncat(buffer, s, sizeof(buffer));
-            SetDlgItemText(theDialogWindow, cCallInfo, buffer);
-        } else {
-            SetDlgItemText(theDialogWindow, cCallInfo, s);
-        }
-    }
-#endif
-
-
     /**
      * Our window proc
      *
@@ -118,24 +97,23 @@
         int command;
         COPYDATASTRUCT *sentToUs;
         char *package;
-        //DEBUG_CODE(char buffer[256]);
 
         switch (message) {
         case WM_INITDIALOG:
-            //DEBUG_CODE(SetDlgItemText(theDialogWindow, cStatusText, "Initializing"));
+            PrintDebugString("In AccessBridgeDialog - Initializing");
             break;
 
         case WM_COMMAND:
             command = LOWORD (wParam);
+            PrintDebugString("In AccessBridgeDialog - Got WM_COMMAND, command: %X", command);
             break;
 
             // call from Java with data for us to deliver
         case WM_COPYDATA:
             if (theDialogWindow == (HWND) wParam) {
-                //DEBUG_CODE(SetDlgItemText(theDialogWindow, cStatusText, "Got WM_COPYDATA from ourselves"));
+                PrintDebugString("In AccessBridgeDialog - Got WM_COPYDATA from ourselves");
             } else {
-                //DEBUG_CODE(sprintf(buffer, "Got WM_COPYDATA from HWND %p", wParam));
-                //DEBUG_CODE(SetDlgItemText(theDialogWindow, cStatusText, buffer));
+                PrintDebugString("In AccessBridgeDialog - Got WM_COPYDATA from HWND %p", wParam);
                 sentToUs = (COPYDATASTRUCT *) lParam;
                 package = (char *) sentToUs->lpData;
                 theJavaAccessBridge->processPackage(package, sentToUs->cbData);
@@ -147,18 +125,16 @@
             // wParam == sourceHwnd
             // lParam == buffer size in shared memory
             if (theDialogWindow == (HWND) wParam) {
-                //DEBUG_CODE(SetDlgItemText(theDialogWindow, cStatusText, "Got AB_MESSAGE_WAITING from ourselves"));
+                PrintDebugString("In AccessBridgeDialog - Got AB_MESSAGE_WAITING from ourselves");
             } else {
-                //DEBUG_CODE(sprintf(buffer, "Got AB_MESSAGE_WAITING from HWND %p", wParam));
-                //DEBUG_CODE(SetDlgItemText(theDialogWindow, cStatusText, buffer));
+                PrintDebugString("In AccessBridgeDialog - Got AB_MESSAGE_WAITING from HWND %p", wParam);
                 LRESULT returnVal = theJavaAccessBridge->receiveMemoryPackage((HWND) wParam, (long) lParam);
             }
             break;
 
             // a JavaAccessBridge DLL is going away
         case AB_DLL_GOING_AWAY:
-            // wParam == sourceHwnd
-            //DEBUG_CODE(SetDlgItemText(theDialogWindow, cStatusText, "Got AB_DLL_GOING_AWAY message"));
+            PrintDebugString("In AccessBridgeDialog - Got AB_DLL_GOING_AWAY message");
             theJavaAccessBridge->WindowsATDestroyed((HWND) wParam);
             break;
 
@@ -169,6 +145,7 @@
                 // A new Windows AT just said "hi";
                 // say "hi" back so it can mate up with us
                 // otherwise don't do anything (e.g. don't set up data structures yet)
+                PrintDebugString("In AccessBridgeDialog - Got theFromWindowsHelloMsgID message");
                 theJavaAccessBridge->postHelloToWindowsDLLMsg((HWND) wParam);
             }
         }
@@ -324,9 +301,9 @@
  */
 void
 JavaAccessBridge::postHelloToWindowsDLLMsg(HWND destHwnd) {
-    PrintDebugString("\r\nin JavaAccessBridge::postHelloToWindowsDLLMsg");
+    PrintDebugString("\r\nIn JavaAccessBridge::postHelloToWindowsDLLMsg");
     PrintDebugString("  calling PostMessage(%p, %X, %p, %p)",
-                     destHwnd, theFromJavaHelloMsgID, dialogWindow, javaVM);
+                     destHwnd, theFromJavaHelloMsgID, dialogWindow, dialogWindow);
     PostMessage(destHwnd, theFromJavaHelloMsgID, (WPARAM) dialogWindow, (LPARAM) dialogWindow);
 }
 
@@ -2493,7 +2470,7 @@
                                     jobject eventObj, jobject source) {                 \
                                                                                         \
         PrintDebugString("\r\nFiring event id = %d(%p, %p, %p, %p); vmID = %X",         \
-                         eventConstant, env, callingObj, eventObj, source, javaVM);     \
+                         eventConstant, env, callingObj, eventObj, source, dialogWindow); \
                                                                                         \
         /* sanity check */                                                              \
         if (ATs == (AccessBridgeATInstance *) 0) {                                      \
@@ -2531,7 +2508,7 @@
     void JavaAccessBridge::javaShutdown(JNIEnv *env, jobject callingObj) {
 
         PrintDebugString("\r\nFiring event id = %d(%p, %p); vmID = %X",
-                         cJavaShutdownEvent, env, callingObj, javaVM);
+                         cJavaShutdownEvent, env, callingObj, dialogWindow);
 
         /* sanity check */
         if (ATs == (AccessBridgeATInstance *) 0) {
--- a/jdk/src/jdk.accessibility/windows/native/libwindowsaccessbridge/AccessBridgeJavaVMInstance.cpp	Fri Jul 31 13:13:30 2015 +0300
+++ b/jdk/src/jdk.accessibility/windows/native/libwindowsaccessbridge/AccessBridgeJavaVMInstance.cpp	Mon Aug 03 15:48:33 2015 -0500
@@ -188,7 +188,7 @@
  *               with the Java AccessBridge DLL
  *
  *               NOTE: WM_COPYDATA is only for one-way IPC; there
- *               is now way to return parameters (especially big ones)
+ *               is no way to return parameters (especially big ones)
  *               Use sendMemoryPackage() to do that!
  */
 LRESULT
--- a/jdk/src/jdk.accessibility/windows/native/libwindowsaccessbridge/AccessBridgeWindowsEntryPoints.cpp	Fri Jul 31 13:13:30 2015 +0300
+++ b/jdk/src/jdk.accessibility/windows/native/libwindowsaccessbridge/AccessBridgeWindowsEntryPoints.cpp	Mon Aug 03 15:48:33 2015 -0500
@@ -51,7 +51,6 @@
         // open our window
         if (theWindowsAccessBridge != (WinAccessBridge *) 0) {
             theWindowsAccessBridge->initWindow();
-            DEBUG_CODE(SetDlgItemText(theDialogWindow, cInvokedByText, "Windows"));
         }
     }
 
--- a/jdk/src/jdk.accessibility/windows/native/libwindowsaccessbridge/WinAccessBridge.cpp	Fri Jul 31 13:13:30 2015 +0300
+++ b/jdk/src/jdk.accessibility/windows/native/libwindowsaccessbridge/WinAccessBridge.cpp	Mon Aug 03 15:48:33 2015 -0500
@@ -366,7 +366,7 @@
 WinAccessBridge::rendezvousWithNewJavaDLL(HWND JavaBridgeDLLwindow, long vmID) {
     LRESULT returnVal;
 
-    PrintDebugString("in JavaAccessBridge::rendezvousWithNewJavaDLL(%p, %X)",
+    PrintDebugString("in WinAccessBridge::rendezvousWithNewJavaDLL(%p, %X)",
                      JavaBridgeDLLwindow, vmID);
 
     isVMInstanceChainInUse = true;
@@ -880,7 +880,7 @@
         return FALSE;
     }
 
-    PrintDebugString("  in WinAccessBridge::isJavaWindow");
+    PrintDebugString("In WinAccessBridge::isJavaWindow");