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

Behaviour of java.awt.AWTEventMulticaster.getListeners(,null) is invalid

    Details

    • Subcomponent:
    • Introduced In Build:
      b95
    • Introduced In Version:
      6
    • Resolved In Build:
      b97
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description

      J2SE : FAIL - mustang b95
      Platform[s] : FAIL - seems to be all
      switch/Mode : FAIL - default

      The method java.awt.AWTEventMulticaster.getListeners contains the following code (since b95):

       public static <T extends EventListener> T[]
              getListeners(EventListener l, Class<T> listenerType)
          {
              if (listenerType == null) {
                  throw new RuntimeException ("Listener type should not be null");
              }
      ...


      This is violation of specification, because it says:

      "Throws:
          ClassCastException - if listenerType doesn't specify a class or interface that implements java.util.EventListener"

      So RuntimeException should be changed to ClassCastException (or specification should be updated).

      This method was changed in mustang b95
      affected JCK 6.0 tests:

      The following tests:

      api/java_awt/AWTEventMulticaster/index.html#GetListeners[AWTEventMulticaster0082]
      api/java_awt/Button/index.html#getListeners[Button0012]
      api/java_awt/Checkbox/index.html#getListeners[Checkbox0041]
      api/java_awt/CheckboxMenuItem/descriptions.html#getListeners[CheckboxMenuItem0014]
      api/java_awt/Choice/descriptions.html#getListeners[Choice0141]
      api/java_awt/Component/descriptions.html#getListeners[Component0001]
      api/java_awt/Container/index.html#getListeners[Container0008]
      api/java_awt/List/index.html#getListeners[List0047]
      api/java_awt/MenuItem/descriptions.html#getListeners[MenuItem0018]
      api/java_awt/Scrollbar/index.html#getListeners[Scrollbar0045]
      api/java_awt/TextComponent/descriptions.html#getListeners[TextComponent0042]
      api/java_awt/TextField/descriptions.html#getListeners[TextField0018]
      api/java_awt/Window/index.html#getListeners[Window0029]

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                son Oleg Sukhodolsky (Inactive)
                Reporter:
                pastepan Pavel Stepanov (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: