You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2002/08/21 09:50:23 UTC

DO NOT REPLY [Bug 11885] New: - After setting an Attribute the Notification Listener will not performed

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11885>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11885

After setting an Attribute the Notification Listener will not performed

           Summary: After setting an Attribute the Notification Listener
                    will not performed
           Product: Commons
           Version: 1.0 Final
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Modeler
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: Daniel.Schmidt@gp.materna.de


Description:
-----------------
After setting an Attribute the Notification Listener 
(AttributeChangeNotification) will not performed.

Cause:
----------
In the setAttribute 
Method in the Class  BaseModelMBean the  Call  sendAttributeChangeNotification is 
missing.

Solution:
-------------
The following Code in the setAttribute Method (BaseModelMBean) 
fix the problem (see   //*********  NEW **********):

 public void setAttribute(Attribute 
attribute)
        throws AttributeNotFoundException, MBeanException,
        ReflectionException {  

...

  String setMethod = (String) attrDesc.getFieldValue("setMethod");
        if 
(setMethod == null)
            throw new AttributeNotFoundException
                ("Cannot find attribute " + name 
+ " set method name");

         //*********  NEW **********
        Object currValue = 
this.getAttribute(name);
	Attribute oldAttr = new Attribute(name, currValue);
        
        // 
Invoke the specified set method and ignore any results
        invoke(setMethod,
               new Object[] { 
value },
               new String[] { attrInfo.getType() });
               
        //***** NEW ********
        
sendAttributeChangeNotification(oldAttr,attribute);

    }

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>