Program: 29321
Project: 29321
Buggy source:
/** 
 * verify that the children/parent relationship exists 
 */
private void validateChildren(final AMXProxy proxy) throws ValidationFailureException {
  final Set<String> attrNames=proxy.attributeNames();
  if (!attrNames.contains(ATTR_CHILDREN)) {
    try {
      final ObjectName[] children=proxy.getChildren();
      fail(proxy,"String_Node_Str");
    }
 catch (    Exception e) {
    }
  }
 else {
    try {
      final ObjectName[] children=proxy.getChildren();
      if (children == null) {
        fail(proxy,"String_Node_Str");
      }
      final Set<ObjectName> childrenSet=SetUtil.newSet(children);
      if (childrenSet.size() != children.length) {
        fail(proxy,"String_Node_Str");
      }
      if (childrenSet.contains(null)) {
        fail(proxy,"String_Node_Str");
      }
      for (      final ObjectName childObjectName : children) {
        if (childObjectName == null) {
          fail(proxy,"String_Node_Str");
        }
        final AMXProxy child=mProxyFactory.getProxy(childObjectName);
        if (!proxy.objectName().equals(child.parent().objectName())) {
          fail(proxy,"String_Node_Str" + child.parent().objectName() + "String_Node_Str"+ proxy.objectName());
        }
      }
      final Set<String> caseSensitiveTypes=new HashSet<String>();
      final Set<String> caseInsensitiveTypes=new HashSet<String>();
      for (      final ObjectName o : children) {
        caseSensitiveTypes.add(Util.getTypeProp(o));
        caseInsensitiveTypes.add(Util.getTypeProp(o).toLowerCase());
      }
      if (caseSensitiveTypes.size() != caseInsensitiveTypes.size()) {
        fail(proxy,"String_Node_Str");
      }
      final Set<ObjectName> tracked=getMBeanTracker().getChildrenOf(proxy.objectName());
      if (childrenSet.size() != children.length) {
        final Set<ObjectName> childrenSetNow=SetUtil.newSet(proxy.getChildren());
        if (!tracked.equals(childrenSetNow)) {
          fail(proxy,"String_Node_Str" + CollectionUtil.toString(tracked,"String_Node_Str") + "String_Node_Str"+ CollectionUtil.toString(childrenSetNow,"String_Node_Str")+ "String_Node_Str");
        }
      }
    }
 catch (    final Exception e) {
      if (!instanceNotFound(e)) {
        fail(proxy,"String_Node_Str");
      }
    }
    try {
      final Map<String,Map<String,AMXProxy>> maps=proxy.childrenMaps();
      for (      final String type : maps.keySet()) {
        final Map<String,AMXProxy> siblings=maps.get(type);
        if (siblings.keySet().size() > 1) {
          final Iterator<AMXProxy> iter=siblings.values().iterator();
          final MBeanInfo mbeanInfo=iter.next().extra().mbeanInfo();
          while (iter.hasNext()) {
            final AMXProxy next=iter.next();
            if (!mbeanInfo.equals(next.extra().mbeanInfo())) {
              fail(proxy,"String_Node_Str" + type + "String_Node_Str"+ siblings.values());
            }
          }
        }
      }
    }
 catch (    final Exception e) {
      if (!instanceNotFound(e)) {
        logWarning("String_Node_Str",e);
        fail(proxy,"String_Node_Str" + e.getMessage());
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * verify that the children/parent relationship exists 
 */
private void validateChildren(final AMXProxy proxy) throws ValidationFailureException {
  final Set<String> attrNames=proxy.attributeNames();
  if (!attrNames.contains(ATTR_CHILDREN)) {
    try {
      fail(proxy,"String_Node_Str");
    }
 catch (    Exception e) {
    }
  }
 else {
    try {
      final ObjectName[] children=proxy.getChildren();
      if (children == null) {
        fail(proxy,"String_Node_Str");
      }
      final Set<ObjectName> childrenSet=SetUtil.newSet(children);
      if (childrenSet.size() != children.length) {
        fail(proxy,"String_Node_Str");
      }
      if (childrenSet.contains(null)) {
        fail(proxy,"String_Node_Str");
      }
      for (      final ObjectName childObjectName : children) {
        if (childObjectName == null) {
          fail(proxy,"String_Node_Str");
        }
        final AMXProxy child=mProxyFactory.getProxy(childObjectName);
        if (!proxy.objectName().equals(child.parent().objectName())) {
          fail(proxy,"String_Node_Str" + child.parent().objectName() + "String_Node_Str"+ proxy.objectName());
        }
      }
      final Set<String> caseSensitiveTypes=new HashSet<String>();
      final Set<String> caseInsensitiveTypes=new HashSet<String>();
      for (      final ObjectName o : children) {
        caseSensitiveTypes.add(Util.getTypeProp(o));
        caseInsensitiveTypes.add(Util.getTypeProp(o).toLowerCase(Locale.ENGLISH));
      }
      if (caseSensitiveTypes.size() != caseInsensitiveTypes.size()) {
        fail(proxy,"String_Node_Str");
      }
      final Set<ObjectName> tracked=getMBeanTracker().getChildrenOf(proxy.objectName());
      if (childrenSet.size() != children.length) {
        final Set<ObjectName> childrenSetNow=SetUtil.newSet(proxy.getChildren());
        if (!tracked.equals(childrenSetNow)) {
          fail(proxy,"String_Node_Str" + CollectionUtil.toString(tracked,"String_Node_Str") + "String_Node_Str"+ CollectionUtil.toString(childrenSetNow,"String_Node_Str")+ "String_Node_Str");
        }
      }
    }
 catch (    final Exception e) {
      if (!instanceNotFound(e)) {
        fail(proxy,"String_Node_Str");
      }
    }
    try {
      final Map<String,Map<String,AMXProxy>> maps=proxy.childrenMaps();
      for (      final Map.Entry<String,Map<String,AMXProxy>> me : maps.entrySet()) {
        final Map<String,AMXProxy> siblings=me.getValue();
        if (siblings.keySet().size() > 1) {
          final Iterator<AMXProxy> iter=siblings.values().iterator();
          final MBeanInfo mbeanInfo=iter.next().extra().mbeanInfo();
          while (iter.hasNext()) {
            final AMXProxy next=iter.next();
            if (!mbeanInfo.equals(next.extra().mbeanInfo())) {
              fail(proxy,"String_Node_Str" + me.getKey() + "String_Node_Str"+ siblings.values());
            }
          }
        }
      }
    }
 catch (    final Exception e) {
      if (!instanceNotFound(e)) {
        logWarning("String_Node_Str",e);
        fail(proxy,"String_Node_Str" + e.getMessage());
      }
    }
  }
}