8129611: Accessbridge error handling improvement
authorptbrunet
Thu, 25 Jun 2015 15:00:08 -0500
changeset 33287 4428afbe11bd
parent 33286 71c4bed3de03
child 33288 ef7d99d1e531
8129611: Accessbridge error handling improvement Reviewed-by: prr, ahgross, asmotrak Contributed-by: peter.brunet@oracle.com
jdk/src/jdk.accessibility/windows/native/common/AccessBridgeDebug.cpp
jdk/src/jdk.accessibility/windows/native/common/AccessBridgeDebug.h
jdk/src/jdk.accessibility/windows/native/libwindowsaccessbridge/WinAccessBridge.cpp
--- a/jdk/src/jdk.accessibility/windows/native/common/AccessBridgeDebug.cpp	Mon Jun 15 12:58:33 2015 +0200
+++ b/jdk/src/jdk.accessibility/windows/native/common/AccessBridgeDebug.cpp	Thu Jun 25 15:00:08 2015 -0500
@@ -36,39 +36,6 @@
 extern "C" {
 #endif
 
-/**
- * print a GetLastError message
- */
-char *printError(char *msg) {
-    LPVOID lpMsgBuf = NULL;
-    static char retbuf[256];
-
-    if (msg != NULL) {
-        strncpy((char *)retbuf, msg, sizeof(retbuf));
-    }
-    if (!FormatMessage(
-                       FORMAT_MESSAGE_ALLOCATE_BUFFER |
-                       FORMAT_MESSAGE_FROM_SYSTEM |
-                       FORMAT_MESSAGE_IGNORE_INSERTS,
-                       NULL,
-                       GetLastError(),
-                       MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
-                       (LPTSTR) &lpMsgBuf,
-                       0,
-                       NULL ))
-        {
-            PrintDebugString("  %s: FormatMessage failed", msg);
-        } else {
-            PrintDebugString("  %s: %s", msg, (char *)lpMsgBuf);
-        }
-    if (lpMsgBuf != NULL) {
-        strncat((char *)retbuf, ": ", sizeof(retbuf) - strlen(retbuf) - 1);
-        strncat((char *)retbuf, (char *)lpMsgBuf, sizeof(retbuf) - strlen(retbuf) - 1);
-    }
-    return (char *)retbuf;
-}
-
-
     /**
      * Send debugging info to the appropriate place
      */
--- a/jdk/src/jdk.accessibility/windows/native/common/AccessBridgeDebug.h	Mon Jun 15 12:58:33 2015 +0200
+++ b/jdk/src/jdk.accessibility/windows/native/common/AccessBridgeDebug.h	Thu Jun 25 15:00:08 2015 -0500
@@ -49,7 +49,6 @@
 extern "C" {
 #endif
 
-    char *printError(char *msg);
     void PrintDebugString(char *msg, ...);
     void PrintJavaDebugString(char *msg, ...);
     void wPrintJavaDebugString(wchar_t *msg, ...);
--- a/jdk/src/jdk.accessibility/windows/native/libwindowsaccessbridge/WinAccessBridge.cpp	Mon Jun 15 12:58:33 2015 +0200
+++ b/jdk/src/jdk.accessibility/windows/native/libwindowsaccessbridge/WinAccessBridge.cpp	Thu Jun 25 15:00:08 2015 -0500
@@ -262,34 +262,6 @@
     theWindowsAccessBridge = this;
     isVMInstanceChainInUse = false;
 
-
-    // notify the user if new JVMs are found
-    /*
-      newJVMs = (char **)malloc(MAX_NEW_JVMS_FOUND);
-      for (int i = 0; i < MAX_NEW_JVMS_FOUND; i++) {
-      newJVMs[i] = (char *)malloc(SHORT_STRING_SIZE);
-      newJVMs[i][0] = 0;
-      }
-
-      BOOL newJ2SEFound = findNewJVMs(J2SE_REG_PATH, newJVMs);
-      BOOL newJ2REFound = TRUE; // findNewJVMs(J2RE_REG_PATH, newJVMs);
-
-      if (newJ2SEFound || newJ2REFound) {
-
-      int result = DialogBox(windowsInstance,
-      "FOUNDNEWJVMDIALOG",
-      NULL,
-      (DLGPROC)newJVMFoundDialogProc);
-      if (result < 0) {
-      printError("DialogBox failed");
-      }
-
-      PrintDebugString("  FOUNDNEWJVMDIALOG: result = %d", result);
-
-      ShowWindow((HWND)result, SW_SHOW);
-      }
-    */
-
     ShowWindow(theDialogWindow, SW_SHOW);
 }