Program: 31175
Project: 31175
Buggy source:
public int beginSection(String type,String name,String value){
  int section=nextsection++;
  Section cs;
  if (section == sections.size()) {
    cs=new Section();
    sections.add(cs);
  }
  cs=sections.get(section);
  if (collapse_depth == 0) {
    beginColorBlock();
    spacer();
    Font of=g.getFont();
    g.setFont(of.deriveFont(Font.BOLD));
    FontMetrics fm=g.getFontMetrics();
    String tok=cs.collapsed ? "String_Node_Str" : "String_Node_Str";
    g.setColor(Color.white);
    g.fillRect(x[0] + indent_level * indentpx,y,1,1);
    g.setColor(Color.black);
    String type_split[]=type.split("String_Node_Str");
    String drawtype=type_split[type_split.length - 1];
    int type_len=fm.stringWidth(drawtype);
    int name_len=fm.stringWidth(name);
    int tok_pixidx=x[0] + indent_level * indentpx;
    int type_pixidx=x[0] + indent_level * indentpx + 10;
    g.drawString(tok,tok_pixidx,y);
    g.drawString(drawtype,type_pixidx,y);
    cs.y0=y - textheight;
    if (type_pixidx + type_len > x[1])     y+=textheight;
    g.drawString(name,x[1],y);
    if (x[1] + name_len > x[2] && value.length() > 0)     y+=textheight;
    g.drawString(value,x[2],y);
    g.setFont(of);
    final int extra_click_margin=10;
    cs.x0=x[0];
    if (name_len > 0)     cs.x1=x[1] + name_len + extra_click_margin;
 else {
      cs.x1=type_pixidx + type_len + extra_click_margin;
    }
    cs.y1=y;
    y+=textheight;
    indent();
  }
 else {
    cs.x0=0;
    cs.x1=0;
    cs.y0=0;
    cs.y1=0;
  }
  if (sections.get(section).collapsed) {
    collapse_depth++;
  }
  return section;
}

Fixed version (ground truth):
public int beginSection(String type,String name,String value){
  int section=nextsection++;
  Section cs;
  if (section == sections.size()) {
    cs=new Section();
    sections.add(cs);
  }
  cs=sections.get(section);
  if (collapse_depth == 0) {
    beginColorBlock();
    spacer();
    Font of=g.getFont();
    g.setFont(of.deriveFont(Font.BOLD));
    FontMetrics fm=g.getFontMetrics();
    String tok=cs.collapsed ? "String_Node_Str" : "String_Node_Str";
    g.setColor(Color.white);
    g.fillRect(x[0] + indent_level * indentpx,y,1,1);
    g.setColor(Color.black);
    String type_split[]=type.split("String_Node_Str");
    String drawtype=type_split[type_split.length - 1];
    int type_len=fm.stringWidth(drawtype);
    int name_len=fm.stringWidth(name);
    int tok_pixidx=x[0] + indent_level * indentpx;
    int type_pixidx=x[0] + indent_level * indentpx + 10;
    g.drawString(tok,tok_pixidx,y);
    g.drawString(drawtype,type_pixidx,y);
    cs.y0=y - textheight;
    if (type_pixidx + type_len > x[1])     y+=textheight;
    g.drawString(name,x[1],y);
    if (x[1] + name_len > x[2] && value.length() > 0)     y+=textheight;
    g.drawString(value,x[2],y);
    g.setFont(of);
    final int extra_click_margin=10;
    cs.x0=x[0];
    if (name_len > 0)     cs.x1=x[1] + name_len + extra_click_margin;
 else {
      cs.x1=type_pixidx + type_len + extra_click_margin;
    }
    cs.y1=y;
    y+=textheight;
  }
 else {
    cs.x0=0;
    cs.x1=0;
    cs.y0=0;
    cs.y1=0;
  }
  if (sections.get(section).collapsed) {
    collapse_depth++;
  }
 else   if (collapse_depth == 0) {
    indent();
  }
  return section;
}