Program: 62184
Project: 62184
Buggy source:
@Override public String convert(String path,List<ABCContainerTag> abcTags,ABC abc,boolean isStatic,boolean pcode,int scriptIndex,int classIndex,boolean highlight,List<String> fullyQualifiedNames){
  if (!highlight) {
    Highlighting.doHighlight=false;
  }
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  PrintStream out=null;
  try {
    out=new PrintStream(baos,true,"String_Node_Str");
  }
 catch (  UnsupportedEncodingException ex) {
    Logger.getLogger(TraitClass.class.getName()).log(Level.SEVERE,null,ex);
    return "String_Node_Str";
  }
  String packageName=abc.instance_info[class_info].getName(abc.constants).getNamespace(abc.constants).getName(abc.constants);
  if (debugMode) {
    System.err.println("String_Node_Str" + packageName + "String_Node_Str"+ abc.instance_info[class_info].getName(abc.constants).getName(abc.constants,fullyQualifiedNames));
  }
  List<String> namesInThisPackage=new ArrayList<String>();
  for (  ABCContainerTag tag : abcTags) {
    for (    ScriptInfo si : tag.getABC().script_info) {
      for (      Trait t : si.traits.traits) {
        String spath=t.getPath(tag.getABC());
        String pkg="String_Node_Str";
        String name=spath;
        if (spath.contains("String_Node_Str")) {
          pkg=spath.substring(0,spath.lastIndexOf("String_Node_Str"));
          name=spath.substring(spath.lastIndexOf("String_Node_Str") + 1);
        }
        if (pkg.equals(packageName)) {
          namesInThisPackage.add(name);
        }
      }
    }
  }
  List<String> imports=new ArrayList<String>();
  List<String> uses=new ArrayList<String>();
  getImportsUsages(abcTags,abc,imports,uses,new ArrayList<String>());
  fullyQualifiedNames=new ArrayList<String>();
  List<String> importnames=new ArrayList<String>();
  importnames.addAll(namesInThisPackage);
  for (  String ipath : imports) {
    String name=ipath;
    String pkg="String_Node_Str";
    if (name.contains("String_Node_Str")) {
      pkg=name.substring(0,name.lastIndexOf("String_Node_Str"));
      name=name.substring(name.lastIndexOf("String_Node_Str") + 1);
    }
    if (importnames.contains(name) || ((!pkg.equals("String_Node_Str")) && isBuiltInClass(name))) {
      fullyQualifiedNames.add(name);
    }
 else {
      importnames.add(name);
    }
  }
  for (  String imp : imports) {
    if (!imp.startsWith("String_Node_Str")) {
      out.println(ABC.IDENT_STRING + "String_Node_Str" + imp+ "String_Node_Str");
    }
  }
  out.println();
  for (  String us : uses) {
    out.println(ABC.IDENT_STRING + "String_Node_Str" + us+ "String_Node_Str");
  }
  out.println();
  String classHeader=abc.instance_info[class_info].getClassHeaderStr(abc,fullyQualifiedNames);
  if (classHeader.startsWith("String_Node_Str")) {
    classHeader=classHeader.substring("String_Node_Str".length());
  }
  out.println(ABC.IDENT_STRING + classHeader);
  out.println(ABC.IDENT_STRING + "String_Node_Str");
  String toPrint;
  List<String> outTraits=new LinkedList<String>();
  int bodyIndex;
  String bodyStr="String_Node_Str";
  bodyIndex=abc.findBodyIndex(abc.class_info[class_info].cinit_index);
  if (bodyIndex != -1) {
    if (Main.DO_DECOMPILE) {
      bodyStr=abc.bodies[bodyIndex].toString(packageName + "String_Node_Str" + abc.instance_info[class_info].getName(abc.constants).getName(abc.constants,fullyQualifiedNames)+ "String_Node_Str",pcode,true,scriptIndex,class_info,abc,abc.constants,abc.method_info,new Stack<GraphTargetItem>(),true,highlight,fullyQualifiedNames,abc.class_info[class_info].static_traits);
    }
  }
  if (Highlighting.stripHilights(bodyStr).equals("String_Node_Str")) {
    toPrint=ABC.addTabs(bodyStr,3);
  }
 else {
    toPrint=ABC.IDENT_STRING + ABC.IDENT_STRING + "String_Node_Str"+ ABC.addTabs(bodyStr,3)+ "String_Node_Str"+ ABC.IDENT_STRING+ ABC.IDENT_STRING+ "String_Node_Str";
  }
  if (highlight) {
    toPrint=Highlighting.hilighTrait(toPrint,abc.class_info[class_info].static_traits.traits.length + abc.instance_info[class_info].instance_traits.traits.length + 1);
  }
  outTraits.add(toPrint);
  if (!abc.instance_info[class_info].isInterface()) {
    String modifier="String_Node_Str";
    Multiname m=abc.constants.constant_multiname[abc.instance_info[class_info].name_index];
    if (m != null) {
      Namespace ns=m.getNamespace(abc.constants);
      if (ns != null) {
        modifier=ns.getPrefix(abc) + "String_Node_Str";
        if (modifier.equals("String_Node_Str")) {
          modifier="String_Node_Str";
        }
        if (modifier.startsWith("String_Node_Str")) {
          modifier="String_Node_Str";
        }
      }
    }
    String constructorParams;
    bodyStr="String_Node_Str";
    bodyIndex=abc.findBodyIndex(abc.instance_info[class_info].iinit_index);
    if (bodyIndex != -1) {
      if (Main.DO_DECOMPILE) {
        bodyStr=ABC.addTabs(abc.bodies[bodyIndex].toString(packageName + "String_Node_Str" + abc.instance_info[class_info].getName(abc.constants).getName(abc.constants,fullyQualifiedNames)+ "String_Node_Str",pcode,false,scriptIndex,class_info,abc,abc.constants,abc.method_info,new Stack<GraphTargetItem>(),false,highlight,fullyQualifiedNames,abc.instance_info[class_info].instance_traits),3);
      }
      constructorParams=abc.method_info[abc.instance_info[class_info].iinit_index].getParamStr(abc.constants,abc.bodies[bodyIndex],abc,fullyQualifiedNames);
    }
 else {
      constructorParams=abc.method_info[abc.instance_info[class_info].iinit_index].getParamStr(abc.constants,null,abc,fullyQualifiedNames);
    }
    toPrint=ABC.IDENT_STRING + ABC.IDENT_STRING + modifier+ "String_Node_Str"+ abc.constants.constant_multiname[abc.instance_info[class_info].name_index].getName(abc.constants,new ArrayList<String>())+ "String_Node_Str"+ constructorParams+ "String_Node_Str"+ bodyStr+ "String_Node_Str"+ ABC.IDENT_STRING+ ABC.IDENT_STRING+ "String_Node_Str";
    if (highlight) {
      toPrint=Highlighting.hilighTrait(toPrint,abc.class_info[class_info].static_traits.traits.length + abc.instance_info[class_info].instance_traits.traits.length);
    }
    outTraits.add(toPrint);
  }
  outTraits.add(abc.class_info[class_info].static_traits.convert(packageName + "String_Node_Str" + abc.instance_info[class_info].getName(abc.constants).getName(abc.constants,fullyQualifiedNames),abcTags,abc,true,pcode,false,scriptIndex,class_info,highlight,fullyQualifiedNames));
  outTraits.add(abc.instance_info[class_info].instance_traits.convert(packageName + "String_Node_Str" + abc.instance_info[class_info].getName(abc.constants).getName(abc.constants,fullyQualifiedNames),abcTags,abc,false,pcode,false,scriptIndex,class_info,highlight,fullyQualifiedNames));
  StringBuilder bui=new StringBuilder();
  boolean first=true;
  String glue="String_Node_Str";
  for (  String s : outTraits) {
    if (!Highlighting.stripHilights(s).trim().equals("String_Node_Str")) {
      if (!first) {
        bui.append(glue);
      }
 else {
        first=false;
      }
    }
 else {
      s=s.replace(ABC.IDENT_STRING,"String_Node_Str");
    }
    bui.append(s);
  }
  out.println(bui.toString());
  out.println(ABC.IDENT_STRING + "String_Node_Str");
  out.flush();
  Highlighting.doHighlight=true;
  try {
    return Highlighting.hilighClass(new String(baos.toByteArray(),"String_Node_Str"),class_info);
  }
 catch (  UnsupportedEncodingException ex) {
    Logger.getLogger(TraitClass.class.getName()).log(Level.SEVERE,null,ex);
    return "String_Node_Str";
  }
}

Fixed version (ground truth):
@Override public String convert(String path,List<ABCContainerTag> abcTags,ABC abc,boolean isStatic,boolean pcode,int scriptIndex,int classIndex,boolean highlight,List<String> fullyQualifiedNames){
  if (!highlight) {
    Highlighting.doHighlight=false;
  }
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  PrintStream out=null;
  try {
    out=new PrintStream(baos,true,"String_Node_Str");
  }
 catch (  UnsupportedEncodingException ex) {
    Logger.getLogger(TraitClass.class.getName()).log(Level.SEVERE,null,ex);
    return "String_Node_Str";
  }
  String packageName=abc.instance_info[class_info].getName(abc.constants).getNamespace(abc.constants).getName(abc.constants);
  if (debugMode) {
    System.err.println("String_Node_Str" + packageName + "String_Node_Str"+ abc.instance_info[class_info].getName(abc.constants).getName(abc.constants,fullyQualifiedNames));
  }
  List<String> namesInThisPackage=new ArrayList<String>();
  for (  ABCContainerTag tag : abcTags) {
    for (    ScriptInfo si : tag.getABC().script_info) {
      for (      Trait t : si.traits.traits) {
        String spath=t.getPath(tag.getABC());
        String pkg="String_Node_Str";
        String name=spath;
        if (spath.contains("String_Node_Str")) {
          pkg=spath.substring(0,spath.lastIndexOf("String_Node_Str"));
          name=spath.substring(spath.lastIndexOf("String_Node_Str") + 1);
        }
        if (pkg.equals(packageName)) {
          namesInThisPackage.add(name);
        }
      }
    }
  }
  List<String> imports=new ArrayList<String>();
  List<String> uses=new ArrayList<String>();
  getImportsUsages(abcTags,abc,imports,uses,new ArrayList<String>());
  fullyQualifiedNames=new ArrayList<String>();
  List<String> importnames=new ArrayList<String>();
  importnames.addAll(namesInThisPackage);
  for (  String ipath : imports) {
    String name=ipath;
    String pkg="String_Node_Str";
    if (name.contains("String_Node_Str")) {
      pkg=name.substring(0,name.lastIndexOf("String_Node_Str"));
      name=name.substring(name.lastIndexOf("String_Node_Str") + 1);
    }
    if (importnames.contains(name) || ((!pkg.equals("String_Node_Str")) && isBuiltInClass(name))) {
      fullyQualifiedNames.add(name);
    }
 else {
      importnames.add(name);
    }
  }
  for (  String imp : imports) {
    if (!imp.startsWith("String_Node_Str")) {
      out.println(ABC.IDENT_STRING + "String_Node_Str" + imp+ "String_Node_Str");
    }
  }
  out.println();
  for (  String us : uses) {
    out.println(ABC.IDENT_STRING + "String_Node_Str" + us+ "String_Node_Str");
  }
  out.println();
  String classHeader=abc.instance_info[class_info].getClassHeaderStr(abc,fullyQualifiedNames);
  if (classHeader.startsWith("String_Node_Str")) {
    classHeader=classHeader.substring("String_Node_Str".length());
  }
  out.println(ABC.IDENT_STRING + classHeader);
  out.println(ABC.IDENT_STRING + "String_Node_Str");
  String toPrint;
  List<String> outTraits=new LinkedList<String>();
  int bodyIndex;
  String bodyStr="String_Node_Str";
  bodyIndex=abc.findBodyIndex(abc.class_info[class_info].cinit_index);
  if (bodyIndex != -1) {
    if (Main.DO_DECOMPILE) {
      bodyStr=abc.bodies[bodyIndex].toString(packageName + "String_Node_Str" + abc.instance_info[class_info].getName(abc.constants).getName(abc.constants,fullyQualifiedNames)+ "String_Node_Str",pcode,true,scriptIndex,class_info,abc,abc.constants,abc.method_info,new Stack<GraphTargetItem>(),true,highlight,fullyQualifiedNames,abc.class_info[class_info].static_traits);
    }
  }
  if (Highlighting.stripHilights(bodyStr).equals("String_Node_Str")) {
    toPrint=ABC.addTabs(bodyStr,3);
  }
 else {
    toPrint=ABC.IDENT_STRING + ABC.IDENT_STRING + "String_Node_Str"+ ABC.addTabs(bodyStr,3)+ "String_Node_Str"+ ABC.IDENT_STRING+ ABC.IDENT_STRING+ "String_Node_Str";
  }
  if (highlight) {
    toPrint=Highlighting.hilighTrait(toPrint,abc.class_info[class_info].static_traits.traits.length + abc.instance_info[class_info].instance_traits.traits.length + 1);
  }
  outTraits.add(toPrint);
  if (!abc.instance_info[class_info].isInterface()) {
    String modifier="String_Node_Str";
    Multiname m=abc.constants.constant_multiname[abc.instance_info[class_info].name_index];
    if (m != null) {
      Namespace ns=m.getNamespace(abc.constants);
      if (ns != null) {
        modifier=ns.getPrefix(abc) + "String_Node_Str";
        if (modifier.equals("String_Node_Str")) {
          modifier="String_Node_Str";
        }
        if (modifier.startsWith("String_Node_Str")) {
          modifier="String_Node_Str";
        }
      }
    }
    String constructorParams;
    bodyStr="String_Node_Str";
    bodyIndex=abc.findBodyIndex(abc.instance_info[class_info].iinit_index);
    if (bodyIndex != -1) {
      if (Main.DO_DECOMPILE) {
        bodyStr=ABC.addTabs(abc.bodies[bodyIndex].toString(packageName + "String_Node_Str" + abc.instance_info[class_info].getName(abc.constants).getName(abc.constants,fullyQualifiedNames)+ "String_Node_Str",pcode,false,scriptIndex,class_info,abc,abc.constants,abc.method_info,new Stack<GraphTargetItem>(),false,highlight,fullyQualifiedNames,abc.instance_info[class_info].instance_traits),3);
      }
      constructorParams=abc.method_info[abc.instance_info[class_info].iinit_index].getParamStr(abc.constants,abc.bodies[bodyIndex],abc,fullyQualifiedNames);
    }
 else {
      constructorParams=abc.method_info[abc.instance_info[class_info].iinit_index].getParamStr(abc.constants,null,abc,fullyQualifiedNames);
    }
    toPrint=ABC.IDENT_STRING + ABC.IDENT_STRING + modifier+ "String_Node_Str"+ abc.constants.constant_multiname[abc.instance_info[class_info].name_index].getName(abc.constants,new ArrayList<String>())+ "String_Node_Str"+ constructorParams+ "String_Node_Str"+ bodyStr+ "String_Node_Str"+ ABC.IDENT_STRING+ ABC.IDENT_STRING+ "String_Node_Str";
    if (highlight) {
      toPrint=Highlighting.hilighTrait(toPrint,abc.class_info[class_info].static_traits.traits.length + abc.instance_info[class_info].instance_traits.traits.length);
    }
    outTraits.add(toPrint);
  }
  outTraits.add(abc.class_info[class_info].static_traits.convert(packageName + "String_Node_Str" + abc.instance_info[class_info].getName(abc.constants).getName(abc.constants,fullyQualifiedNames),abcTags,abc,true,pcode,false,scriptIndex,class_info,highlight,fullyQualifiedNames));
  outTraits.add(abc.instance_info[class_info].instance_traits.convert(packageName + "String_Node_Str" + abc.instance_info[class_info].getName(abc.constants).getName(abc.constants,fullyQualifiedNames),abcTags,abc,false,pcode,false,scriptIndex,class_info,highlight,fullyQualifiedNames));
  StringBuilder bui=new StringBuilder();
  boolean first=true;
  String glue="String_Node_Str";
  for (  String s : outTraits) {
    if (!Highlighting.stripHilights(s).trim().equals("String_Node_Str")) {
      if (!first) {
        bui.append(glue);
      }
 else {
        first=false;
      }
    }
 else {
      s=s.replace(ABC.IDENT_STRING,"String_Node_Str");
    }
    bui.append(s);
  }
  out.println(bui.toString());
  out.println(ABC.IDENT_STRING + "String_Node_Str");
  out.flush();
  Highlighting.doHighlight=true;
  try {
    if (highlight) {
      return Highlighting.hilighClass(new String(baos.toByteArray(),"String_Node_Str"),class_info);
    }
 else {
      return new String(baos.toByteArray(),"String_Node_Str");
    }
  }
 catch (  UnsupportedEncodingException ex) {
    Logger.getLogger(TraitClass.class.getName()).log(Level.SEVERE,null,ex);
    return "String_Node_Str";
  }
}