Program: 62357
Project: 62357
Buggy source:
public void plantUml(String uml,String type,String imagesDir,String imageTarget){
  Objects.requireNonNull(imageTarget);
  if (!imageTarget.endsWith("String_Node_Str") && !imageTarget.endsWith("String_Node_Str"))   return;
  String defaultScale="String_Node_Str";
  if (!uml.contains("String_Node_Str") && !uml.contains("String_Node_Str")) {
    uml=defaultScale + uml;
    uml="String_Node_Str" + uml + "String_Node_Str";
  }
 else   if (uml.contains("String_Node_Str")) {
    uml=uml.replaceFirst("String_Node_Str","String_Node_Str" + defaultScale);
  }
  Integer cacheHit=current.getCache().get(imageTarget);
  int hashCode=(imageTarget + imagesDir + type+ uml).hashCode();
  if (Objects.nonNull(cacheHit))   if (hashCode == cacheHit)   return;
  logger.debug("String_Node_Str",imageTarget);
  SourceStringReader reader=new SourceStringReader(uml);
  try (ByteArrayOutputStream os=new ByteArrayOutputStream()){
    if (!current.currentPath().isPresent())     controller.saveDoc();
    Path path=current.currentPath().get().getParent();
    Path umlPath=path.resolve(imageTarget);
    FileFormat fileType=imageTarget.endsWith("String_Node_Str") ? FileFormat.SVG : FileFormat.PNG;
    threadService.runTaskLater(() -> {
      try {
        reader.generateImage(os,new FileFormatOption(fileType));
        Files.createDirectories(path.resolve(imagesDir));
        IOHelper.writeToFile(umlPath,os.toByteArray(),CREATE,WRITE,TRUNCATE_EXISTING);
        logger.debug("String_Node_Str",imageTarget);
        threadService.runActionLater(() -> {
          controller.clearImageCache();
        }
);
      }
 catch (      Exception e) {
        logger.error("String_Node_Str",e);
      }
    }
);
    current.getCache().put(imageTarget,hashCode);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public void plantUml(String uml,String type,String imagesDir,String imageTarget){
  Objects.requireNonNull(imageTarget);
  if (!imageTarget.endsWith("String_Node_Str") && !imageTarget.endsWith("String_Node_Str"))   return;
  String defaultScale="String_Node_Str";
  if (!uml.contains("String_Node_Str") && !uml.contains("String_Node_Str")) {
    uml=defaultScale + uml;
    uml="String_Node_Str" + uml + "String_Node_Str";
  }
 else   if (uml.contains("String_Node_Str")) {
    uml=uml.replaceFirst("String_Node_Str","String_Node_Str" + defaultScale);
  }
  Integer cacheHit=current.getCache().get(imageTarget);
  int hashCode=(imageTarget + imagesDir + type+ uml).hashCode();
  if (Objects.nonNull(cacheHit))   if (hashCode == cacheHit)   return;
  logger.debug("String_Node_Str",imageTarget);
  SourceStringReader reader=new SourceStringReader(uml);
  try (ByteArrayOutputStream os=new ByteArrayOutputStream()){
    Path path=current.currentTab().getParentOrWorkdir();
    Path umlPath=path.resolve(imageTarget);
    FileFormat fileType=imageTarget.endsWith("String_Node_Str") ? FileFormat.SVG : FileFormat.PNG;
    threadService.runTaskLater(() -> {
      try {
        reader.generateImage(os,new FileFormatOption(fileType));
        Files.createDirectories(path.resolve(imagesDir));
        IOHelper.writeToFile(umlPath,os.toByteArray(),CREATE,WRITE,TRUNCATE_EXISTING);
        logger.debug("String_Node_Str",imageTarget);
        threadService.runActionLater(() -> {
          controller.clearImageCache();
        }
);
      }
 catch (      Exception e) {
        logger.error("String_Node_Str",e);
      }
    }
);
    current.getCache().put(imageTarget,hashCode);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str",e);
  }
}