nus-yam/ex-repair huggingface dataset:
Program: 61560
Project: 61560
Buggy source:
public void replaceScriptPack(ScriptPack pack,String as) throws AVM2ParseException, CompilationException, IOException, InterruptedException {
  String scriptName=pack.getPathScriptName() + "String_Node_Str";
  int oldIndex=pack.scriptIndex;
  int newIndex=script_info.size();
  String documentClass=getSwf().getDocumentClass();
  boolean isDocumentClass=documentClass != null && documentClass.equals(pack.getClassPath().toString());
  ScriptInfo si=script_info.get(oldIndex);
  si.delete(this,true);
  int newClassIndex=instance_info.size();
  for (  Trait t : si.traits.traits) {
    if (t instanceof TraitClass) {
      TraitClass tc=(TraitClass)t;
      newClassIndex=tc.class_info + 1;
    }
  }
  ActionScriptParser.compile(as,this,new ArrayList<ABC>(),isDocumentClass,scriptName,newClassIndex);
  script_info.set(oldIndex,script_info.get(newIndex));
  script_info.remove(newIndex);
  script_info.get(oldIndex).setModified(true);
  pack();
  ((Tag)parentTag).setModified(true);
}

Fixed version (ground truth):
public void replaceScriptPack(ScriptPack pack,String as) throws AVM2ParseException, CompilationException, IOException, InterruptedException {
  String scriptName=pack.getPathScriptName() + "String_Node_Str";
  int oldIndex=pack.scriptIndex;
  int newIndex=script_info.size();
  String documentClass=getSwf().getDocumentClass();
  boolean isDocumentClass=documentClass != null && documentClass.equals(pack.getClassPath().toString());
  ScriptInfo si=script_info.get(oldIndex);
  si.delete(this,true);
  int newClassIndex=instance_info.size();
  for (  Trait t : si.traits.traits) {
    if (t instanceof TraitClass) {
      TraitClass tc=(TraitClass)t;
      newClassIndex=tc.class_info + 1;
    }
  }
  List<ABC> otherAbcs=new ArrayList<>(pack.allABCs);
  otherAbcs.remove(this);
  ActionScriptParser.compile(as,this,otherAbcs,isDocumentClass,scriptName,newClassIndex);
  script_info.set(oldIndex,script_info.get(newIndex));
  script_info.remove(newIndex);
  script_info.get(oldIndex).setModified(true);
  pack();
  ((Tag)parentTag).setModified(true);
}
Program: 61561
Project: 61561
Buggy source:
public List<ScriptPack> getScriptPacks(String packagePrefix){
  List<ScriptPack> ret=new ArrayList<>();
  for (int i=0; i < script_info.size(); i++) {
    ret.addAll(script_info.get(i).getPacks(this,i,packagePrefix));
  }
  return ret;
}

Fixed version (ground truth):
public List<ScriptPack> getScriptPacks(String packagePrefix,List<ABC> allAbcs){
  List<ScriptPack> ret=new ArrayList<>();
  for (int i=0; i < script_info.size(); i++) {
    ret.addAll(script_info.get(i).getPacks(this,i,packagePrefix,allAbcs));
  }
  return ret;
}
Program: 61562
Project: 61562
Buggy source:
public ScriptPack(ClassPath path,ABC abc,int scriptIndex,List<Integer> traitIndices){
  super(path.className,path);
  this.abc=abc;
  this.scriptIndex=scriptIndex;
  this.traitIndices=traitIndices;
  this.path=path;
}

Fixed version (ground truth):
public ScriptPack(ClassPath path,ABC abc,List<ABC> allAbcs,int scriptIndex,List<Integer> traitIndices){
  super(path.className,path);
  this.abc=abc;
  this.scriptIndex=scriptIndex;
  this.traitIndices=traitIndices;
  this.path=path;
  this.allABCs=allAbcs;
}
Program: 61565
Project: 61565
Buggy source:
public List<ScriptPack> getPacks(ABC abc,int scriptIndex,String packagePrefix){
  List<ScriptPack> ret=new ArrayList<>();
  List<Integer> otherTraits=new ArrayList<>();
  for (int j=0; j < traits.traits.size(); j++) {
    Trait t=traits.traits.get(j);
    Multiname name=t.getName(abc);
    Namespace ns=name.getNamespace(abc.constants);
    if (!((ns.kind == Namespace.KIND_PACKAGE_INTERNAL) || (ns.kind == Namespace.KIND_PACKAGE))) {
      otherTraits.add(j);
    }
  }
  for (int j=0; j < traits.traits.size(); j++) {
    Trait t=traits.traits.get(j);
    Multiname name=t.getName(abc);
    Namespace ns=name.getNamespace(abc.constants);
    if ((ns.kind == Namespace.KIND_PACKAGE_INTERNAL) || (ns.kind == Namespace.KIND_PACKAGE)) {
      String packageName=ns.getName(abc.constants,false);
      String objectName=name.getName(abc.constants,null,false);
      List<Integer> traitIndices=new ArrayList<>();
      traitIndices.add(j);
      if (!otherTraits.isEmpty()) {
        traitIndices.addAll(otherTraits);
        otherTraits.clear();
      }
      if (packagePrefix == null || packageName.startsWith(packagePrefix)) {
        ClassPath cp=new ClassPath(packageName,objectName);
        ret.add(new ScriptPack(cp,abc,scriptIndex,traitIndices));
      }
    }
  }
  return ret;
}

Fixed version (ground truth):
public List<ScriptPack> getPacks(ABC abc,int scriptIndex,String packagePrefix,List<ABC> allAbcs){
  List<ScriptPack> ret=new ArrayList<>();
  List<Integer> otherTraits=new ArrayList<>();
  for (int j=0; j < traits.traits.size(); j++) {
    Trait t=traits.traits.get(j);
    Multiname name=t.getName(abc);
    Namespace ns=name.getNamespace(abc.constants);
    if (!((ns.kind == Namespace.KIND_PACKAGE_INTERNAL) || (ns.kind == Namespace.KIND_PACKAGE))) {
      otherTraits.add(j);
    }
  }
  for (int j=0; j < traits.traits.size(); j++) {
    Trait t=traits.traits.get(j);
    Multiname name=t.getName(abc);
    Namespace ns=name.getNamespace(abc.constants);
    if ((ns.kind == Namespace.KIND_PACKAGE_INTERNAL) || (ns.kind == Namespace.KIND_PACKAGE)) {
      String packageName=ns.getName(abc.constants,false);
      String objectName=name.getName(abc.constants,null,false);
      List<Integer> traitIndices=new ArrayList<>();
      traitIndices.add(j);
      if (!otherTraits.isEmpty()) {
        traitIndices.addAll(otherTraits);
        otherTraits.clear();
      }
      if (packagePrefix == null || packageName.startsWith(packagePrefix)) {
        ClassPath cp=new ClassPath(packageName,objectName);
        ret.add(new ScriptPack(cp,abc,allAbcs,scriptIndex,traitIndices));
      }
    }
  }
  return ret;
}
Program: 61568
Project: 61568
Buggy source:
private static void initPlayer() throws IOException, InterruptedException {
  if (playerABCs.isEmpty()) {
    if (Configuration.getPlayerSWC() == null) {
      throw new IOException("String_Node_Str" + Configuration.getPlayerSWC());
    }
    SWC swc=new SWC(new FileInputStream(Configuration.getPlayerSWC()));
    SWF swf=new SWF(swc.getSWF("String_Node_Str"),true);
    for (    Tag t : swf.tags) {
      if (t instanceof ABCContainerTag) {
        playerABCs.add(((ABCContainerTag)t).getABC());
      }
    }
  }
}

Fixed version (ground truth):
private static void initPlayer() throws IOException, InterruptedException {
  if (playerABCs.isEmpty()) {
    if (Configuration.getPlayerSWC() == null) {
      throw new IOException("String_Node_Str" + Configuration.getFlashLibPath());
    }
    SWC swc=new SWC(new FileInputStream(Configuration.getPlayerSWC()));
    SWF swf=new SWF(swc.getSWF("String_Node_Str"),true);
    for (    Tag t : swf.tags) {
      if (t instanceof ABCContainerTag) {
        playerABCs.add(((ABCContainerTag)t).getABC());
      }
    }
  }
}
Program: 61571
Project: 61571
Buggy source:
@Override public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData,SourceGenerator generator) throws CompilationException {
  ActionSourceGenerator asGenerator=(ActionSourceGenerator)generator;
  int tmpReg=asGenerator.getTempRegister(localData);
  return toSourceMerge(localData,generator,object,objectName,value,new ActionStoreRegister(tmpReg),new ActionSetMember(),new ActionPush(new RegisterNumber(tmpReg)));
}

Fixed version (ground truth):
@Override public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData,SourceGenerator generator) throws CompilationException {
  ActionSourceGenerator asGenerator=(ActionSourceGenerator)generator;
  int tmpReg=asGenerator.getTempRegister(localData);
  try {
    return toSourceMerge(localData,generator,object,objectName,value,new ActionStoreRegister(tmpReg),new ActionSetMember(),new ActionPush(new RegisterNumber(tmpReg)));
  }
  finally {
    asGenerator.releaseTempRegister(localData,tmpReg);
  }
}
Program: 61572
Project: 61572
Buggy source:
@Override public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData,SourceGenerator generator) throws CompilationException {
  ActionSourceGenerator asGenerator=(ActionSourceGenerator)generator;
  int tmpReg=asGenerator.getTempRegister(localData);
  return toSourceMerge(localData,generator,target,new ActionPush((Long)(long)propertyIndex),value,new ActionStoreRegister(tmpReg),new ActionSetProperty(),new ActionPush(new RegisterNumber(tmpReg)));
}

Fixed version (ground truth):
@Override public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData,SourceGenerator generator) throws CompilationException {
  ActionSourceGenerator asGenerator=(ActionSourceGenerator)generator;
  int tmpReg=asGenerator.getTempRegister(localData);
  try {
    return toSourceMerge(localData,generator,target,new ActionPush((Long)(long)propertyIndex),value,new ActionStoreRegister(tmpReg),new ActionSetProperty(),new ActionPush(new RegisterNumber(tmpReg)));
  }
  finally {
    asGenerator.releaseTempRegister(localData,tmpReg);
  }
}
Program: 61573
Project: 61573
Buggy source:
@Override public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData,SourceGenerator generator) throws CompilationException {
  ActionSourceGenerator asGenerator=(ActionSourceGenerator)generator;
  int tmpReg=asGenerator.getTempRegister(localData);
  return toSourceMerge(localData,generator,name,value,new ActionStoreRegister(tmpReg),new ActionSetVariable(),new ActionPush(new RegisterNumber(tmpReg)));
}

Fixed version (ground truth):
@Override public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData,SourceGenerator generator) throws CompilationException {
  ActionSourceGenerator asGenerator=(ActionSourceGenerator)generator;
  int tmpReg=asGenerator.getTempRegister(localData);
  try {
    return toSourceMerge(localData,generator,name,value,new ActionStoreRegister(tmpReg),new ActionSetVariable(),new ActionPush(new RegisterNumber(tmpReg)));
  }
  finally {
    asGenerator.releaseTempRegister(localData,tmpReg);
  }
}
Program: 61577
Project: 61577
Buggy source:
@Override public int getPreferredWidth(int i,int i1){
  return 105;
}

Fixed version (ground truth):
@Override public int getPreferredWidth(int i,int i1){
  return width;
}
Program: 61578
Project: 61578
Buggy source:
private List<RibbonBandResizePolicy> getIconBandResizePolicies(JRibbonBand ribbonBand){
  List<RibbonBandResizePolicy> resizePolicies=new ArrayList<>();
  resizePolicies.add(new BaseRibbonBandResizePolicy<AbstractBandControlPanel>(ribbonBand.getControlPanel()){
    @Override public int getPreferredWidth(    int i,    int i1){
      return 105;
    }
    @Override public void install(    int i,    int i1){
    }
  }
);
  resizePolicies.add(new IconRibbonBandResizePolicy(ribbonBand.getControlPanel()));
  return resizePolicies;
}

Fixed version (ground truth):
private List<RibbonBandResizePolicy> getIconBandResizePolicies(JRibbonBand ribbonBand){
  List<RibbonBandResizePolicy> resizePolicies=new ArrayList<>();
  IconRibbonBandResizePolicy iconBandResizePolicy=new IconRibbonBandResizePolicy(ribbonBand.getControlPanel());
  final int width=Math.max(105,iconBandResizePolicy.getPreferredWidth(0,0));
  resizePolicies.add(new BaseRibbonBandResizePolicy<AbstractBandControlPanel>(ribbonBand.getControlPanel()){
    @Override public int getPreferredWidth(    int i,    int i1){
      return width;
    }
    @Override public void install(    int i,    int i1){
    }
  }
);
  resizePolicies.add(iconBandResizePolicy);
  return resizePolicies;
}
Program: 61581
Project: 61581
Buggy source:
@Override public Component getTreeCellRendererComponent(JTree tree,Object value,boolean sel,boolean expanded,boolean leaf,int row,boolean hasFocus){
  TreeItem val=(TreeItem)value;
  if (val.getSwf() == null) {
    value=null;
  }
  super.getTreeCellRendererComponent(tree,value,sel,expanded,leaf,row,hasFocus);
  TreeNodeType type=getTreeNodeType(val);
  if (type == TreeNodeType.FOLDER && expanded) {
    type=TreeNodeType.FOLDER_OPEN;
  }
  if ((type == TreeNodeType.FOLDER || type == TreeNodeType.FOLDER_OPEN) && val instanceof FolderItem) {
    FolderItem si=(FolderItem)val;
    if (!TagTreeRoot.FOLDER_ROOT.equals(si.getName())) {
      String itemName="String_Node_Str" + si.getName();
      setIcon(View.getIcon(itemName.toLowerCase() + "String_Node_Str"));
    }
  }
 else {
    setIcon(icons.get(type));
  }
  boolean isModified=val.isModified();
  if (isModified) {
    if (boldFont == null) {
      Font font=getFont();
      boldFont=font.deriveFont(Font.BOLD);
    }
  }
 else {
    if (plainFont == null) {
      Font font=getFont();
      plainFont=font.deriveFont(Font.PLAIN);
    }
  }
  setFont(isModified ? boldFont : plainFont);
  return this;
}

Fixed version (ground truth):
@Override public Component getTreeCellRendererComponent(JTree tree,Object value,boolean sel,boolean expanded,boolean leaf,int row,boolean hasFocus){
  TreeItem val=(TreeItem)value;
  if (!(val instanceof SWFList) && val.getSwf() == null) {
    value=null;
  }
  super.getTreeCellRendererComponent(tree,value,sel,expanded,leaf,row,hasFocus);
  TreeNodeType type=getTreeNodeType(val);
  if (type == TreeNodeType.FOLDER && expanded) {
    type=TreeNodeType.FOLDER_OPEN;
  }
  if ((type == TreeNodeType.FOLDER || type == TreeNodeType.FOLDER_OPEN) && val instanceof FolderItem) {
    FolderItem si=(FolderItem)val;
    if (!TagTreeRoot.FOLDER_ROOT.equals(si.getName())) {
      String itemName="String_Node_Str" + si.getName();
      setIcon(View.getIcon(itemName.toLowerCase() + "String_Node_Str"));
    }
  }
 else {
    setIcon(icons.get(type));
  }
  boolean isModified=val.isModified();
  if (isModified) {
    if (boldFont == null) {
      Font font=getFont();
      boldFont=font.deriveFont(Font.BOLD);
    }
  }
 else {
    if (plainFont == null) {
      Font font=getFont();
      plainFont=font.deriveFont(Font.PLAIN);
    }
  }
  setFont(isModified ? boldFont : plainFont);
  return this;
}
Program: 61582
Project: 61582
Buggy source:
public GraphTextWriter toString(Trait parent,String path,ABC abc,boolean isStatic,ScriptExportMode exportMode,boolean makePackages,int scriptIndex,int classIndex,GraphTextWriter writer,List<String> fullyQualifiedNames,boolean parallel) throws InterruptedException {
  for (int t=0; t < traits.size(); t++) {
    writer.newLine();
    Trait trait=traits.get(t);
    int h=t;
    if (classIndex != -1) {
      if (!isStatic) {
        h+=abc.class_info.get(classIndex).static_traits.traits.size();
      }
    }
    if (trait instanceof TraitClass) {
      writer.startClass(((TraitClass)trait).class_info);
    }
 else {
      writer.startTrait(h);
    }
    if (makePackages) {
      trait.toStringPackaged(parent,path,abc,isStatic,exportMode,scriptIndex,classIndex,writer,fullyQualifiedNames,parallel);
    }
 else {
      trait.toString(parent,path,abc,isStatic,exportMode,scriptIndex,classIndex,writer,fullyQualifiedNames,parallel);
    }
    if (trait instanceof TraitClass) {
      writer.endClass();
    }
 else {
      writer.endTrait();
    }
  }
  return writer;
}

Fixed version (ground truth):
public GraphTextWriter toString(Class[] traitTypes,Trait parent,String path,ABC abc,boolean isStatic,ScriptExportMode exportMode,boolean makePackages,int scriptIndex,int classIndex,GraphTextWriter writer,List<String> fullyQualifiedNames,boolean parallel) throws InterruptedException {
  for (int t=0; t < traits.size(); t++) {
    Trait trait=traits.get(t);
    if (traitTypes != null) {
      boolean found=false;
      for (      Class c : traitTypes) {
        if (c.isInstance(trait)) {
          found=true;
          break;
        }
      }
      if (!found) {
        continue;
      }
    }
    writer.newLine();
    int h=t;
    if (classIndex != -1) {
      if (!isStatic) {
        h+=abc.class_info.get(classIndex).static_traits.traits.size();
      }
    }
    if (trait instanceof TraitClass) {
      writer.startClass(((TraitClass)trait).class_info);
    }
 else {
      writer.startTrait(h);
    }
    if (makePackages) {
      trait.toStringPackaged(parent,path,abc,isStatic,exportMode,scriptIndex,classIndex,writer,fullyQualifiedNames,parallel);
    }
 else {
      trait.toString(parent,path,abc,isStatic,exportMode,scriptIndex,classIndex,writer,fullyQualifiedNames,parallel);
    }
    if (trait instanceof TraitClass) {
      writer.endClass();
    }
 else {
      writer.endTrait();
    }
  }
  return writer;
}
Program: 61583
Project: 61583
Buggy source:
public void gotoTrait(int traitId){
  if (traitId == -1) {
    return;
  }
  Highlighting tc=Highlighting.searchIndex(classHighlights,classIndex);
  if (tc != null) {
    Highlighting th=Highlighting.searchIndex(traitHighlights,traitId,tc.startPos,tc.startPos + tc.len);
    int pos;
    if (th != null) {
      ignoreCarret=true;
      int startPos=th.startPos + th.len - 1;
      if (startPos <= getDocument().getLength()) {
        setCaretPosition(startPos);
      }
      ignoreCarret=false;
      pos=th.startPos;
    }
 else {
      pos=tc.startPos;
    }
    final int fpos=pos;
    new Timer().schedule(new TimerTask(){
      @Override public void run(){
        if (fpos <= getDocument().getLength()) {
          setCaretPosition(fpos);
        }
      }
    }
,100);
  }
}

Fixed version (ground truth):
public void gotoTrait(int traitId){
  if (traitId == -1) {
    return;
  }
  Highlighting tc=Highlighting.searchIndex(classHighlights,classIndex);
  if (tc != null) {
    Highlighting th=Highlighting.searchIndex(traitHighlights,traitId,tc.startPos,tc.startPos + tc.len);
    int pos;
    if (th != null) {
      if (th.len > 1) {
        ignoreCarret=true;
        int startPos=th.startPos + th.len - 1;
        if (startPos <= getDocument().getLength()) {
          setCaretPosition(startPos);
        }
        ignoreCarret=false;
      }
      pos=th.startPos;
    }
 else {
      pos=tc.startPos;
    }
    final int fpos=pos;
    new Timer().schedule(new TimerTask(){
      @Override public void run(){
        if (fpos <= getDocument().getLength()) {
          setCaretPosition(fpos);
        }
      }
    }
,100);
  }
}
Program: 61586
Project: 61586
Buggy source:
public MainFrameRibbonMenu(MainFrameRibbon mainFrame,JRibbon ribbon,boolean externalFlashPlayerUnavailable){
  super(mainFrame);
  this.mainFrame=mainFrame;
  ribbon.addTask(createFileRibbonTask());
  ribbon.addTask(createToolsRibbonTask());
  ribbon.addTask(createSettingsRibbonTask(externalFlashPlayerUnavailable));
  ribbon.addTask(createHelpRibbonTask());
  if (Configuration.debugMode.get()) {
    ribbon.addTask(createDebugRibbonTask());
  }
  ribbon.setApplicationMenu(createMainMenu());
}

Fixed version (ground truth):
public MainFrameRibbonMenu(MainFrameRibbon mainFrame,JRibbon ribbon,boolean externalFlashPlayerUnavailable){
  super(mainFrame);
  this.mainFrame=mainFrame;
  ribbon.addTask(createFileRibbonTask());
  ribbon.addTask(createToolsRibbonTask());
  ribbon.addTask(createSettingsRibbonTask(externalFlashPlayerUnavailable));
  ribbon.addTask(createHelpRibbonTask());
  if (Configuration.showDebugMenu.get()) {
    ribbon.addTask(createDebugRibbonTask());
  }
  ribbon.setApplicationMenu(createMainMenu());
}
Program: 61588
Project: 61588
Buggy source:
private RibbonTask createDebugRibbonTask(){
  JRibbonBand debugBand=new JRibbonBand("String_Node_Str",null);
  debugBand.setResizePolicies(getResizePolicies(debugBand));
  JCommandButton removeNonScriptsCommandButton=new JCommandButton(fixCommandTitle("String_Node_Str"),View.getResizableIcon("String_Node_Str"));
  assignListener(removeNonScriptsCommandButton,ACTION_REMOVE_NON_SCRIPTS);
  JCommandButton refreshDecompiledCommandButton=new JCommandButton(fixCommandTitle("String_Node_Str"),View.getResizableIcon("String_Node_Str"));
  assignListener(refreshDecompiledCommandButton,ACTION_REFRESH_DECOMPILED);
  JCommandButton checkResourcesCommandButton=new JCommandButton(fixCommandTitle("String_Node_Str"),View.getResizableIcon("String_Node_Str"));
  assignListener(checkResourcesCommandButton,ACTION_CHECK_RESOURCES);
  debugBand.addCommandButton(removeNonScriptsCommandButton,RibbonElementPriority.MEDIUM);
  debugBand.addCommandButton(refreshDecompiledCommandButton,RibbonElementPriority.MEDIUM);
  debugBand.addCommandButton(checkResourcesCommandButton,RibbonElementPriority.MEDIUM);
  return new RibbonTask("String_Node_Str",debugBand);
}

Fixed version (ground truth):
private RibbonTask createDebugRibbonTask(){
  ResizableIcon icon=View.getResizableIcon("String_Node_Str");
  JRibbonBand debugBand=new JRibbonBand("String_Node_Str",null);
  debugBand.setResizePolicies(getResizePolicies(debugBand));
  JCommandButton removeNonScriptsCommandButton=new JCommandButton(fixCommandTitle("String_Node_Str"),icon);
  removeNonScriptsCommandButton.addActionListener(e -> removeNonScripts());
  JCommandButton refreshDecompiledCommandButton=new JCommandButton(fixCommandTitle("String_Node_Str"),icon);
  refreshDecompiledCommandButton.addActionListener(e -> refreshDecompiled());
  JCommandButton checkResourcesCommandButton=new JCommandButton(fixCommandTitle("String_Node_Str"),icon);
  checkResourcesCommandButton.addActionListener(e -> checkResources());
  JCommandButton callGcCommandButton=new JCommandButton(fixCommandTitle("String_Node_Str"),icon);
  callGcCommandButton.addActionListener(e -> System.gc());
  JCommandButton emptyCacheCommandButton=new JCommandButton(fixCommandTitle("String_Node_Str"),icon);
  emptyCacheCommandButton.addActionListener(e -> {
    SWF swf=mainFrame.getPanel().getCurrentSwf();
    if (swf != null) {
      swf.clearAllCache();
    }
  }
);
  debugBand.addCommandButton(removeNonScriptsCommandButton,RibbonElementPriority.MEDIUM);
  debugBand.addCommandButton(refreshDecompiledCommandButton,RibbonElementPriority.MEDIUM);
  debugBand.addCommandButton(checkResourcesCommandButton,RibbonElementPriority.MEDIUM);
  debugBand.addCommandButton(callGcCommandButton,RibbonElementPriority.MEDIUM);
  debugBand.addCommandButton(emptyCacheCommandButton,RibbonElementPriority.MEDIUM);
  return new RibbonTask("String_Node_Str",debugBand);
}
Program: 61591
Project: 61591
Buggy source:
public void closeTag(){
  if (modified && Configuration.autoSaveTagModifications.get()) {
    saveText();
  }
  textTag=null;
}

Fixed version (ground truth):
public void closeTag(){
  if (modified && Configuration.autoSaveTagModifications.get()) {
    saveText(false);
  }
  textTag=null;
}
Program: 61593
Project: 61593
Buggy source:
private void saveText(){
  if (mainPanel.saveText(textTag,textValue.getText(),null)) {
    setEditText(false);
    modified=false;
    textTag.getSwf().clearImageCache();
    mainPanel.refreshTree();
  }
}

Fixed version (ground truth):
private void saveText(boolean refresh){
  if (mainPanel.saveText(textTag,textValue.getText(),null)) {
    setEditText(false);
    modified=false;
    textTag.getSwf().clearImageCache();
    if (refresh) {
      mainPanel.refreshTree();
    }
  }
}
Program: 61594
Project: 61594
Buggy source:
public static SerializableImage frameToImageGet(Timeline timeline,int frame,int time,DepthState stateUnderCursor,int mouseButton,RECT displayRect,Matrix transformation,ColorTransform colorTransform,Color backGroundColor,boolean useCache,double zoom){
  String key="String_Node_Str" + frame + "String_Node_Str"+ timeline.id+ "String_Node_Str"+ timeline.swf.hashCode()+ "String_Node_Str"+ zoom;
  SerializableImage image;
  if (useCache) {
    image=getFromCache(key);
    if (image != null) {
      return image;
    }
  }
  if (timeline.getFrameCount() == 0) {
    return new SerializableImage(1,1,SerializableImage.TYPE_INT_ARGB);
  }
  RECT rect=displayRect;
  image=new SerializableImage((int)(rect.getWidth() * zoom / SWF.unitDivisor) + 1,(int)(rect.getHeight() * zoom / SWF.unitDivisor) + 1,SerializableImage.TYPE_INT_ARGB);
  if (backGroundColor == null) {
    image.fillTransparent();
  }
 else {
    Graphics2D g=(Graphics2D)image.getBufferedImage().getGraphics();
    g.setComposite(AlphaComposite.Src);
    g.setColor(backGroundColor);
    g.fill(new Rectangle(image.getWidth(),image.getHeight()));
  }
  Matrix m=transformation.clone();
  m.translate(-rect.Xmin,-rect.Ymin);
  m.scale(zoom);
  RenderContext renderContext=new RenderContext();
  renderContext.stateUnderCursor=stateUnderCursor;
  renderContext.mouseButton=mouseButton;
  frameToImage(timeline,frame,time,renderContext,image,m,colorTransform);
  if (useCache) {
    putToCache(key,image);
  }
  return image;
}

Fixed version (ground truth):
public static SerializableImage frameToImageGet(Timeline timeline,int frame,int time,DepthState stateUnderCursor,int mouseButton,RECT displayRect,Matrix transformation,ColorTransform colorTransform,Color backGroundColor,boolean useCache,double zoom){
  String key="String_Node_Str" + frame + "String_Node_Str"+ timeline.id+ "String_Node_Str"+ timeline.swf.hashCode()+ "String_Node_Str"+ zoom;
  SerializableImage image;
  if (useCache) {
    image=getFromCache(key);
    if (image != null) {
      return image;
    }
  }
  if (timeline.getFrameCount() == 0) {
    return new SerializableImage(1,1,SerializableImage.TYPE_INT_ARGB);
  }
  RECT rect=displayRect;
  image=new SerializableImage((int)(rect.getWidth() * zoom / SWF.unitDivisor) + 1,(int)(rect.getHeight() * zoom / SWF.unitDivisor) + 1,SerializableImage.TYPE_INT_ARGB);
  if (backGroundColor == null) {
    image.fillTransparent();
  }
 else {
    Graphics2D g=(Graphics2D)image.getBufferedImage().getGraphics();
    g.setComposite(AlphaComposite.Src);
    g.setColor(backGroundColor);
    g.fill(new Rectangle(image.getWidth(),image.getHeight()));
  }
  Matrix m=transformation.clone();
  m.translate(-rect.Xmin * zoom,-rect.Ymin * zoom);
  m.scale(zoom);
  RenderContext renderContext=new RenderContext();
  renderContext.stateUnderCursor=stateUnderCursor;
  renderContext.mouseButton=mouseButton;
  frameToImage(timeline,frame,time,renderContext,image,m,colorTransform);
  if (useCache) {
    putToCache(key,image);
  }
  return image;
}
Program: 61595
Project: 61595
Buggy source:
private List<TreeItem> searchTag(TreeItem obj,TreeItem parent,List<TreeItem> path){
  List<TreeItem> ret=null;
  int cnt=getChildCount(parent);
  for (int i=0; i < cnt; i++) {
    TreeItem n=getChild(parent,i);
    List<TreeItem> newPath=new ArrayList<>();
    newPath.addAll(path);
    newPath.add(n);
    if (n instanceof AS3ClassTreeItem) {
      AS3ClassTreeItem te=(AS3ClassTreeItem)n;
      if (obj.equals(te)) {
        return newPath;
      }
    }
    if (obj instanceof FolderItem && n instanceof FolderItem) {
      FolderItem nds=(FolderItem)n;
      FolderItem objs=(FolderItem)obj;
      if (objs.getName().equals(nds.getName())) {
        return newPath;
      }
    }
 else {
      if (obj.equals(n)) {
        return newPath;
      }
    }
    ret=searchTag(obj,n,newPath);
    if (ret != null) {
      return ret;
    }
  }
  return ret;
}

Fixed version (ground truth):
private List<TreeItem> searchTag(TreeItem obj,TreeItem parent,List<TreeItem> path){
  List<TreeItem> ret=null;
  int cnt=getChildCount(parent);
  for (int i=0; i < cnt; i++) {
    TreeItem n=getChild(parent,i);
    List<TreeItem> newPath=new ArrayList<>();
    newPath.addAll(path);
    newPath.add(n);
    if (n instanceof AS3ClassTreeItem) {
      AS3ClassTreeItem te=(AS3ClassTreeItem)n;
      if (obj.equals(te)) {
        return newPath;
      }
    }
    if (obj instanceof FolderItem && n instanceof FolderItem) {
      FolderItem nds=(FolderItem)n;
      FolderItem objs=(FolderItem)obj;
      if (objs.getName().equals(nds.getName())) {
        return newPath;
      }
    }
 else {
      TreeItem n2=n;
      if (n2 instanceof TagScript) {
        n2=((TagScript)n2).getTag();
      }
      if (obj.equals(n2)) {
        return newPath;
      }
    }
    ret=searchTag(obj,n,newPath);
    if (ret != null) {
      return ret;
    }
  }
  return ret;
}
Program: 61597
Project: 61597
Buggy source:
@Override public void lineStyle(double thickness,RGB color,boolean pixelHinting,String scaleMode,int startCaps,int endCaps,int joints,int miterLimit){
  finalizePath();
  thickness*=zoom / SWF.unitDivisor;
  path.setAttribute("String_Node_Str","String_Node_Str");
  path.setAttribute("String_Node_Str",color.toHexRGB());
  path.setAttribute("String_Node_Str",Double.toString(thickness == 0 ? 1 : thickness));
  if (color instanceof RGBA) {
    RGBA colorA=(RGBA)color;
    if (colorA.alpha != 255) {
      path.setAttribute("String_Node_Str",Float.toString(colorA.getAlphaFloat()));
    }
  }
switch (startCaps) {
case LINESTYLE2.NO_CAP:
    path.setAttribute("String_Node_Str","String_Node_Str");
  break;
case LINESTYLE2.SQUARE_CAP:
path.setAttribute("String_Node_Str","String_Node_Str");
break;
default :
path.setAttribute("String_Node_Str","String_Node_Str");
break;
}
switch (joints) {
case LINESTYLE2.BEVEL_JOIN:
path.setAttribute("String_Node_Str","String_Node_Str");
break;
case LINESTYLE2.ROUND_JOIN:
path.setAttribute("String_Node_Str","String_Node_Str");
break;
default :
path.setAttribute("String_Node_Str","String_Node_Str");
if (miterLimit >= 1 && miterLimit != 4) {
path.setAttribute("String_Node_Str",Integer.toString(miterLimit));
}
break;
}
}

Fixed version (ground truth):
@Override public void lineStyle(double thickness,RGB color,boolean pixelHinting,String scaleMode,int startCaps,int endCaps,int joints,int miterLimit){
  finalizePath();
  thickness*=zoom / SWF.unitDivisor;
  path.setAttribute("String_Node_Str","String_Node_Str");
  if (color != null) {
    path.setAttribute("String_Node_Str",color.toHexRGB());
  }
  path.setAttribute("String_Node_Str",Double.toString(thickness == 0 ? 1 : thickness));
  if (color instanceof RGBA) {
    RGBA colorA=(RGBA)color;
    if (colorA.alpha != 255) {
      path.setAttribute("String_Node_Str",Float.toString(colorA.getAlphaFloat()));
    }
  }
switch (startCaps) {
case LINESTYLE2.NO_CAP:
    path.setAttribute("String_Node_Str","String_Node_Str");
  break;
case LINESTYLE2.SQUARE_CAP:
path.setAttribute("String_Node_Str","String_Node_Str");
break;
default :
path.setAttribute("String_Node_Str","String_Node_Str");
break;
}
switch (joints) {
case LINESTYLE2.BEVEL_JOIN:
path.setAttribute("String_Node_Str","String_Node_Str");
break;
case LINESTYLE2.ROUND_JOIN:
path.setAttribute("String_Node_Str","String_Node_Str");
break;
default :
path.setAttribute("String_Node_Str","String_Node_Str");
if (miterLimit >= 1 && miterLimit != 4) {
path.setAttribute("String_Node_Str",Integer.toString(miterLimit));
}
break;
}
}
Program: 61598
Project: 61598
Buggy source:
@Override public String toString(){
  return name;
}

Fixed version (ground truth):
@Override public String toString(){
  if (isBundle) {
    return name;
  }
 else {
    return swfs.get(0).getFileTitle();
  }
}
Program: 61599
Project: 61599
Buggy source:
public void close(SWFList swfList){
  boolean modified=false;
  for (  SWF swf : swfList) {
    if (swf.isModified()) {
      modified=true;
    }
  }
  if (modified) {
    if (View.showConfirmDialog(this,translate("String_Node_Str").replace("String_Node_Str",swfList.name),translate("String_Node_Str"),JOptionPane.OK_CANCEL_OPTION,Configuration.showCloseConfirmation,JOptionPane.CANCEL_OPTION) == JOptionPane.CANCEL_OPTION) {
      return;
    }
  }
  swfs.remove(swfList);
  if (abcPanel != null) {
    for (    SWF swf : swfList) {
      if (abcPanel.swf == swf) {
        abcPanel.clearSwf();
      }
    }
  }
  if (actionPanel != null) {
    actionPanel.clearSource();
  }
  oldItem=null;
  previewPanel.clear();
  updateUi();
  refreshTree();
}

Fixed version (ground truth):
public void close(SWFList swfList){
  boolean modified=false;
  for (  SWF swf : swfList) {
    if (swf.isModified()) {
      modified=true;
    }
  }
  if (modified) {
    if (View.showConfirmDialog(this,translate("String_Node_Str").replace("String_Node_Str",swfList.toString()),translate("String_Node_Str"),JOptionPane.OK_CANCEL_OPTION,Configuration.showCloseConfirmation,JOptionPane.OK_OPTION) == JOptionPane.CANCEL_OPTION) {
      return;
    }
  }
  swfs.remove(swfList);
  if (abcPanel != null) {
    for (    SWF swf : swfList) {
      if (abcPanel.swf == swf) {
        abcPanel.clearSwf();
      }
    }
  }
  if (actionPanel != null) {
    actionPanel.clearSource();
  }
  oldItem=null;
  previewPanel.clear();
  updateUi();
  refreshTree();
}
Program: 61600
Project: 61600
Buggy source:
public void fixCharactersOrder(boolean checkAll){
  Set<Integer> addedCharacterIds=new HashSet<>();
  Set<CharacterTag> movedTags=new HashSet<>();
  for (int i=0; i < tags.size(); i++) {
    Tag tag=tags.get(i);
    if (checkAll || tag.isModified()) {
      Set<Integer> needed=new HashSet<>();
      tag.getNeededCharacters(needed);
      boolean moved=false;
      for (      Integer id : needed) {
        if (!addedCharacterIds.contains(id)) {
          CharacterTag neededCharacter=characters.get(id);
          if (neededCharacter == null) {
            continue;
          }
          if (movedTags.contains(neededCharacter)) {
            logger.log(Level.SEVERE,"String_Node_Str");
            return;
          }
          tags.remove(neededCharacter);
          tags.add(i,neededCharacter);
          movedTags.add(neededCharacter);
          moved=true;
        }
      }
      if (moved) {
        i--;
        continue;
      }
    }
    if (tag instanceof CharacterTag) {
      addedCharacterIds.add(((CharacterTag)tag).getCharacterId());
    }
  }
}

Fixed version (ground truth):
public void fixCharactersOrder(boolean checkAll){
  Set<Integer> addedCharacterIds=new HashSet<>();
  Set<CharacterTag> movedTags=new HashSet<>();
  for (int i=0; i < tags.size(); i++) {
    Tag tag=tags.get(i);
    if (checkAll || tag.isModified()) {
      Set<Integer> needed=new HashSet<>();
      tag.getNeededCharacters(needed);
      if (tag instanceof CharacterTag) {
        CharacterTag characterTag=(CharacterTag)tag;
        needed.remove(characterTag.getCharacterId());
      }
      boolean moved=false;
      for (      Integer id : needed) {
        if (!addedCharacterIds.contains(id)) {
          CharacterTag neededCharacter=characters.get(id);
          if (neededCharacter == null) {
            continue;
          }
          if (movedTags.contains(neededCharacter)) {
            logger.log(Level.SEVERE,"String_Node_Str");
            return;
          }
          tags.remove(neededCharacter);
          tags.add(i,neededCharacter);
          movedTags.add(neededCharacter);
          moved=true;
        }
      }
      if (moved) {
        i--;
        continue;
      }
    }
    if (tag instanceof CharacterTag) {
      addedCharacterIds.add(((CharacterTag)tag).getCharacterId());
    }
  }
}
Program: 61603
Project: 61603
Buggy source:
public void shiftGlyphIndices(int fontId,int startIndex){
  for (  Tag t : swf.tags) {
    List<TEXTRECORD> textRecords=null;
    if (t instanceof DefineTextTag) {
      textRecords=((DefineTextTag)t).textRecords;
    }
 else     if (t instanceof DefineText2Tag) {
      textRecords=((DefineText2Tag)t).textRecords;
    }
    if (textRecords != null) {
      int curFontId=0;
      for (      TEXTRECORD tr : textRecords) {
        if (tr.styleFlagsHasFont) {
          curFontId=tr.fontId;
        }
        if (curFontId != fontId) {
          continue;
        }
        for (        GLYPHENTRY en : tr.glyphEntries) {
          if (en == null) {
            continue;
          }
          if (en.glyphIndex >= startIndex) {
            en.glyphIndex++;
          }
        }
        t.setModified(true);
      }
    }
  }
}

Fixed version (ground truth):
protected void shiftGlyphIndices(int fontId,int startIndex){
  for (  Tag t : swf.tags) {
    List<TEXTRECORD> textRecords=null;
    if (t instanceof DefineTextTag) {
      textRecords=((DefineTextTag)t).textRecords;
    }
 else     if (t instanceof DefineText2Tag) {
      textRecords=((DefineText2Tag)t).textRecords;
    }
    if (textRecords != null) {
      int curFontId=0;
      for (      TEXTRECORD tr : textRecords) {
        if (tr.styleFlagsHasFont) {
          curFontId=tr.fontId;
        }
        if (curFontId != fontId) {
          continue;
        }
        for (        GLYPHENTRY en : tr.glyphEntries) {
          if (en == null) {
            continue;
          }
          if (en.glyphIndex >= startIndex) {
            en.glyphIndex++;
          }
        }
        t.setModified(true);
      }
    }
  }
}
Program: 61604
Project: 61604
Buggy source:
public int typeName(SourceGeneratorLocalData localData,GraphTargetItem type) throws CompilationException {
  if (type instanceof UnboundedTypeItem) {
    return 0;
  }
  return resolveType(localData,type,abc,allABCs);
}

Fixed version (ground truth):
public int typeName(SourceGeneratorLocalData localData,GraphTargetItem type) throws CompilationException {
  if (type instanceof UnboundedTypeItem) {
    return 0;
  }
  if (("String_Node_Str" + type).equals("String_Node_Str")) {
    return 0;
  }
  return resolveType(localData,type,abc,allABCs);
}
Program: 61611
Project: 61611
Buggy source:
@Override public void actionListParsed(ActionList actions,SWF swf){
  removeObfuscationIfs(actions);
}

Fixed version (ground truth):
@Override public void actionListParsed(ActionList actions,SWF swf){
  removeGetTimes(actions);
  removeObfuscationIfs(actions);
}
Program: 61614
Project: 61614
Buggy source:
@Override public Set<Entry<K,V>> entrySet(){
  if (deleted) {
    throw new NullPointerException();
  }
  Set<Entry<K,V>> ret=new HashSet<Entry<K,V>>();
  for (  K key : keySet()) {
    ret.add(new FileEntry<K,V>(this,key));
  }
  return ret;
}

Fixed version (ground truth):
@Override public Set<Entry<K,V>> entrySet(){
  if (deleted) {
    throw new NullPointerException();
  }
  Set<Entry<K,V>> ret=new HashSet<>();
  for (  K key : keySet()) {
    ret.add(new FileEntry<>(this,key));
  }
  return ret;
}
Program: 61615
Project: 61615
Buggy source:
public void fixCharactersOrder(boolean checkAll){
  Set<Integer> addedCharacterIds=new HashSet<>();
  Set<CharacterTag> movedTags=new HashSet<>();
  for (int i=0; i < tags.size(); i++) {
    Tag tag=tags.get(i);
    if (checkAll || tag.isModified()) {
      Set<Integer> needed=new HashSet<>();
      tag.getNeededCharacters(needed);
      boolean moved=false;
      for (      Integer id : needed) {
        if (!addedCharacterIds.contains(id)) {
          CharacterTag neededCharacter=characters.get(id);
          if (movedTags.contains(neededCharacter)) {
            logger.log(Level.SEVERE,"String_Node_Str");
            return;
          }
          tags.remove(neededCharacter);
          tags.add(i,neededCharacter);
          movedTags.add(neededCharacter);
          moved=true;
        }
      }
      if (moved) {
        i--;
        continue;
      }
    }
    if (tag instanceof CharacterTag) {
      addedCharacterIds.add(((CharacterTag)tag).getCharacterId());
    }
  }
}

Fixed version (ground truth):
public void fixCharactersOrder(boolean checkAll){
  Set<Integer> addedCharacterIds=new HashSet<>();
  Set<CharacterTag> movedTags=new HashSet<>();
  for (int i=0; i < tags.size(); i++) {
    Tag tag=tags.get(i);
    if (checkAll || tag.isModified()) {
      Set<Integer> needed=new HashSet<>();
      tag.getNeededCharacters(needed);
      boolean moved=false;
      for (      Integer id : needed) {
        if (!addedCharacterIds.contains(id)) {
          CharacterTag neededCharacter=characters.get(id);
          if (neededCharacter == null) {
            continue;
          }
          if (movedTags.contains(neededCharacter)) {
            logger.log(Level.SEVERE,"String_Node_Str");
            return;
          }
          tags.remove(neededCharacter);
          tags.add(i,neededCharacter);
          movedTags.add(neededCharacter);
          moved=true;
        }
      }
      if (moved) {
        i--;
        continue;
      }
    }
    if (tag instanceof CharacterTag) {
      addedCharacterIds.add(((CharacterTag)tag).getCharacterId());
    }
  }
}
Program: 61618
Project: 61618
Buggy source:
public AVM2Item(GraphSourceItem instruction,int precedence){
  super(instruction,precedence);
}

Fixed version (ground truth):
public AVM2Item(GraphSourceItem instruction,int precedence){
  super(instruction,precedence);
  if (instruction instanceof AVM2Instruction) {
    this.instruction=(AVM2Instruction)instruction;
  }
}
Program: 61619
Project: 61619
Buggy source:
@Override public GraphTextWriter appendTo(GraphTextWriter writer,LocalData localData){
  if (slotName == null) {
    return writer.append("String_Node_Str");
  }
  srcData.put("String_Node_Str",slotName.getName(localData.constantsAvm2,localData.fullyQualifiedNames,false));
  return writer.append(slotName.getName(localData.constantsAvm2,localData.fullyQualifiedNames,false));
}

Fixed version (ground truth):
@Override public GraphTextWriter appendTo(GraphTextWriter writer,LocalData localData){
  if (slotName == null) {
    return writer.append("String_Node_Str");
  }
  srcData.put("String_Node_Str",getNameAsStr(localData));
  return writer.append(slotName.getName(localData.constantsAvm2,localData.fullyQualifiedNames,false));
}
Program: 61624
Project: 61624
Buggy source:
@Override public FileTextWriter hilightSpecial(String text,String type,int index){
  writeToFile(text);
  return this;
}

Fixed version (ground truth):
@Override public GraphTextWriter hilightSpecial(String text,String type,int index,Map<String,String> data){
  writeToFile(text);
  return this;
}
Program: 61625
Project: 61625
Buggy source:
@Override public void addCharacter(char character,Font cfont){
  int fontStyle=getFontStyle();
  FontType font=fonts.get(0);
  double d=1;
  SHAPE shp=SHAPERECORD.fontCharacterToSHAPE(cfont,fontStyle,(int)(SWF.unitDivisor * font.nominalSize * d),character);
  int code=(int)character;
  int pos=-1;
  boolean exists=false;
  for (int i=0; i < font.glyphInfo.size(); i++) {
    if (font.glyphInfo.get(i).glyphCode >= code) {
      if (font.glyphInfo.get(i).glyphCode == code) {
        exists=true;
      }
      pos=i;
      break;
    }
  }
  if (pos == -1) {
    pos=font.glyphInfo.size();
  }
  if (!exists) {
    shiftGlyphIndices(fontId,pos);
  }
  Font fnt=cfont.deriveFont(fontStyle,Math.round(font.nominalSize * d));
  int advance=(int)Math.round(fnt.createGlyphVector((new JPanel()).getFontMetrics(fnt).getFontRenderContext(),"String_Node_Str" + character).getGlyphMetrics(0).getAdvanceX());
  if (!exists) {
    font.glyphInfo.add(pos,new GlyphInfoType(code,advance,0));
    font.glyphs.add(pos,new GlyphType(shp.shapeRecords));
    shapeCache.add(pos,font.glyphs.get(pos).toSHAPE());
  }
 else {
    font.glyphInfo.set(pos,new GlyphInfoType(code,advance,0));
    font.glyphs.set(pos,new GlyphType(shp.shapeRecords));
    shapeCache.set(pos,font.glyphs.get(pos).toSHAPE());
  }
  setModified(true);
  SWF.clearImageCache();
}

Fixed version (ground truth):
@Override public void addCharacter(char character,Font cfont){
  int fontStyle=getFontStyle();
  FontType font=fonts.get(0);
  double d=1;
  SHAPE shp=SHAPERECORD.fontCharacterToSHAPE(cfont,fontStyle,(int)(font.nominalSize * d),character);
  int code=(int)character;
  int pos=-1;
  boolean exists=false;
  for (int i=0; i < font.glyphInfo.size(); i++) {
    if (font.glyphInfo.get(i).glyphCode >= code) {
      if (font.glyphInfo.get(i).glyphCode == code) {
        exists=true;
      }
      pos=i;
      break;
    }
  }
  if (pos == -1) {
    pos=font.glyphInfo.size();
  }
  if (!exists) {
    shiftGlyphIndices(fontId,pos);
  }
  Font fnt=cfont.deriveFont(fontStyle,Math.round(font.nominalSize * d));
  int advance=(int)Math.round(fnt.createGlyphVector((new JPanel()).getFontMetrics(fnt).getFontRenderContext(),"String_Node_Str" + character).getGlyphMetrics(0).getAdvanceX());
  if (!exists) {
    font.glyphInfo.add(pos,new GlyphInfoType(code,advance,0));
    font.glyphs.add(pos,new GlyphType(shp.shapeRecords));
    shapeCache.add(pos,font.glyphs.get(pos).toSHAPE());
  }
 else {
    font.glyphInfo.set(pos,new GlyphInfoType(code,advance,0));
    font.glyphs.set(pos,new GlyphType(shp.shapeRecords));
    shapeCache.set(pos,font.glyphs.get(pos).toSHAPE());
  }
  setModified(true);
  SWF.clearImageCache();
}
Program: 61626
Project: 61626
Buggy source:
public ContourType(GFxInputStream sis) throws IOException {
  moveToX=sis.readSI15("String_Node_Str");
  moveToY=sis.readSI15("String_Node_Str");
  long numEdgesRef=sis.readUI30("String_Node_Str");
  isReference=(numEdgesRef & 1) == 1;
  numEdgesRef>>=1;
  long oldPos=sis.getPos();
  if (isReference) {
    sis.setPos(numEdgesRef);
    numEdgesRef=sis.readUI30("String_Node_Str");
    numEdgesRef>>=1;
  }
  edges=new EdgeType[(int)numEdgesRef];
  for (int i=0; i < edges.length; i++) {
    sis.newDumpLevel("String_Node_Str","String_Node_Str");
    edges[i]=new EdgeType(sis);
    sis.endDumpLevel();
  }
  if (isReference) {
    sis.setPos(oldPos);
  }
}

Fixed version (ground truth):
public ContourType(GFxInputStream sis,long fontOffset) throws IOException {
  moveToX=sis.readSI15("String_Node_Str");
  moveToY=sis.readSI15("String_Node_Str");
  long numEdgesRef=sis.readUI30("String_Node_Str");
  isReference=(numEdgesRef & 1) == 1;
  numEdgesRef>>=1;
  long oldPos=sis.getPos();
  int numEdges;
  if (isReference) {
    long referencePos=numEdgesRef;
    sis.setPos(fontOffset + referencePos);
    numEdges=(int)(sis.readUI30("String_Node_Str") >> 1);
  }
 else {
    numEdges=(int)numEdgesRef;
  }
  edges=new EdgeType[(int)numEdges];
  for (int i=0; i < edges.length; i++) {
    sis.newDumpLevel("String_Node_Str","String_Node_Str");
    edges[i]=new EdgeType(sis);
    sis.endDumpLevel();
  }
  if (isReference) {
    sis.setPos(oldPos);
  }
}
Program: 61627
Project: 61627
Buggy source:
public FontType(GFxInputStream sis) throws IOException {
  long offset=sis.getPos();
  fontName=sis.readString("String_Node_Str");
  flags=sis.readUI16("String_Node_Str");
  nominalSize=sis.readUI16("String_Node_Str");
  ascent=sis.readSI16("String_Node_Str");
  descent=sis.readSI16("String_Node_Str");
  leading=sis.readSI16("String_Node_Str");
  long numGlyphs=sis.readUI32("String_Node_Str");
  long glyphBytesLen=sis.readUI32("String_Node_Str");
  byte glyphBytes[]=new byte[(int)glyphBytesLen];
  sis.read(glyphBytes);
  glyphInfo=new ArrayList<>();
  for (int i=0; i < numGlyphs; i++) {
    sis.newDumpLevel("String_Node_Str","String_Node_Str");
    glyphInfo.add(new GlyphInfoType(sis));
    sis.endDumpLevel();
  }
  long kerningTableSize=sis.readUI30("String_Node_Str");
  kerning=new ArrayList<>();
  for (int i=0; i < kerningTableSize; i++) {
    sis.newDumpLevel("String_Node_Str","String_Node_Str");
    kerning.add(new KerningPairType(sis));
    sis.endDumpLevel();
  }
  long pos=sis.getPos();
  glyphs=new ArrayList<>();
  for (int i=0; i < glyphInfo.size(); i++) {
    sis.setPos(glyphInfo.get(i).globalOffset + offset);
    sis.newDumpLevel("String_Node_Str","String_Node_Str");
    glyphs.add(new GlyphType(sis));
    sis.endDumpLevel();
  }
  sis.setPos(pos);
}

Fixed version (ground truth):
public FontType(GFxInputStream sis) throws IOException {
  long offset=sis.getPos();
  fontName=sis.readString("String_Node_Str");
  flags=sis.readUI16("String_Node_Str");
  nominalSize=sis.readUI16("String_Node_Str");
  ascent=sis.readSI16("String_Node_Str");
  descent=sis.readSI16("String_Node_Str");
  leading=sis.readSI16("String_Node_Str");
  long numGlyphs=sis.readUI32("String_Node_Str");
  long glyphBytesLen=sis.readUI32("String_Node_Str");
  byte glyphBytes[]=new byte[(int)glyphBytesLen];
  sis.read(glyphBytes);
  glyphInfo=new ArrayList<>();
  for (int i=0; i < numGlyphs; i++) {
    sis.newDumpLevel("String_Node_Str","String_Node_Str");
    glyphInfo.add(new GlyphInfoType(sis));
    sis.endDumpLevel();
  }
  long kerningTableSize=sis.readUI30("String_Node_Str");
  kerning=new ArrayList<>();
  for (int i=0; i < kerningTableSize; i++) {
    sis.newDumpLevel("String_Node_Str","String_Node_Str");
    kerning.add(new KerningPairType(sis));
    sis.endDumpLevel();
  }
  long pos=sis.getPos();
  glyphs=new ArrayList<>();
  for (int i=0; i < glyphInfo.size(); i++) {
    sis.setPos(glyphInfo.get(i).globalOffset + offset);
    sis.newDumpLevel("String_Node_Str","String_Node_Str");
    glyphs.add(new GlyphType(sis,offset));
    sis.endDumpLevel();
  }
  sis.setPos(pos);
}