Program: 29901
Project: 29901
Buggy source:
/** 
 * Called from ExecutionContext.execute.
 */
private void doCommand(ExecutionContext inv,AdminCommand command){
  if (command == null) {
    command=getCommand(inv.name(),inv.report(),logger);
    if (command == null) {
      return;
    }
  }
  CommandModel model;
  try {
    CommandModelProvider c=CommandModelProvider.class.cast(command);
    model=c.getModel();
  }
 catch (  ClassCastException e) {
    model=new CommandModelImpl(command.getClass());
  }
  UploadedFilesManager ufm=null;
  ActionReport report=inv.report();
  ParameterMap parameters;
  final AdminCommandContext context=new AdminCommandContext(LogDomains.getLogger(command.getClass(),LogDomains.ADMIN_LOGGER),report,inv.inboundPayload(),inv.outboundPayload());
  List<RuntimeType> runtimeTypes=new ArrayList<RuntimeType>();
  FailurePolicy fp=null;
  Set<CommandTarget> targetTypesAllowed=new HashSet<CommandTarget>();
  ActionReport.ExitCode preSupplementalReturn=ActionReport.ExitCode.SUCCESS;
  ActionReport.ExitCode postSupplementalReturn=ActionReport.ExitCode.SUCCESS;
  ActionReport.ExitCode afterReplicationSupplementalReturn=ActionReport.ExitCode.SUCCESS;
  boolean doReplication=false;
  if ((domain.getServers().getServer().size() > 1) || (domain.getClusters().getCluster().size() != 0)) {
    doReplication=true;
  }
 else {
    logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str"));
  }
  try {
    try {
      ufm=new UploadedFilesManager(inv.report,logger,inv.inboundPayload());
      if (inv.typedParams() != null) {
        logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str"));
        InjectionResolver<Param> injectionTarget=new DelegatedInjectionResolver(model,inv.typedParams(),ufm.optionNameToFileMap());
        if (injectParameters(model,command,injectionTarget,context).equals(ActionReport.ExitCode.SUCCESS)) {
          inv.setReport(doCommand(model,command,context));
        }
        return;
      }
      parameters=inv.parameters();
      if (parameters == null) {
        parameters=new ParameterMap();
      }
      if (isSet(parameters,"String_Node_Str") || isSet(parameters,"String_Node_Str")) {
        BufferedReader in=getManPage(model.getCommandName(),model);
        String manPage=encodeManPage(in);
        if (manPage != null && isSet(parameters,"String_Node_Str")) {
          inv.report().getTopMessagePart().addProperty("String_Node_Str",manPage);
        }
 else {
          report.getTopMessagePart().addProperty(AdminCommandResponse.GENERATED_HELP,"String_Node_Str");
          getHelp(command,report);
        }
        return;
      }
      try {
        if (!skipValidation(command)) {
          validateParameters(model,parameters);
        }
      }
 catch (      ComponentException e) {
        Exception exception=e;
        Throwable cause=e.getCause();
        if (cause != null && (cause instanceof UnacceptableValueException)) {
          exception=(Exception)cause;
        }
        logger.severe(exception.getMessage());
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        report.setMessage(exception.getMessage());
        report.setFailureCause(exception);
        ActionReport.MessagePart childPart=report.getTopMessagePart().addChild();
        childPart.setMessage(getUsageText(command,model));
        return;
      }
      InjectionResolver<Param> injectionMgr=new MapInjectionResolver(model,parameters,ufm.optionNameToFileMap());
      if (!injectParameters(model,command,injectionMgr,context).equals(ActionReport.ExitCode.SUCCESS)) {
        return;
      }
      logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str"));
      org.glassfish.api.admin.ExecuteOn clAnnotation=model.getClusteringAttributes();
      if (clAnnotation == null) {
        runtimeTypes.add(RuntimeType.DAS);
        runtimeTypes.add(RuntimeType.INSTANCE);
        fp=FailurePolicy.Error;
      }
 else {
        if (clAnnotation.value().length == 0) {
          runtimeTypes.add(RuntimeType.DAS);
          runtimeTypes.add(RuntimeType.INSTANCE);
        }
 else {
          for (          RuntimeType t : clAnnotation.value()) {
            runtimeTypes.add(t);
          }
        }
        if (clAnnotation.ifFailure() == null) {
          fp=FailurePolicy.Error;
        }
 else {
          fp=clAnnotation.ifFailure();
        }
      }
      String targetName=parameters.getOne("String_Node_Str");
      if (targetName == null || model.getModelFor("String_Node_Str").getParam().obsolete()) {
        if (command instanceof DeploymentTargetResolver) {
          targetName=((DeploymentTargetResolver)command).getTarget(parameters);
        }
 else {
          targetName="String_Node_Str";
        }
      }
      logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str",targetName));
      if (serverEnv.isDas()) {
        TargetType tgtTypeAnnotation=command.getClass().getAnnotation(TargetType.class);
        if (tgtTypeAnnotation != null) {
          for (          CommandTarget c : tgtTypeAnnotation.value()) {
            targetTypesAllowed.add(c);
          }
        }
        ;
        if (targetTypesAllowed.size() == 0) {
          targetTypesAllowed.add(CommandTarget.DAS);
          targetTypesAllowed.add(CommandTarget.STANDALONE_INSTANCE);
          targetTypesAllowed.add(CommandTarget.CLUSTER);
          targetTypesAllowed.add(CommandTarget.CONFIG);
        }
        if (CommandTarget.DAS.isValid(habitat,targetName) && !runtimeTypes.contains(RuntimeType.DAS)) {
          runtimeTypes.add(RuntimeType.DAS);
        }
        logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str",runtimeTypes.toString()));
        logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str",targetTypesAllowed.toString()));
        if ((!CommandTarget.DOMAIN.isValid(habitat,targetName)) && (domain.getServerNamed(targetName) == null) && (domain.getClusterNamed(targetName) == null)&& (domain.getConfigNamed(targetName) == null)) {
          report.setActionExitCode(ActionReport.ExitCode.FAILURE);
          report.setMessage(adminStrings.getLocalString("String_Node_Str","String_Node_Str",targetName));
          return;
        }
        boolean isTargetValidType=false;
        Iterator<CommandTarget> it=targetTypesAllowed.iterator();
        while (it.hasNext()) {
          if (it.next().isValid(habitat,targetName)) {
            isTargetValidType=true;
            break;
          }
        }
        if (!isTargetValidType) {
          StringBuilder validTypes=new StringBuilder();
          it=targetTypesAllowed.iterator();
          while (it.hasNext()) {
            validTypes.append(it.next().getDescription() + "String_Node_Str");
          }
          report.setActionExitCode(ActionReport.ExitCode.FAILURE);
          report.setMessage(adminStrings.getLocalString("String_Node_Str","String_Node_Str",targetName,model.getCommandName(),validTypes.toString()));
          return;
        }
        if ((CommandTarget.CLUSTERED_INSTANCE.isValid(habitat,targetName)) && (!targetTypesAllowed.contains(CommandTarget.CLUSTERED_INSTANCE))) {
          Cluster c=domain.getClusterForInstance(targetName);
          report.setActionExitCode(ActionReport.ExitCode.FAILURE);
          report.setMessage(adminStrings.getLocalString("String_Node_Str","String_Node_Str",model.getCommandName(),targetName,c.getName()));
          return;
        }
        logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str"));
      }
      Lock lock=null;
      boolean lockTimedOut=false;
      try {
        lock=adminLock.getLock(command,"String_Node_Str");
        if (command instanceof UndoableCommand) {
          UndoableCommand uCmd=(UndoableCommand)command;
          logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str",inv.name()));
          if (!uCmd.prepare(context,parameters).equals(ActionReport.ExitCode.SUCCESS)) {
            report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            report.setMessage(adminStrings.getLocalString("String_Node_Str","String_Node_Str" + "String_Node_Str",model.getCommandName(),report.getMessage()));
            return;
          }
        }
        ClusterOperationUtil.clearInstanceList();
        logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str",inv.name()));
        preSupplementalReturn=supplementalExecutor.execute(model.getCommandName(),Supplemental.Timing.Before,context,parameters,ufm.optionNameToFileMap());
        if (preSupplementalReturn.equals(ActionReport.ExitCode.FAILURE)) {
          report.setActionExitCode(preSupplementalReturn);
          report.setMessage(adminStrings.getLocalString("String_Node_Str","String_Node_Str"));
          return;
        }
        if ((runtimeTypes.contains(RuntimeType.ALL)) || (serverEnv.isDas() && (CommandTarget.DOMAIN.isValid(habitat,targetName) || runtimeTypes.contains(RuntimeType.DAS))) || (serverEnv.isInstance() && runtimeTypes.contains(RuntimeType.INSTANCE))) {
          logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str",inv.name()));
          report=doCommand(model,command,context);
          inv.setReport(report);
        }
        if (!FailurePolicy.applyFailurePolicy(fp,report.getActionExitCode()).equals(ActionReport.ExitCode.FAILURE)) {
          logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str",inv.name()));
          postSupplementalReturn=supplementalExecutor.execute(model.getCommandName(),Supplemental.Timing.After,context,parameters,ufm.optionNameToFileMap());
          if (postSupplementalReturn.equals(ActionReport.ExitCode.FAILURE)) {
            report.setActionExitCode(postSupplementalReturn);
            report.setMessage(adminStrings.getLocalString("String_Node_Str","String_Node_Str"));
            return;
          }
        }
      }
 catch (      AdminCommandLockTimeoutException ex) {
        lockTimedOut=true;
        String lockTime=formatSuspendDate(ex.getTimeOfAcquisition());
        String logMsg="String_Node_Str" + model.getCommandName() + "String_Node_Str"+ "String_Node_Str"+ lockTime+ "String_Node_Str";
        logger.warning(logMsg);
        String msg=adminStrings.getLocalString("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",lockTime);
        report.setMessage(msg);
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
      }
catch (      AdminCommandLockException ex) {
        lockTimedOut=true;
        String lockTime=formatSuspendDate(ex.getTimeOfAcquisition());
        String lockMsg=ex.getMessage();
        String logMsg;
        logMsg="String_Node_Str" + model.getCommandName() + "String_Node_Str"+ "String_Node_Str"+ lockTime;
        if (lockMsg != null && lockMsg != "String_Node_Str") {
          logMsg+="String_Node_Str" + lockMsg;
        }
        logger.warning(logMsg);
        String msg=adminStrings.getLocalString("String_Node_Str","String_Node_Str" + "String_Node_Str",lockTime);
        if (lockMsg != null && lockMsg != "String_Node_Str") {
          msg+="String_Node_Str" + adminStrings.getLocalString("String_Node_Str","String_Node_Str") + "String_Node_Str"+ lockMsg;
        }
        report.setMessage(msg);
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
      }
 finally {
        if (lock != null && lockTimedOut == false) {
          lock.unlock();
        }
      }
    }
 catch (    Exception ex) {
      logger.log(Level.SEVERE,"String_Node_Str",ex);
      report.setActionExitCode(ActionReport.ExitCode.FAILURE);
      report.setMessage(ex.getMessage());
      report.setFailureCause(ex);
      ActionReport.MessagePart childPart=report.getTopMessagePart().addChild();
      childPart.setMessage(getUsageText(command,model));
      return;
    }
    if (processEnv.getProcessType().isEmbedded()) {
      return;
    }
    if (preSupplementalReturn == ActionReport.ExitCode.WARNING || postSupplementalReturn == ActionReport.ExitCode.WARNING) {
      report.setActionExitCode(ActionReport.ExitCode.WARNING);
    }
    if (doReplication && (!FailurePolicy.applyFailurePolicy(fp,report.getActionExitCode()).equals(ActionReport.ExitCode.FAILURE)) && (serverEnv.isDas())&& (runtimeTypes.contains(RuntimeType.INSTANCE) || runtimeTypes.contains(RuntimeType.ALL))) {
      logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str"));
      ClusterExecutor executor=null;
      try {
        if (model.getClusteringAttributes() != null && model.getClusteringAttributes().executor() != null) {
          executor=habitat.getComponent(model.getClusteringAttributes().executor());
        }
 else {
          executor=habitat.getComponent(ClusterExecutor.class,"String_Node_Str");
        }
      }
 catch (      UnsatisfiedDependencyException usdepex) {
        String err=adminStrings.getLocalString("String_Node_Str","String_Node_Str");
        logger.warning(err);
      }
      if (executor != null) {
        report.setActionExitCode(executor.execute(model.getCommandName(),command,context,parameters));
        if (report.getActionExitCode().equals(ActionReport.ExitCode.FAILURE)) {
          report.setMessage(adminStrings.getLocalString("String_Node_Str","String_Node_Str"));
        }
 else {
          if (!FailurePolicy.applyFailurePolicy(fp,report.getActionExitCode()).equals(ActionReport.ExitCode.FAILURE)) {
            logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str",inv.name()));
            afterReplicationSupplementalReturn=supplementalExecutor.execute(model.getCommandName(),Supplemental.Timing.AfterReplication,context,parameters,ufm.optionNameToFileMap());
            if (afterReplicationSupplementalReturn.equals(ActionReport.ExitCode.FAILURE)) {
              report.setActionExitCode(afterReplicationSupplementalReturn);
              report.setMessage(adminStrings.getLocalString("String_Node_Str","String_Node_Str"));
              return;
            }
          }
        }
      }
    }
    if (report.getActionExitCode().equals(ActionReport.ExitCode.FAILURE)) {
      if (command instanceof UndoableCommand) {
        UndoableCommand uCmd=(UndoableCommand)command;
        logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str",inv.name()));
        uCmd.undo(context,parameters,ClusterOperationUtil.getCompletedInstances());
      }
    }
 else {
      if ("String_Node_Str".equals(model.getCommandName())) {
        state.addServerToStateService(parameters.getOne("String_Node_Str"));
      }
      if ("String_Node_Str".equals(model.getCommandName())) {
        state.removeInstanceFromStateService(parameters.getOne("String_Node_Str"));
      }
    }
  }
  finally {
    if (ufm != null) {
      ufm.close();
    }
  }
}

Fixed version (ground truth):
/** 
 * Called from ExecutionContext.execute.
 */
private void doCommand(ExecutionContext inv,AdminCommand command){
  if (command == null) {
    command=getCommand(inv.name(),inv.report(),logger);
    if (command == null) {
      return;
    }
  }
  CommandModel model;
  try {
    CommandModelProvider c=CommandModelProvider.class.cast(command);
    model=c.getModel();
  }
 catch (  ClassCastException e) {
    model=new CommandModelImpl(command.getClass());
  }
  UploadedFilesManager ufm=null;
  ActionReport report=inv.report();
  ParameterMap parameters;
  final AdminCommandContext context=new AdminCommandContext(LogDomains.getLogger(command.getClass(),LogDomains.ADMIN_LOGGER),report,inv.inboundPayload(),inv.outboundPayload());
  List<RuntimeType> runtimeTypes=new ArrayList<RuntimeType>();
  FailurePolicy fp=null;
  Set<CommandTarget> targetTypesAllowed=new HashSet<CommandTarget>();
  ActionReport.ExitCode preSupplementalReturn=ActionReport.ExitCode.SUCCESS;
  ActionReport.ExitCode postSupplementalReturn=ActionReport.ExitCode.SUCCESS;
  boolean doReplication=false;
  if ((domain.getServers().getServer().size() > 1) || (domain.getClusters().getCluster().size() != 0)) {
    doReplication=true;
  }
 else {
    logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str"));
  }
  try {
    try {
      ufm=new UploadedFilesManager(inv.report,logger,inv.inboundPayload());
      if (inv.typedParams() != null) {
        logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str"));
        InjectionResolver<Param> injectionTarget=new DelegatedInjectionResolver(model,inv.typedParams(),ufm.optionNameToFileMap());
        if (injectParameters(model,command,injectionTarget,context).equals(ActionReport.ExitCode.SUCCESS)) {
          inv.setReport(doCommand(model,command,context));
        }
        return;
      }
      parameters=inv.parameters();
      if (parameters == null) {
        parameters=new ParameterMap();
      }
      if (isSet(parameters,"String_Node_Str") || isSet(parameters,"String_Node_Str")) {
        BufferedReader in=getManPage(model.getCommandName(),model);
        String manPage=encodeManPage(in);
        if (manPage != null && isSet(parameters,"String_Node_Str")) {
          inv.report().getTopMessagePart().addProperty("String_Node_Str",manPage);
        }
 else {
          report.getTopMessagePart().addProperty(AdminCommandResponse.GENERATED_HELP,"String_Node_Str");
          getHelp(command,report);
        }
        return;
      }
      try {
        if (!skipValidation(command)) {
          validateParameters(model,parameters);
        }
      }
 catch (      ComponentException e) {
        Exception exception=e;
        Throwable cause=e.getCause();
        if (cause != null && (cause instanceof UnacceptableValueException)) {
          exception=(Exception)cause;
        }
        logger.severe(exception.getMessage());
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        report.setMessage(exception.getMessage());
        report.setFailureCause(exception);
        ActionReport.MessagePart childPart=report.getTopMessagePart().addChild();
        childPart.setMessage(getUsageText(command,model));
        return;
      }
      InjectionResolver<Param> injectionMgr=new MapInjectionResolver(model,parameters,ufm.optionNameToFileMap());
      if (!injectParameters(model,command,injectionMgr,context).equals(ActionReport.ExitCode.SUCCESS)) {
        return;
      }
      logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str"));
      org.glassfish.api.admin.ExecuteOn clAnnotation=model.getClusteringAttributes();
      if (clAnnotation == null) {
        runtimeTypes.add(RuntimeType.DAS);
        runtimeTypes.add(RuntimeType.INSTANCE);
        fp=FailurePolicy.Error;
      }
 else {
        if (clAnnotation.value().length == 0) {
          runtimeTypes.add(RuntimeType.DAS);
          runtimeTypes.add(RuntimeType.INSTANCE);
        }
 else {
          for (          RuntimeType t : clAnnotation.value()) {
            runtimeTypes.add(t);
          }
        }
        if (clAnnotation.ifFailure() == null) {
          fp=FailurePolicy.Error;
        }
 else {
          fp=clAnnotation.ifFailure();
        }
      }
      String targetName=parameters.getOne("String_Node_Str");
      if (targetName == null || model.getModelFor("String_Node_Str").getParam().obsolete()) {
        if (command instanceof DeploymentTargetResolver) {
          targetName=((DeploymentTargetResolver)command).getTarget(parameters);
        }
 else {
          targetName="String_Node_Str";
        }
      }
      logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str",targetName));
      if (serverEnv.isDas()) {
        TargetType tgtTypeAnnotation=command.getClass().getAnnotation(TargetType.class);
        if (tgtTypeAnnotation != null) {
          for (          CommandTarget c : tgtTypeAnnotation.value()) {
            targetTypesAllowed.add(c);
          }
        }
        ;
        if (targetTypesAllowed.size() == 0) {
          targetTypesAllowed.add(CommandTarget.DAS);
          targetTypesAllowed.add(CommandTarget.STANDALONE_INSTANCE);
          targetTypesAllowed.add(CommandTarget.CLUSTER);
          targetTypesAllowed.add(CommandTarget.CONFIG);
        }
        if (CommandTarget.DAS.isValid(habitat,targetName) && !runtimeTypes.contains(RuntimeType.DAS)) {
          runtimeTypes.add(RuntimeType.DAS);
        }
        logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str",runtimeTypes.toString()));
        logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str",targetTypesAllowed.toString()));
        if ((!CommandTarget.DOMAIN.isValid(habitat,targetName)) && (domain.getServerNamed(targetName) == null) && (domain.getClusterNamed(targetName) == null)&& (domain.getConfigNamed(targetName) == null)) {
          report.setActionExitCode(ActionReport.ExitCode.FAILURE);
          report.setMessage(adminStrings.getLocalString("String_Node_Str","String_Node_Str",targetName));
          return;
        }
        boolean isTargetValidType=false;
        Iterator<CommandTarget> it=targetTypesAllowed.iterator();
        while (it.hasNext()) {
          if (it.next().isValid(habitat,targetName)) {
            isTargetValidType=true;
            break;
          }
        }
        if (!isTargetValidType) {
          StringBuilder validTypes=new StringBuilder();
          it=targetTypesAllowed.iterator();
          while (it.hasNext()) {
            validTypes.append(it.next().getDescription() + "String_Node_Str");
          }
          report.setActionExitCode(ActionReport.ExitCode.FAILURE);
          report.setMessage(adminStrings.getLocalString("String_Node_Str","String_Node_Str",targetName,model.getCommandName(),validTypes.toString()));
          return;
        }
        if ((CommandTarget.CLUSTERED_INSTANCE.isValid(habitat,targetName)) && (!targetTypesAllowed.contains(CommandTarget.CLUSTERED_INSTANCE))) {
          Cluster c=domain.getClusterForInstance(targetName);
          report.setActionExitCode(ActionReport.ExitCode.FAILURE);
          report.setMessage(adminStrings.getLocalString("String_Node_Str","String_Node_Str",model.getCommandName(),targetName,c.getName()));
          return;
        }
        logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str"));
      }
      Lock lock=null;
      boolean lockTimedOut=false;
      try {
        lock=adminLock.getLock(command,"String_Node_Str");
        if (command instanceof UndoableCommand) {
          UndoableCommand uCmd=(UndoableCommand)command;
          logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str",inv.name()));
          if (!uCmd.prepare(context,parameters).equals(ActionReport.ExitCode.SUCCESS)) {
            report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            report.setMessage(adminStrings.getLocalString("String_Node_Str","String_Node_Str" + "String_Node_Str",model.getCommandName(),report.getMessage()));
            return;
          }
        }
        ClusterOperationUtil.clearInstanceList();
        logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str",inv.name()));
        preSupplementalReturn=supplementalExecutor.execute(model.getCommandName(),Supplemental.Timing.Before,context,parameters,ufm.optionNameToFileMap());
        if (preSupplementalReturn.equals(ActionReport.ExitCode.FAILURE)) {
          report.setActionExitCode(preSupplementalReturn);
          report.setMessage(adminStrings.getLocalString("String_Node_Str","String_Node_Str"));
          return;
        }
        if ((runtimeTypes.contains(RuntimeType.ALL)) || (serverEnv.isDas() && (CommandTarget.DOMAIN.isValid(habitat,targetName) || runtimeTypes.contains(RuntimeType.DAS))) || (serverEnv.isInstance() && runtimeTypes.contains(RuntimeType.INSTANCE))) {
          logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str",inv.name()));
          report=doCommand(model,command,context);
          inv.setReport(report);
        }
        if (!FailurePolicy.applyFailurePolicy(fp,report.getActionExitCode()).equals(ActionReport.ExitCode.FAILURE)) {
          logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str",inv.name()));
          postSupplementalReturn=supplementalExecutor.execute(model.getCommandName(),Supplemental.Timing.After,context,parameters,ufm.optionNameToFileMap());
          if (postSupplementalReturn.equals(ActionReport.ExitCode.FAILURE)) {
            report.setActionExitCode(postSupplementalReturn);
            report.setMessage(adminStrings.getLocalString("String_Node_Str","String_Node_Str"));
            return;
          }
        }
      }
 catch (      AdminCommandLockTimeoutException ex) {
        lockTimedOut=true;
        String lockTime=formatSuspendDate(ex.getTimeOfAcquisition());
        String logMsg="String_Node_Str" + model.getCommandName() + "String_Node_Str"+ "String_Node_Str"+ lockTime+ "String_Node_Str";
        logger.warning(logMsg);
        String msg=adminStrings.getLocalString("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",lockTime);
        report.setMessage(msg);
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
      }
catch (      AdminCommandLockException ex) {
        lockTimedOut=true;
        String lockTime=formatSuspendDate(ex.getTimeOfAcquisition());
        String lockMsg=ex.getMessage();
        String logMsg;
        logMsg="String_Node_Str" + model.getCommandName() + "String_Node_Str"+ "String_Node_Str"+ lockTime;
        if (lockMsg != null && !lockMsg.isEmpty()) {
          logMsg+="String_Node_Str" + lockMsg;
        }
        logger.warning(logMsg);
        String msg=adminStrings.getLocalString("String_Node_Str","String_Node_Str" + "String_Node_Str",lockTime);
        if (lockMsg != null && !lockMsg.isEmpty()) {
          msg+="String_Node_Str" + adminStrings.getLocalString("String_Node_Str","String_Node_Str") + "String_Node_Str"+ lockMsg;
        }
        report.setMessage(msg);
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
      }
 finally {
        if (lock != null && lockTimedOut == false) {
          lock.unlock();
        }
      }
    }
 catch (    Exception ex) {
      logger.log(Level.SEVERE,"String_Node_Str",ex);
      report.setActionExitCode(ActionReport.ExitCode.FAILURE);
      report.setMessage(ex.getMessage());
      report.setFailureCause(ex);
      ActionReport.MessagePart childPart=report.getTopMessagePart().addChild();
      childPart.setMessage(getUsageText(command,model));
      return;
    }
    if (processEnv.getProcessType().isEmbedded()) {
      return;
    }
    if (preSupplementalReturn == ActionReport.ExitCode.WARNING || postSupplementalReturn == ActionReport.ExitCode.WARNING) {
      report.setActionExitCode(ActionReport.ExitCode.WARNING);
    }
    if (doReplication && (!FailurePolicy.applyFailurePolicy(fp,report.getActionExitCode()).equals(ActionReport.ExitCode.FAILURE)) && (serverEnv.isDas())&& (runtimeTypes.contains(RuntimeType.INSTANCE) || runtimeTypes.contains(RuntimeType.ALL))) {
      logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str"));
      ClusterExecutor executor=null;
      try {
        if (model.getClusteringAttributes() != null && model.getClusteringAttributes().executor() != null) {
          executor=habitat.getComponent(model.getClusteringAttributes().executor());
        }
 else {
          executor=habitat.getComponent(ClusterExecutor.class,"String_Node_Str");
        }
      }
 catch (      UnsatisfiedDependencyException usdepex) {
        String err=adminStrings.getLocalString("String_Node_Str","String_Node_Str");
        logger.warning(err);
      }
      if (executor != null) {
        report.setActionExitCode(executor.execute(model.getCommandName(),command,context,parameters));
        if (report.getActionExitCode().equals(ActionReport.ExitCode.FAILURE)) {
          report.setMessage(adminStrings.getLocalString("String_Node_Str","String_Node_Str"));
        }
 else {
          if (!FailurePolicy.applyFailurePolicy(fp,report.getActionExitCode()).equals(ActionReport.ExitCode.FAILURE)) {
            logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str",inv.name()));
            ActionReport.ExitCode afterReplicationSupplementalReturn=supplementalExecutor.execute(model.getCommandName(),Supplemental.Timing.AfterReplication,context,parameters,ufm.optionNameToFileMap());
            if (afterReplicationSupplementalReturn.equals(ActionReport.ExitCode.FAILURE)) {
              report.setActionExitCode(afterReplicationSupplementalReturn);
              report.setMessage(adminStrings.getLocalString("String_Node_Str","String_Node_Str"));
              return;
            }
          }
        }
      }
    }
    if (report.getActionExitCode().equals(ActionReport.ExitCode.FAILURE)) {
      if (command instanceof UndoableCommand) {
        UndoableCommand uCmd=(UndoableCommand)command;
        logger.fine(adminStrings.getLocalString("String_Node_Str","String_Node_Str",inv.name()));
        uCmd.undo(context,parameters,ClusterOperationUtil.getCompletedInstances());
      }
    }
 else {
      if ("String_Node_Str".equals(model.getCommandName())) {
        state.addServerToStateService(parameters.getOne("String_Node_Str"));
      }
      if ("String_Node_Str".equals(model.getCommandName())) {
        state.removeInstanceFromStateService(parameters.getOne("String_Node_Str"));
      }
    }
  }
  finally {
    if (ufm != null) {
      ufm.close();
    }
  }
}