United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6592586 RequiredModelMBean prints a WARNING message when calling getAttributes() for a non-existing attr
JDK-6592586 : RequiredModelMBean prints a WARNING message when calling getAttributes() for a non-existing attr

Details
Type:
Bug
Submit Date:
2007-08-14
Status:
Closed
Updated Date:
2011-03-08
Project Name:
JDK
Resolved Date:
2011-03-08
Component:
core-svc
OS:
generic
Sub-Component:
javax.management
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:

Related Reports
Backport:
Backport:

Sub Tasks

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).

                                    

Comments
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);
                }
	    }
	}
---------------------------------------------------------------------------------
                                     
2007-08-14
WORK AROUND

Use -Djava.util.logging.config.file=normmb.logging.properties, where that file contains this line:

javax.management.modelmbean.level=OFF
                                     
2007-08-16
EVALUATION

I think a FINER trace in all cases is the right thing to do.
                                     
2007-08-16



Hardware and Software, Engineered to Work Together