Program: 28189
Project: 28189
Buggy source:
/** 
 * Changes the state of an application. <p> Used for enable and disable.
 * @param targets targets on which the change should occur
 * @param moduleID name of the module affected
 * @param commandName enable or disable
 * @param action name enabling or disabling
 * @return DFProgressObject the caller can use to monitor progress and query final status
 */
protected DFProgressObject changeState(Target[] targets,String moduleID,String commandName,String action){
  ensureConnected();
  targets=prepareTargets(targets);
  ProgressObjectImpl po=new ProgressObjectImpl(targets);
  List<TargetModuleIDImpl> targetModuleIDList=new ArrayList<TargetModuleIDImpl>();
  try {
    for (    Target target : targets) {
      Map commandParams=new HashMap();
      commandParams.put(DFDeploymentProperties.TARGET,target.getName());
      DFCommandRunner commandRunner=getDFCommandRunner(commandName,commandParams,new String[]{moduleID});
      DFDeploymentStatus ds=commandRunner.run();
      DFDeploymentStatus mainStatus=ds.getMainStatus();
      if (!po.checkStatusAndAddStage((TargetImpl)target,localStrings.getLocalString("String_Node_Str","String_Node_Str",action,moduleID,target.getName()),mainStatus)) {
        return po;
      }
 else {
        TargetModuleIDImpl targetModuleID=new TargetModuleIDImpl((TargetImpl)target,moduleID);
        targetModuleIDList.add(targetModuleID);
      }
    }
    TargetModuleIDImpl[] targetModuleIDs=new TargetModuleIDImpl[targetModuleIDList.size()];
    targetModuleIDs=(TargetModuleIDImpl[])targetModuleIDList.toArray(targetModuleIDs);
    po.setupForNormalExit(localStrings.getLocalString("String_Node_Str","String_Node_Str",action),(TargetImpl)targets[0],targetModuleIDs);
    return po;
  }
 catch (  Throwable ioex) {
    po.setupForAbnormalExit(localStrings.getLocalString("String_Node_Str","String_Node_Str",moduleID,ioex.toString()),(TargetImpl)targets[0]);
    return po;
  }
}

Fixed version (ground truth):
/** 
 * Changes the state of an application. <p> Used for enable and disable.
 * @param targets targets on which the change should occur
 * @param moduleID name of the module affected
 * @param commandName enable or disable
 * @param action name enabling or disabling
 * @return DFProgressObject the caller can use to monitor progress and query final status
 */
protected DFProgressObject changeState(Target[] targets,String moduleID,String commandName,String action){
  ensureConnected();
  targets=prepareTargets(targets);
  ProgressObjectImpl po=new ProgressObjectImpl(targets);
  if (commandName.equals("String_Node_Str"))   po.setCommand(CommandType.START,null);
 else   if (commandName.equals("String_Node_Str"))   po.setCommand(CommandType.STOP,null);
  List<TargetModuleIDImpl> targetModuleIDList=new ArrayList<TargetModuleIDImpl>();
  try {
    for (    Target target : targets) {
      Map commandParams=new HashMap();
      commandParams.put(DFDeploymentProperties.TARGET,target.getName());
      DFCommandRunner commandRunner=getDFCommandRunner(commandName,commandParams,new String[]{moduleID});
      DFDeploymentStatus ds=commandRunner.run();
      DFDeploymentStatus mainStatus=ds.getMainStatus();
      if (!po.checkStatusAndAddStage((TargetImpl)target,localStrings.getLocalString("String_Node_Str","String_Node_Str",action,moduleID,target.getName()),mainStatus)) {
        return po;
      }
 else {
        TargetModuleIDImpl targetModuleID=new TargetModuleIDImpl((TargetImpl)target,moduleID);
        targetModuleIDList.add(targetModuleID);
      }
    }
    TargetModuleIDImpl[] targetModuleIDs=new TargetModuleIDImpl[targetModuleIDList.size()];
    targetModuleIDs=(TargetModuleIDImpl[])targetModuleIDList.toArray(targetModuleIDs);
    po.setupForNormalExit(localStrings.getLocalString("String_Node_Str","String_Node_Str",action),(TargetImpl)targets[0],targetModuleIDs);
    return po;
  }
 catch (  Throwable ioex) {
    po.setupForAbnormalExit(localStrings.getLocalString("String_Node_Str","String_Node_Str",moduleID,ioex.toString()),(TargetImpl)targets[0]);
    return po;
  }
}