Program: 61702
Project: 61702
Buggy source:
public List<File> exportFrames(AbortRetryIgnoreHandler handler,String outdir,int containerId,List<Integer> frames,final FramesExportSettings settings) throws IOException {
  final List<File> ret=new ArrayList<>();
  if (tags.isEmpty()) {
    return ret;
  }
  Timeline tim=null;
  String path="String_Node_Str";
  if (containerId == 0) {
    tim=getTimeline();
  }
 else {
    tim=((Timelined)characters.get(containerId)).getTimeline();
    path=File.separator + Helper.makeFileName(characters.get(containerId).getExportFileName());
  }
  if (frames == null) {
    int frameCnt=tim.frames.size();
    frames=new ArrayList<>();
    for (int i=0; i < frameCnt; i++) {
      frames.add(i);
    }
  }
  final File foutdir=new File(outdir + path);
  if (!foutdir.exists()) {
    if (!foutdir.mkdirs()) {
      if (!foutdir.exists()) {
        throw new IOException("String_Node_Str" + outdir);
      }
    }
  }
  final List<Integer> fframes=frames;
  Color backgroundColor=null;
  if (settings.mode == FramesExportMode.AVI) {
    for (    Tag t : tags) {
      if (t instanceof SetBackgroundColorTag) {
        SetBackgroundColorTag sb=(SetBackgroundColorTag)t;
        backgroundColor=sb.backgroundColor.toColor();
      }
    }
  }
  if (settings.mode == FramesExportMode.SVG) {
    for (int i=0; i < frames.size(); i++) {
      final int fi=i;
      final Timeline ftim=tim;
      final Color fbackgroundColor=backgroundColor;
      new RetryTask(new RunnableIOEx(){
        @Override public void run() throws IOException {
          int frame=fframes.get(fi);
          File f=new File(foutdir + File.separator + frame+ "String_Node_Str");
          try (FileOutputStream fos=new FileOutputStream(f)){
            SVGExporter exporter=new SVGExporter(new ExportRectangle(ftim.displayRect));
            if (fbackgroundColor != null) {
              exporter.setBackGroundColor(fbackgroundColor);
            }
            frameToSvg(ftim,frame,0,null,0,exporter,new ColorTransform(),0);
            fos.write(Utf8Helper.getBytes(exporter.getSVG()));
          }
           ret.add(f);
        }
      }
,handler).run();
    }
    return ret;
  }
  if (settings.mode == FramesExportMode.CANVAS) {
    final Timeline ftim=tim;
    final Color fbackgroundColor=backgroundColor;
    final SWF fswf=this;
    new RetryTask(new RunnableIOEx(){
      @Override public void run() throws IOException {
        File fcanvas=new File(foutdir + File.separator + "String_Node_Str");
        Helper.saveStream(SWF.class.getClassLoader().getResourceAsStream("String_Node_Str"),fcanvas);
        ret.add(fcanvas);
        File f=new File(foutdir + File.separator + "String_Node_Str");
        File fmin=new File(foutdir + File.separator + "String_Node_Str");
        int width=(int)(ftim.displayRect.getWidth() / SWF.unitDivisor);
        int height=(int)(ftim.displayRect.getHeight() / SWF.unitDivisor);
        try (FileOutputStream fos=new FileOutputStream(f)){
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          Set<Integer> library=new HashSet<>();
          ftim.getNeededCharacters(fframes,library);
          writeLibrary(fswf,library,fos);
          String currentName=ftim.id == 0 ? "String_Node_Str" : getTypePrefix(fswf.characters.get(ftim.id)) + ftim.id;
          fos.write(Utf8Helper.getBytes("String_Node_Str" + currentName + "String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str" + (-ftim.displayRect.Xmin / unitDivisor) + "String_Node_Str"+ (-ftim.displayRect.Ymin / unitDivisor)+ "String_Node_Str"));
          fos.write(Utf8Helper.getBytes(framesToHtmlCanvas(unitDivisor,ftim,fframes,0,null,0,ftim.displayRect,new ColorTransform(),fbackgroundColor)));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          for (          int i : fframes) {
            fos.write(Utf8Helper.getBytes("String_Node_Str" + i + "String_Node_Str"));
          }
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          RGB backgroundColor=new RGB(255,255,255);
          for (          Tag t : fswf.tags) {
            if (t instanceof SetBackgroundColorTag) {
              SetBackgroundColorTag sb=(SetBackgroundColorTag)t;
              backgroundColor=sb.backgroundColor;
            }
          }
          fos.write(Utf8Helper.getBytes("String_Node_Str" + backgroundColor.toHexRGB() + "String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str" + width + "String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str" + height + "String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str" + currentName + "String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str" + (int)(1000.0 / ftim.swf.frameRate) + "String_Node_Str"));
        }
         if (Configuration.packJavaScripts.get()) {
          try {
            JPacker.main(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",fmin.getAbsolutePath(),f.getAbsolutePath()});
            f.delete();
          }
 catch (          Exception|Error e) {
            Logger.getLogger(SWF.class.getName()).log(Level.WARNING,"String_Node_Str");
            f.renameTo(fmin);
          }
        }
 else {
          f.renameTo(fmin);
        }
        File fh=new File(foutdir + File.separator + "String_Node_Str");
        try (FileOutputStream fos=new FileOutputStream(fh);FileInputStream fis=new FileInputStream(fmin)){
          fos.write(Utf8Helper.getBytes(CanvasShapeExporter.getHtmlPrefix(width,height)));
          fos.write(Utf8Helper.getBytes(CanvasShapeExporter.getJsPrefix()));
          byte buf[]=new byte[1000];
          int cnt;
          while ((cnt=fis.read(buf)) > 0) {
            fos.write(buf,0,cnt);
          }
          if (Configuration.packJavaScripts.get()) {
            fos.write(Utf8Helper.getBytes("String_Node_Str"));
          }
          fos.write(Utf8Helper.getBytes(CanvasShapeExporter.getJsSuffix()));
          fos.write(Utf8Helper.getBytes(CanvasShapeExporter.getHtmlSuffix()));
        }
         fmin.delete();
        ret.add(f);
      }
    }
,handler).run();
    return ret;
  }
  final Timeline ftim=tim;
  final Color fbackgroundColor=backgroundColor;
  final Iterator<BufferedImage> frameImages=new Iterator<BufferedImage>(){
    private final int pos=0;
    @Override public boolean hasNext(){
      return fframes.size() > pos;
    }
    @Override public void remove(){
      throw new UnsupportedOperationException();
    }
    @Override public BufferedImage next(){
      if (!hasNext()) {
        return null;
      }
      return frameToImageGet(ftim,fframes.get(pos),0,null,0,ftim.displayRect,new Matrix(),new ColorTransform(),fbackgroundColor,false).getBufferedImage();
    }
  }
;
switch (settings.mode) {
case GIF:
    new RetryTask(new RunnableIOEx(){
      @Override public void run() throws IOException {
        File f=new File(foutdir + File.separator + "String_Node_Str");
        makeGIF(frameImages,frameRate,f);
        ret.add(f);
      }
    }
,handler).run();
  break;
case PNG:
for (int i=0; frameImages.hasNext(); i++) {
  final int fi=i;
  new RetryTask(new RunnableIOEx(){
    @Override public void run() throws IOException {
      File f=new File(foutdir + File.separator + fframes.get(fi)+ "String_Node_Str");
      ImageIO.write(frameImages.next(),"String_Node_Str",f);
      ret.add(f);
    }
  }
,handler).run();
}
break;
case PDF:
new RetryTask(new RunnableIOEx(){
@Override public void run() throws IOException {
File f=new File(foutdir + File.separator + "String_Node_Str");
PDFJob job=new PDFJob(new FileOutputStream(f));
PageFormat pf=new PageFormat();
pf.setOrientation(PageFormat.PORTRAIT);
Paper p=new Paper();
BufferedImage img0=frameImages.next();
p.setSize(img0.getWidth() + 10,img0.getHeight() + 10);
pf.setPaper(p);
for (int i=0; frameImages.hasNext(); i++) {
  BufferedImage img=frameImages.next();
  Graphics g=job.getGraphics(pf);
  g.drawImage(img,5,5,img.getWidth(),img.getHeight(),null);
  g.dispose();
}
job.end();
ret.add(f);
}
}
,handler).run();
break;
case AVI:
new RetryTask(new RunnableIOEx(){
@Override public void run() throws IOException {
File f=new File(foutdir + File.separator + "String_Node_Str");
makeAVI(frameImages,frameRate,f);
ret.add(f);
}
}
,handler).run();
break;
}
return ret;
}

Fixed version (ground truth):
public List<File> exportFrames(AbortRetryIgnoreHandler handler,String outdir,int containerId,List<Integer> frames,final FramesExportSettings settings) throws IOException {
  final List<File> ret=new ArrayList<>();
  if (tags.isEmpty()) {
    return ret;
  }
  Timeline tim=null;
  String path="String_Node_Str";
  if (containerId == 0) {
    tim=getTimeline();
  }
 else {
    tim=((Timelined)characters.get(containerId)).getTimeline();
    path=File.separator + Helper.makeFileName(characters.get(containerId).getExportFileName());
  }
  if (frames == null) {
    int frameCnt=tim.frames.size();
    frames=new ArrayList<>();
    for (int i=0; i < frameCnt; i++) {
      frames.add(i);
    }
  }
  final File foutdir=new File(outdir + path);
  if (!foutdir.exists()) {
    if (!foutdir.mkdirs()) {
      if (!foutdir.exists()) {
        throw new IOException("String_Node_Str" + outdir);
      }
    }
  }
  final List<Integer> fframes=frames;
  Color backgroundColor=null;
  if (settings.mode == FramesExportMode.AVI) {
    for (    Tag t : tags) {
      if (t instanceof SetBackgroundColorTag) {
        SetBackgroundColorTag sb=(SetBackgroundColorTag)t;
        backgroundColor=sb.backgroundColor.toColor();
      }
    }
  }
  if (settings.mode == FramesExportMode.SVG) {
    for (int i=0; i < frames.size(); i++) {
      final int fi=i;
      final Timeline ftim=tim;
      final Color fbackgroundColor=backgroundColor;
      new RetryTask(new RunnableIOEx(){
        @Override public void run() throws IOException {
          int frame=fframes.get(fi);
          File f=new File(foutdir + File.separator + frame+ "String_Node_Str");
          try (FileOutputStream fos=new FileOutputStream(f)){
            SVGExporter exporter=new SVGExporter(new ExportRectangle(ftim.displayRect));
            if (fbackgroundColor != null) {
              exporter.setBackGroundColor(fbackgroundColor);
            }
            frameToSvg(ftim,frame,0,null,0,exporter,new ColorTransform(),0);
            fos.write(Utf8Helper.getBytes(exporter.getSVG()));
          }
           ret.add(f);
        }
      }
,handler).run();
    }
    return ret;
  }
  if (settings.mode == FramesExportMode.CANVAS) {
    final Timeline ftim=tim;
    final Color fbackgroundColor=backgroundColor;
    final SWF fswf=this;
    new RetryTask(new RunnableIOEx(){
      @Override public void run() throws IOException {
        File fcanvas=new File(foutdir + File.separator + "String_Node_Str");
        Helper.saveStream(SWF.class.getClassLoader().getResourceAsStream("String_Node_Str"),fcanvas);
        ret.add(fcanvas);
        File f=new File(foutdir + File.separator + "String_Node_Str");
        File fmin=new File(foutdir + File.separator + "String_Node_Str");
        int width=(int)(ftim.displayRect.getWidth() / SWF.unitDivisor);
        int height=(int)(ftim.displayRect.getHeight() / SWF.unitDivisor);
        try (FileOutputStream fos=new FileOutputStream(f)){
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          Set<Integer> library=new HashSet<>();
          ftim.getNeededCharacters(fframes,library);
          writeLibrary(fswf,library,fos);
          String currentName=ftim.id == 0 ? "String_Node_Str" : getTypePrefix(fswf.characters.get(ftim.id)) + ftim.id;
          fos.write(Utf8Helper.getBytes("String_Node_Str" + currentName + "String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str" + (-ftim.displayRect.Xmin / unitDivisor) + "String_Node_Str"+ (-ftim.displayRect.Ymin / unitDivisor)+ "String_Node_Str"));
          fos.write(Utf8Helper.getBytes(framesToHtmlCanvas(unitDivisor,ftim,fframes,0,null,0,ftim.displayRect,new ColorTransform(),fbackgroundColor)));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          for (          int i : fframes) {
            fos.write(Utf8Helper.getBytes("String_Node_Str" + i + "String_Node_Str"));
          }
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          RGB backgroundColor=new RGB(255,255,255);
          for (          Tag t : fswf.tags) {
            if (t instanceof SetBackgroundColorTag) {
              SetBackgroundColorTag sb=(SetBackgroundColorTag)t;
              backgroundColor=sb.backgroundColor;
            }
          }
          fos.write(Utf8Helper.getBytes("String_Node_Str" + backgroundColor.toHexRGB() + "String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str" + width + "String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str" + height + "String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str" + currentName + "String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str"));
          fos.write(Utf8Helper.getBytes("String_Node_Str" + (int)(1000.0 / ftim.swf.frameRate) + "String_Node_Str"));
        }
         if (Configuration.packJavaScripts.get()) {
          try {
            JPacker.main(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",fmin.getAbsolutePath(),f.getAbsolutePath()});
            f.delete();
          }
 catch (          Exception|Error e) {
            Logger.getLogger(SWF.class.getName()).log(Level.WARNING,"String_Node_Str");
            f.renameTo(fmin);
          }
        }
 else {
          f.renameTo(fmin);
        }
        File fh=new File(foutdir + File.separator + "String_Node_Str");
        try (FileOutputStream fos=new FileOutputStream(fh);FileInputStream fis=new FileInputStream(fmin)){
          fos.write(Utf8Helper.getBytes(CanvasShapeExporter.getHtmlPrefix(width,height)));
          fos.write(Utf8Helper.getBytes(CanvasShapeExporter.getJsPrefix()));
          byte buf[]=new byte[1000];
          int cnt;
          while ((cnt=fis.read(buf)) > 0) {
            fos.write(buf,0,cnt);
          }
          if (Configuration.packJavaScripts.get()) {
            fos.write(Utf8Helper.getBytes("String_Node_Str"));
          }
          fos.write(Utf8Helper.getBytes(CanvasShapeExporter.getJsSuffix()));
          fos.write(Utf8Helper.getBytes(CanvasShapeExporter.getHtmlSuffix()));
        }
         fmin.delete();
        ret.add(f);
      }
    }
,handler).run();
    return ret;
  }
  final Timeline ftim=tim;
  final Color fbackgroundColor=backgroundColor;
  final Iterator<BufferedImage> frameImages=new Iterator<BufferedImage>(){
    private int pos=0;
    @Override public boolean hasNext(){
      return fframes.size() > pos;
    }
    @Override public void remove(){
      throw new UnsupportedOperationException();
    }
    @Override public BufferedImage next(){
      if (!hasNext()) {
        return null;
      }
      return frameToImageGet(ftim,fframes.get(pos++),0,null,0,ftim.displayRect,new Matrix(),new ColorTransform(),fbackgroundColor,false).getBufferedImage();
    }
  }
;
switch (settings.mode) {
case GIF:
    new RetryTask(new RunnableIOEx(){
      @Override public void run() throws IOException {
        File f=new File(foutdir + File.separator + "String_Node_Str");
        makeGIF(frameImages,frameRate,f);
        ret.add(f);
      }
    }
,handler).run();
  break;
case PNG:
for (int i=0; frameImages.hasNext(); i++) {
  final int fi=i;
  new RetryTask(new RunnableIOEx(){
    @Override public void run() throws IOException {
      File f=new File(foutdir + File.separator + (fframes.get(fi) + 1)+ "String_Node_Str");
      ImageIO.write(frameImages.next(),"String_Node_Str",f);
      ret.add(f);
    }
  }
,handler).run();
}
break;
case PDF:
new RetryTask(new RunnableIOEx(){
@Override public void run() throws IOException {
File f=new File(foutdir + File.separator + "String_Node_Str");
PDFJob job=new PDFJob(new FileOutputStream(f));
PageFormat pf=new PageFormat();
pf.setOrientation(PageFormat.PORTRAIT);
Paper p=new Paper();
BufferedImage img0=frameImages.next();
p.setSize(img0.getWidth() + 10,img0.getHeight() + 10);
pf.setPaper(p);
for (int i=0; frameImages.hasNext(); i++) {
  BufferedImage img=frameImages.next();
  Graphics g=job.getGraphics(pf);
  g.drawImage(img,5,5,img.getWidth(),img.getHeight(),null);
  g.dispose();
}
job.end();
ret.add(f);
}
}
,handler).run();
break;
case AVI:
new RetryTask(new RunnableIOEx(){
@Override public void run() throws IOException {
File f=new File(foutdir + File.separator + "String_Node_Str");
makeAVI(frameImages,frameRate,f);
ret.add(f);
}
}
,handler).run();
break;
}
return ret;
}