harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Svetlana Samoilenko (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-386) java.beans.PropertyChangeSupport.removePropertyChangeListener does not remove a PropertyChangeListener.
Date Fri, 21 Apr 2006 12:04:05 GMT
java.beans.PropertyChangeSupport.removePropertyChangeListener does not remove a PropertyChangeListener.

--------------------------------------------------------------------------------------------------------

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

  Components: Classlib  
    Reporter: Svetlana Samoilenko


The test listed below demonstrates that java.beans.PropertyChangeSupport.removePropertyChangeListener(
String propertyName,PropertyChangeListener listener) method does not remove a PropertyChangeListener
with a specific property. 

import java.beans.PropertyChangeSupport; 
import java.beans.PropertyChangeListenerProxy; 
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;

public class test { 
    public static void main(String[] args) { 

       PropertyChangeSupport prop = new PropertyChangeSupport(new Object());
       PropertyChangeListener lis1 = new UserPropertyChangeListener();
       PropertyChangeListener lis2 = new PropertyChangeListenerProxy("name",lis1);
       System.out.println("len before adding="+prop.getPropertyChangeListeners().length);

            
       prop.addPropertyChangeListener(lis2);
       System.out.println("len after adding="+prop.getPropertyChangeListeners().length); 
            
       prop.removePropertyChangeListener("name",lis1);
       System.out.println("len after removing="+prop.getPropertyChangeListeners().length);
        
    } 
} 

class UserPropertyChangeListener implements PropertyChangeListener {
     PropertyChangeEvent event;
     public void propertyChange(PropertyChangeEvent event) {
         this.event = event;
     }
}

Output on Harmony:
len before adding=0
len after adding=1
len after removing=1

Output on RI (BEA 1.5):
len before adding=0
len after adding=1
len after removing=0

-- 
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