Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6573426

InputMethodManager: unnecessary try-catch clause should be deleted in the run() method

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 7
    • 7
    • client-libs
    • None
    • b20
    • generic
    • generic

        There is an oversight of the fix for 6544309. Look at the code in sun.awt.im.InputMethodManager:

        286 public void run() {
        ...
        297 // Loop for processing input method change requests
        298 while (true) {
        299 waitForChangeRequest();
        300 initializeInputMethodLocatorList();
        301 try {
        302 if (requestComponent != null) {
        303 try {
        304 showInputMethodMenuOnRequesterEDT(requestComponent);
        305 } catch (Exception ex) {
        306 throw new RuntimeException(ex);
        307 }
        308 } else {
        309 // show the popup menu within the event thread
        310 EventQueue.invokeAndWait(new Runnable() {
        311 public void run() {
        312 showInputMethodMenu();
        313 }
        314 });
        315 }
        316 } catch (InterruptedException ie) {
        317 } catch (InvocationTargetException ite) {
        318 // should we do anything under these exceptions?
        319 }
        320 }
        321 }

        There is an unnecessary try-catch clause at 303-307 lines. InterruptedException and InvocationTargetException that could be thrown in showInputMethodMenuOnRequesterEDT() will be caught in the outer try-catch clause. The try-catch clause should be deleted in this way:

        286 public void run() {
        ...
        297 // Loop for processing input method change requests
        298 while (true) {
        299 waitForChangeRequest();
        300 initializeInputMethodLocatorList();
        301 try {
        302 if (requestComponent != null) {
        303 showInputMethodMenuOnRequesterEDT(requestComponent);
        304 } else {
        305 // show the popup menu within the event thread
        306 EventQueue.invokeAndWait(new Runnable() {
        307 public void run() {
        308 showInputMethodMenu();
        309 }
        310 });
        311 }
        312 } catch (InterruptedException ie) {
        313 } catch (InvocationTargetException ite) {
        314 // should we do anything under these exceptions?
        315 }
        316 }
        317 }

              mlapshin Mikhail Lapshin (Inactive)
              mlapshin Mikhail Lapshin (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: