Program: 83360
Project: 83360
Buggy source:
/** 
 * Emits all the script required to set up the module and, in web mode, select a compilation.
 * @param pw
 */
private void genScript(PrintWriter mainPw,String template){
  StringBuffer buf=new StringBuffer(template);
  replaceAll(buf,"String_Node_Str",moduleFunction);
  replaceAll(buf,"String_Node_Str",moduleName);
  if (orderedProps != null) {
    int startPos=buf.indexOf("String_Node_Str");
    int endPos=buf.indexOf("String_Node_Str");
    buf.delete(startPos,endPos);
  }
  int startPos=buf.indexOf("String_Node_Str");
  for (Iterator iter=styles.iterator(); iter.hasNext(); ) {
    String style=(String)iter.next();
    String text=cssInjector(style);
    buf.insert(startPos,text);
    startPos+=text.length();
  }
  for (Iterator iter=scripts.iterator(); iter.hasNext(); ) {
    Script script=(Script)iter.next();
    String text=scriptInjector(script.getSrc());
    buf.insert(startPos,text);
    startPos+=text.length();
  }
{
    StringWriter sw=new StringWriter();
    PrintWriter pw=new PrintWriter(sw,true);
    genPropProviders(pw);
    pw.close();
    String stuff=sw.toString();
    startPos=buf.indexOf("String_Node_Str");
    buf.insert(startPos,stuff);
  }
{
    StringWriter sw=new StringWriter();
    PrintWriter pw=new PrintWriter(sw,true);
    if (orderedProps != null) {
      if (orderedProps.length > 0) {
        pw.println();
        genAnswers(pw);
        pw.println();
        pw.print("String_Node_Str");
        genPropValues(pw);
      }
 else {
        assert(orderedProps.length == 0);
        Set entrySet=propertyValuesSetByStrongName.entrySet();
        assert(entrySet.size() == 1);
        Map.Entry entry=(Entry)entrySet.iterator().next();
        String strongName=(String)entry.getKey();
        pw.print("String_Node_Str" + literal(strongName));
      }
      pw.println("String_Node_Str");
    }
    pw.close();
    String stuff=sw.toString();
    startPos=buf.indexOf("String_Node_Str");
    buf.insert(startPos,stuff);
  }
  mainPw.print(buf.toString());
}

Fixed version (ground truth):
/** 
 * Emits all the script required to set up the module and, in web mode, select a compilation.
 * @param pw
 */
private void genScript(PrintWriter mainPw,String template){
  StringBuffer buf=new StringBuffer(template);
  replaceAll(buf,"String_Node_Str",moduleFunction);
  replaceAll(buf,"String_Node_Str",moduleName);
  if (orderedProps != null) {
    int startPos=buf.indexOf("String_Node_Str");
    int endPos=buf.indexOf("String_Node_Str");
    buf.delete(startPos,endPos);
  }
  int startPos=buf.indexOf("String_Node_Str");
  for (Iterator iter=styles.iterator(); iter.hasNext(); ) {
    String style=(String)iter.next();
    String text=cssInjector(style);
    buf.insert(startPos,text);
    startPos+=text.length();
  }
  for (Iterator iter=scripts.iterator(); iter.hasNext(); ) {
    Script script=(Script)iter.next();
    String text=scriptInjector(script.getSrc());
    buf.insert(startPos,text);
    startPos+=text.length();
  }
{
    StringWriter sw=new StringWriter();
    PrintWriter pw=new PrintWriter(sw,true);
    genPropProviders(pw);
    pw.close();
    String stuff=sw.toString();
    startPos=buf.indexOf("String_Node_Str");
    buf.insert(startPos,stuff);
  }
{
    StringWriter sw=new StringWriter();
    PrintWriter pw=new PrintWriter(sw,true);
    if (orderedProps != null) {
      if (propertyValuesSetByStrongName.size() > 1) {
        pw.println();
        genAnswers(pw);
        pw.println();
        pw.print("String_Node_Str");
        genPropValues(pw);
      }
 else {
        Set entrySet=propertyValuesSetByStrongName.entrySet();
        assert(entrySet.size() == 1);
        Map.Entry entry=(Entry)entrySet.iterator().next();
        String strongName=(String)entry.getKey();
        pw.print("String_Node_Str" + literal(strongName));
      }
      pw.println("String_Node_Str");
    }
    pw.close();
    String stuff=sw.toString();
    startPos=buf.indexOf("String_Node_Str");
    buf.insert(startPos,stuff);
  }
  mainPw.print(buf.toString());
}