Program: 62390
Project: 62390
Buggy source:
private CompletableFuture<Path> produceEpub3(boolean askPath,boolean isTemp){
  CompletableFuture<Path> completableFuture=new CompletableFuture<>();
  try {
    Path currentTabPath=current.currentPath().get();
    Path currentTabPathDir=currentTabPath.getParent();
    Path configPath=asciiDocController.getConfigPath();
    String tabText=current.getCurrentTabText().replace("String_Node_Str","String_Node_Str").trim();
    if (askPath) {
      FileChooser fileChooser=directoryService.newFileChooser("String_Node_Str");
      fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("String_Node_Str","String_Node_Str"));
      epubPath=fileChooser.showSaveDialog(null).toPath();
    }
 else     if (isTemp) {
      epubPath=IOHelper.createTempFile("String_Node_Str");
    }
 else     epubPath=currentTabPathDir.resolve(tabText + "String_Node_Str");
    threadService.runTaskLater(() -> {
      try {
        if (!isTemp)         indikatorService.startCycle();
        Path epubTemp=Files.createTempDirectory("String_Node_Str");
        TransformerFactory factory=new TransformerFactoryImpl();
        File xslFile=configPath.resolve("String_Node_Str").toFile();
        StreamSource xslSource=new StreamSource(xslFile);
        Transformer transformer=factory.newTransformer(xslSource);
        docBookService.generateDocbook(docbook -> {
          threadService.runTaskLater(() -> {
            transformer.setParameter("String_Node_Str",epubTemp.resolve("String_Node_Str").toString());
            try (StringReader reader=new StringReader(docbook)){
              StreamSource xmlSource=new StreamSource(reader);
              IOHelper.transform(transformer,xmlSource,new StreamResult());
            }
             Path containerXml=epubTemp.resolve("String_Node_Str");
            Match root=IOHelper.$(containerXml.toFile());
            root.find("String_Node_Str").attr("String_Node_Str","String_Node_Str");
            StringBuilder builder=new StringBuilder();
            builder.append("String_Node_Str");
            Match wrapper=$("String_Node_Str");
            wrapper.append(root);
            builder.append(wrapper.content());
            IOHelper.matchWrite(root,containerXml.toFile());
            IOHelper.writeToFile(containerXml,builder.toString(),TRUNCATE_EXISTING,WRITE);
            Path epubOut=epubTemp.resolve("String_Node_Str");
            IOHelper.copyDirectoryToDirectory(currentTabPathDir.resolve("String_Node_Str").toFile(),epubTemp.resolve("String_Node_Str").toFile());
            IOHelper.copyDirectoryToDirectory(configPath.resolve("String_Node_Str").toFile(),epubTemp.resolve("String_Node_Str").toFile());
            ZipUtil.pack(epubTemp.toFile(),epubOut.toFile());
            ZipUtil.removeEntry(epubOut.toFile(),"String_Node_Str");
            IOHelper.move(epubOut,epubPath,StandardCopyOption.REPLACE_EXISTING);
            if (!isTemp) {
              indikatorService.completeCycle();
              threadService.runActionLater(() -> {
                asciiDocController.getRecentFiles().remove(epubPath.toString());
                asciiDocController.getRecentFiles().add(0,epubPath.toString());
              }
);
            }
          }
);
        }
);
      }
 catch (      Exception e) {
        logger.error(e.getMessage(),e);
      }
 finally {
        completableFuture.complete(epubPath);
      }
    }
);
  }
 catch (  Exception e) {
    logger.error(e.getMessage(),e);
    indikatorService.completeCycle();
  }
  return completableFuture;
}

Fixed version (ground truth):
private CompletableFuture<Path> produceEpub3(boolean askPath,boolean isTemp){
  CompletableFuture<Path> completableFuture=new CompletableFuture<>();
  try {
    Path currentTabPath=current.currentPath().get();
    Path currentTabPathDir=currentTabPath.getParent();
    Path configPath=asciiDocController.getConfigPath();
    String tabText=current.getCurrentTabText().replace("String_Node_Str","String_Node_Str").trim();
    if (askPath) {
      FileChooser fileChooser=directoryService.newFileChooser("String_Node_Str");
      fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("String_Node_Str","String_Node_Str"));
      epubPath=fileChooser.showSaveDialog(null).toPath();
    }
 else     if (isTemp) {
      epubPath=IOHelper.createTempFile("String_Node_Str");
    }
 else     epubPath=currentTabPathDir.resolve(tabText + "String_Node_Str");
    threadService.runTaskLater(() -> {
      try {
        if (!isTemp)         indikatorService.startCycle();
        Path epubTemp=Files.createTempDirectory("String_Node_Str");
        TransformerFactory factory=new TransformerFactoryImpl();
        File xslFile=configPath.resolve("String_Node_Str").toFile();
        StreamSource xslSource=new StreamSource(xslFile);
        Transformer transformer=factory.newTransformer(xslSource);
        docBookService.generateDocbook(docbook -> {
          threadService.runTaskLater(() -> {
            transformer.setParameter("String_Node_Str",epubTemp.resolve("String_Node_Str").toString());
            try (StringReader reader=new StringReader(docbook)){
              StreamSource xmlSource=new StreamSource(reader);
              IOHelper.transform(transformer,xmlSource,new StreamResult());
            }
             Path containerXml=epubTemp.resolve("String_Node_Str");
            Match root=IOHelper.$(containerXml.toFile());
            root.find("String_Node_Str").attr("String_Node_Str","String_Node_Str");
            StringBuilder builder=new StringBuilder();
            builder.append("String_Node_Str");
            Match wrapper=$("String_Node_Str");
            wrapper.append(root);
            builder.append(wrapper.content());
            IOHelper.matchWrite(root,containerXml.toFile());
            IOHelper.writeToFile(containerXml,builder.toString(),TRUNCATE_EXISTING,WRITE);
            Path epubOut=epubTemp.resolve("String_Node_Str");
            Stream<Path> imageStream=IOHelper.find(currentTabPathDir,Integer.MAX_VALUE,(p,attr) -> pathResolverService.isImage(p));
            imageStream.forEach(img -> {
              IOHelper.copyFile(img.toFile(),epubTemp.resolve("String_Node_Str").resolve(currentTabPathDir.relativize(img)).toFile());
            }
);
            IOHelper.copyDirectoryToDirectory(configPath.resolve("String_Node_Str").toFile(),epubTemp.resolve("String_Node_Str").toFile());
            ZipUtil.pack(epubTemp.toFile(),epubOut.toFile());
            ZipUtil.removeEntry(epubOut.toFile(),"String_Node_Str");
            IOHelper.move(epubOut,epubPath,StandardCopyOption.REPLACE_EXISTING);
            if (!isTemp) {
              indikatorService.completeCycle();
              threadService.runActionLater(() -> {
                asciiDocController.getRecentFiles().remove(epubPath.toString());
                asciiDocController.getRecentFiles().add(0,epubPath.toString());
              }
);
            }
          }
);
        }
);
      }
 catch (      Exception e) {
        logger.error(e.getMessage(),e);
      }
 finally {
        completableFuture.complete(epubPath);
      }
    }
);
  }
 catch (  Exception e) {
    logger.error(e.getMessage(),e);
    indikatorService.completeCycle();
  }
  return completableFuture;
}