Program: 61964
Project: 61964
Buggy source:
public static List<File> exportNodeAS(List<Tag> allTags,AbortRetryIgnoreHandler handler,List<TagNode> nodeList,String outdir,ExportMode exportMode,AtomicInteger index,int count,EventListener ev) throws IOException {
  File dir=new File(outdir);
  List<File> ret=new ArrayList<>();
  if (!outdir.endsWith(File.separator)) {
    outdir=outdir + File.separator;
  }
  List<String> existingNames=new ArrayList<>();
  for (  TagNode node : nodeList) {
    String name="String_Node_Str";
    if (node.tag instanceof Exportable) {
      name=((Exportable)node.tag).getExportFileName(allTags);
    }
 else {
      name=Helper.makeFileName(node.tag.toString());
    }
    int i=1;
    String baseName=name;
    while (existingNames.contains(name)) {
      i++;
      name=baseName + "String_Node_Str" + i;
    }
    existingNames.add(name);
    if (node.subItems.isEmpty()) {
      if ((node.tag instanceof ASMSource) && (node.export)) {
        if (!dir.exists()) {
          if (!dir.mkdirs()) {
            if (!dir.exists()) {
              continue;
            }
          }
        }
        boolean retry;
        do {
          retry=false;
          try {
            long startTime=System.currentTimeMillis();
            String f=outdir + name + "String_Node_Str";
            File file=new File(f);
            String res;
            ASMSource asm=((ASMSource)node.tag);
            if (exportMode == ExportMode.HEX) {
              HilightedTextWriter writer=new HilightedTextWriter(false,asm.getActionSourceIndent());
              asm.getActionBytesAsHex(writer);
              res=asm.getActionSourcePrefix() + writer.toString() + asm.getActionSourceSuffix();
            }
 else             if (exportMode != ExportMode.SOURCE) {
              HilightedTextWriter writer=new HilightedTextWriter(false,asm.getActionSourceIndent());
              asm.getASMSource(SWF.DEFAULT_VERSION,exportMode,writer,null);
              String str=writer.toString();
              res=asm.getActionSourcePrefix() + str + asm.getActionSourceSuffix();
            }
 else {
              List<Action> as=asm.getActions(SWF.DEFAULT_VERSION);
              Action.setActionsAddresses(as,0,SWF.DEFAULT_VERSION);
              res=asm.getActionSourcePrefix() + Action.actionsToSource(as,SWF.DEFAULT_VERSION,"String_Node_Str",false,asm.getActionSourceIndent()) + asm.getActionSourceSuffix();
            }
            try (FileOutputStream fos=new FileOutputStream(f)){
              fos.write(res.getBytes("String_Node_Str"));
            }
             long stopTime=System.currentTimeMillis();
            if (ev != null) {
              long time=stopTime - startTime;
              ev.handleEvent("String_Node_Str","String_Node_Str" + index.getAndIncrement() + "String_Node_Str"+ count+ "String_Node_Str"+ f+ "String_Node_Str"+ Helper.formatTimeSec(time));
            }
            ret.add(file);
          }
 catch (          Exception|OutOfMemoryError|StackOverflowError ex) {
            Logger.getLogger(TagNode.class.getName()).log(Level.SEVERE,"String_Node_Str",ex);
            if (handler != null) {
              int action=handler.getNewInstance().handle(ex);
switch (action) {
case AbortRetryIgnoreHandler.ABORT:
                throw ex;
case AbortRetryIgnoreHandler.RETRY:
              retry=true;
            break;
case AbortRetryIgnoreHandler.IGNORE:
          retry=false;
        break;
    }
  }
}
}
 while (retry);
}
}
 else {
ret.addAll(exportNodeAS(allTags,handler,node.subItems,outdir + name,exportMode,index,count,ev));
}
}
return ret;
}

Fixed version (ground truth):
public static List<File> exportNodeAS(List<Tag> allTags,AbortRetryIgnoreHandler handler,List<TagNode> nodeList,String outdir,ExportMode exportMode,AtomicInteger index,int count,EventListener ev) throws IOException {
  File dir=new File(outdir);
  List<File> ret=new ArrayList<>();
  if (!outdir.endsWith(File.separator)) {
    outdir=outdir + File.separator;
  }
  List<String> existingNames=new ArrayList<>();
  for (  TagNode node : nodeList) {
    String name="String_Node_Str";
    if (node.tag instanceof Exportable) {
      name=((Exportable)node.tag).getExportFileName(allTags);
    }
 else {
      name=Helper.makeFileName(node.tag.toString());
    }
    int i=1;
    String baseName=name;
    while (existingNames.contains(name)) {
      i++;
      name=baseName + "String_Node_Str" + i;
    }
    existingNames.add(name);
    if (node.subItems.isEmpty()) {
      if ((node.tag instanceof ASMSource) && (node.export)) {
        if (!dir.exists()) {
          if (!dir.mkdirs()) {
            if (!dir.exists()) {
              continue;
            }
          }
        }
        boolean retry;
        do {
          retry=false;
          try {
            long startTime=System.currentTimeMillis();
            String f=outdir + name + "String_Node_Str";
            File file=new File(f);
            String res;
            ASMSource asm=((ASMSource)node.tag);
            if (exportMode == ExportMode.HEX) {
              HilightedTextWriter writer=new HilightedTextWriter(false);
              asm.getActionSourcePrefix(writer);
              asm.getActionBytesAsHex(writer);
              asm.getActionSourceSuffix(writer);
              res=writer.toString();
            }
 else             if (exportMode != ExportMode.SOURCE) {
              HilightedTextWriter writer=new HilightedTextWriter(false);
              asm.getActionSourcePrefix(writer);
              asm.getASMSource(SWF.DEFAULT_VERSION,exportMode,writer,null);
              asm.getActionSourceSuffix(writer);
              res=writer.toString();
            }
 else {
              List<Action> as=asm.getActions(SWF.DEFAULT_VERSION);
              Action.setActionsAddresses(as,0,SWF.DEFAULT_VERSION);
              HilightedTextWriter writer=new HilightedTextWriter(false);
              asm.getActionSourcePrefix(writer);
              Action.actionsToSource(as,SWF.DEFAULT_VERSION,"String_Node_Str",writer);
              asm.getActionSourceSuffix(writer);
              res=writer.toString();
            }
            try (FileOutputStream fos=new FileOutputStream(f)){
              fos.write(res.getBytes("String_Node_Str"));
            }
             long stopTime=System.currentTimeMillis();
            if (ev != null) {
              long time=stopTime - startTime;
              ev.handleEvent("String_Node_Str","String_Node_Str" + index.getAndIncrement() + "String_Node_Str"+ count+ "String_Node_Str"+ f+ "String_Node_Str"+ Helper.formatTimeSec(time));
            }
            ret.add(file);
          }
 catch (          Exception|OutOfMemoryError|StackOverflowError ex) {
            Logger.getLogger(TagNode.class.getName()).log(Level.SEVERE,"String_Node_Str",ex);
            if (handler != null) {
              int action=handler.getNewInstance().handle(ex);
switch (action) {
case AbortRetryIgnoreHandler.ABORT:
                throw ex;
case AbortRetryIgnoreHandler.RETRY:
              retry=true;
            break;
case AbortRetryIgnoreHandler.IGNORE:
          retry=false;
        break;
    }
  }
}
}
 while (retry);
}
}
 else {
ret.addAll(exportNodeAS(allTags,handler,node.subItems,outdir + name,exportMode,index,count,ev));
}
}
return ret;
}