Program: 61658
Project: 61658
Buggy source:
private List<TreeNode> createTagList(List<Tag> list,SWF swf,SWFNode swfNode,ClassesListTreeModel classTreeModel){
  boolean hasAbc=swf.abcList != null && !swf.abcList.isEmpty();
  List<TreeNode> ret=new ArrayList<>();
  List<TreeNode> frames=new ArrayList<>();
  List<TreeNode> shapes=new ArrayList<>();
  List<TreeNode> morphShapes=new ArrayList<>();
  List<TreeNode> sprites=new ArrayList<>();
  List<TreeNode> buttons=new ArrayList<>();
  List<TreeNode> images=new ArrayList<>();
  List<TreeNode> fonts=new ArrayList<>();
  List<TreeNode> texts=new ArrayList<>();
  List<TreeNode> movies=new ArrayList<>();
  List<TreeNode> sounds=new ArrayList<>();
  List<TreeNode> binaryData=new ArrayList<>();
  List<TreeNode> others=new ArrayList<>();
  List<TreeNode> actionScript=SWF.createASTagList(list,swf);
  List<Tag> actionScriptTags=new ArrayList<>();
  SWF.getTagsFromTreeNodes(actionScript,actionScriptTags);
  for (  Tag t : list) {
    TreeNodeType ttype=TagTree.getTreeNodeType(t);
switch (ttype) {
case SHAPE:
      shapes.add(new TagNode(t));
    break;
case MORPH_SHAPE:
  morphShapes.add(new TagNode(t));
break;
case SPRITE:
sprites.add(new TagNode(t));
break;
case BUTTON:
buttons.add(new TagNode(t));
break;
case IMAGE:
images.add(new TagNode(t));
break;
case FONT:
fonts.add(new TagNode(t));
break;
case TEXT:
texts.add(new TagNode(t));
break;
case MOVIE:
movies.add(new TagNode(t));
break;
case SOUND:
sounds.add(new TagNode(t));
break;
case BINARY_DATA:
TagNode bt;
binaryData.add(bt=new TagNode(t));
break;
default :
if (!actionScriptTags.contains(t) && t.getId() != ShowFrameTag.ID && !ShowFrameTag.isNestedTagType(t.getId())) {
others.add(new TagNode(t));
}
break;
}
}
Timeline timeline=swf.getTimeline();
for (int i=0; i < timeline.getFrameCount(); i++) {
frames.add(new FrameNode(new FrameNodeItem(swf,i + 1,swf,true),timeline.frames.get(i).innerTags,false));
}
for (int i=0; i < sounds.size(); i++) {
if (sounds.get(i).getItem() instanceof SoundStreamHeadTypeTag) {
List<SoundStreamBlockTag> blocks=((SoundStreamHeadTypeTag)sounds.get(i).getItem()).getBlocks();
if (blocks.isEmpty()) {
sounds.remove(i);
i--;
}
}
}
for (TreeNode n : sprites) {
Timelined timelined=n.getItem() instanceof Timelined ? (Timelined)n.getItem() : null;
n.subNodes=createSubTagList(((DefineSpriteTag)n.getItem()).subTags,timelined,swf,actionScriptTags);
}
StringNode textsNode=new StringNode(new StringItem(translate("String_Node_Str"),FOLDER_TEXTS,swf));
textsNode.subNodes.addAll(texts);
StringNode imagesNode=new StringNode(new StringItem(translate("String_Node_Str"),FOLDER_IMAGES,swf));
imagesNode.subNodes.addAll(images);
StringNode moviesNode=new StringNode(new StringItem(translate("String_Node_Str"),FOLDER_MOVIES,swf));
moviesNode.subNodes.addAll(movies);
StringNode soundsNode=new StringNode(new StringItem(translate("String_Node_Str"),FOLDER_SOUNDS,swf));
soundsNode.subNodes.addAll(sounds);
StringNode binaryDataNode=new StringNode(new StringItem(translate("String_Node_Str"),FOLDER_BINARY_DATA,swf));
binaryDataNode.subNodes.addAll(binaryData);
StringNode fontsNode=new StringNode(new StringItem(translate("String_Node_Str"),FOLDER_FONTS,swf));
fontsNode.subNodes.addAll(fonts);
StringNode spritesNode=new StringNode(new StringItem(translate("String_Node_Str"),FOLDER_SPRITES,swf));
spritesNode.subNodes.addAll(sprites);
StringNode shapesNode=new StringNode(new StringItem(translate("String_Node_Str"),FOLDER_SHAPES,swf));
shapesNode.subNodes.addAll(shapes);
StringNode morphShapesNode=new StringNode(new StringItem(translate("String_Node_Str"),FOLDER_MORPHSHAPES,swf));
morphShapesNode.subNodes.addAll(morphShapes);
StringNode buttonsNode=new StringNode(new StringItem(translate("String_Node_Str"),FOLDER_BUTTONS,swf));
buttonsNode.subNodes.addAll(buttons);
StringNode framesNode=new StringNode(new StringItem(translate("String_Node_Str"),FOLDER_FRAMES,swf));
framesNode.subNodes.addAll(frames);
StringNode otherNode=new StringNode(new StringItem(translate("String_Node_Str"),FOLDER_OTHERS,swf));
otherNode.subNodes.addAll(others);
TreeNode actionScriptNode;
if (hasAbc) {
actionScriptNode=new ClassesListNode(classTreeModel);
}
 else {
actionScriptNode=new StringNode(new StringItem(translate("String_Node_Str"),FOLDER_SCRIPTS,swf));
actionScriptNode.subNodes.addAll(actionScript);
}
swfNode.scriptsNode=actionScriptNode;
ret.add(new HeaderNode(new HeaderItem(swf,AppStrings.translate("String_Node_Str"))));
if (!shapesNode.subNodes.isEmpty()) {
ret.add(shapesNode);
}
if (!morphShapesNode.subNodes.isEmpty()) {
ret.add(morphShapesNode);
}
if (!spritesNode.subNodes.isEmpty()) {
ret.add(spritesNode);
}
if (!textsNode.subNodes.isEmpty()) {
ret.add(textsNode);
}
if (!imagesNode.subNodes.isEmpty()) {
ret.add(imagesNode);
}
if (!moviesNode.subNodes.isEmpty()) {
ret.add(moviesNode);
}
if (!soundsNode.subNodes.isEmpty()) {
ret.add(soundsNode);
}
if (!buttonsNode.subNodes.isEmpty()) {
ret.add(buttonsNode);
}
if (!fontsNode.subNodes.isEmpty()) {
ret.add(fontsNode);
}
if (!binaryDataNode.subNodes.isEmpty()) {
ret.add(binaryDataNode);
}
if (!framesNode.subNodes.isEmpty()) {
ret.add(framesNode);
}
if (!otherNode.subNodes.isEmpty()) {
ret.add(otherNode);
}
if ((!actionScriptNode.subNodes.isEmpty()) || hasAbc) {
ret.add(actionScriptNode);
}
return ret;
}

Fixed version (ground truth):
private List<TreeNode> createTagList(List<Tag> list,SWF swf,SWFNode swfNode,ClassesListTreeModel classTreeModel){
  boolean hasAbc=swf.abcList != null && !swf.abcList.isEmpty();
  List<TreeNode> ret=new ArrayList<>();
  List<TreeNode> frames=new ArrayList<>();
  List<TreeNode> shapes=new ArrayList<>();
  List<TreeNode> morphShapes=new ArrayList<>();
  List<TreeNode> sprites=new ArrayList<>();
  List<TreeNode> buttons=new ArrayList<>();
  List<TreeNode> images=new ArrayList<>();
  List<TreeNode> fonts=new ArrayList<>();
  List<TreeNode> texts=new ArrayList<>();
  List<TreeNode> movies=new ArrayList<>();
  List<TreeNode> sounds=new ArrayList<>();
  List<TreeNode> binaryData=new ArrayList<>();
  List<TreeNode> others=new ArrayList<>();
  List<TreeNode> actionScript=SWF.createASTagList(list,swf);
  List<Tag> actionScriptTags=new ArrayList<>();
  SWF.getTagsFromTreeNodes(actionScript,actionScriptTags);
  for (  Tag t : list) {
    TreeNodeType ttype=TagTree.getTreeNodeType(t);
switch (ttype) {
case SHAPE:
      shapes.add(new TagNode(t));
    break;
case MORPH_SHAPE:
  morphShapes.add(new TagNode(t));
break;
case SPRITE:
sprites.add(new TagNode(t));
sounds.addAll(getSoundStreams((DefineSpriteTag)t));
break;
case BUTTON:
buttons.add(new TagNode(t));
break;
case IMAGE:
images.add(new TagNode(t));
break;
case FONT:
fonts.add(new TagNode(t));
break;
case TEXT:
texts.add(new TagNode(t));
break;
case MOVIE:
movies.add(new TagNode(t));
break;
case SOUND:
sounds.add(new TagNode(t));
break;
case BINARY_DATA:
TagNode bt;
binaryData.add(bt=new TagNode(t));
break;
default :
if (!actionScriptTags.contains(t) && t.getId() != ShowFrameTag.ID && !ShowFrameTag.isNestedTagType(t.getId())) {
others.add(new TagNode(t));
}
break;
}
}
Timeline timeline=swf.getTimeline();
for (int i=0; i < timeline.getFrameCount(); i++) {
frames.add(new FrameNode(new FrameNodeItem(swf,i + 1,swf,true),timeline.frames.get(i).innerTags,false));
}
for (int i=0; i < sounds.size(); i++) {
if (sounds.get(i).getItem() instanceof SoundStreamHeadTypeTag) {
List<SoundStreamBlockTag> blocks=((SoundStreamHeadTypeTag)sounds.get(i).getItem()).getBlocks();
if (blocks.isEmpty()) {
sounds.remove(i);
i--;
}
}
}
for (TreeNode n : sprites) {
Timelined timelined=n.getItem() instanceof Timelined ? (Timelined)n.getItem() : null;
n.subNodes=createSubTagList(((DefineSpriteTag)n.getItem()).subTags,timelined,swf,actionScriptTags);
}
StringNode textsNode=new StringNode(new StringItem(translate("String_Node_Str"),FOLDER_TEXTS,swf));
textsNode.subNodes.addAll(texts);
StringNode imagesNode=new StringNode(new StringItem(translate("String_Node_Str"),FOLDER_IMAGES,swf));
imagesNode.subNodes.addAll(images);
StringNode moviesNode=new StringNode(new StringItem(translate("String_Node_Str"),FOLDER_MOVIES,swf));
moviesNode.subNodes.addAll(movies);
StringNode soundsNode=new StringNode(new StringItem(translate("String_Node_Str"),FOLDER_SOUNDS,swf));
soundsNode.subNodes.addAll(sounds);
StringNode binaryDataNode=new StringNode(new StringItem(translate("String_Node_Str"),FOLDER_BINARY_DATA,swf));
binaryDataNode.subNodes.addAll(binaryData);
StringNode fontsNode=new StringNode(new StringItem(translate("String_Node_Str"),FOLDER_FONTS,swf));
fontsNode.subNodes.addAll(fonts);
StringNode spritesNode=new StringNode(new StringItem(translate("String_Node_Str"),FOLDER_SPRITES,swf));
spritesNode.subNodes.addAll(sprites);
StringNode shapesNode=new StringNode(new StringItem(translate("String_Node_Str"),FOLDER_SHAPES,swf));
shapesNode.subNodes.addAll(shapes);
StringNode morphShapesNode=new StringNode(new StringItem(translate("String_Node_Str"),FOLDER_MORPHSHAPES,swf));
morphShapesNode.subNodes.addAll(morphShapes);
StringNode buttonsNode=new StringNode(new StringItem(translate("String_Node_Str"),FOLDER_BUTTONS,swf));
buttonsNode.subNodes.addAll(buttons);
StringNode framesNode=new StringNode(new StringItem(translate("String_Node_Str"),FOLDER_FRAMES,swf));
framesNode.subNodes.addAll(frames);
StringNode otherNode=new StringNode(new StringItem(translate("String_Node_Str"),FOLDER_OTHERS,swf));
otherNode.subNodes.addAll(others);
TreeNode actionScriptNode;
if (hasAbc) {
actionScriptNode=new ClassesListNode(classTreeModel);
}
 else {
actionScriptNode=new StringNode(new StringItem(translate("String_Node_Str"),FOLDER_SCRIPTS,swf));
actionScriptNode.subNodes.addAll(actionScript);
}
swfNode.scriptsNode=actionScriptNode;
ret.add(new HeaderNode(new HeaderItem(swf,AppStrings.translate("String_Node_Str"))));
if (!shapesNode.subNodes.isEmpty()) {
ret.add(shapesNode);
}
if (!morphShapesNode.subNodes.isEmpty()) {
ret.add(morphShapesNode);
}
if (!spritesNode.subNodes.isEmpty()) {
ret.add(spritesNode);
}
if (!textsNode.subNodes.isEmpty()) {
ret.add(textsNode);
}
if (!imagesNode.subNodes.isEmpty()) {
ret.add(imagesNode);
}
if (!moviesNode.subNodes.isEmpty()) {
ret.add(moviesNode);
}
if (!soundsNode.subNodes.isEmpty()) {
ret.add(soundsNode);
}
if (!buttonsNode.subNodes.isEmpty()) {
ret.add(buttonsNode);
}
if (!fontsNode.subNodes.isEmpty()) {
ret.add(fontsNode);
}
if (!binaryDataNode.subNodes.isEmpty()) {
ret.add(binaryDataNode);
}
if (!framesNode.subNodes.isEmpty()) {
ret.add(framesNode);
}
if (!otherNode.subNodes.isEmpty()) {
ret.add(otherNode);
}
if ((!actionScriptNode.subNodes.isEmpty()) || hasAbc) {
ret.add(actionScriptNode);
}
return ret;
}