JMXQuery
JMXQuery copied to clipboard
recursive loop in JMXConnector
getAttributes(foundKey, cData.get(attribute.getAttributeKey())). cData.get(attribute.getAttributeKey() is null which causes a recursive loop.
I think JMXConnector.java needs
if (value instanceof CompositeData) { CompositeData cData = (CompositeData) value; // If attribute has key specified, only get that otherwise get all keys if (attribute.getAttributeKey() != null) { try {
JMXMetric foundKey = new JMXMetric(attribute.getmBeanName(),
attribute.getAttribute(),
attribute.getAttributeKey());
foundKey.setAttributeType(cData.get(attribute.getAttributeKey()));
foundKey.setmetricName(attribute.getmetricName());
foundKey.setmetricLabels(attribute.getmetricLabels());
Object oValue = cData.get(attribute.getAttributeKey()); // add this
if (oValue == null) oValue = ""; // add this
// or perhaps if (oValue == null) oValue = "Missing" ; attributes.addAll(getAttributes(foundKey, oValue)); // change this <<
// attributes.addAll(getAttributes(foundKey, cData.get(attribute.getAttributeKey())));
} catch (InvalidKeyException e) {
// Key doesn't exist so don't add to list
}