Program: 116523
Project: 116523
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(ParentBehavior component){
  String alias=null;
  if (component instanceof Application) {
    alias=((Application)component).getId();
  }
 else   if (component instanceof Group) {
    alias=((Group)component).getAlias();
  }
  DependencyTree dependencyTree=new DependencyTree(alias);
  DependencyOrder dependencyOrder=component.getDependencyOrder();
  if (dependencyOrder != null) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + alias);
    }
    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> startupOrderSet=dependencyOrder.getStartupOrders();
    ApplicationContext foundContext=null;
    for (    StartupOrder startupOrder : startupOrderSet) {
      foundContext=null;
      for (      String start : startupOrder.getStartList()) {
        ApplicationContext applicationContext=ApplicationContextFactory.getApplicationContext(start,component,dependencyTree);
        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 {
            log.warn("String_Node_Str" + "String_Node_Str");
          }
        }
      }
    }
  }
  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(ParentBehavior component) throws DependencyBuilderException {
  String alias=null;
  if (component instanceof Application) {
    alias=((Application)component).getId();
  }
 else   if (component instanceof Group) {
    alias=((Group)component).getAlias();
  }
  DependencyTree dependencyTree=new DependencyTree(alias);
  DependencyOrder dependencyOrder=component.getDependencyOrder();
  if (dependencyOrder != null) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + alias);
    }
    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> startupOrderSet=dependencyOrder.getStartupOrders();
    ApplicationContext foundContext=null;
    for (    StartupOrder startupOrder : startupOrderSet) {
      foundContext=null;
      for (      String start : startupOrder.getStartList()) {
        ApplicationContext applicationContext=ApplicationContextFactory.getApplicationContext(start,component,dependencyTree);
        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;
}