Program: 116509
Project: 116509
Buggy source:
/** 
 * This will build the dependency tree based on the given dependency order
 * @param component it will give the necessary information to build the tree
 * @return the dependency tree out of the dependency orders
 */
public DependencyTree buildDependency(ParentComponent component) throws DependencyBuilderException {
  String identifier=component.getUniqueIdentifier();
  DependencyTree dependencyTree=new DependencyTree(identifier);
  DependencyOrder dependencyOrder=component.getDependencyOrder();
  if (dependencyOrder != null) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + identifier);
    }
    String killBehavior=dependencyOrder.getKillbehavior();
    if (Constants.KILL_NONE.equals(killBehavior)) {
      dependencyTree.setKillNone(true);
    }
 else     if (Constants.KILL_ALL.equals(killBehavior)) {
      dependencyTree.setKillAll(true);
    }
 else     if (Constants.KILL_DEPENDENTS.equals(killBehavior)) {
      dependencyTree.setKillDependent(true);
    }
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + killBehavior + "String_Node_Str"+ "String_Node_Str"+ dependencyTree.getId());
    }
    Set<StartupOrder> startupOrders=dependencyOrder.getStartupOrders();
    ApplicationContext foundContext;
    if (startupOrders == null) {
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str");
      }
      return dependencyTree;
    }
    for (    StartupOrder startupOrder : startupOrders) {
      foundContext=null;
      for (      String start : startupOrder.getStartList()) {
        if (start != null) {
          ApplicationContext applicationContext=ApplicationContextFactory.getApplicationContext(start,component,dependencyTree.isKillDependent());
          String id=applicationContext.getId();
          ApplicationContext existingApplicationContext=dependencyTree.findApplicationContextWithId(id);
          if (existingApplicationContext == null) {
            if (foundContext != null) {
              foundContext.addApplicationContext(applicationContext);
              if (log.isDebugEnabled()) {
                log.debug("String_Node_Str" + foundContext.getId() + "String_Node_Str"+ id+ "String_Node_Str");
              }
            }
 else {
              dependencyTree.addApplicationContext(applicationContext);
            }
          }
 else {
            if (foundContext == null) {
              foundContext=existingApplicationContext;
              if (log.isDebugEnabled()) {
                log.debug("String_Node_Str" + id + "String_Node_Str"+ "String_Node_Str");
              }
            }
 else {
              String msg="String_Node_Str" + "String_Node_Str";
              throw new DependencyBuilderException(msg);
            }
          }
        }
      }
    }
  }
  for (  Group group1 : component.getAliasToGroupMap().values()) {
    if (dependencyTree.findApplicationContextWithId(group1.getAlias()) == null) {
      dependencyTree.addApplicationContext(new GroupContext(group1.getAlias(),dependencyTree.isKillDependent()));
    }
  }
  for (  ClusterDataHolder dataHolder : component.getClusterDataMap().values()) {
    if (dependencyTree.findApplicationContextWithId(dataHolder.getClusterId()) == null) {
      dependencyTree.addApplicationContext(new ClusterContext(dataHolder.getClusterId(),dependencyTree.isKillDependent()));
    }
  }
  return dependencyTree;
}

Fixed version (ground truth):
/** 
 * This will build the dependency tree based on the given dependency order
 * @param component it will give the necessary information to build the tree
 * @return the dependency tree out of the dependency orders
 */
public DependencyTree buildDependency(ParentComponent component) throws DependencyBuilderException {
  String identifier=component.getUniqueIdentifier();
  DependencyTree dependencyTree=new DependencyTree(identifier);
  DependencyOrder dependencyOrder=component.getDependencyOrder();
  if (dependencyOrder != null) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + identifier);
    }
    String killBehavior=dependencyOrder.getKillbehavior();
    if (Constants.KILL_NONE.equals(killBehavior)) {
      dependencyTree.setKillNone(true);
    }
 else     if (Constants.KILL_ALL.equals(killBehavior)) {
      dependencyTree.setKillAll(true);
    }
 else     if (Constants.KILL_DEPENDENTS.equals(killBehavior)) {
      dependencyTree.setKillDependent(true);
    }
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + killBehavior + "String_Node_Str"+ "String_Node_Str"+ dependencyTree.getId());
    }
    Set<StartupOrder> startupOrders=dependencyOrder.getStartupOrders();
    ApplicationContext foundContext;
    ApplicationContext parentContext;
    if (startupOrders != null) {
      for (      StartupOrder startupOrder : startupOrders) {
        foundContext=null;
        parentContext=null;
        for (        String start : startupOrder.getStartList()) {
          if (start != null) {
            ApplicationContext applicationContext=ApplicationContextFactory.getApplicationContext(start,component,dependencyTree.isKillDependent());
            String id=applicationContext.getId();
            ApplicationContext existingApplicationContext=dependencyTree.findApplicationContextWithId(id);
            if (existingApplicationContext == null) {
              if (parentContext != null) {
                parentContext.addApplicationContext(applicationContext);
                parentContext=applicationContext;
                if (log.isDebugEnabled()) {
                  log.debug("String_Node_Str" + parentContext.getId() + "String_Node_Str"+ id+ "String_Node_Str");
                }
              }
 else {
                dependencyTree.addApplicationContext(applicationContext);
                parentContext=applicationContext;
              }
            }
 else {
              if (foundContext == null) {
                existingApplicationContext.addApplicationContext(applicationContext);
                parentContext=existingApplicationContext;
                if (log.isDebugEnabled()) {
                  log.debug("String_Node_Str" + id + "String_Node_Str"+ "String_Node_Str");
                }
              }
 else {
                String msg="String_Node_Str" + "String_Node_Str";
                throw new DependencyBuilderException(msg);
              }
            }
          }
        }
      }
    }
  }
  for (  Group group1 : component.getAliasToGroupMap().values()) {
    if (dependencyTree.findApplicationContextWithId(group1.getAlias()) == null) {
      dependencyTree.addApplicationContext(new GroupContext(group1.getAlias(),dependencyTree.isKillDependent()));
    }
  }
  for (  ClusterDataHolder dataHolder : component.getClusterDataMap().values()) {
    if (dependencyTree.findApplicationContextWithId(dataHolder.getClusterId()) == null) {
      dependencyTree.addApplicationContext(new ClusterContext(dataHolder.getClusterId(),dependencyTree.isKillDependent()));
    }
  }
  return dependencyTree;
}