Program: 167721
Project: 167721
Buggy source:
@Override protected void doHandle(CommandContext ctx) throws CommandLineException {
  final boolean v=verbose.isPresent(ctx.getParsedCommandLine());
  final OperationResponse response;
  boolean failed=false;
  boolean hasFile=file.getValue(ctx.getParsedCommandLine()) != null;
  try {
    final ModelNode request=buildRequest(ctx);
    OperationBuilder builder=new OperationBuilder(request,true);
    for (    String path : getAttachments(ctx).getAttachedFiles()) {
      builder.addFileAsAttachment(new File(path));
    }
    final ModelControllerClient client=ctx.getModelControllerClient();
    try {
      response=client.executeOperation(builder.build(),OperationMessageHandler.DISCARD);
    }
 catch (    Exception e) {
      throw new CommandFormatException("String_Node_Str" + e.getLocalizedMessage());
    }
    if (!Util.isSuccess(response.getResponseNode())) {
      throw new CommandFormatException(Util.getFailureDescription(response.getResponseNode()));
    }
    ModelNode steps=response.getResponseNode().get(Util.RESULT);
    if (steps.isDefined()) {
      final Batch batch=ctx.getBatchManager().getActiveBatch();
      int i=1;
      for (      BatchedCommand cmd : batch.getCommands()) {
        ModelNode step=steps.get("String_Node_Str" + i);
        if (step.isDefined()) {
          if (cmd.getResponseHandler() != null) {
            cmd.getResponseHandler().handleResponse(step,response);
          }
          i+=1;
        }
      }
    }
  }
 catch (  CommandLineException e) {
    failed=true;
    if (hasFile) {
      throw new CommandLineException("String_Node_Str",e);
    }
 else {
      throw new CommandLineException("String_Node_Str" + "String_Node_Str",e);
    }
  }
 finally {
    if (hasFile) {
      ctx.getBatchManager().discardActiveBatch();
    }
 else     if (!failed) {
      if (ctx.getBatchManager().isBatchActive()) {
        ctx.getBatchManager().discardActiveBatch();
      }
    }
  }
  if (v) {
    ctx.printLine(response.getResponseNode().toString());
  }
 else {
    ctx.printLine("String_Node_Str");
    super.handleResponse(ctx,response.getResponseNode(),true);
  }
}

Fixed version (ground truth):
@Override protected void doHandle(CommandContext ctx) throws CommandLineException {
  final boolean v=verbose.isPresent(ctx.getParsedCommandLine());
  final OperationResponse response;
  boolean failed=false;
  boolean hasFile=file.getValue(ctx.getParsedCommandLine()) != null;
  try {
    final ModelNode request=buildRequest(ctx);
    OperationBuilder builder=new OperationBuilder(request,true);
    for (    String path : getAttachments(ctx).getAttachedFiles()) {
      builder.addFileAsAttachment(new File(path));
    }
    final ModelControllerClient client=ctx.getModelControllerClient();
    try {
      response=client.executeOperation(builder.build(),OperationMessageHandler.DISCARD);
    }
 catch (    Exception e) {
      throw new CommandFormatException("String_Node_Str" + e.getLocalizedMessage());
    }
    if (!Util.isSuccess(response.getResponseNode())) {
      String msg=formatBatchError(ctx,response.getResponseNode());
      if (msg == null) {
        msg=Util.getFailureDescription(response.getResponseNode());
      }
      throw new CommandFormatException(msg);
    }
    ModelNode steps=response.getResponseNode().get(Util.RESULT);
    if (steps.isDefined()) {
      final Batch batch=ctx.getBatchManager().getActiveBatch();
      int i=1;
      for (      BatchedCommand cmd : batch.getCommands()) {
        ModelNode step=steps.get("String_Node_Str" + i);
        if (step.isDefined()) {
          if (cmd.getResponseHandler() != null) {
            cmd.getResponseHandler().handleResponse(step,response);
          }
          i+=1;
        }
      }
    }
  }
 catch (  CommandLineException e) {
    failed=true;
    if (hasFile) {
      throw new CommandLineException("String_Node_Str",e);
    }
 else {
      throw new CommandLineException("String_Node_Str" + "String_Node_Str",e);
    }
  }
 finally {
    if (hasFile) {
      ctx.getBatchManager().discardActiveBatch();
    }
 else     if (!failed) {
      if (ctx.getBatchManager().isBatchActive()) {
        ctx.getBatchManager().discardActiveBatch();
      }
    }
  }
  if (v) {
    ctx.printLine(response.getResponseNode().toString());
  }
 else {
    ctx.printLine("String_Node_Str");
    super.handleResponse(ctx,response.getResponseNode(),true);
  }
}