Program: 28540
Project: 28540
Buggy source:
/** 
 * Entry point from the framework into the command execution
 * @param context context for the command.
 */
public void execute(AdminCommandContext context){
  if (origin == Origin.unload && command == Command.disable) {
    deployment.validateSpecifiedTarget(target);
  }
  InterceptorNotifier notifier=new InterceptorNotifier(habitat,null);
  if (env.isDas() && DeploymentUtils.isDomainTarget(target)) {
    Iterator it=enabledVersionsInTargets.entrySet().iterator();
    while (it.hasNext()) {
      Map.Entry entry=(Map.Entry)it.next();
      appName=(String)entry.getKey();
      List<String> targets=new ArrayList<String>((Set<String>)entry.getValue());
      try {
        ParameterMapExtractor extractor=new ParameterMapExtractor(this);
        ParameterMap paramMap=extractor.extract(Collections.EMPTY_LIST);
        paramMap.set("String_Node_Str",appName);
        notifier.ensureBeforeReported(ExtendedDeploymentContext.Phase.REPLICATION);
        ClusterOperationUtil.replicateCommand("String_Node_Str",FailurePolicy.Error,FailurePolicy.Warn,FailurePolicy.Ignore,targets,context,paramMap,habitat);
      }
 catch (      Exception e) {
        report.failure(logger,e.getMessage());
        return;
      }
    }
  }
 else   if (isVersionExpressionWithWildcard) {
    try {
      if (matchedVersions == Collections.EMPTY_LIST) {
        report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
        return;
      }
      String enabledVersion=versioningService.getEnabledVersion(appName,target);
      if (matchedVersions.contains(enabledVersion)) {
        appName=enabledVersion;
      }
 else {
        report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
        return;
      }
    }
 catch (    VersioningException e) {
      report.failure(logger,e.getMessage());
      return;
    }
  }
  if (target == null) {
    target=deployment.getDefaultTarget(appName,origin,_classicstyle);
  }
  if (env.isDas() || !isundeploy) {
    if (!deployment.isRegistered(appName)) {
      if (env.isDas()) {
        report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str",appName));
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
      }
      return;
    }
    if (!DeploymentUtils.isDomainTarget(target)) {
      ApplicationRef ref=domain.getApplicationRefInTarget(appName,target);
      if (ref == null) {
        if (env.isDas()) {
          report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str",appName,target));
          report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        }
        return;
      }
    }
  }
  if (env.isDas()) {
    try {
      notifier.ensureBeforeReported(ExtendedDeploymentContext.Phase.REPLICATION);
      DeploymentCommandUtils.replicateEnableDisableToContainingCluster("String_Node_Str",domain,target,appName,habitat,context,this);
    }
 catch (    Exception e) {
      report.failure(logger,e.getMessage());
      return;
    }
  }
  ApplicationInfo appInfo=deployment.get(appName);
  try {
    Application app=applications.getApplication(appName);
    this.name=appName;
    final DeploymentContext basicDC=deployment.disable(this,app,appInfo,report,logger);
    final DeployCommandSupplementalInfo suppInfo=new DeployCommandSupplementalInfo();
    suppInfo.setDeploymentContext((ExtendedDeploymentContext)basicDC);
    suppInfo.setAccessChecks(accessChecks);
    report.setResultType(DeployCommandSupplementalInfo.class,suppInfo);
  }
 catch (  Exception e) {
    logger.log(Level.SEVERE,"String_Node_Str",e);
    if (env.isDas() || !isundeploy) {
      report.setActionExitCode(ActionReport.ExitCode.FAILURE);
      report.setMessage(e.getMessage());
    }
  }
  if (enabledVersionsToDisable == Collections.EMPTY_SET) {
    enabledVersionsToDisable=new HashSet<String>();
    enabledVersionsToDisable.add(appName);
  }
  Iterator it=enabledVersionsToDisable.iterator();
  while (it.hasNext()) {
    appName=(String)it.next();
    if (!isundeploy && !report.getActionExitCode().equals(ActionReport.ExitCode.FAILURE)) {
      try {
        deployment.updateAppEnabledAttributeInDomainXML(appName,target,false);
      }
 catch (      TransactionFailure e) {
        logger.warning("String_Node_Str" + appName);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Entry point from the framework into the command execution
 * @param context context for the command.
 */
public void execute(AdminCommandContext context){
  if (origin == Origin.unload && command == Command.disable) {
    deployment.validateSpecifiedTarget(target);
  }
  InterceptorNotifier notifier=new InterceptorNotifier(habitat,null);
  final DeployCommandSupplementalInfo suppInfo=new DeployCommandSupplementalInfo();
  suppInfo.setAccessChecks(accessChecks);
  report.setResultType(DeployCommandSupplementalInfo.class,suppInfo);
  if (env.isDas() && DeploymentUtils.isDomainTarget(target)) {
    Iterator it=enabledVersionsInTargets.entrySet().iterator();
    while (it.hasNext()) {
      Map.Entry entry=(Map.Entry)it.next();
      appName=(String)entry.getKey();
      List<String> targets=new ArrayList<String>((Set<String>)entry.getValue());
      try {
        ParameterMapExtractor extractor=new ParameterMapExtractor(this);
        ParameterMap paramMap=extractor.extract(Collections.EMPTY_LIST);
        paramMap.set("String_Node_Str",appName);
        notifier.ensureBeforeReported(ExtendedDeploymentContext.Phase.REPLICATION);
        ClusterOperationUtil.replicateCommand("String_Node_Str",FailurePolicy.Error,FailurePolicy.Warn,FailurePolicy.Ignore,targets,context,paramMap,habitat);
      }
 catch (      Exception e) {
        report.failure(logger,e.getMessage());
        return;
      }
    }
  }
 else   if (isVersionExpressionWithWildcard) {
    try {
      if (matchedVersions == Collections.EMPTY_LIST) {
        report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
        return;
      }
      String enabledVersion=versioningService.getEnabledVersion(appName,target);
      if (matchedVersions.contains(enabledVersion)) {
        appName=enabledVersion;
      }
 else {
        report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
        return;
      }
    }
 catch (    VersioningException e) {
      report.failure(logger,e.getMessage());
      return;
    }
  }
  if (target == null) {
    target=deployment.getDefaultTarget(appName,origin,_classicstyle);
  }
  if (env.isDas() || !isundeploy) {
    if (!deployment.isRegistered(appName)) {
      if (env.isDas()) {
        report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str",appName));
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
      }
      return;
    }
    if (!DeploymentUtils.isDomainTarget(target)) {
      ApplicationRef ref=domain.getApplicationRefInTarget(appName,target);
      if (ref == null) {
        if (env.isDas()) {
          report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str",appName,target));
          report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        }
        return;
      }
    }
  }
  if (env.isDas()) {
    try {
      notifier.ensureBeforeReported(ExtendedDeploymentContext.Phase.REPLICATION);
      DeploymentCommandUtils.replicateEnableDisableToContainingCluster("String_Node_Str",domain,target,appName,habitat,context,this);
    }
 catch (    Exception e) {
      report.failure(logger,e.getMessage());
      return;
    }
  }
  ApplicationInfo appInfo=deployment.get(appName);
  try {
    Application app=applications.getApplication(appName);
    this.name=appName;
    final DeploymentContext basicDC=deployment.disable(this,app,appInfo,report,logger);
    suppInfo.setDeploymentContext((ExtendedDeploymentContext)basicDC);
  }
 catch (  Exception e) {
    logger.log(Level.SEVERE,"String_Node_Str",e);
    if (env.isDas() || !isundeploy) {
      report.setActionExitCode(ActionReport.ExitCode.FAILURE);
      report.setMessage(e.getMessage());
    }
  }
  if (enabledVersionsToDisable == Collections.EMPTY_SET) {
    enabledVersionsToDisable=new HashSet<String>();
    enabledVersionsToDisable.add(appName);
  }
  Iterator it=enabledVersionsToDisable.iterator();
  while (it.hasNext()) {
    appName=(String)it.next();
    if (!isundeploy && !report.getActionExitCode().equals(ActionReport.ExitCode.FAILURE)) {
      try {
        deployment.updateAppEnabledAttributeInDomainXML(appName,target,false);
      }
 catch (      TransactionFailure e) {
        logger.warning("String_Node_Str" + appName);
      }
    }
  }
}