You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Dmitry A. Durnev (JIRA)" <ji...@apache.org> on 2006/04/25 10:32:06 UTC

[jira] Updated: (HARMONY-321) VetoableChangeSupport: the reverting event is not fired if the change is vetoed

     [ http://issues.apache.org/jira/browse/HARMONY-321?page=all ]

Dmitry A. Durnev updated HARMONY-321:
-------------------------------------

    Attachment: Harmony-321.txt

Attached patch should fix the issue.(Includes light refactoring of VetoableChangeSupport.doFirePropertyChange() private method)

> 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
>     Assignee: Mikhail Loenko
>     Priority: Minor
>  Attachments: Harmony-321.txt
>
> 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