harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitry A. Durnev (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-320) PropertyChangeSupport.removePropertyChangeListener(PropertyChangeListener) doesn't remove a specific property listener
Date Fri, 07 Apr 2006 07:30:26 GMT
PropertyChangeSupport.removePropertyChangeListener(PropertyChangeListener) doesn't remove a
specific property listener
----------------------------------------------------------------------------------------------------------------------

         Key: HARMONY-320
         URL: http://issues.apache.org/jira/browse/HARMONY-320
     Project: Harmony
        Type: Bug

  Components: Classlib  
 Environment: j9 + Harmony classlib
    Reporter: Dmitry A. Durnev
    Priority: Minor


If the listener was added with addPropertyChangeListener(String, 
PropertyChangeListener) it is not removed by  removePropertyChangeListener
(PropertyChangeListener). See test below. RI output is:

1
0

Harmony output is:
1
1

Test:
--------------------------------------------------------------------------------------------
import java.beans.*;

public class PropertyChangeSupportTest {
   PropertyChangeSupport pcs = new PropertyChangeSupport(this);
   PropertyChangeListener listener = new PropertyChangeListener() {

    public void propertyChange(PropertyChangeEvent arg0) {        
    }
       
   };
    public static void main(String[] args) {
        new PropertyChangeSupportTest().runTest();
    }
    
    void runTest() {
        pcs.addPropertyChangeListener("property", listener);
        PropertyChangeListener[] listeners = pcs.getPropertyChangeListeners(); 
        System.out.println(listeners.length);
        pcs.removePropertyChangeListener(listeners[0]);
        listeners = pcs.getPropertyChangeListeners();
        System.out.println(pcs.getPropertyChangeListeners().length);
    }
}



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message