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-321) VetoableChangeSupport: the reverting event is not fired if the change is vetoed
Date Fri, 07 Apr 2006 07:40:24 GMT
VetoableChangeSupport: the reverting event is not fired if the change is vetoed
-------------------------------------------------------------------------------

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

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


The spec on VetoableChangeSupport.fireVetoableChange(String, Object, Object)
reads:

"If anyone vetos the change, then fire a new event reverting everyone to the old 
value and then rethrow the PropertyVetoException." 

This "new event" is never fired. See test below. Expected and RI output is:
1
0

But actual output on Harmony is:
0
1

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

public class VetoableChangeSupportTest {
    VetoableChangeSupport vcs = new VetoableChangeSupport(this);
    PropertyChangeEvent event;
    String vetoedPropName = "prop";
    VetoableChangeListener vlistener = new VetoableChangeListener() {        
        public void vetoableChange(PropertyChangeEvent e) throws PropertyVetoException {
            event = e;
            String propName = e.getPropertyName();
            if (propName.equals(vetoedPropName) && e.getNewValue().equals(new Integer(1)))
{                
                throw new PropertyVetoException(propName + " change is vetoed!", e);
            }
        }
        
    };
    public static void main(String[] args) {
        new VetoableChangeSupportTest().runTest();
    }
    
    void runTest(){
        vcs.addVetoableChangeListener(vlistener);
        try {
            vcs.fireVetoableChange(vetoedPropName, 0, 1);
        }
        catch (PropertyVetoException pve) {
            
        }
        System.out.println(event.getOldValue());
        System.out.println(event.getNewValue());
    }
}


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