JDK-6592586 : RequiredModelMBean prints a WARNING message when calling getAttributes() for a non-existing attr
  • Type: Bug
  • Component: core-svc
  • Sub-Component: javax.management
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2007-08-14
  • Updated: 2011-03-08
  • Resolved: 2011-03-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7 Other
6u12Fixed 7 b29Fixed OpenJDK6Resolved
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 I think a FINER trace in all cases is the right thing to do.
16-08-2007

WORK AROUND Use -Djava.util.logging.config.file=normmb.logging.properties, where that file contains this line: javax.management.modelmbean.level=OFF
16-08-2007

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