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

EventSetDescriptor does not support listener methods taking 0 or more than 1 arguments

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P1
    • Resolution: Fixed
    • Affects Version/s: 5.0
    • Fix Version/s: 6
    • Component/s: client-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b50
    • CPU:
      generic, x86
    • OS:
      generic, windows_xp

      Backports

        Description

        The JavaBeans specification states under certain circumstances it is permissible to allow method signatures containing one or more parameters of any arbitrary Java type. But the changes made to EventDescriptor.java in JDK1.5 does not provide support for this.

        For example if EventDescriptor is constructed with listener methods array, but the caller doesn't maintain any hard reference to the array. Because EventDescriptor uses soft reference to the listener method array, it may be gced based on memory constraints. In such cases, EventSetDescriptor uses introspector to find listener methods but methods are looked up using the method names array and only methods which takes only one argument is looked for. This will break lots of components whose listener methods have 0 or more than 1 arguments.

        If you look into the code in EventSetDescriptor.java
        public synchronized Method[] getListenerMethods() {
        Method[] methods = getListenerMethods0();
        if (methods == null) {
        if (listenerMethodDescriptors != null) {
        methods = new Method[listenerMethodDescriptors.length];
        for (int i = 0; i < methods.length; i++) {
        methods[i] = listenerMethodDescriptors[i].getMethod();
        }
        } else if (listenerMethodNames != null) {
        methods = new Method[listenerMethodNames.length];

        for (int i = 0; i < methods.length; i++) {
        methods[i] = Introspector.findMethod(getListenerType(),
        listenerMethodNames[i], 1);
        }
        }
        setListenerMethods(methods);
        }
        return methods;
            }
        Note that argument count passed to findMethod is always one.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                peterz Peter Zhelezniakov
                Reporter:
                djayaramsunw Devananda Jayaraman (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: