Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6592586
Votes 0
Synopsis RequiredModelMBean prints a WARNING message when calling getAttributes() for a non-existing attr
Category jmx:classes
Reported Against
Release Fixed 7(b29), 6u12(b01) (Bug ID:2151863)
State 10-Fix Delivered, bug
Priority: 4-Low
Related Bugs
Submit Date 14-AUG-2007
Description
in RequiredModelMBean.java,

    public AttributeList getAttributes(String[] attrNames)	{
    }

emits a WARNING (JDK7) / SEVERE (JDK 6) message if the list of attrNames contain
an attribute which isn't declared in the MBean (or which is write-only).

There's no reason for emitting more than a debug trace here: if the attribute is not
found it will be omitted from the result - just like JMX spec says it should.
Standard MBean do not print WARNING/SEVERE messages in this case, so there's no reason
that RequiredModelMBean should (except for debug purposes).
Posted Date : 2007-08-14 10:28:46.0
Work Around
Use -Djava.util.logging.config.file=normmb.logging.properties, where that file contains this line:

javax.management.modelmbean.level=OFF
Evaluation
Here is the for loop from RequiredModelMBean.getAttributes()

=> we could make the distinction between AttributeNotFoundException and plain
   Exception, or simply print a FINE/FINER trace in all cases instead of a WARNING.

-----------------------------------------------------------------------------------
	responseList = new AttributeList();
	for (int i = 0; i < attrNames.length; i++) {
	    try {
		responseList.add(new Attribute(attrNames[i],
				     getAttribute(attrNames[i])));
	    } catch (Exception e) {
		// eat exceptions because interface doesn't have an
		// exception on it
                if (MODELMBEAN_LOGGER.isLoggable(Level.WARNING)) {
                    MODELMBEAN_LOGGER.logp(Level.WARNING,
                            RequiredModelMBean.class.getName(),
                        "getAttributes(String[])",
                            "Failed to get \"" + attrNames[i] + "\": ", e);
                }
	    }
	}
---------------------------------------------------------------------------------
Posted Date : 2007-08-14 10:28:46.0

I think a FINER trace in all cases is the right thing to do.
Posted Date : 2007-08-16 10:50:12.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang