Program: 36433
Project: 36433
Buggy source:
/** 
 * Attempts to select an input method or keyboard layout that supports the given locale, and returns a value indicating whether such an input method or keyboard layout has been successfully selected. The following steps are taken until an input method has been selected: <p> <ul> <li> If the currently selected input method or keyboard layout supports the requested locale, it remains selected.</li> <li> If there is no input method or keyboard layout available that supports the requested locale, the current input method or keyboard layout remains selected.</li> <li> If the user has previously selected an input method or keyboard layout for the requested locale from the user interface, then the most recently selected such input method or keyboard layout is reselected.</li> <li> Otherwise, an input method or keyboard layout that supports the requested locale is selected in an implementation dependent way.</li> <p> </ul> Before switching away from an input method, any currently uncommitted text is committed. If no input method or keyboard layout supporting the requested locale is available, then false is returned. <p> Not all host operating systems provide API to determine the locale of the currently selected native input method or keyboard layout, and to select a native input method or keyboard layout by locale. For host operating systems that don't provide such API, <code>selectInputMethod</code> assumes that native input methods or keyboard layouts provided by the host operating system support only the system's default locale. <p> A text editing component may call this method, for example, when the user changes the insertion point, so that the user can immediately continue typing in the language of the surrounding text.
 * @param locale The desired new locale.
 * @return true if the input method or keyboard layout that's active afterthis call supports the desired locale.
 * @exception NullPointerException if <code>locale</code> is null
 */
public boolean selectInputMethod(Locale locale){
  return false;
}

Fixed version (ground truth):
/** 
 * Attempts to select an input method or keyboard layout that supports the given locale, and returns a value indicating whether such an input method or keyboard layout has been successfully selected. The following steps are taken until an input method has been selected: <p> <ul> <li> If the currently selected input method or keyboard layout supports the requested locale, it remains selected.</li> <li> If there is no input method or keyboard layout available that supports the requested locale, the current input method or keyboard layout remains selected.</li> <li> If the user has previously selected an input method or keyboard layout for the requested locale from the user interface, then the most recently selected such input method or keyboard layout is reselected.</li> <li> Otherwise, an input method or keyboard layout that supports the requested locale is selected in an implementation dependent way.</li> </ul> Before switching away from an input method, any currently uncommitted text is committed. If no input method or keyboard layout supporting the requested locale is available, then false is returned. <p> Not all host operating systems provide API to determine the locale of the currently selected native input method or keyboard layout, and to select a native input method or keyboard layout by locale. For host operating systems that don't provide such API, <code>selectInputMethod</code> assumes that native input methods or keyboard layouts provided by the host operating system support only the system's default locale. <p> A text editing component may call this method, for example, when the user changes the insertion point, so that the user can immediately continue typing in the language of the surrounding text.
 * @param locale The desired new locale.
 * @return true if the input method or keyboard layout that's active afterthis call supports the desired locale.
 * @exception NullPointerException if <code>locale</code> is null
 */
public boolean selectInputMethod(Locale locale){
  return false;
}