JMXQuery icon indicating copy to clipboard operation
JMXQuery copied to clipboard

recursive loop in JMXConnector

Open colinpaicemq opened this issue 5 years ago • 0 comments

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
            }    

colinpaicemq avatar Aug 15 '19 13:08 colinpaicemq