Program: 90502
Project: 90502
Buggy source:
/** 
 * Merge the source Configuration into the target Configuration.
 * @param target        The target node to merge into.
 * @param source        The source node.
 * @param pluginManager The PluginManager.
 */
public void mergConfigurations(Node target,Node source,PluginManager pluginManager){
  for (  Map.Entry<String,String> attribute : source.getAttributes().entrySet()) {
    boolean isFound=false;
    for (    Map.Entry<String,String> targetAttribute : target.getAttributes().entrySet()) {
      if (targetAttribute.getKey().equalsIgnoreCase(attribute.getKey())) {
        if (attribute.getKey().equalsIgnoreCase(STATUS)) {
          Level targetLevel=Level.getLevel(targetAttribute.getValue());
          Level sourceLevel=Level.getLevel(attribute.getValue());
          if (targetLevel != null && sourceLevel != null) {
            if (sourceLevel.isLessSpecificThan(targetLevel)) {
              targetAttribute.setValue(attribute.getValue());
            }
          }
        }
 else {
          if (attribute.getKey().equalsIgnoreCase("String_Node_Str")) {
            int sourceInterval=Integer.parseInt(attribute.getValue());
            int targetInterval=Integer.parseInt(targetAttribute.getValue());
            if (targetInterval == 0 || sourceInterval < targetInterval) {
              targetAttribute.setValue(attribute.getValue());
            }
          }
 else {
            targetAttribute.setValue(attribute.getValue());
          }
        }
        isFound=true;
      }
    }
    if (!isFound) {
      target.getAttributes().put(attribute.getKey(),attribute.getValue());
    }
  }
  for (  Node sourceChildNode : source.getChildren()) {
    boolean isFilter=isFilterNode(sourceChildNode);
    boolean isMerged=false;
    for (    Node targetChildNode : target.getChildren()) {
      if (isFilter) {
        if (isFilterNode(targetChildNode)) {
          updateFilterNode(target,targetChildNode,sourceChildNode,pluginManager);
          isMerged=true;
          break;
        }
 else {
          continue;
        }
      }
      if (!targetChildNode.getName().equalsIgnoreCase(sourceChildNode.getName())) {
        continue;
      }
switch (targetChildNode.getName().toLowerCase()) {
case PROPERTIES:
case SCRIPTS:
case APPENDERS:
{
          for (          Node node : sourceChildNode.getChildren()) {
            for (            Node targetNode : targetChildNode.getChildren()) {
              if (targetNode.getAttributes().get(NAME).equals(node.getAttributes().get(NAME))) {
                targetChildNode.getChildren().remove(targetNode);
                break;
              }
            }
            targetChildNode.getChildren().add(node);
          }
          isMerged=true;
          break;
        }
case LOGGERS:
{
        Map<String,Node> targetLoggers=new HashMap<>();
        for (        Node node : targetChildNode.getChildren()) {
          targetLoggers.put(node.getName(),node);
        }
        for (        Node node : sourceChildNode.getChildren()) {
          Node targetNode=getLoggerNode(targetChildNode,node.getAttributes().get(NAME));
          Node loggerNode=new Node(targetChildNode,node.getName(),node.getType());
          if (targetNode != null) {
            for (            Node sourceLoggerChild : node.getChildren()) {
              if (isFilterNode(sourceLoggerChild)) {
                boolean foundFilter=false;
                for (                Node targetChild : targetNode.getChildren()) {
                  if (isFilterNode(targetChild)) {
                    updateFilterNode(loggerNode,targetChild,sourceLoggerChild,pluginManager);
                    foundFilter=true;
                    break;
                  }
                }
                if (!foundFilter) {
                  Node childNode=new Node(loggerNode,sourceLoggerChild.getName(),sourceLoggerChild.getType());
                  targetNode.getChildren().add(childNode);
                }
              }
 else {
                Node childNode=new Node(loggerNode,sourceLoggerChild.getName(),sourceLoggerChild.getType());
                childNode.getAttributes().putAll(sourceLoggerChild.getAttributes());
                if (childNode.getName().equalsIgnoreCase("String_Node_Str")) {
                  for (                  Node targetChild : targetNode.getChildren()) {
                    if (isSameReference(targetChild,childNode)) {
                      targetNode.getChildren().remove(targetChild);
                      break;
                    }
                  }
                }
 else {
                  for (                  Node targetChild : targetNode.getChildren()) {
                    if (isSameName(targetChild,childNode)) {
                      targetNode.getChildren().remove(targetChild);
                      break;
                    }
                  }
                }
                targetNode.getChildren().add(childNode);
              }
            }
          }
 else {
            loggerNode.getAttributes().putAll(node.getAttributes());
            loggerNode.getChildren().addAll(node.getChildren());
            targetChildNode.getChildren().add(loggerNode);
          }
        }
        isMerged=true;
        break;
      }
default :
{
      targetChildNode.getChildren().addAll(sourceChildNode.getChildren());
      isMerged=true;
      break;
    }
}
}
if (!isMerged) {
target.getChildren().add(sourceChildNode);
}
}
}

Fixed version (ground truth):
/** 
 * Merge the source Configuration into the target Configuration.
 * @param target        The target node to merge into.
 * @param source        The source node.
 * @param pluginManager The PluginManager.
 */
@Override public void mergConfigurations(Node target,Node source,PluginManager pluginManager){
  for (  Node sourceChildNode : source.getChildren()) {
    boolean isFilter=isFilterNode(sourceChildNode);
    boolean isMerged=false;
    for (    Node targetChildNode : target.getChildren()) {
      if (isFilter) {
        if (isFilterNode(targetChildNode)) {
          updateFilterNode(target,targetChildNode,sourceChildNode,pluginManager);
          isMerged=true;
          break;
        }
 else {
          continue;
        }
      }
      if (!targetChildNode.getName().equalsIgnoreCase(sourceChildNode.getName())) {
        continue;
      }
switch (targetChildNode.getName().toLowerCase()) {
case PROPERTIES:
case SCRIPTS:
case APPENDERS:
{
          for (          Node node : sourceChildNode.getChildren()) {
            for (            Node targetNode : targetChildNode.getChildren()) {
              if (targetNode.getAttributes().get(NAME).equals(node.getAttributes().get(NAME))) {
                targetChildNode.getChildren().remove(targetNode);
                break;
              }
            }
            targetChildNode.getChildren().add(node);
          }
          isMerged=true;
          break;
        }
case LOGGERS:
{
        Map<String,Node> targetLoggers=new HashMap<>();
        for (        Node node : targetChildNode.getChildren()) {
          targetLoggers.put(node.getName(),node);
        }
        for (        Node node : sourceChildNode.getChildren()) {
          Node targetNode=getLoggerNode(targetChildNode,node.getAttributes().get(NAME));
          Node loggerNode=new Node(targetChildNode,node.getName(),node.getType());
          if (targetNode != null) {
            for (            Node sourceLoggerChild : node.getChildren()) {
              if (isFilterNode(sourceLoggerChild)) {
                boolean foundFilter=false;
                for (                Node targetChild : targetNode.getChildren()) {
                  if (isFilterNode(targetChild)) {
                    updateFilterNode(loggerNode,targetChild,sourceLoggerChild,pluginManager);
                    foundFilter=true;
                    break;
                  }
                }
                if (!foundFilter) {
                  Node childNode=new Node(loggerNode,sourceLoggerChild.getName(),sourceLoggerChild.getType());
                  targetNode.getChildren().add(childNode);
                }
              }
 else {
                Node childNode=new Node(loggerNode,sourceLoggerChild.getName(),sourceLoggerChild.getType());
                childNode.getAttributes().putAll(sourceLoggerChild.getAttributes());
                if (childNode.getName().equalsIgnoreCase("String_Node_Str")) {
                  for (                  Node targetChild : targetNode.getChildren()) {
                    if (isSameReference(targetChild,childNode)) {
                      targetNode.getChildren().remove(targetChild);
                      break;
                    }
                  }
                }
 else {
                  for (                  Node targetChild : targetNode.getChildren()) {
                    if (isSameName(targetChild,childNode)) {
                      targetNode.getChildren().remove(targetChild);
                      break;
                    }
                  }
                }
                targetNode.getChildren().add(childNode);
              }
            }
          }
 else {
            loggerNode.getAttributes().putAll(node.getAttributes());
            loggerNode.getChildren().addAll(node.getChildren());
            targetChildNode.getChildren().add(loggerNode);
          }
        }
        isMerged=true;
        break;
      }
default :
{
      targetChildNode.getChildren().addAll(sourceChildNode.getChildren());
      isMerged=true;
      break;
    }
}
}
if (!isMerged) {
target.getChildren().add(sourceChildNode);
}
}
}