JDK-4871899 : REGRESSION:java.awt.Component.setName() fires PropertyChangeEvent
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux,solaris_2.6,solaris_8
  • CPU: x86,sparc
  • Submitted: 2003-05-30
  • Updated: 2003-08-14
  • Resolved: 2003-08-12
Related Reports
Duplicate :  
Duplicate :  
Description

Name: apR10229			Date: 05/30/2003


Filed By      : SPB JCK team (###@###.###)
JDK           : java full version "1.5.0-beta-b07"
JCK           : 1.5
Platform[s]   : Linux
switch/Mode   : 
JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto
Failing Test [s] :
    api/java_awt/Component/descriptions.html#Listener[Component2125]


Specification excerpt:
======================
--------- J2SE API spec v.1.5 ---------
...
public void addPropertyChangeListener(PropertyChangeListener listener)

       Adds a PropertyChangeListener to the listener list. The listener is registered for all bound properties
       of this class, including the following: 
              this Component's font ("font") 
              this Component's background color ("background") 
              this Component's foreground color ("foreground") 
              this Component's focusability ("focusable") 
              this Component's focus traversal keys enabled state ("focusTraversalKeysEnabled") 
              this Component's Set of FORWARD_TRAVERSAL_KEYS ("forwardFocusTraversalKeys") 
              this Component's Set of BACKWARD_TRAVERSAL_KEYS ("backwardFocusTraversalKeys") 
              this Component's Set of UP_CYCLE_TRAVERSAL_KEYS ("upCycleFocusTraversalKeys") 
       Note that if this Component is inheriting a bound property, then no event will be fired in response to a
       change in the inherited property. 

...
---------- end-of-excerpt ---------------

Problem description
===================
Invoking java.awt.Component.setName() method fires PropertyChangeEvent, 
but documentation contains no any information about such kind of behaviour, 
so the property "name" does not exist in the property list for 
PropertyChangeListener for this component.
    
Minimized test:
===============
------- Test.java -------
import java.awt.*;
import java.beans.*;
public class Test {
    public static void main(String[] argv) {    
        StubComponent comp = new StubComponent();
        PCListener pcl = new PCListener();
        comp.addPropertyChangeListener(pcl);
        comp.setName("newname");
    }
}
class StubComponent extends Component {
    public StubComponent() {
        super();
    }
}
class PCListener implements PropertyChangeListener {
    public void propertyChange(PropertyChangeEvent evt){
        System.out.println("Listener called!");
    }
}

------- end-of-Test.java -------

Minimized test output:
======================
<pav@libra(pts/5).283> java -cp . Test
Listener called!
<pav@libra(pts/5).284>

JCK test source location:
==========================
/java/re/jck/1.5//nightly/binaries/latest/JCK-runtime-15/tests

Test output:
=============
Component2125: Failed. Component2125 failed: 1

Specific Machine Info:
=====================
Linux libra 2.4.18 #10 Fri Jun 28 18:21:54 MSD 2002 i686 unknown

======================================================================

Comments
EVALUATION I thnk the cause of this bug is this revision to Component.java : D 1.357 03/04/29 16:28:40 sky 703 699 00009/00006/07852 MRs: COMMENTS: name is now bound. Part of synth work. It looks like it was intentional, so I'll let Swing handle it as appropriate. ###@###.### 2003-06-03 Yep, this was intentional. I'll file the CCC request. ###@###.### 2003-06-04 This was approved under the CCC request 4864304, closing as a duplicate. ###@###.### 2003-08-12
04-06-2003