nus-yam/ex-repair huggingface dataset:
Program: 31158
Project: 31158
Buggy source:
public Settings(){
  HomePath=System.getProperty("String_Node_Str");
  if (!HomePath.endsWith(File.separator))   HomePath+=File.separator;
  File SettingsFile=new File(HomePath + SettingsFileName + "String_Node_Str");
  if (SettingsFile.exists()) {
    try {
      DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
      DocumentBuilder parser=factory.newDocumentBuilder();
      SettingsDocument=parser.parse(SettingsFile);
    }
 catch (    Exception e) {
      JOptionPane.showMessageDialog(null,"String_Node_Str" + SettingsFile.getPath());
      System.exit(-1);
    }
  }
  NodeList SettingsList=SettingsDocument.getElementsByTagName(Boards);
  if (SettingsList.getLength() != 1) {
    return;
  }
  Node ThisWorkspace=SettingsList.item(0);
  NamedNodeMap WorkspaceParameters=ThisWorkspace.getAttributes();
  for (int i=0; i < WorkspaceParameters.getLength(); i++) {
    if (WorkspaceParameters.item(i).getNodeName().contains(ExternalBoard)) {
      File TestFile=new File(WorkspaceParameters.item(i).getNodeValue());
      if (TestFile.exists())       KnownBoards.AddExternalBoard(WorkspaceParameters.item(i).getNodeValue());
    }
  }
  if (!SettingsComplete()) {
    if (!WriteXml(SettingsFile)) {
      JOptionPane.showMessageDialog(null,"String_Node_Str" + SettingsFile.getPath());
      System.exit(-1);
    }
  }
}

Fixed version (ground truth):
public Settings(){
  HomePath=System.getProperty("String_Node_Str");
  if (!HomePath.endsWith(File.separator))   HomePath+=File.separator;
  File SettingsFile=new File(HomePath + SettingsFileName + "String_Node_Str");
  if (SettingsFile.exists()) {
    try {
      DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
      DocumentBuilder parser=factory.newDocumentBuilder();
      SettingsDocument=parser.parse(SettingsFile);
    }
 catch (    Exception e) {
      JOptionPane.showMessageDialog(null,"String_Node_Str" + SettingsFile.getPath());
      System.exit(-1);
    }
    NodeList SettingsList=SettingsDocument.getElementsByTagName(Boards);
    if (SettingsList.getLength() != 1) {
      return;
    }
    Node ThisWorkspace=SettingsList.item(0);
    NamedNodeMap WorkspaceParameters=ThisWorkspace.getAttributes();
    for (int i=0; i < WorkspaceParameters.getLength(); i++) {
      if (WorkspaceParameters.item(i).getNodeName().contains(ExternalBoard)) {
        File TestFile=new File(WorkspaceParameters.item(i).getNodeValue());
        if (TestFile.exists())         KnownBoards.AddExternalBoard(WorkspaceParameters.item(i).getNodeValue());
      }
    }
  }
  if (!SettingsComplete()) {
    if (!WriteXml(SettingsFile)) {
      JOptionPane.showMessageDialog(null,"String_Node_Str" + SettingsFile.getPath());
      System.exit(-1);
    }
  }
}
Program: 31159
Project: 31159
Buggy source:
void mutatorAdd(Component c){
  logger.debug("String_Node_Str",c);
  locker.checkForWritePermission("String_Node_Str");
  Annotated=false;
  MyNetList.clear();
  if (c instanceof Wire) {
    Wire w=(Wire)c;
    if (w.getEnd0().equals(w.getEnd1()))     return;
    boolean added=wires.add(w);
    if (!added)     return;
  }
 else {
    boolean added=comps.add(c);
    if (!added)     return;
    wires.add(c);
    ComponentFactory factory=c.getFactory();
    if (factory instanceof Clock) {
      clocks.add(c);
    }
 else     if (factory instanceof SubcircuitFactory) {
      SubcircuitFactory subcirc=(SubcircuitFactory)factory;
      subcirc.getSubcircuit().circuitsUsingThis.put(c,this);
    }
    c.addComponentListener(myComponentListener);
  }
  fireEvent(CircuitEvent.ACTION_ADD,c);
}

Fixed version (ground truth):
void mutatorAdd(Component c){
  locker.checkForWritePermission("String_Node_Str");
  Annotated=false;
  MyNetList.clear();
  if (c instanceof Wire) {
    Wire w=(Wire)c;
    if (w.getEnd0().equals(w.getEnd1()))     return;
    boolean added=wires.add(w);
    if (!added)     return;
  }
 else {
    boolean added=comps.add(c);
    if (!added)     return;
    wires.add(c);
    ComponentFactory factory=c.getFactory();
    if (factory instanceof Clock) {
      clocks.add(c);
    }
 else     if (factory instanceof SubcircuitFactory) {
      SubcircuitFactory subcirc=(SubcircuitFactory)factory;
      subcirc.getSubcircuit().circuitsUsingThis.put(c,this);
    }
    c.addComponentListener(myComponentListener);
  }
  fireEvent(CircuitEvent.ACTION_ADD,c);
}
Program: 31160
Project: 31160
Buggy source:
void mutatorRemove(Component c){
  logger.debug("String_Node_Str",c);
  locker.checkForWritePermission("String_Node_Str");
  Annotated=false;
  MyNetList.clear();
  if (c instanceof Wire) {
    wires.remove(c);
  }
 else {
    wires.remove(c);
    comps.remove(c);
    ComponentFactory factory=c.getFactory();
    if (factory instanceof Clock) {
      clocks.remove(c);
    }
 else     if (factory instanceof SubcircuitFactory) {
      SubcircuitFactory subcirc=(SubcircuitFactory)factory;
      subcirc.getSubcircuit().circuitsUsingThis.remove(c);
    }
    c.removeComponentListener(myComponentListener);
  }
  fireEvent(CircuitEvent.ACTION_REMOVE,c);
}

Fixed version (ground truth):
void mutatorRemove(Component c){
  locker.checkForWritePermission("String_Node_Str");
  Annotated=false;
  MyNetList.clear();
  if (c instanceof Wire) {
    wires.remove(c);
  }
 else {
    wires.remove(c);
    comps.remove(c);
    ComponentFactory factory=c.getFactory();
    if (factory instanceof Clock) {
      clocks.remove(c);
    }
 else     if (factory instanceof SubcircuitFactory) {
      SubcircuitFactory subcirc=(SubcircuitFactory)factory;
      subcirc.getSubcircuit().circuitsUsingThis.remove(c);
    }
    c.removeComponentListener(myComponentListener);
  }
  fireEvent(CircuitEvent.ACTION_REMOVE,c);
}
Program: 31162
Project: 31162
Buggy source:
public void run(){
  Scanner sc=new Scanner(new InputStreamReader(process.getInputStream()));
  sc.close();
  stop();
}

Fixed version (ground truth):
public void run(){
  Scanner sc=new Scanner(new InputStreamReader(process.getInputStream()));
  String nextLine;
  while (sc.hasNextLine()) {
    nextLine=sc.nextLine();
    if (nextLine.length() > 0)     System.out.println(nextLine);
  }
  sc.close();
  stop();
}
Program: 31163
Project: 31163
Buggy source:
void mutatorAdd(Component c){
  locker.checkForWritePermission("String_Node_Str");
  Annotated=false;
  MyNetList.clear();
  if (c instanceof Wire) {
    Wire w=(Wire)c;
    if (w.getEnd0().equals(w.getEnd1()))     return;
    boolean added=wires.add(w);
    if (!added)     return;
  }
 else {
    boolean added=comps.add(c);
    if (!added)     return;
    wires.add(c);
    ComponentFactory factory=c.getFactory();
    if (factory instanceof Clock) {
      clocks.add(c);
    }
 else     if (factory instanceof SubcircuitFactory) {
      SubcircuitFactory subcirc=(SubcircuitFactory)factory;
      subcirc.getSubcircuit().circuitsUsingThis.put(c,this);
    }
    c.addComponentListener(myComponentListener);
  }
  fireEvent(CircuitEvent.ACTION_ADD,c);
}

Fixed version (ground truth):
void mutatorAdd(Component c){
  logger.debug("String_Node_Str",c);
  locker.checkForWritePermission("String_Node_Str");
  Annotated=false;
  MyNetList.clear();
  if (c instanceof Wire) {
    Wire w=(Wire)c;
    if (w.getEnd0().equals(w.getEnd1()))     return;
    boolean added=wires.add(w);
    if (!added)     return;
  }
 else {
    boolean added=comps.add(c);
    if (!added)     return;
    wires.add(c);
    ComponentFactory factory=c.getFactory();
    if (factory instanceof Clock) {
      clocks.add(c);
    }
 else     if (factory instanceof SubcircuitFactory) {
      SubcircuitFactory subcirc=(SubcircuitFactory)factory;
      subcirc.getSubcircuit().circuitsUsingThis.put(c,this);
    }
    c.addComponentListener(myComponentListener);
  }
  fireEvent(CircuitEvent.ACTION_ADD,c);
}
Program: 31164
Project: 31164
Buggy source:
void mutatorRemove(Component c){
  locker.checkForWritePermission("String_Node_Str");
  Annotated=false;
  MyNetList.clear();
  if (c instanceof Wire) {
    wires.remove(c);
  }
 else {
    wires.remove(c);
    comps.remove(c);
    ComponentFactory factory=c.getFactory();
    if (factory instanceof Clock) {
      clocks.remove(c);
    }
 else     if (factory instanceof SubcircuitFactory) {
      SubcircuitFactory subcirc=(SubcircuitFactory)factory;
      subcirc.getSubcircuit().circuitsUsingThis.remove(c);
    }
    c.removeComponentListener(myComponentListener);
  }
  fireEvent(CircuitEvent.ACTION_REMOVE,c);
}

Fixed version (ground truth):
void mutatorRemove(Component c){
  logger.debug("String_Node_Str",c);
  locker.checkForWritePermission("String_Node_Str");
  Annotated=false;
  MyNetList.clear();
  if (c instanceof Wire) {
    wires.remove(c);
  }
 else {
    wires.remove(c);
    comps.remove(c);
    ComponentFactory factory=c.getFactory();
    if (factory instanceof Clock) {
      clocks.remove(c);
    }
 else     if (factory instanceof SubcircuitFactory) {
      SubcircuitFactory subcirc=(SubcircuitFactory)factory;
      subcirc.getSubcircuit().circuitsUsingThis.remove(c);
    }
    c.removeComponentListener(myComponentListener);
  }
  fireEvent(CircuitEvent.ACTION_REMOVE,c);
}
Program: 31165
Project: 31165
Buggy source:
LogisimFile readLibrary(InputStream is) throws IOException, SAXException {
  Document doc=loadXmlFrom(is);
  Element elt=doc.getDocumentElement();
  elt=ensureLogisimCompatibility(elt,doc);
  considerRepairs(doc,elt);
  LogisimFile file=new LogisimFile((Loader)loader);
  ReadContext context=new ReadContext(file);
  context.toLogisimFile(elt);
  if (file.getCircuitCount() == 0) {
    file.addCircuit(new Circuit("String_Node_Str",file));
  }
  if (context.messages.size() > 0) {
    StringBuilder all=new StringBuilder();
    for (    String msg : context.messages) {
      all.append(msg);
      all.append("String_Node_Str");
    }
    loader.showError(all.substring(0,all.length() - 1));
  }
  return file;
}

Fixed version (ground truth):
LogisimFile readLibrary(InputStream is) throws IOException, SAXException {
  Document doc=loadXmlFrom(is);
  Element elt=doc.getDocumentElement();
  elt=ensureLogisimCompatibility(elt);
  considerRepairs(doc,elt);
  LogisimFile file=new LogisimFile((Loader)loader);
  ReadContext context=new ReadContext(file);
  context.toLogisimFile(elt);
  if (file.getCircuitCount() == 0) {
    file.addCircuit(new Circuit("String_Node_Str",file));
  }
  if (context.messages.size() > 0) {
    StringBuilder all=new StringBuilder();
    for (    String msg : context.messages) {
      all.append(msg);
      all.append("String_Node_Str");
    }
    loader.showError(all.substring(0,all.length() - 1));
  }
  return file;
}
Program: 31166
Project: 31166
Buggy source:
/** 
 * Change label names in an XML tree according to a list of suggested labels
 * @param root root element of the XML tree
 * @param nodeType type of nodes to consider
 * @param attrType type of attributes to consider
 * @param validLabels label set of correct label names
 */
public static void applyValidLabels(Element root,String nodeType,String attrType,Map<String,String> validLabels,Document doc) throws IllegalArgumentException {
  assert(root != null);
  assert(nodeType != null);
  assert(attrType != null);
  assert(nodeType.length() > 0);
  assert(attrType.length() > 0);
  assert(validLabels != null);
switch (nodeType) {
case "String_Node_Str":
    replaceCircuitNodes(root,attrType,validLabels,doc);
  break;
case "String_Node_Str":
replaceCompNodes(root,validLabels);
break;
default :
throw new IllegalArgumentException("String_Node_Str" + nodeType);
}
}

Fixed version (ground truth):
/** 
 * Change label names in an XML tree according to a list of suggested labels
 * @param root root element of the XML tree
 * @param nodeType type of nodes to consider
 * @param attrType type of attributes to consider
 * @param validLabels label set of correct label names
 */
public static void applyValidLabels(Element root,String nodeType,String attrType,Map<String,String> validLabels) throws IllegalArgumentException {
  assert(root != null);
  assert(nodeType != null);
  assert(attrType != null);
  assert(nodeType.length() > 0);
  assert(attrType.length() > 0);
  assert(validLabels != null);
switch (nodeType) {
case "String_Node_Str":
    replaceCircuitNodes(root,attrType,validLabels);
  break;
case "String_Node_Str":
replaceCompNodes(root,validLabels);
break;
default :
throw new IllegalArgumentException("String_Node_Str" + nodeType);
}
}
Program: 31167
Project: 31167
Buggy source:
public static Element ensureLogisimCompatibility(Element elt,Document doc){
  Map<String,String> validLabels;
  validLabels=findValidLabels(elt,"String_Node_Str","String_Node_Str");
  applyValidLabels(elt,"String_Node_Str","String_Node_Str",validLabels,doc);
  validLabels=findValidLabels(elt,"String_Node_Str","String_Node_Str");
  applyValidLabels(elt,"String_Node_Str","String_Node_Str",validLabels,doc);
  validLabels=findValidLabels(elt,"String_Node_Str","String_Node_Str");
  applyValidLabels(elt,"String_Node_Str","String_Node_Str",validLabels,doc);
  fixInvalidToolbarLib(elt);
  return (elt);
}

Fixed version (ground truth):
public static Element ensureLogisimCompatibility(Element elt){
  Map<String,String> validLabels;
  validLabels=findValidLabels(elt,"String_Node_Str","String_Node_Str");
  applyValidLabels(elt,"String_Node_Str","String_Node_Str",validLabels);
  validLabels=findValidLabels(elt,"String_Node_Str","String_Node_Str");
  applyValidLabels(elt,"String_Node_Str","String_Node_Str",validLabels);
  validLabels=findValidLabels(elt,"String_Node_Str","String_Node_Str");
  applyValidLabels(elt,"String_Node_Str","String_Node_Str",validLabels);
  fixInvalidToolbarLib(elt);
  return (elt);
}
Program: 31169
Project: 31169
Buggy source:
/** 
 * Test method for  {@link com.cburch.logisim.file.XmlReader#labelVHDLInvalid(java.lang.String)}.
 */
@Test public final void testLabelVHDLInvalid(){
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertFalse(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertFalse(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertFalse(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertFalse(XmlReader.labelVHDLInvalid("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Test method for  {@link com.cburch.logisim.file.XmlReader#labelVHDLInvalid(java.lang.String)}.
 */
@Test public final void testLabelVHDLInvalid(){
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertTrue(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertFalse(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertFalse(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertFalse(XmlReader.labelVHDLInvalid("String_Node_Str"));
  assertFalse(XmlReader.labelVHDLInvalid("String_Node_Str"));
}
Program: 31170
Project: 31170
Buggy source:
private void updateHighlightLine(){
  String where;
  if (combo.getSelectedItem() != null) {
    selReg=entry.get(combo.getSelectedItem().toString());
    Value val=curCircuitState.getInstanceState(selReg).getPortValue(Register.OUT);
    if (val.isFullyDefined()) {
      where=val.toHexString().replaceAll("String_Node_Str","String_Node_Str");
      if (where.isEmpty()) {
        where="String_Node_Str";
      }
      Pattern pattern=Pattern.compile("String_Node_Str" + where + "String_Node_Str",Pattern.MULTILINE + Pattern.CASE_INSENSITIVE);
      Matcher m=pattern.matcher(document.getText().replaceAll("String_Node_Str","String_Node_Str"));
      if (m.find()) {
        document.setCaretPosition(m.start());
        status.setText("String_Node_Str");
      }
 else {
        status.setText("String_Node_Str" + where + "String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
private void updateHighlightLine(){
  String where;
  if (combo.getSelectedItem() != null) {
    selReg=entry.get(combo.getSelectedItem().toString());
    Value val=curCircuitState.getInstanceState(selReg).getPortValue(Register.OUT);
    if (val.isFullyDefined()) {
      where=val.toHexString().replaceAll("String_Node_Str","String_Node_Str");
      if (where.isEmpty()) {
        where="String_Node_Str";
      }
      Pattern pattern=Pattern.compile("String_Node_Str" + where + "String_Node_Str",Pattern.MULTILINE + Pattern.CASE_INSENSITIVE);
      Matcher m=pattern.matcher(document.getText().replaceAll("String_Node_Str","String_Node_Str"));
      if (m.find()) {
        document.setCaretPosition(m.start());
        status.setText("String_Node_Str");
        try {
          document.getHighlighter().removeAllHighlights();
          DefaultHighlighter.DefaultHighlightPainter highlightPainter=new DefaultHighlighter.DefaultHighlightPainter(Color.LIGHT_GRAY);
          document.getHighlighter().addHighlight(m.start(),m.end(),highlightPainter);
        }
 catch (        BadLocationException ex) {
          ex.printStackTrace();
        }
      }
 else {
        status.setText("String_Node_Str" + where + "String_Node_Str");
      }
    }
  }
}
Program: 31171
Project: 31171
Buggy source:
@Override public void add(int index,Emojicon object){
  super.add(index,object);
  saveRecents();
}

Fixed version (ground truth):
@Override public void add(int index,Emojicon object){
  super.add(index,object);
}
Program: 31172
Project: 31172
Buggy source:
private void loadRecents(){
  SharedPreferences prefs=getPreferences();
  String str=prefs.getString(PREF_RECENTS,"String_Node_Str");
  StringTokenizer tokenizer=new StringTokenizer(str,"String_Node_Str");
  while (tokenizer.hasMoreTokens()) {
    try {
      int codepoint=Integer.parseInt(tokenizer.nextToken());
      add(Emojicon.fromCodePoint(codepoint));
    }
 catch (    NumberFormatException e) {
    }
  }
}

Fixed version (ground truth):
private void loadRecents(){
  SharedPreferences prefs=getPreferences();
  String str=prefs.getString(PREF_RECENTS,"String_Node_Str");
  StringTokenizer tokenizer=new StringTokenizer(str,"String_Node_Str");
  while (tokenizer.hasMoreTokens()) {
    try {
      add(new Emojicon(tokenizer.nextToken()));
    }
 catch (    NumberFormatException e) {
    }
  }
}
Program: 31173
Project: 31173
Buggy source:
private void saveRecents(){
  StringBuilder str=new StringBuilder();
  int c=size();
  for (int i=0; i < c; i++) {
    Emojicon e=get(i);
    str.append(e.getEmoji().codePointAt(0));
    if (i < (c - 1)) {
      str.append('~');
    }
  }
  SharedPreferences prefs=getPreferences();
  prefs.edit().putString(PREF_RECENTS,str.toString()).commit();
}

Fixed version (ground truth):
public void saveRecents(){
  StringBuilder str=new StringBuilder();
  int c=size();
  for (int i=0; i < c; i++) {
    Emojicon e=get(i);
    str.append(e.getEmoji());
    if (i < (c - 1)) {
      str.append('~');
    }
  }
  SharedPreferences prefs=getPreferences();
  prefs.edit().putString(PREF_RECENTS,str.toString()).commit();
}
Program: 31174
Project: 31174
Buggy source:
@Override public boolean remove(Object object){
  boolean ret=super.remove(object);
  saveRecents();
  return ret;
}

Fixed version (ground truth):
@Override public boolean remove(Object object){
  boolean ret=super.remove(object);
  return ret;
}
Program: 31176
Project: 31176
Buggy source:
public void endSection(int section){
  Section cs=sections.get(section);
  cs.y1=y;
  if (collapse_depth == 0) {
    unindent();
  }
  if (sections.get(section).collapsed) {
    collapse_depth--;
  }
  spacer();
  endColorBlock();
  spacer();
}

Fixed version (ground truth):
public void endSection(int section){
  Section cs=sections.get(section);
  if (collapse_depth == 0) {
    unindent();
  }
  if (sections.get(section).collapsed) {
    collapse_depth--;
  }
  spacer();
  endColorBlock();
  spacer();
}
Program: 31177
Project: 31177
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);
    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);
    cs.x0=x[0];
    cs.x1=getWidth();
    cs.y0=y - textheight;
    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);
    int y_top=y;
    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);
    cs.x0=x[0];
    cs.x1=getWidth();
    cs.y0=y_top - textheight;
    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;
}
Program: 31178
Project: 31178
Buggy source:
public void endSection(int section){
  Section cs=sections.get(section);
  cs.y1=y;
  if (sections.get(section).collapsed)   collapse_depth--;
  unindent();
  spacer();
  endColorBlock();
  spacer();
}

Fixed version (ground truth):
public void endSection(int section){
  Section cs=sections.get(section);
  cs.y1=y;
  if (collapse_depth == 0) {
    unindent();
  }
  if (sections.get(section).collapsed) {
    collapse_depth--;
  }
  spacer();
  endColorBlock();
  spacer();
}
Program: 31179
Project: 31179
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);
    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);
    cs.x0=x[0];
    cs.x1=getWidth();
    cs.y0=y - textheight;
    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);
    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);
    cs.x0=x[0];
    cs.x1=getWidth();
    cs.y0=y - textheight;
    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;
}
Program: 31180
Project: 31180
Buggy source:
public void setObject(Object o,long utime){
  this.o=o;
  this.utime=utime - chartData.getStartTime();
  repaint();
}

Fixed version (ground truth):
public void setObject(Object o,long utime){
  this.o=o;
  this.utime=utime - chartData.getStartTime();
  JFrame topFrame=(JFrame)SwingUtilities.getWindowAncestor(this);
  if (topFrame.getExtendedState() == Frame.ICONIFIED) {
    UpdateGraphDataWithoutPaint();
  }
 else {
    repaint();
  }
}
Program: 31181
Project: 31181
Buggy source:
void createViewer(ChannelData cd){
  if (cd.viewerFrame != null && !cd.viewerFrame.isVisible()) {
    cd.viewerFrame.dispose();
    cd.viewer=null;
  }
  if (cd.viewer == null) {
    cd.viewerFrame=new JFrame(cd.name);
    cd.viewer=new ObjectPanel(cd.name,chartData);
    cd.viewer.setObject(cd.last,cd.last_utime);
    cd.viewerFrame.setLayout(new BorderLayout());
    JScrollPane viewerScrollPane=new JScrollPane(cd.viewer);
    viewerScrollPane.getVerticalScrollBar().setUnitIncrement(16);
    cd.viewer.setViewport(viewerScrollPane.getViewport());
    cd.viewerFrame.add(viewerScrollPane,BorderLayout.CENTER);
    cd.viewerFrame.setSize(650,400);
    cd.viewerFrame.setLocationByPlatform(true);
    cd.viewerFrame.setVisible(true);
  }
 else {
    cd.viewerFrame.setVisible(true);
  }
}

Fixed version (ground truth):
void createViewer(ChannelData cd){
  if (cd.viewerFrame != null && !cd.viewerFrame.isVisible()) {
    cd.viewerFrame.dispose();
    cd.viewer=null;
  }
  if (cd.viewer == null) {
    cd.viewerFrame=new JFrame(cd.name);
    cd.viewer=new ObjectPanel(cd.name,chartData);
    cd.viewerFrame.setLayout(new BorderLayout());
    JScrollPane viewerScrollPane=new JScrollPane(cd.viewer);
    viewerScrollPane.getVerticalScrollBar().setUnitIncrement(16);
    cd.viewer.setViewport(viewerScrollPane.getViewport());
    cd.viewerFrame.add(viewerScrollPane,BorderLayout.CENTER);
    cd.viewer.setObject(cd.last,cd.last_utime);
    cd.viewerFrame.setSize(650,400);
    cd.viewerFrame.setLocationByPlatform(true);
    cd.viewerFrame.setVisible(true);
  }
 else {
    cd.viewerFrame.setVisible(true);
  }
}
Program: 31183
Project: 31183
Buggy source:
public void paint(Graphics g){
  Graphics2D g2=(Graphics2D)g;
  g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
  int width=getWidth(), height=getHeight();
  g.setColor(Color.white);
  g.fillRect(0,0,width,height);
  g.setColor(Color.black);
  FontMetrics fm=g.getFontMetrics();
  PaintState ps=new PaintState();
  ps.panel=this;
  ps.g=g;
  ps.fm=fm;
  ps.textheight=15;
  ps.y=ps.textheight;
  ps.indent_level=1;
  ps.x[0]=0;
  ps.x[1]=Math.min(200,width / 4);
  ps.x[2]=Math.min(ps.x[1] + 200,2 * width / 4);
  ps.x[3]=ps.x[2] + 150;
  int previousNumSections=sections.size();
  if (!visibleSparklinesUpdated && visibleSparklines.isEmpty() && (previousNumSections > 0)&& (scrollViewport != null)) {
    visibleSparklinesUpdated=true;
    updateVisibleSparklines(scrollViewport);
  }
  if (o != null)   paintRecurse(g,ps,"String_Node_Str",o.getClass(),o,false,-1);
  ps.finish();
  if (ps.y != lastheight) {
    lastheight=ps.y;
    invalidate();
    getParent().validate();
  }
  if (previousNumSections != sections.size()) {
    repaint();
  }
}

Fixed version (ground truth):
public void paint(Graphics g){
  Graphics2D g2=(Graphics2D)g;
  g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
  int width=getWidth(), height=getHeight();
  g.setColor(Color.white);
  g.fillRect(0,0,width,height);
  g.setColor(Color.black);
  FontMetrics fm=g.getFontMetrics();
  PaintState ps=new PaintState();
  ps.panel=this;
  ps.g=g;
  ps.fm=fm;
  ps.textheight=15;
  ps.y=ps.textheight;
  ps.indent_level=1;
  ps.x[0]=0;
  ps.x[1]=Math.min(200,width / 4);
  ps.x[2]=Math.min(ps.x[1] + 200,2 * width / 4);
  ps.x[3]=ps.x[2] + 150;
  currentDrawNumber++;
  int previousNumSections=sections.size();
  if (!visibleSparklinesInitialized && visibleSparklines.isEmpty() && (previousNumSections > 0)&& (scrollViewport != null)) {
    visibleSparklinesInitialized=true;
    updateVisibleSparklines(scrollViewport);
  }
  if (o != null)   paintRecurse(g,ps,"String_Node_Str",o.getClass(),o,false,-1);
  ps.finish();
  if (ps.y != lastheight) {
    lastheight=ps.y;
    invalidate();
    getParent().validate();
  }
  if (previousNumSections != sections.size()) {
    repaint();
  }
}
Program: 31184
Project: 31184
Buggy source:
/** 
 * Called on mouse movement to determine if we need to highlight a line or open a chart.
 * @param e MouseEvent to process
 * @return returns true if a mouse click was consumed
 */
public boolean doSparklineInteraction(MouseEvent e){
  int y=e.getY();
  for (  SparklineData data : visibleSparklines) {
    if (data.ymin < y && data.ymax > y) {
      currentlyHoveringName=data.name;
      currentlyHoveringSection=data.section;
      if (e.getButton() == MouseEvent.BUTTON1) {
        displayDetailedChart(data,false,false);
        graphingSparklines.add(data);
      }
 else       if (e.getButton() == MouseEvent.BUTTON2) {
        displayDetailedChart(data,true,true);
        graphingSparklines.add(data);
      }
 else       if (e.getButton() == MouseEvent.BUTTON3) {
        displayDetailedChart(data,false,true);
        graphingSparklines.add(data);
      }
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Called on mouse movement to determine if we need to highlight a line or open a chart.
 * @param e MouseEvent to process
 * @return returns true if a mouse click was consumed
 */
public boolean doSparklineInteraction(MouseEvent e){
  int y=e.getY();
  currentlyHoveringName="String_Node_Str";
  currentlyHoveringSection=null;
  for (  SparklineData data : visibleSparklines) {
    if (data.ymin < y && data.ymax > y && data.lastDrawNumber == currentDrawNumber) {
      currentlyHoveringName=data.name;
      currentlyHoveringSection=data.section;
      if (e.getButton() == MouseEvent.BUTTON1) {
        displayDetailedChart(data,false,false);
        graphingSparklines.add(data);
      }
 else       if (e.getButton() == MouseEvent.BUTTON2) {
        displayDetailedChart(data,true,true);
        graphingSparklines.add(data);
      }
 else       if (e.getButton() == MouseEvent.BUTTON3) {
        displayDetailedChart(data,false,true);
        graphingSparklines.add(data);
      }
      return true;
    }
  }
  return false;
}
Program: 31187
Project: 31187
Buggy source:
/** 
 * Constructor for an object panel, call when the user clicks to see more data about a message.
 * @param name name of the channel
 * @param chartData global data about all charts displayed by lcm-spy
 */
public ObjectPanel(String name,ChartData chartData){
  this.name=name;
  this.setLayout(null);
  this.chartData=chartData;
  addMouseListener(new MyMouseAdapter());
  addMouseMotionListener(new MyMouseMotionListener());
}

Fixed version (ground truth):
/** 
 * Constructor for an object panel, call when the user clicks to see more data about a message.
 * @param name name of the channel
 * @param chartData global data about all charts displayed by lcm-spy
 */
public ObjectPanel(String name,ChartData chartData){
  this.name=name;
  this.setLayout(null);
  this.chartData=chartData;
  addMouseListener(new MyMouseAdapter());
  addMouseMotionListener(new MyMouseMotionListener());
  repaint();
}
Program: 31188
Project: 31188
Buggy source:
public void paint(Graphics g){
  Graphics2D g2=(Graphics2D)g;
  g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
  int width=getWidth(), height=getHeight();
  g.setColor(Color.white);
  g.fillRect(0,0,width,height);
  g.setColor(Color.black);
  FontMetrics fm=g.getFontMetrics();
  PaintState ps=new PaintState();
  ps.panel=this;
  ps.g=g;
  ps.fm=fm;
  ps.textheight=15;
  ps.y=ps.textheight;
  ps.indent_level=1;
  ps.x[0]=0;
  ps.x[1]=Math.min(200,width / 4);
  ps.x[2]=Math.min(ps.x[1] + 200,2 * width / 4);
  ps.x[3]=ps.x[2] + 150;
  if (o != null)   paintRecurse(g,ps,"String_Node_Str",o.getClass(),o,false,-1);
  ps.finish();
  if (ps.y != lastheight) {
    lastheight=ps.y;
    invalidate();
    getParent().validate();
  }
}

Fixed version (ground truth):
public void paint(Graphics g){
  Graphics2D g2=(Graphics2D)g;
  g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
  int width=getWidth(), height=getHeight();
  g.setColor(Color.white);
  g.fillRect(0,0,width,height);
  g.setColor(Color.black);
  FontMetrics fm=g.getFontMetrics();
  PaintState ps=new PaintState();
  ps.panel=this;
  ps.g=g;
  ps.fm=fm;
  ps.textheight=15;
  ps.y=ps.textheight;
  ps.indent_level=1;
  ps.x[0]=0;
  ps.x[1]=Math.min(200,width / 4);
  ps.x[2]=Math.min(ps.x[1] + 200,2 * width / 4);
  ps.x[3]=ps.x[2] + 150;
  int previousNumSections=sections.size();
  if (o != null)   paintRecurse(g,ps,"String_Node_Str",o.getClass(),o,false,-1);
  ps.finish();
  if (ps.y != lastheight) {
    lastheight=ps.y;
    invalidate();
    getParent().validate();
  }
  if (previousNumSections != sections.size()) {
    repaint();
  }
}
Program: 31189
Project: 31189
Buggy source:
public void setObject(Object o,long utime){
  this.o=o;
  this.utime=utime - chartData.getStartTime();
  this.updateGraphs=true;
  repaint();
}

Fixed version (ground truth):
public void setObject(Object o,long utime){
  this.o=o;
  this.utime=utime - chartData.getStartTime();
  repaint();
}
Program: 31190
Project: 31190
Buggy source:
public void finish(){
  g.setColor(Color.white);
  g.fillRect(0,y,getWidth(),getHeight());
  updateGraphs=false;
}

Fixed version (ground truth):
public void finish(){
  g.setColor(Color.white);
  g.fillRect(0,y,getWidth(),getHeight());
}
Program: 31191
Project: 31191
Buggy source:
/** 
 * Check to see if we need to update the hightlight on a row.
 * @param e MouseEvent from the mouse move
 */
public void mouseMoved(MouseEvent e){
  doSparklineInteraction(e);
  repaint();
}

Fixed version (ground truth):
/** 
 * Check to see if we need to update the highlight on a row.
 * @param e MouseEvent from the mouse move
 */
public void mouseMoved(MouseEvent e){
  doSparklineInteraction(e);
  repaint();
}
Program: 31192
Project: 31192
Buggy source:
/** 
 * Handle mouse press events
 */
public void mousePressed(MouseEvent e){
  if (maybeShowPopup(e)) {
    return;
  }
  IAxis xAxis=this.getAxisX();
  IAxis yAxis=this.getAxisY();
  double xAxisRange=xAxis.getMax() - xAxis.getMin();
  mouseDownValPerPxY.clear();
  mouseDownMinY.clear();
  mouseDownMaxY.clear();
  mouseDownStartX=e.getX();
  mouseDownStartY=e.getY();
  double xAxisWidth=this.getXChartEnd() - this.getXChartStart();
  double yAxisHeight=this.getYChartStart() - this.getYChartEnd();
  mouseDownValPerPxX=xAxisRange / xAxisWidth;
  mouseDownMinX=xAxis.getMin();
  mouseDownMaxX=xAxis.getMax();
  double yAxisRange=yAxis.getMax() - yAxis.getMin();
  mouseDownValPerPxY.add(yAxisRange / yAxisHeight);
  mouseDownMinY.add(yAxis.getMin());
  mouseDownMaxY.add(yAxis.getMax());
  for (  AAxis yAxisRight : rightYAxis) {
    double yAxisRangeRight=yAxisRight.getMax() - yAxisRight.getMin();
    mouseDownValPerPxY.add(yAxisRangeRight / yAxisHeight);
    mouseDownMinY.add(yAxisRight.getMin());
    mouseDownMaxY.add(yAxisRight.getMax());
  }
}

Fixed version (ground truth):
/** 
 * Handle mouse press events
 */
public void mousePressed(MouseEvent e){
  if (maybeShowPopup(e)) {
    return;
  }
  IAxis xAxis=this.getAxisX();
  IAxis yAxis=this.getAxisY();
  double xAxisRange=xAxis.getRange().getExtent();
  mouseDownValPerPxY.clear();
  mouseDownMinY.clear();
  mouseDownMaxY.clear();
  mouseDownStartX=e.getX();
  mouseDownStartY=e.getY();
  double xAxisWidth=this.getXChartEnd() - this.getXChartStart();
  double yAxisHeight=this.getYChartStart() - this.getYChartEnd();
  mouseDownValPerPxX=xAxisRange / xAxisWidth;
  mouseDownMinX=xAxis.getMin();
  mouseDownMaxX=xAxis.getMax();
  double yAxisRange=yAxis.getRange().getExtent();
  mouseDownValPerPxY.add(yAxisRange / yAxisHeight);
  mouseDownMinY.add(yAxis.getMin());
  mouseDownMaxY.add(yAxis.getMax());
  for (  AAxis yAxisRight : rightYAxis) {
    double yAxisRangeRight=yAxisRight.getMax() - yAxisRight.getMin();
    mouseDownValPerPxY.add(yAxisRangeRight / yAxisHeight);
    mouseDownMinY.add(yAxisRight.getMin());
    mouseDownMaxY.add(yAxisRight.getMax());
  }
}
Program: 31198
Project: 31198
Buggy source:
public boolean doSparklineInteraction(int x,int y,MouseEvent e){
  for (  Section section : sections) {
    Iterator<Entry<String,SparklineData>> it=section.sparklines.entrySet().iterator();
    while (it.hasNext()) {
      Entry<String,SparklineData> pair=it.next();
      SparklineData data=pair.getValue();
      if (data.ymin < y && data.ymax > y && section.collapsed == false) {
        currentlyHoveringSection=section;
        currentlyHoveringName=pair.getKey();
        if (e.getButton() == MouseEvent.BUTTON1) {
          displayDetailedChart(data,false);
        }
 else         if (e.getButton() == MouseEvent.BUTTON2 || e.getButton() == MouseEvent.BUTTON3) {
          displayDetailedChart(data,true);
        }
        return true;
      }
    }
  }
  currentlyHoveringSection=null;
  return false;
}

Fixed version (ground truth):
public boolean doSparklineInteraction(int x,int y,MouseEvent e){
  for (int i=sections.size() - 1; i > -1; i--) {
    Section section=sections.get(i);
    if (section.y0 < y && section.y1 > y) {
      Iterator<Entry<String,SparklineData>> it=section.sparklines.entrySet().iterator();
      while (it.hasNext()) {
        Entry<String,SparklineData> pair=it.next();
        SparklineData data=pair.getValue();
        if (data.ymin < y && data.ymax > y && section.collapsed == false) {
          currentlyHoveringSection=section;
          currentlyHoveringName=pair.getKey();
          System.out.println(currentlyHoveringName);
          if (e.getButton() == MouseEvent.BUTTON1) {
            displayDetailedChart(data,false);
          }
 else           if (e.getButton() == MouseEvent.BUTTON2 || e.getButton() == MouseEvent.BUTTON3) {
            displayDetailedChart(data,true);
          }
          return true;
        }
      }
    }
  }
  currentlyHoveringSection=null;
  System.out.println("String_Node_Str");
  return false;
}
Program: 31201
Project: 31201
Buggy source:
public void setObject(Object o,long utime){
  this.o=o;
  this.utime=utime;
  repaint();
}

Fixed version (ground truth):
public void setObject(Object o,long utime){
  this.o=o;
  this.utime=utime;
  this.updateGraphs=true;
  repaint();
}
Program: 31203
Project: 31203
Buggy source:
public void mouseClicked(MouseEvent e){
  int x=e.getX(), y=e.getY();
  int bestsection=-1;
  for (int i=0; i < sections.size(); i++) {
    Section cs=sections.get(i);
    if (x >= cs.x0 && x <= cs.x1 && y >= cs.y0 && y <= cs.y1) {
      bestsection=i;
    }
  }
  if (bestsection >= 0)   sections.get(bestsection).collapsed^=true;
  repaint();
}

Fixed version (ground truth):
public void mouseClicked(MouseEvent e){
  int x=e.getX(), y=e.getY();
  if (doSparklineInteraction(x,y,true) == true) {
    return;
  }
  int bestsection=-1;
  for (int i=0; i < sections.size(); i++) {
    Section cs=sections.get(i);
    if (x >= cs.x0 && x <= cs.x1 && y >= cs.y0 && y <= cs.y1) {
      bestsection=i;
    }
  }
  if (bestsection >= 0)   sections.get(bestsection).collapsed^=true;
  repaint();
}
Program: 31204
Project: 31204
Buggy source:
public void finish(){
  g.setColor(Color.white);
  g.fillRect(0,y,getWidth(),getHeight());
}

Fixed version (ground truth):
public void finish(){
  g.setColor(Color.white);
  g.fillRect(0,y,getWidth(),getHeight());
  updateGraphs=false;
}
Program: 31205
Project: 31205
Buggy source:
public void mouseMoved(MouseEvent e){
  setSparklineHover(e.getX(),e.getY());
}

Fixed version (ground truth):
public void mouseMoved(MouseEvent e){
  doSparklineInteraction(e.getX(),e.getY(),false);
  repaint();
}
Program: 31207
Project: 31207
Buggy source:
public void setObject(Object o,long utime){
  this.o=o;
  this.utime=utime;
  repaint();
}

Fixed version (ground truth):
public void setObject(Object o,long utime){
  this.o=o;
  this.utime=utime;
  this.updateGraphs=true;
  repaint();
}
Program: 31209
Project: 31209
Buggy source:
public void mouseClicked(MouseEvent e){
  int x=e.getX(), y=e.getY();
  int bestsection=-1;
  for (int i=0; i < sections.size(); i++) {
    Section cs=sections.get(i);
    if (x >= cs.x0 && x <= cs.x1 && y >= cs.y0 && y <= cs.y1) {
      bestsection=i;
    }
  }
  if (bestsection >= 0)   sections.get(bestsection).collapsed^=true;
  repaint();
}

Fixed version (ground truth):
public void mouseClicked(MouseEvent e){
  int x=e.getX(), y=e.getY();
  if (doSparklineInteraction(x,y,true) == true) {
    return;
  }
  int bestsection=-1;
  for (int i=0; i < sections.size(); i++) {
    Section cs=sections.get(i);
    if (x >= cs.x0 && x <= cs.x1 && y >= cs.y0 && y <= cs.y1) {
      bestsection=i;
    }
  }
  if (bestsection >= 0)   sections.get(bestsection).collapsed^=true;
  repaint();
}
Program: 31210
Project: 31210
Buggy source:
public void finish(){
  g.setColor(Color.white);
  g.fillRect(0,y,getWidth(),getHeight());
}

Fixed version (ground truth):
public void finish(){
  g.setColor(Color.white);
  g.fillRect(0,y,getWidth(),getHeight());
  updateGraphs=false;
}
Program: 31211
Project: 31211
Buggy source:
public void mouseMoved(MouseEvent e){
  setSparklineHover(e.getX(),e.getY());
}

Fixed version (ground truth):
public void mouseMoved(MouseEvent e){
  doSparklineInteraction(e.getX(),e.getY(),false);
  repaint();
}
Program: 31215
Project: 31215
Buggy source:
public boolean doSparklineInteraction(int x,int y,MouseEvent e){
  for (  Section section : sections) {
    Iterator<Entry<String,SparklineData>> it=section.sparklines.entrySet().iterator();
    while (it.hasNext()) {
      Entry<String,SparklineData> pair=it.next();
      SparklineData data=pair.getValue();
      if (data.ymin < y && data.ymax > y && section.collapsed == false) {
        currentlyHoveringSection=section;
        currentlyHoveringName=pair.getKey();
        if (e.getButton() == MouseEvent.BUTTON1) {
          displayDetailedChart(data,false);
        }
 else         if (e.getButton() == MouseEvent.BUTTON2 || e.getButton() == MouseEvent.BUTTON3) {
          displayDetailedChart(data,true);
        }
        return true;
      }
    }
  }
  currentlyHoveringSection=null;
  return false;
}

Fixed version (ground truth):
public boolean doSparklineInteraction(int x,int y,MouseEvent e){
  for (int i=sections.size() - 1; i > -1; i--) {
    Section section=sections.get(i);
    if (section.y0 < y && section.y1 > y) {
      Iterator<Entry<String,SparklineData>> it=section.sparklines.entrySet().iterator();
      while (it.hasNext()) {
        Entry<String,SparklineData> pair=it.next();
        SparklineData data=pair.getValue();
        if (data.ymin < y && data.ymax > y && section.collapsed == false) {
          currentlyHoveringSection=section;
          currentlyHoveringName=pair.getKey();
          System.out.println(currentlyHoveringName);
          if (e.getButton() == MouseEvent.BUTTON1) {
            displayDetailedChart(data,false);
          }
 else           if (e.getButton() == MouseEvent.BUTTON2 || e.getButton() == MouseEvent.BUTTON3) {
            displayDetailedChart(data,true);
          }
          return true;
        }
      }
    }
  }
  currentlyHoveringSection=null;
  System.out.println("String_Node_Str");
  return false;
}