You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Roman S. Bushmanov (JIRA)" <ji...@apache.org> on 2007/05/31 13:32:18 UTC

[jira] Created: (HARMONY-4011) [classlib][beans] compatibility: java.beans.beancontext.BeanContextSupport allows registering the same listener several times

[classlib][beans] compatibility: java.beans.beancontext.BeanContextSupport allows registering the same listener several times
-----------------------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-4011
                 URL: https://issues.apache.org/jira/browse/HARMONY-4011
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Roman S. Bushmanov


Successive calls to addBeanContextMembershipListener() method with the same object as argument result in adding that object into listener set multiple times. RI behaves differently.

The exact behaviour in the described case is not specified, but it makes sense to be compatible with RI. 

To reproduce the issue, please run the test listed below.

-------------------------- Expected output (= RI output): -----------------------
Listener added
ADDED
Listener added
ADDED

---------------------------------- Harmony output ----------------------------------
Listener added
ADDED
Listener added
ADDED
ADDED

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

public class Test{

    public static void main(String[] args){

        BeanContextSupport context = new BeanContextSupport();
        BeanContextMembershipListener listener = new BeanContextMembershipListener() {
            public void childrenAdded(BeanContextMembershipEvent bcme) {
                System.out.println("ADDED");
            }

            public void childrenRemoved(BeanContextMembershipEvent bcme){}
        };

        // add listener
        context.addBeanContextMembershipListener(listener);
        System.out.println("Listener added");
        context.add(new BeanContextChildSupport());
        
        // add the same listener onse again
        System.out.println("Listener added again");
        context.addBeanContextMembershipListener(listener);
        context.add(new BeanContextChildSupport());
}


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-4011) [classlib][beans] compatibility: java.beans.beancontext.BeanContextSupport allows registering the same listener several times

Posted by "Roman S. Bushmanov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4011?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roman S. Bushmanov updated HARMONY-4011:
----------------------------------------

    Description: 
Successive calls to addBeanContextMembershipListener() method with the same object as argument result in adding that object into listener set multiple times. RI behaves differently.

The exact behaviour in the described case is not specified, but it makes sense to be compatible with RI. 

To reproduce the issue, please run the test listed below.

-------------------------- Expected output (= RI output): -----------------------
Listener added
ADDED
Listener added again
ADDED

---------------------------------- Harmony output ----------------------------------
Listener added
ADDED
Listener added again
ADDED
ADDED

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

public class Test{

    public static void main(String[] args){

        BeanContextSupport context = new BeanContextSupport();
        BeanContextMembershipListener listener = new BeanContextMembershipListener() {
            public void childrenAdded(BeanContextMembershipEvent bcme) {
                System.out.println("ADDED");
            }

            public void childrenRemoved(BeanContextMembershipEvent bcme){}
        };

        // add listener
        context.addBeanContextMembershipListener(listener);
        System.out.println("Listener added");
        context.add(new BeanContextChildSupport());
        
        // add the same listener onse again
        System.out.println("Listener added again");
        context.addBeanContextMembershipListener(listener);
        context.add(new BeanContextChildSupport());
}


  was:
Successive calls to addBeanContextMembershipListener() method with the same object as argument result in adding that object into listener set multiple times. RI behaves differently.

The exact behaviour in the described case is not specified, but it makes sense to be compatible with RI. 

To reproduce the issue, please run the test listed below.

-------------------------- Expected output (= RI output): -----------------------
Listener added
ADDED
Listener added
ADDED

---------------------------------- Harmony output ----------------------------------
Listener added
ADDED
Listener added
ADDED
ADDED

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

public class Test{

    public static void main(String[] args){

        BeanContextSupport context = new BeanContextSupport();
        BeanContextMembershipListener listener = new BeanContextMembershipListener() {
            public void childrenAdded(BeanContextMembershipEvent bcme) {
                System.out.println("ADDED");
            }

            public void childrenRemoved(BeanContextMembershipEvent bcme){}
        };

        // add listener
        context.addBeanContextMembershipListener(listener);
        System.out.println("Listener added");
        context.add(new BeanContextChildSupport());
        
        // add the same listener onse again
        System.out.println("Listener added again");
        context.addBeanContextMembershipListener(listener);
        context.add(new BeanContextChildSupport());
}



> [classlib][beans] compatibility: java.beans.beancontext.BeanContextSupport allows registering the same listener several times
> -----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4011
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4011
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Roman S. Bushmanov
>
> Successive calls to addBeanContextMembershipListener() method with the same object as argument result in adding that object into listener set multiple times. RI behaves differently.
> The exact behaviour in the described case is not specified, but it makes sense to be compatible with RI. 
> To reproduce the issue, please run the test listed below.
> -------------------------- Expected output (= RI output): -----------------------
> Listener added
> ADDED
> Listener added again
> ADDED
> ---------------------------------- Harmony output ----------------------------------
> Listener added
> ADDED
> Listener added again
> ADDED
> ADDED
> ---------------------------------------  Test.java  -------------------------------------- 
> import java.beans.beancontext.*;
> public class Test{
>     public static void main(String[] args){
>         BeanContextSupport context = new BeanContextSupport();
>         BeanContextMembershipListener listener = new BeanContextMembershipListener() {
>             public void childrenAdded(BeanContextMembershipEvent bcme) {
>                 System.out.println("ADDED");
>             }
>             public void childrenRemoved(BeanContextMembershipEvent bcme){}
>         };
>         // add listener
>         context.addBeanContextMembershipListener(listener);
>         System.out.println("Listener added");
>         context.add(new BeanContextChildSupport());
>         
>         // add the same listener onse again
>         System.out.println("Listener added again");
>         context.addBeanContextMembershipListener(listener);
>         context.add(new BeanContextChildSupport());
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-4011) [classlib][beans] compatibility: java.beans.beancontext.BeanContextSupport allows registering the same listener several times

Posted by "Nellya Udovichenko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-4011?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12506884 ] 

Nellya Udovichenko commented on HARMONY-4011:
---------------------------------------------

Thank you, Alexei! Verified. It works well. 

> [classlib][beans] compatibility: java.beans.beancontext.BeanContextSupport allows registering the same listener several times
> -----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4011
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4011
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Roman S. Bushmanov
>            Assignee: Alexei Zakharov
>         Attachments: H-4011.patch
>
>
> Successive calls to addBeanContextMembershipListener() method with the same object as argument result in adding that object into listener set multiple times. RI behaves differently.
> The exact behaviour in the described case is not specified, but it makes sense to be compatible with RI. 
> To reproduce the issue, please run the test listed below.
> -------------------------- Expected output (= RI output): -----------------------
> Listener added
> ADDED
> Listener added again
> ADDED
> ---------------------------------- Harmony output ----------------------------------
> Listener added
> ADDED
> Listener added again
> ADDED
> ADDED
> ---------------------------------------  Test.java  -------------------------------------- 
> import java.beans.beancontext.*;
> public class Test{
>     public static void main(String[] args){
>         BeanContextSupport context = new BeanContextSupport();
>         BeanContextMembershipListener listener = new BeanContextMembershipListener() {
>             public void childrenAdded(BeanContextMembershipEvent bcme) {
>                 System.out.println("ADDED");
>             }
>             public void childrenRemoved(BeanContextMembershipEvent bcme){}
>         };
>         // add listener
>         context.addBeanContextMembershipListener(listener);
>         System.out.println("Listener added");
>         context.add(new BeanContextChildSupport());
>         
>         // add the same listener onse again
>         System.out.println("Listener added again");
>         context.addBeanContextMembershipListener(listener);
>         context.add(new BeanContextChildSupport());
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-4011) [classlib][beans] compatibility: java.beans.beancontext.BeanContextSupport allows registering the same listener several times

Posted by "Nellya Udovichenko (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4011?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nellya Udovichenko updated HARMONY-4011:
----------------------------------------

    Attachment: H-4011.patch

At adding of the second listener the same object as first (listener) is put in ArrayList bcmListeners of java.beans.beancontext.BeanContextSupport class once more at Harmony. Therefore in the attached patch the corresponding check-up is added in BeanContextSupport.addBeanContextMembershipListeners() method. If bcmListeners already contains the listener the object isn't added again. Test works fine on Harmony (with the same result as RI).

> [classlib][beans] compatibility: java.beans.beancontext.BeanContextSupport allows registering the same listener several times
> -----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4011
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4011
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Roman S. Bushmanov
>         Attachments: H-4011.patch
>
>
> Successive calls to addBeanContextMembershipListener() method with the same object as argument result in adding that object into listener set multiple times. RI behaves differently.
> The exact behaviour in the described case is not specified, but it makes sense to be compatible with RI. 
> To reproduce the issue, please run the test listed below.
> -------------------------- Expected output (= RI output): -----------------------
> Listener added
> ADDED
> Listener added again
> ADDED
> ---------------------------------- Harmony output ----------------------------------
> Listener added
> ADDED
> Listener added again
> ADDED
> ADDED
> ---------------------------------------  Test.java  -------------------------------------- 
> import java.beans.beancontext.*;
> public class Test{
>     public static void main(String[] args){
>         BeanContextSupport context = new BeanContextSupport();
>         BeanContextMembershipListener listener = new BeanContextMembershipListener() {
>             public void childrenAdded(BeanContextMembershipEvent bcme) {
>                 System.out.println("ADDED");
>             }
>             public void childrenRemoved(BeanContextMembershipEvent bcme){}
>         };
>         // add listener
>         context.addBeanContextMembershipListener(listener);
>         System.out.println("Listener added");
>         context.add(new BeanContextChildSupport());
>         
>         // add the same listener onse again
>         System.out.println("Listener added again");
>         context.addBeanContextMembershipListener(listener);
>         context.add(new BeanContextChildSupport());
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (HARMONY-4011) [classlib][beans] compatibility: java.beans.beancontext.BeanContextSupport allows registering the same listener several times

Posted by "Alexei Zakharov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4011?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Zakharov resolved HARMONY-4011.
--------------------------------------

    Resolution: Fixed

Thanks Nellya for patch and Roman for reporting this issue. The patch was applied at the repository revision 549135. I've added a regression test at the same revision as well. Please verify.

> [classlib][beans] compatibility: java.beans.beancontext.BeanContextSupport allows registering the same listener several times
> -----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4011
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4011
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Roman S. Bushmanov
>            Assignee: Alexei Zakharov
>         Attachments: H-4011.patch
>
>
> Successive calls to addBeanContextMembershipListener() method with the same object as argument result in adding that object into listener set multiple times. RI behaves differently.
> The exact behaviour in the described case is not specified, but it makes sense to be compatible with RI. 
> To reproduce the issue, please run the test listed below.
> -------------------------- Expected output (= RI output): -----------------------
> Listener added
> ADDED
> Listener added again
> ADDED
> ---------------------------------- Harmony output ----------------------------------
> Listener added
> ADDED
> Listener added again
> ADDED
> ADDED
> ---------------------------------------  Test.java  -------------------------------------- 
> import java.beans.beancontext.*;
> public class Test{
>     public static void main(String[] args){
>         BeanContextSupport context = new BeanContextSupport();
>         BeanContextMembershipListener listener = new BeanContextMembershipListener() {
>             public void childrenAdded(BeanContextMembershipEvent bcme) {
>                 System.out.println("ADDED");
>             }
>             public void childrenRemoved(BeanContextMembershipEvent bcme){}
>         };
>         // add listener
>         context.addBeanContextMembershipListener(listener);
>         System.out.println("Listener added");
>         context.add(new BeanContextChildSupport());
>         
>         // add the same listener onse again
>         System.out.println("Listener added again");
>         context.addBeanContextMembershipListener(listener);
>         context.add(new BeanContextChildSupport());
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (HARMONY-4011) [classlib][beans] compatibility: java.beans.beancontext.BeanContextSupport allows registering the same listener several times

Posted by "Alexei Zakharov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4011?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Zakharov reassigned HARMONY-4011:
----------------------------------------

    Assignee: Alexei Zakharov

> [classlib][beans] compatibility: java.beans.beancontext.BeanContextSupport allows registering the same listener several times
> -----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4011
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4011
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Roman S. Bushmanov
>            Assignee: Alexei Zakharov
>         Attachments: H-4011.patch
>
>
> Successive calls to addBeanContextMembershipListener() method with the same object as argument result in adding that object into listener set multiple times. RI behaves differently.
> The exact behaviour in the described case is not specified, but it makes sense to be compatible with RI. 
> To reproduce the issue, please run the test listed below.
> -------------------------- Expected output (= RI output): -----------------------
> Listener added
> ADDED
> Listener added again
> ADDED
> ---------------------------------- Harmony output ----------------------------------
> Listener added
> ADDED
> Listener added again
> ADDED
> ADDED
> ---------------------------------------  Test.java  -------------------------------------- 
> import java.beans.beancontext.*;
> public class Test{
>     public static void main(String[] args){
>         BeanContextSupport context = new BeanContextSupport();
>         BeanContextMembershipListener listener = new BeanContextMembershipListener() {
>             public void childrenAdded(BeanContextMembershipEvent bcme) {
>                 System.out.println("ADDED");
>             }
>             public void childrenRemoved(BeanContextMembershipEvent bcme){}
>         };
>         // add listener
>         context.addBeanContextMembershipListener(listener);
>         System.out.println("Listener added");
>         context.add(new BeanContextChildSupport());
>         
>         // add the same listener onse again
>         System.out.println("Listener added again");
>         context.addBeanContextMembershipListener(listener);
>         context.add(new BeanContextChildSupport());
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (HARMONY-4011) [classlib][beans] compatibility: java.beans.beancontext.BeanContextSupport allows registering the same listener several times

Posted by "Roman S. Bushmanov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4011?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roman S. Bushmanov closed HARMONY-4011.
---------------------------------------


The test case works as expected.
Thanks for the fix.

> [classlib][beans] compatibility: java.beans.beancontext.BeanContextSupport allows registering the same listener several times
> -----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4011
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4011
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Roman S. Bushmanov
>            Assignee: Alexei Zakharov
>         Attachments: H-4011.patch
>
>
> Successive calls to addBeanContextMembershipListener() method with the same object as argument result in adding that object into listener set multiple times. RI behaves differently.
> The exact behaviour in the described case is not specified, but it makes sense to be compatible with RI. 
> To reproduce the issue, please run the test listed below.
> -------------------------- Expected output (= RI output): -----------------------
> Listener added
> ADDED
> Listener added again
> ADDED
> ---------------------------------- Harmony output ----------------------------------
> Listener added
> ADDED
> Listener added again
> ADDED
> ADDED
> ---------------------------------------  Test.java  -------------------------------------- 
> import java.beans.beancontext.*;
> public class Test{
>     public static void main(String[] args){
>         BeanContextSupport context = new BeanContextSupport();
>         BeanContextMembershipListener listener = new BeanContextMembershipListener() {
>             public void childrenAdded(BeanContextMembershipEvent bcme) {
>                 System.out.println("ADDED");
>             }
>             public void childrenRemoved(BeanContextMembershipEvent bcme){}
>         };
>         // add listener
>         context.addBeanContextMembershipListener(listener);
>         System.out.println("Listener added");
>         context.add(new BeanContextChildSupport());
>         
>         // add the same listener onse again
>         System.out.println("Listener added again");
>         context.addBeanContextMembershipListener(listener);
>         context.add(new BeanContextChildSupport());
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.