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

Kestrel-F regression: java.awt.im.InputContext.selectInputMethod

    XMLWordPrintable

Details

    • beta
    • sparc
    • solaris_2.5
    • Verified

    Description



      Name: mgC56079 Date: 06/04/99


      According to the spec this method should never throw an exception:
          /**
           * Selects an input method that supports the given locale.
           * If the currently selected input method supports the desired locale
           * or if there's no input method available that supports the desired
           * locale, the current input method remains active. Otherwise, an input
           * method is selected that supports text input for the desired locale.
           * Before switching to a different input method, any currently uncommitted
           * text is committed.
           * If the platform does not support input methods or the desired locale,
           * then false is returned.
           *
           * <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 Whether the input method that's active after this call
           * supports the desired locale.
           */
          public boolean selectInputMethod(Locale locale) {

      This no longer works in JDK-Kestrel (build F):
      ----- Minimized test: IM1.java -----
      import java.awt.im.*;
      import java.util.Locale;

      public class IM1 {
          public static void main(String args[]) {
              InputContext anInputContext = InputContext.getInstance();

              if ( anInputContext == null ) {
                  System.out.println("skipping the test");
                  return;
              }

            anInputContext.selectInputMethod(Locale.JAPANESE);
            System.out.println("passed");

          }
      }
      ----- Output (JDK1.2, correct) -----
      % java IM1
      passed
      ----- Output (JDK-Kestrel, wrong) -----
      % java IM1
      Exception in thread "main" java.lang.NullPointerException
      at sun.awt.im.ExecutableInputMethodManager.findInputMethod(InputMethodManager.java, Compiled Code)
      at sun.awt.im.InputContext.selectInputMethod(InputContext.java, Compiled Code)
      at IM1.main(IM1.java, Compiled Code)


      ======================================================================

      Attachments

        Activity

          People

            okutsu Masayoshi Okutsu
            gorsunw Gor Gor (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: