Program: 167709
Project: 167709
Buggy source:
@Override protected ModelNode buildRequestWOValidation(CommandContext ctx) throws CommandFormatException {
  final String path=file.getValue(ctx.getParsedCommandLine());
  final ModelNode headersNode=headers.isPresent(ctx.getParsedCommandLine()) ? headers.toModelNode(ctx) : null;
  final BatchManager batchManager=ctx.getBatchManager();
  if (batchManager.isBatchActive()) {
    if (path != null) {
      throw new CommandFormatException("String_Node_Str");
    }
    final Batch batch=batchManager.getActiveBatch();
    List<BatchedCommand> currentBatch=batch.getCommands();
    if (currentBatch.isEmpty()) {
      batchManager.discardActiveBatch();
      throw new CommandFormatException("String_Node_Str");
    }
    final ModelNode request=batch.toRequest();
    if (headersNode != null) {
      request.get(Util.OPERATION_HEADERS).set(headersNode);
    }
    return request;
  }
  if (path != null) {
    final File f=new File(path);
    if (!f.exists()) {
      throw new CommandFormatException("String_Node_Str" + f.getAbsolutePath() + "String_Node_Str");
    }
    final File currentDir=ctx.getCurrentDir();
    final File baseDir=f.getParentFile();
    if (baseDir != null) {
      ctx.setCurrentDir(baseDir);
    }
    BufferedReader reader=null;
    try {
      reader=Files.newBufferedReader(f.toPath(),StandardCharsets.UTF_8);
      String line=reader.readLine();
      batchManager.activateNewBatch();
      while (line != null) {
        ctx.handle(line.trim());
        line=reader.readLine();
      }
      final ModelNode request=batchManager.getActiveBatch().toRequest();
      if (headersNode != null) {
        request.get(Util.OPERATION_HEADERS).set(headersNode);
      }
      return request;
    }
 catch (    IOException e) {
      throw new CommandFormatException("String_Node_Str" + f.getAbsolutePath(),e);
    }
catch (    CommandLineException e) {
      throw new CommandFormatException("String_Node_Str" + f.getAbsolutePath(),e);
    }
 finally {
      if (baseDir != null) {
        ctx.setCurrentDir(currentDir);
      }
      if (reader != null) {
        try {
          reader.close();
        }
 catch (        IOException e) {
        }
      }
    }
  }
  throw new CommandFormatException("String_Node_Str");
}

Fixed version (ground truth):
@Override protected ModelNode buildRequestWOValidation(CommandContext ctx) throws CommandFormatException {
  final String path=file.getValue(ctx.getParsedCommandLine());
  final ModelNode headersNode=headers.isPresent(ctx.getParsedCommandLine()) ? headers.toModelNode(ctx) : null;
  final BatchManager batchManager=ctx.getBatchManager();
  if (batchManager.isBatchActive()) {
    if (path != null) {
      throw new CommandFormatException("String_Node_Str");
    }
    final Batch batch=batchManager.getActiveBatch();
    List<BatchedCommand> currentBatch=batch.getCommands();
    if (currentBatch.isEmpty()) {
      batchManager.discardActiveBatch();
      throw new CommandFormatException("String_Node_Str");
    }
    final ModelNode request=batch.toRequest();
    if (headersNode != null) {
      request.get(Util.OPERATION_HEADERS).set(headersNode);
    }
    return request;
  }
  if (path != null) {
    final File f=new File(path);
    if (!f.exists()) {
      throw new CommandFormatException("String_Node_Str" + f.getAbsolutePath() + "String_Node_Str");
    }
    final File currentDir=ctx.getCurrentDir();
    final File baseDir=f.getParentFile();
    if (baseDir != null) {
      ctx.setCurrentDir(baseDir);
    }
    try (BufferedReader reader=new BufferedReader(new FileReader(f))){
      String line=reader.readLine();
      batchManager.activateNewBatch();
      while (line != null) {
        ctx.handle(line.trim());
        line=reader.readLine();
      }
      final ModelNode request=batchManager.getActiveBatch().toRequest();
      if (headersNode != null) {
        request.get(Util.OPERATION_HEADERS).set(headersNode);
      }
      return request;
    }
 catch (    IOException e) {
      throw new CommandFormatException("String_Node_Str" + f.getAbsolutePath(),e);
    }
catch (    CommandLineException e) {
      throw new CommandFormatException("String_Node_Str" + f.getAbsolutePath(),e);
    }
 finally {
      if (baseDir != null) {
        ctx.setCurrentDir(currentDir);
      }
    }
  }
  throw new CommandFormatException("String_Node_Str");
}