JDK-6573426 : InputMethodManager: unnecessary try-catch clause should be deleted in the run() method
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt:i18n
  • Affected Version: 7
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2007-06-25
  • Updated: 2011-01-19
  • Resolved: 2007-09-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b20Fixed
Related Reports
Relates :  
Description
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     }

Comments
SUGGESTED FIX webrev: http://javaweb.sfbay/jcg/7/swing/6573426/ +++ InputMethodManager.java Mon Jun 25 19:00:26 2007 @@ -316,15 +316,11 @@ while (true) { waitForChangeRequest(); initializeInputMethodLocatorList(); try { if (requestComponent != null) { - try { - showInputMethodMenuOnRequesterEDT(requestComponent); - } catch (Exception ex) { - throw new RuntimeException(ex); - } + showInputMethodMenuOnRequesterEDT(requestComponent); } else { // show the popup menu within the event thread EventQueue.invokeAndWait(new Runnable() { public void run() { showInputMethodMenu();
26-06-2007

EVALUATION See description.
25-06-2007