nus-yam/ex-repair huggingface dataset:
Program: 180467
Project: 180467
Buggy source:
public GraphPopupMenu(P2PGraphViewer applet,final DefaultModalGraphMouse<P2PVertex,P2PConnection> gm,ActionListener listener){
  this.applet=applet;
  this.gm=gm;
  JMenuItem picking=new JMenuItem("String_Node_Str");
  JMenuItem transforming=new JMenuItem("String_Node_Str");
  JMenuItem kkLayout=new JMenuItem("String_Node_Str");
  JMenuItem frLayout=new JMenuItem("String_Node_Str");
  JMenuItem isomLayout=new JMenuItem("String_Node_Str");
  JMenuItem circleLayout=new JMenuItem("String_Node_Str");
  balloonLayout=new JMenuItem("String_Node_Str");
  treeLayout=new JMenuItem("String_Node_Str");
  picking.addActionListener(listener);
  transforming.addActionListener(listener);
  kkLayout.addActionListener(listener);
  frLayout.addActionListener(listener);
  isomLayout.addActionListener(listener);
  circleLayout.addActionListener(listener);
  balloonLayout.addActionListener(listener);
  treeLayout.addActionListener(listener);
  add("String_Node_Str").setEnabled(false);
  add(picking);
  add(transforming);
  addSeparator();
  add("String_Node_Str").setEnabled(false);
  add(circleLayout);
  add(frLayout);
  add(isomLayout);
  add(kkLayout);
}

Fixed version (ground truth):
public GraphPopupMenu(P2PGraphViewer applet,final DefaultModalGraphMouse<P2PVertex,P2PConnection> gm,ActionListener listener){
  this.applet=applet;
  this.gm=gm;
  JMenuItem picking=new JMenuItem("String_Node_Str");
  JMenuItem transforming=new JMenuItem("String_Node_Str");
  JMenuItem circleLayout=new JMenuItem("String_Node_Str");
  JMenuItem frLayout=new JMenuItem("String_Node_Str");
  JMenuItem isomLayout=new JMenuItem("String_Node_Str");
  JMenuItem kkLayout=new JMenuItem("String_Node_Str");
  JMenuItem springLayout=new JMenuItem("String_Node_Str");
  radialTreeLayout=new JMenuItem("String_Node_Str");
  balloonLayout=new JMenuItem("String_Node_Str");
  treeLayout=new JMenuItem("String_Node_Str");
  treeSeparator=new JMenuItem("String_Node_Str");
  treeSeparator.setEnabled(false);
  picking.addActionListener(listener);
  transforming.addActionListener(listener);
  kkLayout.addActionListener(listener);
  frLayout.addActionListener(listener);
  isomLayout.addActionListener(listener);
  circleLayout.addActionListener(listener);
  springLayout.addActionListener(listener);
  balloonLayout.addActionListener(listener);
  treeLayout.addActionListener(listener);
  radialTreeLayout.addActionListener(listener);
  add("String_Node_Str").setEnabled(false);
  add(picking);
  add(transforming);
  addSeparator();
  add("String_Node_Str").setEnabled(false);
  add(circleLayout);
  add(frLayout);
  add(isomLayout);
  add(kkLayout);
  add(springLayout);
  stopAnimateTimer=new Timer("String_Node_Str",true);
}
Program: 180468
Project: 180468
Buggy source:
/** 
 * @param eventToAdd
 * @param events
 */
private void addEventAtProperTime(LogEvent eventToAdd,List<LogEvent> events){
  if (events.isEmpty()) {
    events.add(0,eventToAdd);
  }
 else {
    ListIterator<LogEvent> li=events.listIterator(events.size());
    int index=events.size();
    while (li.hasPrevious()) {
      LogEvent evt=li.previous();
      index--;
      if (evt.getTime() < eventToAdd.getTime() || index == 0) {
        events.add(index,eventToAdd);
        break;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Helper method places the passed event into the properly sorted position. ensures the event is placed in the proper position in the list (times match up)
 * @param eventToAdd The event to place into the list.
 * @param events The list which the event will be added to
 */
private static void addEventAtProperTime(LogEvent eventToAdd,List<LogEvent> events){
synchronized (events) {
    if (events.isEmpty()) {
      events.add(0,eventToAdd);
    }
 else {
      ListIterator<LogEvent> li=events.listIterator(events.size());
      int index=events.size();
      while (li.hasPrevious()) {
        LogEvent evt=li.previous();
        if (evt.getTime() < eventToAdd.getTime() || index == 0) {
          events.add(index,eventToAdd);
          break;
        }
        index--;
      }
    }
  }
}
Program: 180469
Project: 180469
Buggy source:
/** 
 * Helper method adds an "online" event into the list of LogEvents The method checks to make sure the event is in the proper position in the list (times match up and index does not go out of bounds)
 * @param events		 The list of LogEvents modifying the graph
 * @param timeToAddEvent The time the event takes place
 * @param peerNumber	 The peer to add the event for
 */
private void addPeerOnlineEvent(List<LogEvent> events,long timeToAddEvent,int peerNumber){
  try {
    LogEvent eventToAdd=new LogEvent(timeToAddEvent,"String_Node_Str",peerNumber,0,0);
    addEventAtProperTime(eventToAdd,events);
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Helper method adds an "online" event into the list of LogEvents
 * @param events		 The list of LogEvents modifying the graph
 * @param timeToAddEvent The time the event takes place
 * @param peerNumber	 The peer to add the event for
 */
private static void addPeerOnlineEvent(List<LogEvent> events,long timeToAddEvent,int peerNumber){
  try {
    LogEvent eventToAdd=new LogEvent(timeToAddEvent,"String_Node_Str",peerNumber,0,0);
    addEventAtProperTime(eventToAdd,events);
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
  }
}
Program: 180470
Project: 180470
Buggy source:
/** 
 * Helper method adds a "publish" event into the list of LogEvents The method checks to make sure the event is in the proper position in the list (times match up and index does not go out of bounds)
 * @param events		 The list of LogEvents modifying the graph
 * @param currentIndex	 The index which the current event is located 
 * @param timeToAddEvent The time the event takes place
 * @param peerNumber	 The peer who publishes the document in the event
 * @param documentNumber the Document to be published in the event
 */
private void addDocumentPublish(List<LogEvent> events,long timeToAddEvent,int peerNumber,int documentNumber){
  try {
    LogEvent eventToAdd=new LogEvent(timeToAddEvent,"String_Node_Str",peerNumber,documentNumber,0);
    addEventAtProperTime(eventToAdd,events);
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Helper method adds a "publish" event into the list of LogEvents
 * @param events		 The list of LogEvents modifying the graph
 * @param timeToAddEvent The time the event takes place
 * @param peerNumber	 The peer who publishes the document in the event
 * @param documentNumber the Document to be published in the event
 */
private static void addDocumentPublish(List<LogEvent> events,long timeToAddEvent,int peerNumber,int documentNumber){
  try {
    LogEvent eventToAdd=new LogEvent(timeToAddEvent,"String_Node_Str",peerNumber,documentNumber,0);
    addEventAtProperTime(eventToAdd,events);
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
  }
}
Program: 180471
Project: 180471
Buggy source:
@Override public synchronized void incomingLogEvents(InputStream inStream){
  try {
    eventThread.pause();
    List<LogEvent> events;
synchronized (fullGraph) {
      events=P2PNetworkGraphLoader.buildLogs(inStream,networkClient,fullGraph);
    }
    if (!events.isEmpty()) {
      networkClient.setLatestTime(events.get(events.size() - 1).getTime());
      events.add(LogEvent.getEndEvent(events.get(events.size() - 1)));
      for (int i=0; i < events.size(); i++) {
        fullGraph.robustGraphEvent(events,i);
      }
      eventThread.addEvents(events);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public synchronized void incomingLogEvents(InputStream inStream){
  try {
    eventThread.pause();
    List<LogEvent> events;
synchronized (fullGraph) {
      events=P2PNetworkGraphLoader.buildLogs(inStream,networkClient,fullGraph);
    }
    if (!events.isEmpty()) {
      for (int i=0; i < events.size(); i++) {
        fullGraph.robustGraphEvent(events,i);
      }
      events.add(LogEvent.getEndEvent(events.get(events.size() - 1)));
      eventThread.addEvents(events);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 180472
Project: 180472
Buggy source:
public static P2PNetworkGraphLoader buildGraph(InputStream inStream,HTTPClient client) throws JDOMException, IOException {
  SAXBuilder parser=new SAXBuilder();
  Document doc=parser.build(inStream);
  client.setLatestTime(doc.getRootElement().getAttribute("String_Node_Str").getLongValue());
  P2PNetworkGraphLoader loader=new P2PNetworkGraphLoader();
  loader.logList.add(0,LogEvent.getStartEvent());
  loader.logList.add(LogEvent.getEndEvent(loader.logList.get(loader.logList.size() - 1)));
  loader.graphBuilder(doc);
  return loader;
}

Fixed version (ground truth):
public static P2PNetworkGraphLoader buildGraph(InputStream inStream,HTTPClient client) throws JDOMException, IOException {
  SAXBuilder parser=new SAXBuilder();
  Document doc=parser.build(inStream);
  long currentTime=doc.getRootElement().getAttribute("String_Node_Str").getLongValue();
  client.setZeroTime(currentTime);
  P2PNetworkGraphLoader loader=new P2PNetworkGraphLoader();
  loader.logList.add(0,LogEvent.getStartEvent());
  loader.logList.add(LogEvent.getEndEvent(loader.logList.get(loader.logList.size() - 1)));
  loader.graphBuilder(doc);
  return loader;
}
Program: 180473
Project: 180473
Buggy source:
public static List<LogEvent> buildLogs(InputStream inStream,HTTPClient client,P2PNetworkGraph fullGraph) throws JDOMException, IOException {
  SAXBuilder parser=new SAXBuilder();
  Document doc=parser.build(inStream);
  client.setLatestTime(doc.getRootElement().getAttribute("String_Node_Str").getLongValue());
  P2PNetworkGraphLoader loader=new P2PNetworkGraphLoader();
  loader.fullGraph=fullGraph;
  loader.addEventsToGraph(doc);
  return loader.logList;
}

Fixed version (ground truth):
public static List<LogEvent> buildLogs(InputStream inStream,HTTPClient client,P2PNetworkGraph fullGraph) throws JDOMException, IOException {
  SAXBuilder parser=new SAXBuilder();
  Document doc=parser.build(inStream);
  long requestTime=doc.getRootElement().getAttribute("String_Node_Str").getIntValue();
  long currentTime=doc.getRootElement().getAttribute("String_Node_Str").getLongValue();
  client.setLatestTime(currentTime);
  P2PNetworkGraphLoader loader=new P2PNetworkGraphLoader();
  loader.fullGraph=fullGraph;
  loader.addEventsToGraph(doc,requestTime);
  return loader.logList;
}
Program: 180475
Project: 180475
Buggy source:
public static String saveGraphForWeb(P2PNetworkGraph graph,long simulationTime){
  P2PNetworkGraphSaver saver=new P2PNetworkGraphSaver(graph);
  Document doc=saver.buildDoc();
  doc.getRootElement().setAttribute("String_Node_Str",Long.toString(simulationTime));
  XMLOutputter outputter=new XMLOutputter();
  try {
    return outputter.outputString(doc);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
public static String saveGraphForWeb(P2PNetworkGraph graph,long simulationTime){
  P2PNetworkGraphSaver saver=new P2PNetworkGraphSaver(graph);
  Document doc=saver.buildDoc();
  doc.getRootElement().setAttribute("String_Node_Str",Long.toString(simulationTime));
  XMLOutputter outputter=new XMLOutputter();
  try {
    return outputter.outputString(doc);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return "String_Node_Str" + simulationTime + "String_Node_Str";
}
Program: 180476
Project: 180476
Buggy source:
public static String saveEventsForWeb(List<LogEvent> events,long simulationTime){
  if (!events.isEmpty()) {
    try {
      P2PNetworkGraphSaver saver=new P2PNetworkGraphSaver(events,events.get(0).getTime());
      Document doc=saver.buildDoc();
      doc.getRootElement().setAttribute("String_Node_Str",Long.toString(simulationTime));
      XMLOutputter outputter=new XMLOutputter();
      return outputter.outputString(doc);
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
public static String saveEventsForWeb(List<LogEvent> events,long requestTime,long simulationTime){
  if (!events.isEmpty()) {
    try {
      P2PNetworkGraphSaver saver=new P2PNetworkGraphSaver(events,requestTime);
      Document doc=saver.buildDoc();
      doc.getRootElement().setAttribute("String_Node_Str",Long.toString(requestTime));
      doc.getRootElement().setAttribute("String_Node_Str",Long.toString(simulationTime));
      XMLOutputter outputter=new XMLOutputter();
      return outputter.outputString(doc);
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  return "String_Node_Str" + requestTime + "String_Node_Str"+ simulationTime+ "String_Node_Str";
}
Program: 180477
Project: 180477
Buggy source:
/** 
 * Notify all Listeners that a message has been receieved which contains Log Events.
 * @param inStream InputStream containing the Log Event XML file as it's payload.
 */
protected void notifyIncomingLogEvents(InputStream inStream){
  System.out.println("String_Node_Str");
  for (  NetworkGraphListener l : networkListeners) {
    l.incomingLogEvents(inStream);
  }
}

Fixed version (ground truth):
/** 
 * Notify all Listeners that a message has been receieved which contains Log Events.
 * @param inStream InputStream containing the Log Event XML file as it's payload.
 */
protected void notifyIncomingLogEvents(InputStream inStream){
  for (  NetworkGraphListener l : networkListeners) {
    l.incomingLogEvents(inStream);
  }
}
Program: 180478
Project: 180478
Buggy source:
@Override public void actionPerformed(ActionEvent arg0){
  if (connected) {
    try {
      getLogEvents();
      connected=false;
    }
 catch (    IOException e) {
      connected=false;
      e.printStackTrace();
    }
catch (    Exception e) {
      connected=false;
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent arg0){
  if (connected) {
    try {
      getLogEvents();
    }
 catch (    IOException e) {
      connected=false;
      e.printStackTrace();
    }
catch (    Exception e) {
      connected=false;
      e.printStackTrace();
    }
  }
}
Program: 180479
Project: 180479
Buggy source:
/** 
 * Notify all Listeners that a message has been receieved which contains a Graph.
 * @param inStream InputStream containing the Network Graph XML file as it's payload.
 */
protected void notifyIncomingGraph(InputStream inStream){
  System.out.println("String_Node_Str");
  for (  NetworkGraphListener l : networkListeners) {
    l.incomingGraph(inStream);
  }
}

Fixed version (ground truth):
/** 
 * Notify all Listeners that a message has been receieved which contains a Graph.
 * @param inStream InputStream containing the Network Graph XML file as it's payload.
 */
protected void notifyIncomingGraph(InputStream inStream){
  for (  NetworkGraphListener l : networkListeners) {
    l.incomingGraph(inStream);
  }
}
Program: 180480
Project: 180480
Buggy source:
@Override public synchronized void incomingLogEvents(InputStream inStream){
  try {
    eventThread.pause();
    List<LogEvent> events;
synchronized (graph.getReferenceGraph()) {
      events=P2PNetworkGraphLoader.buildLogs(inStream,networkClient,graph);
    }
    if (!events.isEmpty()) {
      for (int i=0; i < events.size(); i++) {
        graph.getReferenceGraph().robustGraphEvent(events,i);
      }
      events.add(LogEvent.getEndEvent(events.get(events.size() - 1)));
      eventThread.addEvents(events);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public synchronized void incomingLogEvents(InputStream inStream){
  try {
    List<LogEvent> events;
synchronized (graph.getReferenceGraph()) {
      events=P2PNetworkGraphLoader.buildLogs(inStream,networkClient,graph);
    }
    if (!events.isEmpty()) {
      for (int i=0; i < events.size(); i++) {
        graph.getReferenceGraph().robustGraphEvent(events,i);
      }
      events.add(LogEvent.getEndEvent(events.get(events.size() - 1)));
      eventThread.addEvents(events);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 180481
Project: 180481
Buggy source:
@Override public void doRepaint(){
  fullViewViewer.repaint();
  collapsedDocumentViewViewer.repaint();
  collapsedPeerViewViewer.repaint();
  collapsedPeerAndDocumentViewViewer.repaint();
}

Fixed version (ground truth):
@Override public void doRepaint(){
  currentViewer.repaint();
}
Program: 180482
Project: 180482
Buggy source:
public void startNetwork(String serverURL){
  this.serverURL=serverURL;
  try {
    getGraph();
    connected=true;
  }
 catch (  Exception e) {
    connected=false;
    JOptionPane.showMessageDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE);
  }
  if (connected) {
    networkScheduler.start();
  }
}

Fixed version (ground truth):
public void startNetwork(String serverURL){
  this.serverURL=serverURL;
  Thread starterThread=new Thread(new Runnable(){
    @Override public void run(){
      try {
        getGraph();
        connected=true;
      }
 catch (      Exception e) {
        connected=false;
        JOptionPane.showMessageDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE);
      }
      if (connected) {
        networkScheduler.start();
      }
    }
  }
);
  starterThread.start();
}
Program: 180483
Project: 180483
Buggy source:
public EventPlayer(ReferencedNetworkGraph graph){
  this.graph=graph;
  this.playbackSlider=null;
  myEventList=new ArrayList<LogEvent>();
  current_index=0;
  state=PlayState.PAUSE;
  timeCounter=new TimeCounter(0,0,0,0);
  my_listeners=new LinkedList<EventPlayerListener>();
  playable=false;
}

Fixed version (ground truth):
public EventPlayer(ReferencedNetworkGraph graph){
  this.graph=graph;
  this.playbackSlider=null;
  myEventList=new ArrayList<LogEvent>();
  current_index=0;
  state=PlayState.PAUSE;
  prevState=PlayState.PAUSE;
  timeCounter=new TimeCounter(0,0,0,0);
  my_listeners=new LinkedList<EventPlayerListener>();
  playable=false;
}
Program: 180484
Project: 180484
Buggy source:
public synchronized void addEvents(List<LogEvent> events){
  myEventList.remove(myEventList.size() - 1);
  myEventList.addAll(events);
  playbackSlider.setMaximum((int)myEventList.get(myEventList.size() - 1).getTime());
  timeCounter.setUpperBound(myEventList.get(myEventList.size() - 1).getTime());
}

Fixed version (ground truth):
public synchronized void addEvents(List<LogEvent> events){
  myEventList.remove(myEventList.size() - 1);
  myEventList.addAll(events);
  playbackSlider.setMaximum((int)myEventList.get(myEventList.size() - 1).getTime());
  timeCounter.setUpperBound(myEventList.get(myEventList.size() - 1).getTime());
  if (state.equals(PlayState.PAUSE)) {
    for (    EventPlayerListener epl : my_listeners) {
      epl.playbackPause();
    }
  }
}
Program: 180485
Project: 180485
Buggy source:
/** 
 */
public void fastReverse(){
  for (  EventPlayerListener epl : my_listeners) {
    epl.playbackFastReverse();
  }
  if (state != PlayState.FASTREVERSE) {
    PlayState prevState=state;
    state=PlayState.FASTREVERSE;
    timeCounter.setIncrement(-speed * fastMultiplier);
    wakeup(prevState);
  }
}

Fixed version (ground truth):
/** 
 */
public void fastReverse(){
  for (  EventPlayerListener epl : my_listeners) {
    epl.playbackFastReverse();
  }
  if (state != PlayState.FASTREVERSE) {
    prevState=state;
    state=PlayState.FASTREVERSE;
    timeCounter.setIncrement(-speed * fastMultiplier);
    wakeup(prevState);
  }
}
Program: 180486
Project: 180486
Buggy source:
public void forward(){
  for (  EventPlayerListener epl : my_listeners) {
    epl.playbackForward();
  }
  if (state != PlayState.FORWARD) {
    PlayState prevState=state;
    state=PlayState.FORWARD;
    timeCounter.setIncrement(speed);
    wakeup(prevState);
  }
}

Fixed version (ground truth):
public void forward(){
  for (  EventPlayerListener epl : my_listeners) {
    epl.playbackForward();
  }
  if (state != PlayState.FORWARD) {
    prevState=state;
    state=PlayState.FORWARD;
    timeCounter.setIncrement(speed);
    wakeup(prevState);
  }
}
Program: 180487
Project: 180487
Buggy source:
public void reverse(){
  for (  EventPlayerListener epl : my_listeners) {
    epl.playbackReverse();
  }
  if (state != PlayState.REVERSE) {
    PlayState prevState=state;
    state=PlayState.REVERSE;
    timeCounter.setIncrement(-speed);
    wakeup(prevState);
  }
}

Fixed version (ground truth):
public void reverse(){
  for (  EventPlayerListener epl : my_listeners) {
    epl.playbackReverse();
  }
  if (state != PlayState.REVERSE) {
    prevState=state;
    state=PlayState.REVERSE;
    timeCounter.setIncrement(-speed);
    wakeup(prevState);
  }
}
Program: 180488
Project: 180488
Buggy source:
public synchronized void pause(){
  for (  EventPlayerListener epl : my_listeners) {
    epl.playbackPause();
  }
  if (state != PlayState.PAUSE) {
    state=PlayState.PAUSE;
    notify();
  }
}

Fixed version (ground truth):
public synchronized void pause(){
  for (  EventPlayerListener epl : my_listeners) {
    epl.playbackPause();
  }
  if (state != PlayState.PAUSE) {
    prevState=state;
    state=PlayState.PAUSE;
    notify();
  }
}
Program: 180491
Project: 180491
Buggy source:
@Override public void stateChanged(ChangeEvent ce){
  JSlider source=(JSlider)ce.getSource();
  eventthread.schedule.stop();
  eventthread.goToTime(source.getValue());
}

Fixed version (ground truth):
@Override public void stateChanged(ChangeEvent ce){
  JSlider source=(JSlider)ce.getSource();
  eventthread.goToTime(source.getValue());
}
Program: 180492
Project: 180492
Buggy source:
public void run(){
  long myTimeNow=0L;
  long nextTime;
  boolean oldDirection;
  schedule=new Timer(speed,timeCounter);
  schedule.start();
  while (playing) {
    if (timeCounter.getTime() == myTimeNow) {
      try {
        Thread.sleep(20);
        continue;
      }
 catch (      InterruptedException e) {
      }
    }
    if (state != PlayState.PAUSE && !playbackSlider.getValueIsAdjusting()) {
      nextTime=timeCounter.getTime();
      oldDirection=isForward();
      if (atAnEnd()) {
        pauseButton.doClick();
      }
      for (      LogEvent evt : getLogEventsUntil(nextTime)) {
        if (oldDirection == isForward()) {
          handleLogEvent(evt);
        }
 else {
          break;
        }
      }
      myTimeNow=nextTime;
      playbackSlider.setValue((int)myTimeNow);
      vv.repaint();
    }
 else {
      try {
synchronized (this) {
          while (state == PlayState.PAUSE) {
            wait();
          }
        }
      }
 catch (      InterruptedException e) {
      }
    }
  }
}

Fixed version (ground truth):
public void run(){
  long myTimeNow=0L;
  long nextTime;
  boolean oldDirection;
  schedule=new Timer(speed,timeCounter);
  schedule.start();
  while (playing) {
    if (timeCounter.getTime() == myTimeNow) {
      try {
        Thread.sleep(20);
        continue;
      }
 catch (      InterruptedException e) {
      }
    }
    if (state != PlayState.PAUSE && !playbackSlider.getValueIsAdjusting()) {
      nextTime=timeCounter.getTime();
      oldDirection=isForward();
      if (atAnEnd()) {
        pause();
      }
      for (      LogEvent evt : getLogEventsUntil(nextTime)) {
        if (oldDirection == isForward()) {
          handleLogEvent(evt);
        }
 else {
          break;
        }
      }
      myTimeNow=nextTime;
      playbackSlider.setValue((int)myTimeNow);
      vv.repaint();
    }
 else {
      try {
synchronized (this) {
          while (state == PlayState.PAUSE) {
            wait();
          }
        }
      }
 catch (      InterruptedException e) {
      }
    }
  }
}
Program: 180493
Project: 180493
Buggy source:
private synchronized void wakeup(PlayState previousState){
  if (this.getState().equals(Thread.State.TIMED_WAITING)) {
    interrupt();
  }
  if (previousState == PlayState.PAUSE) {
    schedule.start();
    notify();
  }
}

Fixed version (ground truth):
private synchronized void wakeup(PlayState previousState){
  if (previousState == PlayState.PAUSE) {
    if (atAnEnd()) {
      timeCounter.doIncrement();
    }
    schedule.start();
    notify();
  }
  if (this.getState().equals(Thread.State.TIMED_WAITING)) {
    interrupt();
  }
}
Program: 180494
Project: 180494
Buggy source:
public void fastForward(){
  if (state != PlayState.FASTFORWARD) {
    fastReverseButton.setEnabled(true);
    reverseButton.setEnabled(true);
    pauseButton.setEnabled(true);
    forwardButton.setEnabled(true);
    fastforwardButton.setEnabled(false);
    PlayState prevState=state;
    state=PlayState.FASTFORWARD;
    wakeup(prevState);
    timeCounter.setIncrement(speed * ffMultiplier);
  }
}

Fixed version (ground truth):
public void fastForward(){
  if (state != PlayState.FASTFORWARD) {
    fastReverseButton.setEnabled(true);
    reverseButton.setEnabled(true);
    pauseButton.setEnabled(true);
    forwardButton.setEnabled(true);
    fastforwardButton.setEnabled(false);
    PlayState prevState=state;
    state=PlayState.FASTFORWARD;
    timeCounter.setIncrement(speed * ffMultiplier);
    wakeup(prevState);
  }
}
Program: 180495
Project: 180495
Buggy source:
/** 
 */
public void fastReverse(){
  if (state != PlayState.FASTREVERSE) {
    fastReverseButton.setEnabled(false);
    reverseButton.setEnabled(true);
    pauseButton.setEnabled(true);
    forwardButton.setEnabled(true);
    fastforwardButton.setEnabled(true);
    PlayState prevState=state;
    state=PlayState.FASTREVERSE;
    wakeup(prevState);
    timeCounter.setIncrement(-speed * ffMultiplier);
  }
}

Fixed version (ground truth):
/** 
 */
public void fastReverse(){
  if (state != PlayState.FASTREVERSE) {
    fastReverseButton.setEnabled(false);
    reverseButton.setEnabled(true);
    pauseButton.setEnabled(true);
    forwardButton.setEnabled(true);
    fastforwardButton.setEnabled(true);
    PlayState prevState=state;
    state=PlayState.FASTREVERSE;
    timeCounter.setIncrement(-speed * ffMultiplier);
    wakeup(prevState);
  }
}
Program: 180496
Project: 180496
Buggy source:
public void forward(){
  if (state != PlayState.FORWARD) {
    fastReverseButton.setEnabled(true);
    reverseButton.setEnabled(true);
    pauseButton.setEnabled(true);
    forwardButton.setEnabled(false);
    fastforwardButton.setEnabled(true);
    PlayState prevState=state;
    state=PlayState.FORWARD;
    wakeup(prevState);
    timeCounter.setIncrement(speed);
  }
}

Fixed version (ground truth):
public void forward(){
  if (state != PlayState.FORWARD) {
    fastReverseButton.setEnabled(true);
    reverseButton.setEnabled(true);
    pauseButton.setEnabled(true);
    forwardButton.setEnabled(false);
    fastforwardButton.setEnabled(true);
    PlayState prevState=state;
    state=PlayState.FORWARD;
    timeCounter.setIncrement(speed);
    wakeup(prevState);
  }
}
Program: 180497
Project: 180497
Buggy source:
public void reverse(){
  if (state != PlayState.REVERSE) {
    fastReverseButton.setEnabled(true);
    reverseButton.setEnabled(false);
    pauseButton.setEnabled(true);
    forwardButton.setEnabled(true);
    fastforwardButton.setEnabled(true);
    PlayState prevState=state;
    state=PlayState.REVERSE;
    wakeup(prevState);
    timeCounter.setIncrement(-speed);
  }
}

Fixed version (ground truth):
public void reverse(){
  if (state != PlayState.REVERSE) {
    fastReverseButton.setEnabled(true);
    reverseButton.setEnabled(false);
    pauseButton.setEnabled(true);
    forwardButton.setEnabled(true);
    fastforwardButton.setEnabled(true);
    PlayState prevState=state;
    state=PlayState.REVERSE;
    timeCounter.setIncrement(-speed);
    wakeup(prevState);
  }
}
Program: 180498
Project: 180498
Buggy source:
public String toString(){
  return (time + "String_Node_Str" + type+ "String_Node_Str"+ param1+ "String_Node_Str"+ param2+ "String_Node_Str");
}

Fixed version (ground truth):
@Override public String toString(){
  return (time + "String_Node_Str" + type+ "String_Node_Str"+ param1+ "String_Node_Str"+ param2+ "String_Node_Str");
}
Program: 180499
Project: 180499
Buggy source:
@Override public void mousePressed(MouseEvent arg0){
  prevState=eventthread.state;
  pauseButton.doClick();
}

Fixed version (ground truth):
@Override public void mousePressed(MouseEvent arg0){
  prevState=eventthread.state;
  eventthread.pause();
}
Program: 180500
Project: 180500
Buggy source:
public synchronized void pause(){
  if (state != PlayState.PAUSE) {
    if (eventthread.atFront()) {
      fastReverseButton.setEnabled(false);
      reverseButton.setEnabled(false);
    }
 else {
      fastReverseButton.setEnabled(true);
      reverseButton.setEnabled(true);
    }
    pauseButton.setEnabled(false);
    if (eventthread.atBack()) {
      forwardButton.setEnabled(false);
      fastforwardButton.setEnabled(false);
    }
 else {
      forwardButton.setEnabled(true);
      fastforwardButton.setEnabled(true);
    }
    state=PlayState.PAUSE;
    notify();
    schedule.stop();
    vv.repaint();
  }
}

Fixed version (ground truth):
public synchronized void pause(){
  if (eventthread.atFront()) {
    fastReverseButton.setEnabled(false);
    reverseButton.setEnabled(false);
  }
 else {
    fastReverseButton.setEnabled(true);
    reverseButton.setEnabled(true);
  }
  pauseButton.setEnabled(false);
  if (eventthread.atBack()) {
    forwardButton.setEnabled(false);
    fastforwardButton.setEnabled(false);
  }
 else {
    forwardButton.setEnabled(true);
    fastforwardButton.setEnabled(true);
  }
  if (state != PlayState.PAUSE) {
    state=PlayState.PAUSE;
    notify();
    schedule.stop();
    vv.repaint();
  }
}
Program: 180501
Project: 180501
Buggy source:
@Override public void mouseReleased(MouseEvent arg0){
  if (prevState == PlayState.FASTREVERSE) {
    fastReverseButton.doClick();
  }
 else   if (prevState == PlayState.REVERSE) {
    reverseButton.doClick();
  }
 else   if (prevState == PlayState.FORWARD) {
    forwardButton.doClick();
  }
 else   if (prevState == PlayState.FASTFORWARD) {
    fastforwardButton.doClick();
  }
}

Fixed version (ground truth):
@Override public void mouseReleased(MouseEvent arg0){
  if (prevState == PlayState.FASTREVERSE) {
    eventthread.fastReverse();
  }
 else   if (prevState == PlayState.REVERSE) {
    eventthread.reverse();
  }
 else   if (prevState == PlayState.FORWARD) {
    eventthread.forward();
  }
 else   if (prevState == PlayState.FASTFORWARD) {
    eventthread.fastForward();
  }
 else   if (prevState == PlayState.PAUSE) {
    eventthread.pause();
  }
}
Program: 180502
Project: 180502
Buggy source:
public void goToTime(int value){
  PlayState prevState=state;
  if (value < timeCounter.getTime()) {
    state=PlayState.REVERSE;
  }
 else {
    state=PlayState.FORWARD;
  }
  for (  LogEvent evt : getLogEventsUntil(value)) {
    handleLogEvent(evt);
  }
  vv.repaint();
  timeCounter.setTime(value);
  wakeup(prevState);
  state=prevState;
  schedule.start();
}

Fixed version (ground truth):
public void goToTime(int value){
  PlayState prevState=state;
  if (value < timeCounter.getTime()) {
    state=PlayState.REVERSE;
  }
 else {
    state=PlayState.FORWARD;
  }
  for (  LogEvent evt : getLogEventsUntil(value)) {
    handleLogEvent(evt);
  }
  vv.repaint();
  timeCounter.setTime(value);
  state=prevState;
}
Program: 180503
Project: 180503
Buggy source:
public static RemoteViews buildView(int appWidgetId) throws ServiceUnavailableException, ParsingError {
  Document doc;
  try {
    FileInputStream inputStream=MyApp.getContext().openFileInput("String_Node_Str" + appWidgetId);
    doc=Jsoup.parse(inputStream,"String_Node_Str","String_Node_Str");
  }
 catch (  Exception e) {
    throw new Error(e);
  }
  List<String> sectionLabels=getSectionLabels(doc);
  if (!doc.select("String_Node_Str").isEmpty()) {
    throw new ServiceUnavailableException();
  }
  if (!doc.select("String_Node_Str").isEmpty()) {
    throw new ServiceUnavailableException();
  }
  if (sectionLabels.equals(Arrays.asList(new String[]{"String_Node_Str"}))) {
    return callingCardView(doc);
  }
 else   if (sectionLabels.equals(Arrays.asList(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"}))) {
    return smartPhoneView(doc);
  }
 else {
    throw new ParsingError("String_Node_Str");
  }
}

Fixed version (ground truth):
public static RemoteViews buildView(int appWidgetId) throws ServiceUnavailableException, ParsingError {
  Document doc;
  try {
    FileInputStream inputStream=MyApp.getContext().openFileInput("String_Node_Str" + appWidgetId);
    doc=Jsoup.parse(inputStream,"String_Node_Str","String_Node_Str");
  }
 catch (  Exception e) {
    throw new Error(e);
  }
  List<String> sectionLabels=getSectionLabels(doc);
  if (!doc.select("String_Node_Str").isEmpty()) {
    throw new ServiceUnavailableException();
  }
  if (!doc.select("String_Node_Str").isEmpty()) {
    throw new ServiceUnavailableException();
  }
  if (sectionLabels.equals(Arrays.asList(new String[]{"String_Node_Str"}))) {
    return callingCardView(doc);
  }
 else   if (sectionLabels.equals(Arrays.asList(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"}))) {
    return smartPhoneView(doc);
  }
 else   if (sectionLabels.equals(Arrays.asList(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"}))) {
    return smartPhoneView(doc);
  }
 else {
    throw new ParsingError("String_Node_Str");
  }
}
Program: 180504
Project: 180504
Buggy source:
private void showScraperState(){
switch (scraperThread.result) {
case SCRAPE_IN_PROGRESS:
    if (progressDialog == null) {
      progressDialog=ProgressDialog.show(this,null,getString(R.string.configure_loading));
    }
  break;
case SCRAPE_COMPLETE:
dismissDialogs();
if (scraperThread.subscribers != null) {
if (pickSubscriberDialog == null) {
  final String[] phoneNumbers=scraperThread.subscribers;
  pickSubscriberDialog=new AlertDialog.Builder(this).setTitle(R.string.pick_phone_number).setCancelable(false).setItems(phoneNumbers,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int item){
      PreferencesData preferences=TelusWidgetPreferences.getPreferences(appWidgetId);
      preferences.subscriber=phoneNumbers[item];
      preferences.lastUpdateTime=-1;
      preferences.save();
      scraperThreadsMap.remove(appWidgetId);
      finishOk();
    }
  }
).show();
}
}
 else {
finishOk();
}
break;
case SCRAPE_ERROR:
dismissDialogs();
if (errorDialog == null) {
errorDialog=new AlertDialog.Builder(this).setTitle(R.string.unable_to_add_widget).setMessage(scraperThread.errorMessageId).setCancelable(false).setPositiveButton(R.string.okay,new AlertDialog.OnClickListener(){
public void onClick(DialogInterface dialog,int which){
TelusWidgetPreferences.deletePreferences(appWidgetId);
scraperThreadsMap.remove(appWidgetId);
dismissDialogs();
}
}
).show();
}
break;
}
}

Fixed version (ground truth):
private void showScraperState(){
}
Program: 180505
Project: 180505
Buggy source:
@Override public void handleMessage(Message msg){
  if (scraperThread.result == SCRAPE_PARSING_ERROR) {
    Intent intent=new Intent(ConfigureActivity.this,ReportAccountErrorActivity.class);
    intent.setAction(getPackageName() + "String_Node_Str");
    intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,appWidgetId);
    startActivity(intent);
  }
 else {
    showScraperState();
  }
}

Fixed version (ground truth):
public void handleMessage(Message msg){
  if (!isFinishing()) {
    showScraperState();
  }
}
Program: 180506
Project: 180506
Buggy source:
@Override public void run(){
  int r=SCRAPE_COMPLETE;
  try {
    TelusReportFetcher.retriveUsageSummaryData(appWidgetId);
    subscribers=ReportParser.subscribers(appWidgetId);
  }
 catch (  TelusReportFetcher.InvalidCredentialsException e) {
    r=SCRAPE_ERROR;
    errorMessageId=R.string.invalid_credentials;
  }
catch (  TelusReportFetcher.NetworkErrorException e) {
    r=SCRAPE_ERROR;
    errorMessageId=R.string.network_error;
  }
catch (  ReportParser.ServiceUnavailableException e) {
    r=SCRAPE_ERROR;
    errorMessageId=R.string.widget_service_unavailable;
  }
catch (  ReportParser.ParsingError e) {
    r=SCRAPE_PARSING_ERROR;
  }
  result=r;
  Handler handler=scraperCompletedHandler;
  if (handler != null)   handler.sendEmptyMessage(0);
}

Fixed version (ground truth):
@Override public void run(){
  ScrapeResult r=ScrapeResult.COMPLETE;
  try {
    TelusReportFetcher.retriveUsageSummaryData(appWidgetId);
    subscribers=ReportParser.subscribers(appWidgetId);
  }
 catch (  TelusReportFetcher.InvalidCredentialsException e) {
    r=ScrapeResult.ERROR;
    errorMessageId=R.string.invalid_credentials;
  }
catch (  TelusReportFetcher.NetworkErrorException e) {
    r=ScrapeResult.ERROR;
    errorMessageId=R.string.network_error;
  }
catch (  ReportParser.ServiceUnavailableException e) {
    r=ScrapeResult.ERROR;
    errorMessageId=R.string.widget_service_unavailable;
  }
catch (  ReportParser.ParsingError e) {
    r=ScrapeResult.PARSING_ERROR;
  }
  result=r;
  Handler handler=scraperCompletedHandler;
  if (handler != null)   handler.sendEmptyMessage(0);
}
Program: 180507
Project: 180507
Buggy source:
private void registerScraperCompletedHandler(){
  Handler handler=new Handler(){
    @Override public void handleMessage(    Message msg){
      if (scraperThread.result == SCRAPE_PARSING_ERROR) {
        Intent intent=new Intent(ConfigureActivity.this,ReportAccountErrorActivity.class);
        intent.setAction(getPackageName() + "String_Node_Str");
        intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,appWidgetId);
        startActivity(intent);
      }
 else {
        showScraperState();
      }
    }
  }
;
  scraperThread.scraperCompletedHandler=handler;
}

Fixed version (ground truth):
private void registerScraperCompletedHandler(){
  Handler handler=new Handler(){
    public void handleMessage(    Message msg){
      if (!isFinishing()) {
        showScraperState();
      }
    }
  }
;
  scraperThread.scraperCompletedHandler=handler;
}
Program: 180508
Project: 180508
Buggy source:
@Override public void handleMessage(Message msg){
  showPostState();
}

Fixed version (ground truth):
public void handleMessage(Message msg){
  if (!isFinishing()) {
    showPostState();
  }
}
Program: 180509
Project: 180509
Buggy source:
@Override public void run(){
  String url="String_Node_Str" + "String_Node_Str" + MyApp.getVersionCode();
  final DefaultHttpClient httpclient=new DefaultHttpClient();
  HttpPost httpPost=new HttpPost(url);
  httpPost.setEntity(new InputStreamEntity(dataStream,-1));
  int r=POST_COMPLETE;
  try {
    httpclient.execute(httpPost);
  }
 catch (  Exception e) {
    r=POST_ERROR;
  }
  result=r;
  Handler handler=postCompletedHandler;
  if (handler != null)   handler.sendEmptyMessage(0);
}

Fixed version (ground truth):
@Override public void run(){
  String url="String_Node_Str" + "String_Node_Str" + MyApp.getVersionCode();
  final DefaultHttpClient httpclient=new DefaultHttpClient();
  HttpPost httpPost=new HttpPost(url);
  httpPost.setEntity(new InputStreamEntity(dataStream,-1));
  PostResult r=PostResult.COMPLETE;
  try {
    httpclient.execute(httpPost);
  }
 catch (  Exception e) {
    r=PostResult.ERROR;
  }
  result=r;
  Handler handler=postCompletedHandler;
  if (handler != null)   handler.sendEmptyMessage(0);
}
Program: 180510
Project: 180510
Buggy source:
private void showPostState(){
switch (postDataThread.result) {
case POST_IN_PROGRESS:
    if (progressDialog == null) {
      progressDialog=ProgressDialog.show(this,null,getString(R.string.sending_data));
    }
  break;
case POST_COMPLETE:
dismissDialogs();
if (completeDialog == null) {
completeDialog=new AlertDialog.Builder(this).setMessage(R.string.report_sent).setCancelable(false).setPositiveButton(R.string.okay,new AlertDialog.OnClickListener(){
  public void onClick(  DialogInterface dialog,  int which){
    postDataThreadsMap.remove(appWidgetId);
    finish();
  }
}
).show();
}
break;
case POST_ERROR:
dismissDialogs();
if (errorDialog == null) {
errorDialog=new AlertDialog.Builder(this).setMessage(R.string.unable_to_send_data).setCancelable(false).setPositiveButton(R.string.okay,new AlertDialog.OnClickListener(){
public void onClick(DialogInterface dialog,int which){
postDataThreadsMap.remove(appWidgetId);
dismissDialogs();
}
}
).show();
}
break;
}
}

Fixed version (ground truth):
private void showPostState(){
}
Program: 180511
Project: 180511
Buggy source:
private void registerPostCompletedHandler(){
  Handler handler=new Handler(){
    @Override public void handleMessage(    Message msg){
      showPostState();
    }
  }
;
  postDataThread.postCompletedHandler=handler;
}

Fixed version (ground truth):
private void registerPostCompletedHandler(){
  Handler handler=new Handler(){
    public void handleMessage(    Message msg){
      if (!isFinishing()) {
        showPostState();
      }
    }
  }
;
  postDataThread.postCompletedHandler=handler;
}
Program: 180512
Project: 180512
Buggy source:
private RemoteViews networkErrorRemoteViews(PreferencesData prefData){
  RemoteViews updateViews=new RemoteViews(getPackageName(),R.layout.widget_network_error);
  Intent defineIntent=new Intent(this,TelusWidgetUpdateService.class);
  defineIntent.setAction(ACTION_UPDATE_WIDGET);
  defineIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,prefData.appWidgetId);
  PendingIntent pendingIntent=PendingIntent.getService(this,prefData.appWidgetId,defineIntent,PendingIntent.FLAG_UPDATE_CURRENT);
  updateViews.setOnClickPendingIntent(R.id.widget,pendingIntent);
  return updateViews;
}

Fixed version (ground truth):
private RemoteViews networkErrorRemoteViews(PreferencesData prefData){
  RemoteViews updateViews=new RemoteViews(getPackageName(),R.layout.widget_network_error);
  Intent defineIntent=new Intent(this,TelusWidgetProvider.class);
  defineIntent.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
  defineIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS,new int[]{prefData.appWidgetId});
  PendingIntent pendingIntent=PendingIntent.getBroadcast(this,prefData.appWidgetId,defineIntent,PendingIntent.FLAG_UPDATE_CURRENT);
  updateViews.setOnClickPendingIntent(R.id.widget,pendingIntent);
  return updateViews;
}
Program: 180513
Project: 180513
Buggy source:
public void run(){
  try {
    updateWidget(appWidgetId);
    stopSelf(startId);
  }
  finally {
    widgetThreads.remove(appWidgetId);
    wakeLock.release();
  }
}

Fixed version (ground truth):
public void run(){
  try {
    updateWidget(appWidgetId);
synchronized (TelusWidgetUpdateService.this) {
      taskCount--;
      if (taskCount == 0)       stopSelf(lastTaskId);
    }
  }
  finally {
synchronized (TelusWidgetUpdateService.this) {
      widgetThreads.remove(appWidgetId);
    }
    wakeLock.release();
  }
}
Program: 180514
Project: 180514
Buggy source:
@Override public void onStart(Intent intent,final int startId){
  if (!intent.getAction().equals(ACTION_UPDATE_WIDGET)) {
    stopSelf(startId);
    return;
  }
  Bundle extra=intent.getExtras();
  final int appWidgetId=extra.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID);
  Thread thread=new Thread(TelusWidgetUpdateService.class.toString() + appWidgetId){
    public void run(){
      try {
        updateWidget(appWidgetId);
        stopSelf(startId);
      }
  finally {
        widgetThreads.remove(appWidgetId);
        wakeLock.release();
      }
    }
  }
;
  Thread previousThread=widgetThreads.putIfAbsent(appWidgetId,thread);
  if (previousThread == null) {
    thread.start();
  }
}

Fixed version (ground truth):
@Override public void onStart(Intent intent,final int startId){
  if (!intent.getAction().equals(ACTION_UPDATE_WIDGET)) {
    stopSelf(startId);
    return;
  }
  Bundle extra=intent.getExtras();
  final int appWidgetId=extra.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID);
synchronized (this) {
    lastTaskId=startId;
    if (!widgetThreads.containsKey(appWidgetId)) {
      Thread thread=createWidgetThread(appWidgetId);
      widgetThreads.put(appWidgetId,thread);
      taskCount++;
      thread.start();
    }
  }
}
Program: 180515
Project: 180515
Buggy source:
private String extract8ASignature(){
  String s1=extractCharacters(a_topline,a_downline,"String_Node_Str",new int[]{12,15,16});
  String s2=extractCharacters(a_topline,a_downline,"String_Node_Str",new int[]{3,8,9,10,11,12,13,14,17});
  String s3=extractCharacters(a_topline,a_downline,"String_Node_Str",new int[]{4,5});
  String s4=extractCharacters(a_topline,a_downline,"String_Node_Str",new int[]{4,5,6,7,8});
  String s5=extractCharacters(a_topline,a_downline,"String_Node_Str",new int[]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15});
  return s1 + s2 + s3+ s4+ s5;
}

Fixed version (ground truth):
private String extract8ASignature() throws Exception {
  String s1=extractCharacters(a_topline,a_downline,"String_Node_Str",new int[]{12,15,16});
  String s2=extractCharacters(a_topline,a_downline,"String_Node_Str",new int[]{3,8,9,10,11,12,13,14,17});
  String s3=extractCharacters(a_topline,a_downline,"String_Node_Str",new int[]{4,5});
  String s4=extractCharacters(a_topline,a_downline,"String_Node_Str",new int[]{4,5,6,7,8});
  String s5=extractCharacters(a_topline,a_downline,"String_Node_Str",new int[]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15});
  return s1 + s2 + s3+ s4+ s5;
}
Program: 180516
Project: 180516
Buggy source:
public String getStachelhausCode(){
  return this.sigstach;
}

Fixed version (ground truth):
public String getStachelhausCode() throws Exception {
  return extractStachelhausSignature();
}
Program: 180517
Project: 180517
Buggy source:
public void run(){
  removeToplineIndels();
  sig8a=extract8ASignature();
  sigstach=extractStachelhausSignature();
}

Fixed version (ground truth):
public void run(){
  removeToplineIndels();
}
Program: 180518
Project: 180518
Buggy source:
public static void main(String[] args){
  ADomSigExtractor e=new ADomSigExtractor();
  e.setADomainTopline("String_Node_Str");
  e.setADomainDownline("String_Node_Str");
  e.setLysDomainTopline("String_Node_Str");
  e.setLysDomainDownline("String_Node_Str");
  e.run();
  System.out.println(e.get8ASignature());
  System.out.println(e.getStachelhausCode());
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  ADomSigExtractor e=new ADomSigExtractor();
  e.setADomainTopline("String_Node_Str");
  e.setADomainDownline("String_Node_Str");
  e.setLysDomainTopline("String_Node_Str");
  e.setLysDomainDownline("String_Node_Str");
  e.run();
  System.out.println(e.get8ASignature());
  System.out.println(e.getStachelhausCode());
}
Program: 180519
Project: 180519
Buggy source:
private String extractStachelhausSignature(){
  String s2=extractCharacters(a_topline,a_downline,"String_Node_Str",new int[]{9,10,13});
  String s3=extractCharacters(a_topline,a_downline,"String_Node_Str",new int[]{4});
  String s4=extractCharacters(a_topline,a_downline,"String_Node_Str",new int[]{4,6});
  String s5=extractCharacters(a_topline,a_downline,"String_Node_Str",new int[]{3,11,12});
  String s6=extractCharacters(lys_topline,lys_downline,"String_Node_Str",new int[]{13});
  return s2 + s3 + s4+ s5+ (s6.equals("String_Node_Str") ? "String_Node_Str" : s6);
}

Fixed version (ground truth):
private String extractStachelhausSignature() throws Exception {
  String s2=extractCharacters(a_topline,a_downline,"String_Node_Str",new int[]{9,10,13});
  String s3=extractCharacters(a_topline,a_downline,"String_Node_Str",new int[]{4});
  String s4=extractCharacters(a_topline,a_downline,"String_Node_Str",new int[]{4,6});
  String s5=extractCharacters(a_topline,a_downline,"String_Node_Str",new int[]{3,11,12});
  String s6="String_Node_Str";
  if (!lys_topline.equals("String_Node_Str"))   s6=extractCharacters(lys_topline,lys_downline,"String_Node_Str",new int[]{13});
  return s2 + s3 + s4+ s5+ s6;
}