Program: 167706
Project: 167706
Buggy source:
@Override public ModelNode buildRequestWithoutHeaders(CommandContext ctx) throws CommandFormatException {
  final ModelControllerClient client=ctx.getModelControllerClient();
  ParsedCommandLine args=ctx.getParsedCommandLine();
  boolean l=this.l.isPresent(args);
  if (!args.hasProperties() || l) {
    throw new OperationFormatException("String_Node_Str" + args.getOriginalLine() + "String_Node_Str");
  }
  final boolean unmanaged=this.unmanaged.isPresent(args);
  final String path=this.path.getValue(args);
  final File f;
  if (path != null) {
    f=new File(path);
    if (!f.exists()) {
      throw new OperationFormatException("String_Node_Str" + f.getAbsolutePath() + "String_Node_Str");
    }
    if (!unmanaged && f.isDirectory()) {
      throw new OperationFormatException(f.getAbsolutePath() + "String_Node_Str");
    }
  }
 else {
    f=null;
  }
  String name=this.name.getValue(args);
  if (name == null) {
    if (f == null) {
      throw new OperationFormatException("String_Node_Str");
    }
    name=f.getName();
  }
  final String runtimeName=rtName.getValue(args);
  final boolean force=this.force.isPresent(args);
  final boolean disabled=this.disabled.isPresent(args);
  final String serverGroups=this.serverGroups.getValue(args);
  final boolean allServerGroups=this.allServerGroups.isPresent(args);
  final boolean archive=isCliArchive(f);
  if (name.equals(ALL)) {
    if (force || disabled) {
      throw new CommandFormatException("String_Node_Str");
    }
    List<String> sgList=getServerGroups(ctx,client,allServerGroups,serverGroups,f);
    try {
      return buildDeployAllRequest(client,sgList);
    }
 catch (    IOException ex) {
      throw new CommandFormatException(ex.getMessage(),ex);
    }
  }
  if (force) {
    if (f == null) {
      throw new OperationFormatException(this.force.getFullName() + "String_Node_Str");
    }
    if ((disabled && ctx.isDomainMode()) || serverGroups != null || allServerGroups) {
      throw new OperationFormatException(this.force.getFullName() + "String_Node_Str" + this.disabled.getFullName()+ "String_Node_Str"+ this.serverGroups.getFullName()+ "String_Node_Str"+ this.allServerGroups.getFullName()+ '.');
    }
    if (archive) {
      throw new OperationFormatException(this.force.getFullName() + "String_Node_Str");
    }
    if (Util.isDeploymentInRepository(name,client)) {
      return buildDeploymentReplace(f,name,runtimeName,disabled);
    }
 else {
      return buildDeploymentAdd(f,name,runtimeName,unmanaged,ctx.isDomainMode() ? null : disabled);
    }
  }
  if (disabled) {
    if (f == null) {
      throw new OperationFormatException(this.disabled.getFullName() + "String_Node_Str");
    }
    if (serverGroups != null || allServerGroups) {
      throw new OperationFormatException(this.serverGroups.getFullName() + "String_Node_Str" + this.allServerGroups.getFullName()+ "String_Node_Str"+ this.disabled.getFullName()+ '.');
    }
    if (archive) {
      throw new OperationFormatException(this.disabled.getFullName() + "String_Node_Str");
    }
    if (!ctx.isBatchMode() && Util.isDeploymentInRepository(name,client)) {
      throw new OperationFormatException("String_Node_Str" + name + "String_Node_Str"+ this.force.getFullName()+ "String_Node_Str");
    }
    return buildDeploymentAdd(f,name,runtimeName,unmanaged,ctx.isDomainMode() ? null : Boolean.TRUE);
  }
  if (archive) {
    if (serverGroups != null || allServerGroups) {
      throw new OperationFormatException(this.serverGroups.getFullName() + "String_Node_Str" + this.allServerGroups.getFullName()+ "String_Node_Str");
    }
    TempFileProvider tempFileProvider;
    MountHandle root;
    try {
      tempFileProvider=TempFileProvider.create("String_Node_Str",Executors.newSingleThreadScheduledExecutor(),true);
      root=extractArchive(f,tempFileProvider);
    }
 catch (    IOException e) {
      throw new OperationFormatException("String_Node_Str" + f.getAbsolutePath() + "String_Node_Str");
    }
    final File currentDir=ctx.getCurrentDir();
    ctx.setCurrentDir(root.getMountSource());
    String holdbackBatch=activateNewBatch(ctx);
    try {
      String script=this.script.getValue(args);
      if (script == null) {
        script="String_Node_Str";
      }
      File scriptFile=new File(ctx.getCurrentDir(),script);
      if (!scriptFile.exists()) {
        throw new CommandFormatException("String_Node_Str" + script + "String_Node_Str");
      }
      BufferedReader reader=null;
      try {
        reader=Files.newBufferedReader(scriptFile.toPath(),StandardCharsets.UTF_8);
        String line=reader.readLine();
        while (!ctx.isTerminated() && line != null) {
          ctx.handle(line);
          line=reader.readLine();
        }
      }
 catch (      FileNotFoundException e) {
        throw new CommandFormatException("String_Node_Str" + script + "String_Node_Str");
      }
catch (      IOException e) {
        throw new CommandFormatException("String_Node_Str" + scriptFile.getName() + "String_Node_Str"+ e.getMessage(),e);
      }
catch (      CommandLineException e) {
        throw new CommandFormatException(e.getMessage(),e);
      }
 finally {
        if (reader != null) {
          try {
            reader.close();
          }
 catch (          IOException e) {
          }
        }
      }
      return ctx.getBatchManager().getActiveBatch().toRequest();
    }
  finally {
      ctx.setCurrentDir(currentDir);
      discardBatch(ctx,holdbackBatch);
      VFSUtils.safeClose(root,tempFileProvider);
    }
  }
  final ModelNode deployRequest;
  if (ctx.isDomainMode()) {
    final List<String> sgList=getServerGroups(ctx,client,allServerGroups,serverGroups,f);
    deployRequest=new ModelNode();
    deployRequest.get(Util.OPERATION).set(Util.COMPOSITE);
    deployRequest.get(Util.ADDRESS).setEmptyList();
    ModelNode steps=deployRequest.get(Util.STEPS);
    for (    String serverGroup : sgList) {
      steps.add(Util.configureDeploymentOperation(Util.ADD,name,serverGroup));
    }
    for (    String serverGroup : sgList) {
      steps.add(Util.configureDeploymentOperation(Util.DEPLOY,name,serverGroup));
    }
  }
 else {
    if (serverGroups != null || allServerGroups) {
      throw new OperationFormatException(this.serverGroups.getFullName() + "String_Node_Str" + this.allServerGroups.getFullName()+ "String_Node_Str");
    }
    deployRequest=new ModelNode();
    deployRequest.get(Util.OPERATION).set(Util.DEPLOY);
    deployRequest.get(Util.ADDRESS,Util.DEPLOYMENT).set(name);
  }
  final ModelNode addRequest;
  if (f != null) {
    if (!ctx.isBatchMode() && Util.isDeploymentInRepository(name,client)) {
      throw new OperationFormatException("String_Node_Str" + name + "String_Node_Str"+ this.force.getFullName()+ "String_Node_Str");
    }
    addRequest=this.buildDeploymentAdd(f,name,runtimeName,unmanaged,ctx.isDomainMode() ? null : Boolean.FALSE);
  }
 else   if (!ctx.isBatchMode() && !Util.isDeploymentInRepository(name,client)) {
    throw new OperationFormatException("String_Node_Str" + name + "String_Node_Str");
  }
 else {
    addRequest=null;
  }
  if (addRequest != null) {
    final ModelNode composite=new ModelNode();
    composite.get(Util.OPERATION).set(Util.COMPOSITE);
    composite.get(Util.ADDRESS).setEmptyList();
    final ModelNode steps=composite.get(Util.STEPS);
    steps.add(addRequest);
    steps.add(deployRequest);
    return composite;
  }
  return deployRequest;
}

Fixed version (ground truth):
@Override public ModelNode buildRequestWithoutHeaders(CommandContext ctx) throws CommandFormatException {
  final ModelControllerClient client=ctx.getModelControllerClient();
  ParsedCommandLine args=ctx.getParsedCommandLine();
  boolean l=this.l.isPresent(args);
  if (!args.hasProperties() || l) {
    throw new OperationFormatException("String_Node_Str" + args.getOriginalLine() + "String_Node_Str");
  }
  final boolean unmanaged=this.unmanaged.isPresent(args);
  final String path=this.path.getValue(args);
  final File f;
  if (path != null) {
    f=new File(path);
    if (!f.exists()) {
      throw new OperationFormatException("String_Node_Str" + f.getAbsolutePath() + "String_Node_Str");
    }
    if (!unmanaged && f.isDirectory()) {
      throw new OperationFormatException(f.getAbsolutePath() + "String_Node_Str");
    }
  }
 else {
    f=null;
  }
  String name=this.name.getValue(args);
  if (name == null) {
    if (f == null) {
      throw new OperationFormatException("String_Node_Str");
    }
    name=f.getName();
  }
  final String runtimeName=rtName.getValue(args);
  final boolean force=this.force.isPresent(args);
  final boolean disabled=this.disabled.isPresent(args);
  final String serverGroups=this.serverGroups.getValue(args);
  final boolean allServerGroups=this.allServerGroups.isPresent(args);
  final boolean archive=isCliArchive(f);
  if (name.equals(ALL)) {
    if (force || disabled) {
      throw new CommandFormatException("String_Node_Str");
    }
    List<String> sgList=getServerGroups(ctx,client,allServerGroups,serverGroups,f);
    try {
      return buildDeployAllRequest(client,sgList);
    }
 catch (    IOException ex) {
      throw new CommandFormatException(ex.getMessage(),ex);
    }
  }
  if (force) {
    if (f == null) {
      throw new OperationFormatException(this.force.getFullName() + "String_Node_Str");
    }
    if ((disabled && ctx.isDomainMode()) || serverGroups != null || allServerGroups) {
      throw new OperationFormatException(this.force.getFullName() + "String_Node_Str" + this.disabled.getFullName()+ "String_Node_Str"+ this.serverGroups.getFullName()+ "String_Node_Str"+ this.allServerGroups.getFullName()+ '.');
    }
    if (archive) {
      throw new OperationFormatException(this.force.getFullName() + "String_Node_Str");
    }
    if (Util.isDeploymentInRepository(name,client)) {
      return buildDeploymentReplace(f,name,runtimeName,disabled);
    }
 else {
      return buildDeploymentAdd(f,name,runtimeName,unmanaged,ctx.isDomainMode() ? null : disabled);
    }
  }
  if (disabled) {
    if (f == null) {
      throw new OperationFormatException(this.disabled.getFullName() + "String_Node_Str");
    }
    if (serverGroups != null || allServerGroups) {
      throw new OperationFormatException(this.serverGroups.getFullName() + "String_Node_Str" + this.allServerGroups.getFullName()+ "String_Node_Str"+ this.disabled.getFullName()+ '.');
    }
    if (archive) {
      throw new OperationFormatException(this.disabled.getFullName() + "String_Node_Str");
    }
    if (!ctx.isBatchMode() && Util.isDeploymentInRepository(name,client)) {
      throw new OperationFormatException("String_Node_Str" + name + "String_Node_Str"+ this.force.getFullName()+ "String_Node_Str");
    }
    return buildDeploymentAdd(f,name,runtimeName,unmanaged,ctx.isDomainMode() ? null : Boolean.TRUE);
  }
  if (archive) {
    if (serverGroups != null || allServerGroups) {
      throw new OperationFormatException(this.serverGroups.getFullName() + "String_Node_Str" + this.allServerGroups.getFullName()+ "String_Node_Str");
    }
    TempFileProvider tempFileProvider;
    MountHandle root;
    try {
      tempFileProvider=TempFileProvider.create("String_Node_Str",Executors.newSingleThreadScheduledExecutor(),true);
      root=extractArchive(f,tempFileProvider);
    }
 catch (    IOException e) {
      throw new OperationFormatException("String_Node_Str" + f.getAbsolutePath() + "String_Node_Str");
    }
    final File currentDir=ctx.getCurrentDir();
    ctx.setCurrentDir(root.getMountSource());
    String holdbackBatch=activateNewBatch(ctx);
    try {
      String script=this.script.getValue(args);
      if (script == null) {
        script="String_Node_Str";
      }
      File scriptFile=new File(ctx.getCurrentDir(),script);
      if (!scriptFile.exists()) {
        throw new CommandFormatException("String_Node_Str" + script + "String_Node_Str");
      }
      try (BufferedReader reader=new BufferedReader(new FileReader(scriptFile))){
        String line=reader.readLine();
        while (!ctx.isTerminated() && line != null) {
          ctx.handle(line);
          line=reader.readLine();
        }
      }
 catch (      FileNotFoundException e) {
        throw new CommandFormatException("String_Node_Str" + script + "String_Node_Str");
      }
catch (      IOException e) {
        throw new CommandFormatException("String_Node_Str" + scriptFile.getName() + "String_Node_Str"+ e.getMessage(),e);
      }
catch (      CommandLineException e) {
        throw new CommandFormatException(e.getMessage(),e);
      }
      return ctx.getBatchManager().getActiveBatch().toRequest();
    }
  finally {
      ctx.setCurrentDir(currentDir);
      discardBatch(ctx,holdbackBatch);
      VFSUtils.safeClose(root,tempFileProvider);
    }
  }
  final ModelNode deployRequest;
  if (ctx.isDomainMode()) {
    final List<String> sgList=getServerGroups(ctx,client,allServerGroups,serverGroups,f);
    deployRequest=new ModelNode();
    deployRequest.get(Util.OPERATION).set(Util.COMPOSITE);
    deployRequest.get(Util.ADDRESS).setEmptyList();
    ModelNode steps=deployRequest.get(Util.STEPS);
    for (    String serverGroup : sgList) {
      steps.add(Util.configureDeploymentOperation(Util.ADD,name,serverGroup));
    }
    for (    String serverGroup : sgList) {
      steps.add(Util.configureDeploymentOperation(Util.DEPLOY,name,serverGroup));
    }
  }
 else {
    if (serverGroups != null || allServerGroups) {
      throw new OperationFormatException(this.serverGroups.getFullName() + "String_Node_Str" + this.allServerGroups.getFullName()+ "String_Node_Str");
    }
    deployRequest=new ModelNode();
    deployRequest.get(Util.OPERATION).set(Util.DEPLOY);
    deployRequest.get(Util.ADDRESS,Util.DEPLOYMENT).set(name);
  }
  final ModelNode addRequest;
  if (f != null) {
    if (!ctx.isBatchMode() && Util.isDeploymentInRepository(name,client)) {
      throw new OperationFormatException("String_Node_Str" + name + "String_Node_Str"+ this.force.getFullName()+ "String_Node_Str");
    }
    addRequest=this.buildDeploymentAdd(f,name,runtimeName,unmanaged,ctx.isDomainMode() ? null : Boolean.FALSE);
  }
 else   if (!ctx.isBatchMode() && !Util.isDeploymentInRepository(name,client)) {
    throw new OperationFormatException("String_Node_Str" + name + "String_Node_Str");
  }
 else {
    addRequest=null;
  }
  if (addRequest != null) {
    final ModelNode composite=new ModelNode();
    composite.get(Util.OPERATION).set(Util.COMPOSITE);
    composite.get(Util.ADDRESS).setEmptyList();
    final ModelNode steps=composite.get(Util.STEPS);
    steps.add(addRequest);
    steps.add(deployRequest);
    return composite;
  }
  return deployRequest;
}