nus-yam/ex-repair huggingface dataset:
Program: 24493
Project: 24493
Buggy source:
@Override public SortedSet<IDrawingPrimitiveController> findIntersectingNodes(IConvexHull queryHull,IDrawingPrimitiveController queryNode){
  SortedSet<IDrawingPrimitiveController> retVal=createSortedSet();
  IRootController rootNode=model.getRootNode();
  if (filter.accept(rootNode)) {
    retVal.add(rootNode);
  }
  Envelope drawnBounds=queryNode.getDrawnBounds();
  Point origin=drawnBounds.getOrigin();
  Point diagonal=drawnBounds.getDiagonalCorner();
  ISpacialEntry2DEnumerator<IDrawingPrimitiveController> iter=this.spacialIndex.queryOverlap((float)origin.getX(),(float)origin.getY(),(float)diagonal.getX(),(float)diagonal.getY(),null,0,false);
  while (iter.numRemaining() > 0) {
    IDrawingPrimitiveController node=iter.nextInt();
    if (!node.equals(queryNode) && !node.equals(rootNode) && filter.accept(node)&& node.intersectsHull(queryHull)) {
      retVal.add(node);
    }
  }
  return retVal;
}

Fixed version (ground truth):
@Override public SortedSet<IDrawingPrimitiveController> findIntersectingNodes(IConvexHull queryHull,IDrawingPrimitiveController queryNode){
  SortedSet<IDrawingPrimitiveController> retVal=createSortedSet();
  IRootController rootNode=model.getRootNode();
  if (filter.accept(rootNode)) {
    retVal.add(rootNode);
  }
  Envelope drawnBounds=queryHull.getEnvelope();
  Point origin=drawnBounds.getOrigin();
  Point diagonal=drawnBounds.getDiagonalCorner();
  ISpacialEntry2DEnumerator<IDrawingPrimitiveController> iter=this.spacialIndex.queryOverlap((float)origin.getX(),(float)origin.getY(),(float)diagonal.getX(),(float)diagonal.getY(),null,0,false);
  while (iter.numRemaining() > 0) {
    IDrawingPrimitiveController node=iter.nextInt();
    if (!node.equals(queryNode) && !node.equals(rootNode) && filter.accept(node)&& node.intersectsHull(queryHull)) {
      retVal.add(node);
    }
  }
  return retVal;
}
Program: 24494
Project: 24494
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  currentSentence.sentenceValidated();
  int currSelectionIdx=getCurrentSelection();
  if (getCurrentSelection() < tableModel.getRowCount() - 1) {
    currSelectionIdx++;
  }
  selectionModel.setSelectionInterval(currSelectionIdx,currSelectionIdx);
  int scrollOffset=dataViewTable.getRowHeight() * getCurrentSelection();
  dataViewScrollPane.getVerticalScrollBar().setValue(scrollOffset);
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  currentSentence.sentenceValidated();
  int currSelectionIdx=getCurrentSelection();
  if (getCurrentSelection() < tableModel.getRowCount() - 1) {
    currSelectionIdx++;
  }
  selectionModel.setSelectionInterval(currSelectionIdx,currSelectionIdx);
}
Program: 24497
Project: 24497
Buggy source:
@Override public void paintComponent(Graphics g){
  super.paintComponent(g);
  Graphics2D g2d=(Graphics2D)g;
  Envelope bounds=this.canvasDrawer.getViewControllerStore().getCanvasBounds();
  AffineTransform originalTransform=g2d.getTransform();
  g2d.translate(-bounds.getOrigin().getX() + PANE_BORDER,-bounds.getOrigin().getY() + PANE_BORDER);
  this.lastTransform=g2d.getTransform();
  g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
  g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
  this.canvasDrawer.paint(g2d);
  paintSelections(g2d);
  this.feedbackDrawer.paint(g2d);
  g2d.setTransform(originalTransform);
}

Fixed version (ground truth):
@Override public void paintComponent(Graphics g){
  super.paintComponent(g);
  Graphics2D g2d=(Graphics2D)g;
  Envelope bounds=this.canvasDrawer.getViewControllerStore().getCanvasBounds();
  AffineTransform originalTransform=g2d.getTransform();
  g2d.scale(0.65,0.65);
  g2d.translate(-bounds.getOrigin().getX() + PANE_BORDER,-bounds.getOrigin().getY() + PANE_BORDER);
  this.lastTransform=g2d.getTransform();
  g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
  g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
  this.canvasDrawer.paint(g2d);
  paintSelections(g2d);
  this.feedbackDrawer.paint(g2d);
  g2d.setTransform(originalTransform);
}
Program: 24498
Project: 24498
Buggy source:
private Point getAdjustedMousePosition(double originalMouseX,double originalMouseY){
  AffineTransform paneTransform=this.shapePane.getLastUsedTransform();
  Point retVal=null;
  if (paneTransform == null) {
    retVal=new Point(originalMouseX,originalMouseY);
  }
 else {
    retVal=new Point(originalMouseX - paneTransform.getTranslateX(),originalMouseY - paneTransform.getTranslateY());
  }
  return retVal;
}

Fixed version (ground truth):
private Point getAdjustedMousePosition(double originalMouseX,double originalMouseY){
  AffineTransform paneTransform=this.shapePane.getLastUsedTransform();
  Point retVal=null;
  if (paneTransform == null) {
    retVal=new Point(originalMouseX,originalMouseY);
  }
 else {
    retVal=new Point((originalMouseX - paneTransform.getTranslateX()) / paneTransform.getScaleX(),(originalMouseY - paneTransform.getTranslateY()) / paneTransform.getScaleY());
  }
  return retVal;
}
Program: 24499
Project: 24499
Buggy source:
public void openFile(File file){
  try {
    INotationSubsystemPool subsystemPool=new NotationSubsystemPool();
    canvasPersistenceManager=new FileXmlCanvasPersistenceManager(subsystemPool);
    InputStream in=new FileInputStream(file);
    canvasPersistenceManager.readCanvasFromStream(in);
    in.close();
    ICanvas canvas=canvasPersistenceManager.getCurrentCanvas();
    NdomBuilder builder=new NdomBuilder();
    BoParser parser=new BoParser(builder);
    BoTreeLexer lexer=new BoTreeLexer(canvas);
    parser.parse(lexer);
    IMapDiagram ndom=builder.getNdom();
    sentencesPanel.loadData(new SentenceFromSInterationIterator(ndom.sInteractionIterator()));
    insp.loadCanvas(canvas);
    this.validate();
    initComponentLinkage();
    insp.selectAndFocusOnElement(sentencesPanel.getSelectedSentence().getArc().getLinkEdge());
  }
 catch (  IOException ex) {
    JOptionPane.showMessageDialog(this,"String_Node_Str" + ex.getLocalizedMessage(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
  }
catch (  TreeParseException e) {
    JOptionPane.showMessageDialog(this,"String_Node_Str" + e.getLocalizedMessage(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
  }
}

Fixed version (ground truth):
public void openFile(File file){
  try {
    getContentPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    INotationSubsystemPool subsystemPool=new NotationSubsystemPool();
    canvasPersistenceManager=new FileXmlCanvasPersistenceManager(subsystemPool);
    InputStream in=new FileInputStream(file);
    canvasPersistenceManager.readCanvasFromStream(in);
    in.close();
    ICanvas canvas=canvasPersistenceManager.getCurrentCanvas();
    NdomBuilder builder=new NdomBuilder();
    BoParser parser=new BoParser(builder);
    BoTreeLexer lexer=new BoTreeLexer(canvas);
    parser.parse(lexer);
    IMapDiagram ndom=builder.getNdom();
    sentencesPanel.loadData(new SentenceFromSInterationIterator(ndom.sInteractionIterator()));
    insp.loadCanvas(canvas);
    this.validate();
    initComponentLinkage();
    insp.selectAndFocusOnElement(sentencesPanel.getSelectedSentence().getArc().getLinkEdge());
  }
 catch (  IOException ex) {
    JOptionPane.showMessageDialog(this,"String_Node_Str" + ex.getLocalizedMessage(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
  }
catch (  TreeParseException e) {
    JOptionPane.showMessageDialog(this,"String_Node_Str" + e.getLocalizedMessage(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
  }
 finally {
    getContentPane().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
  }
}
Program: 24501
Project: 24501
Buggy source:
private void showFocusSynonymDialog(){
  focusNodeSynonymJDialog=new SynonymDialog(this.synonymDialog);
  focusNodeSynonymJDialog.setPreferredSize(new Dimension(200,300));
  focusNodeSynonymJDialog.setSynonyms(currentSentence.getArc().getFocusNode());
  focusNodeSynonymJDialog.setVisible(true);
}

Fixed version (ground truth):
private void showFocusSynonymDialog(){
  focusNodeSynonymJDialog.setSynonyms(currentSentence.getArc().getFocusNode());
  focusNodeSynonymJDialog.setVisible(true);
}
Program: 24502
Project: 24502
Buggy source:
private void showIntNodeSynonymDialog(){
  intNodeSynonymJDialog=new SynonymDialog(this.synonymDialog);
  intNodeSynonymJDialog.setPreferredSize(new Dimension(200,300));
  intNodeSynonymJDialog.setSynonyms(currentSentence.getArc().getInteractingNode());
  intNodeSynonymJDialog.setVisible(true);
}

Fixed version (ground truth):
private void showIntNodeSynonymDialog(){
  intNodeSynonymJDialog.setSynonyms(currentSentence.getArc().getInteractingNode());
  intNodeSynonymJDialog.setVisible(true);
}
Program: 24504
Project: 24504
Buggy source:
private static void buildOutputFile(){
  for (  String tLine : templateFile) {
    if (tLine.trim().isEmpty() || isComment(tLine)) {
      if (!tLine.trim().startsWith("String_Node_Str")) {
        outputFile.add(tLine);
      }
    }
 else {
      String code=getCode(tLine);
      String lookupCode=null;
      if (remappings.containsKey(code)) {
        for (        String alt : remappings.get(code)) {
          if (editFile.containsKey(alt)) {
            lookupCode=alt;
            break;
          }
        }
      }
 else {
        lookupCode=code;
      }
      if (lookupCode == null) {
        throw new PFRemapperException("String_Node_Str");
      }
      String message=editFile.get(lookupCode);
      if (message == null) {
        System.err.println("String_Node_Str" + lookupCode + "String_Node_Str");
        continue;
      }
      outputFile.add(code + "String_Node_Str" + message);
    }
  }
}

Fixed version (ground truth):
private static void buildOutputFile(){
  for (  String tLine : templateFile) {
    if (tLine.trim().isEmpty() || isComment(tLine)) {
      if (!tLine.trim().startsWith("String_Node_Str")) {
        outputFile.add(tLine);
      }
    }
 else {
      String code=getCode(tLine);
      String lookupCode=null;
      if (remappings.containsKey(code)) {
        for (        String alt : remappings.get(code)) {
          if (editFile.containsKey(alt)) {
            lookupCode=alt;
            break;
          }
        }
      }
      if (lookupCode == null) {
        lookupCode=code;
      }
      String message=editFile.get(lookupCode);
      if (message == null) {
        System.err.println("String_Node_Str" + lookupCode + "String_Node_Str");
        continue;
      }
      outputFile.add(code + "String_Node_Str" + message);
    }
  }
}
Program: 24505
Project: 24505
Buggy source:
public static @NotNull Map<String,Set<String>> createMap(String input){
  Map<String,Set<String>> map=new HashMap<String,Set<String>>();
  if (input == null) {
    return map;
  }
  input=input.trim();
  if (!input.startsWith("String_Node_Str") || !input.endsWith("String_Node_Str")) {
    throw new PFRemapperException("String_Node_Str");
  }
  String pairs[]=input.substring(1,input.length() - 1).split("String_Node_Str");
  for (  String pair : pairs) {
    String kv[]=pair.split("String_Node_Str");
    if (kv.length != 2) {
      throw new PFRemapperException("String_Node_Str");
    }
    addToSet(kv[0].trim(),kv[1].trim(),map);
  }
  return map;
}

Fixed version (ground truth):
public static Map<String,Set<String>> createMap(String input){
  Map<String,Set<String>> map=new HashMap<String,Set<String>>();
  if (input == null) {
    return map;
  }
  input=input.trim();
  if (!input.startsWith("String_Node_Str") || !input.endsWith("String_Node_Str")) {
    throw new PFRemapperException("String_Node_Str");
  }
  String pairs[]=input.substring(1,input.length() - 1).split("String_Node_Str");
  for (  String pair : pairs) {
    String kv[]=pair.split("String_Node_Str");
    if (kv.length != 2) {
      throw new PFRemapperException("String_Node_Str");
    }
    addToSet(kv[0].trim(),kv[1].trim(),map);
  }
  return map;
}
Program: 24506
Project: 24506
Buggy source:
public GuiBot(){
  this.setName("String_Node_Str");
}

Fixed version (ground truth):
public GuiBot(){
  this.setName(Main.nick);
}
Program: 24508
Project: 24508
Buggy source:
@Override public void onBlockDamage(BlockDamageEvent event){
  if (scheduleHandler.rushId != 0) {
    if (event.getPlayer().getItemInHand().getTypeId() == 257 || event.getPlayer().getItemInHand().getTypeId() == 278) {
      int durab=(int)event.getPlayer().getItemInHand().getDurability() + 2;
      short newDurab=(short)durab;
      event.getPlayer().getItemInHand().setDurability(newDurab);
      event.setInstaBreak(true);
    }
  }
 else   if (scheduleHandler.crashId != 0) {
    event.setCancelled(true);
  }
}

Fixed version (ground truth):
@Override public void onBlockDamage(BlockDamageEvent event){
  if (scheduleHandler.rushId != 0) {
    if (event.getPlayer().getItemInHand().getTypeId() == 257 || event.getPlayer().getItemInHand().getTypeId() == 278) {
      if (event.getBlock().getTypeId() != 7 && event.getBlock().getTypeId() != 49) {
        int durab=(int)event.getPlayer().getItemInHand().getDurability() + 2;
        short newDurab=(short)durab;
        event.getPlayer().getItemInHand().setDurability(newDurab);
        event.setInstaBreak(true);
      }
    }
  }
 else   if (scheduleHandler.crashId != 0) {
    event.setCancelled(true);
  }
}
Program: 24510
Project: 24510
Buggy source:
@Override public void onPlayerInteract(PlayerInteractEvent event){
  Location target=event.getPlayer().getLocation();
  player=event.getPlayer();
  World world=target.getWorld();
  if (event.getAction().equals(Action.RIGHT_CLICK_BLOCK) || event.getAction().equals(Action.RIGHT_CLICK_AIR)) {
    if (event.getPlayer().getItemInHand().getType() == Material.SUGAR) {
      int numOfSugar=event.getPlayer().getItemInHand().getAmount();
      if (numOfSugar == 1) {
        event.getPlayer().setItemInHand(null);
      }
 else {
        event.getPlayer().getItemInHand().setAmount(numOfSugar - 1);
      }
      event.getPlayer().updateInventory();
      event.getPlayer().setHealth(event.getPlayer().getHealth() + 1);
    }
  }
}

Fixed version (ground truth):
@Override public void onPlayerInteract(PlayerInteractEvent event){
  Location target=event.getPlayer().getLocation();
  player=event.getPlayer();
  World world=target.getWorld();
  if (event.getAction().equals(Action.RIGHT_CLICK_BLOCK) || event.getAction().equals(Action.RIGHT_CLICK_AIR)) {
    if (event.getPlayer().getItemInHand().getType() == Material.SUGAR) {
      int numOfSugar=event.getPlayer().getItemInHand().getAmount();
      if (event.getPlayer().getHealth() != 20) {
        if (numOfSugar == 1) {
          event.getPlayer().setItemInHand(null);
        }
 else {
          event.getPlayer().getItemInHand().setAmount(numOfSugar - 1);
        }
        event.getPlayer().updateInventory();
        event.getPlayer().setHealth(event.getPlayer().getHealth() + 1);
      }
    }
  }
}
Program: 24511
Project: 24511
Buggy source:
/** 
 * <p>Initialises the underlying data structure of the Grid that the Sudoku is represented as</p>
 * @param sudokuAsText  a chain of text with the sudoku numbers in it
 * @return the data grid with the appropriate values
 * @throws NumberFormatException in the case of not providing complete or valid input
 */
private int[][] initialiseGrid(String sudokuAsText) throws NumberFormatException {
  int grid[][]=new int[9][9];
  if (Sudoku.isValidChain(sudokuAsText)) {
    throw new NumberFormatException("String_Node_Str");
  }
  if (!isTheRightAmountOFNumbers(sudokuAsText)) {
    throw new NumberFormatException("String_Node_Str");
  }
  int counterForSudokuText=0;
  for (int row=0; row < 9; row++) {
    for (int column=0; column < 9; column++) {
      grid[row][column]=new Integer(sudokuAsText.charAt(counterForSudokuText) + "String_Node_Str").intValue();
      counterForSudokuText++;
    }
  }
  return grid;
}

Fixed version (ground truth):
/** 
 * <p>Initialises the underlying data structure of the Grid that the Sudoku is represented as</p>
 * @param sudokuAsText  a chain of text with the sudoku numbers in it
 * @return the data grid with the appropriate values
 * @throws NumberFormatException in the case of not providing complete or valid input
 */
private int[][] initialiseGrid(String sudokuAsText) throws NumberFormatException {
  int grid[][]=new int[9][9];
  if (!isValidChain(sudokuAsText)) {
    throw new NumberFormatException("String_Node_Str");
  }
  if (!isTheRightAmountOFNumbers(sudokuAsText)) {
    throw new NumberFormatException("String_Node_Str");
  }
  int counterForSudokuText=0;
  for (int row=0; row < 9; row++) {
    for (int column=0; column < 9; column++) {
      grid[row][column]=new Integer(sudokuAsText.charAt(counterForSudokuText) + "String_Node_Str").intValue();
      counterForSudokuText++;
    }
  }
  return grid;
}
Program: 24512
Project: 24512
Buggy source:
/** 
 * <p>Validity through RegExp: all numbers from 1 to 9 appear in the chain, just once</p>
 * @param row  the Sudoku chain to verify
 * @return A boolean indicating if the chain is valid
 */
static boolean isValidChain(String chain){
  return chain.matches("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * <p>Validity through RegExp: all numbers from 1 to 9 appear in the chain, and a total of 81</p>
 * @param row  the Sudoku chain to verify
 * @return A boolean indicating if the chain is valid
 */
private boolean isValidChain(String chain){
  return chain.matches("String_Node_Str");
}
Program: 24513
Project: 24513
Buggy source:
/** 
 * <p>Verifies that a particular entry (row, column, or square) of the Sudoku is correct</p>
 * @param row  the Sudoku chain to verify
 * @return A boolean indicating if the chain is correct or not (a <code>null</code> input returns <code>false</code>)
 */
public boolean isChainCorrect(String chain){
  if (isEmptyChain(chain) || !Sudoku.isValidChain(chain))   return false;
  boolean isCorrect=true;
  for (int i=0; i < chain.length(); i++) {
    int counterMatches=countMatches(chain,chain.charAt(i) + "String_Node_Str");
    if (counterMatches > 1) {
      isCorrect=false;
      System.out.println("String_Node_Str" + chain.charAt(i) + "String_Node_Str"+ counterMatches+ "String_Node_Str"+ chain);
      break;
    }
  }
  return isCorrect;
}

Fixed version (ground truth):
/** 
 * <p>Verifies that a particular entry (row, column, or square) of the Sudoku is correct</p>
 * @param row  the Sudoku chain to verify
 * @return A boolean indicating if the chain is correct or not (a <code>null</code> input returns <code>false</code>)
 */
public boolean isChainCorrect(String chain){
  if (isEmptyChain(chain) || !isValidChain(chain))   return false;
  boolean isCorrect=true;
  for (int i=0; i < chain.length(); i++) {
    int counterMatches=countMatches(chain,chain.charAt(i) + "String_Node_Str");
    if (counterMatches > 1) {
      isCorrect=false;
      System.out.println("String_Node_Str" + chain.charAt(i) + "String_Node_Str"+ counterMatches+ "String_Node_Str"+ chain);
      break;
    }
  }
  return isCorrect;
}
Program: 24514
Project: 24514
Buggy source:
/** 
 * @param service
 * @param query
 * @param var
 * @return
 */
public static Set<Node> process(EndPoint endPoint,Query query,Node var){
  query.setLimit(PAGE_SIZE);
  query.setOffset(0);
  Set<Node> results=new HashSet<Node>();
  boolean morePages=true;
  while (morePages) {
    long count=0;
    try {
      QueryEngineHTTPClient queryExec=new QueryEngineHTTPClient(endPoint.getURI(),query);
      queryExec.addDefaultGraph(endPoint.getDefaultGraph());
      queryExec.addParam("String_Node_Str","String_Node_Str");
      queryExec.addParam("String_Node_Str","String_Node_Str");
      ResultSet bindings=queryExec.execSelect();
      if (bindings != null)       while (bindings.hasNext())       results.add(bindings.next().get(var.getName()).asNode());
      queryExec.close();
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
    morePages=(count == PAGE_SIZE - 1);
    query.setOffset(query.getOffset() + PAGE_SIZE);
  }
  return results;
}

Fixed version (ground truth):
/** 
 * @param service
 * @param query
 * @param var
 * @return
 */
public static Set<Node> process(EndPoint endPoint,Query query,Node var){
  query.setLimit(PAGE_SIZE);
  query.setOffset(0);
  Set<Node> results=new HashSet<Node>();
  boolean morePages=true;
  while (morePages) {
    long count=0;
    try {
      QueryEngineHTTPClient queryExec=new QueryEngineHTTPClient(endPoint.getURI(),query);
      if (endPoint.getDefaultGraph() != null)       queryExec.addDefaultGraph(endPoint.getDefaultGraph());
      ResultSet bindings=queryExec.execSelect();
      if (bindings != null) {
        while (bindings.hasNext()) {
          results.add(bindings.next().get(var.getName()).asNode());
          count++;
        }
      }
      queryExec.close();
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
    morePages=(count == PAGE_SIZE);
    query.setOffset(query.getOffset() + PAGE_SIZE);
  }
  return results;
}
Program: 24516
Project: 24516
Buggy source:
public void receivedGday(Peer peer,Packet.GDay packet){
  User u=new User(packet.nickname,peer.getAddress().toString());
  if (!peers.containsKey(packet.nickname)) {
    this.peers.put(u,peer);
    System.out.println(u + "String_Node_Str" + peer.getAddress());
  }
  this.peers.get(u).receivedGDay();
}

Fixed version (ground truth):
public void receivedGday(Peer peer,Packet.GDay packet){
  User u=new User(packet.nickname,peer.getAddress().toString());
  if (!peers.containsKey(u)) {
    this.peers.put(u,peer);
    System.out.println(u + "String_Node_Str" + peer.getAddress());
  }
  this.peers.get(u).receivedGDay();
}
Program: 24517
Project: 24517
Buggy source:
public static String boxify(Packet.Says packet){
  return packet.nickname + "String_Node_Str" + packet.message+ "String_Node_Str";
}

Fixed version (ground truth):
public static String boxify(Packet.Says packet){
  return packet.nickname + "String_Node_Str" + packet.message;
}
Program: 24518
Project: 24518
Buggy source:
public boolean isPeer(String nickname){
  return this.peers.containsKey(nickname);
}

Fixed version (ground truth):
public boolean isPeer(User u){
  return this.peers.containsKey(u);
}
Program: 24519
Project: 24519
Buggy source:
public void run(){
  while (true) {
    try {
      byte[] buf=new byte[256];
      DatagramPacket packet=new DatagramPacket(buf,buf.length);
      socket.receive(packet);
      Packet type=Packet.getType(packet.getData());
switch (type) {
case SAYS:
        Packet.Says says=new Packet.Says(packet.getData());
      if (manager.isPeer(says.nickname)) {
        Integer lastSeqNum=lastSeqNumsReceived.get(says.nickname);
        if (lastSeqNum == null || lastSeqNum <= says.sequenceNumber) {
          System.out.println(Utils.boxify(says));
          lastSeqNum=says.sequenceNumber;
        }
        lastSeqNumsReceived.put(says.nickname,lastSeqNum);
        try {
          buf=new Packet.Yeah(lastSeqNum).toBytes();
          packet=new DatagramPacket(buf,buf.length,packet.getAddress(),packet.getPort());
          socket.send(packet);
        }
 catch (        Exception e) {
        }
      }
    break;
case YEAH:
  try {
    sender.recievedYeah(new Packet.Yeah(packet.getData()));
  }
 catch (  Exception e) {
  }
break;
case GDAY:
manager.receivedGday(new Peer(packet.getAddress(),packet.getPort()),new Packet.GDay(packet.getData()));
break;
case GBYE:
manager.recievedGbye(packet.getAddress().toString(),new Packet.GBye(packet.getData()));
break;
default :
System.err.println("String_Node_Str" + packet.getData().toString());
}
}
 catch (IOException e) {
e.printStackTrace();
break;
}
}
socket.close();
}

Fixed version (ground truth):
public void run(){
  while (true) {
    try {
      byte[] buf=new byte[256];
      DatagramPacket packet=new DatagramPacket(buf,buf.length);
      socket.receive(packet);
      Packet type=Packet.getType(packet.getData());
switch (type) {
case SAYS:
        Packet.Says says=new Packet.Says(packet.getData());
      if (manager.isPeer(new User(says.nickname,packet.getAddress().toString()))) {
        Integer lastSeqNum=lastSeqNumsReceived.get(says.nickname);
        if (lastSeqNum == null || lastSeqNum <= says.sequenceNumber) {
          System.out.println(Utils.boxify(says));
          lastSeqNum=says.sequenceNumber;
        }
        lastSeqNumsReceived.put(says.nickname,lastSeqNum);
        try {
          buf=new Packet.Yeah(lastSeqNum).toBytes();
          packet=new DatagramPacket(buf,buf.length,packet.getAddress(),packet.getPort());
          socket.send(packet);
        }
 catch (        Exception e) {
        }
      }
    break;
case YEAH:
  try {
    sender.recievedYeah(new Packet.Yeah(packet.getData()));
  }
 catch (  Exception e) {
  }
break;
case GDAY:
manager.receivedGday(new Peer(packet.getAddress(),packet.getPort()),new Packet.GDay(packet.getData()));
break;
case GBYE:
manager.recievedGbye(packet.getAddress().toString(),new Packet.GBye(packet.getData()));
break;
default :
System.err.println("String_Node_Str" + packet.getData().toString());
}
}
 catch (IOException e) {
e.printStackTrace();
break;
}
}
socket.close();
}
Program: 24520
Project: 24520
Buggy source:
public static void main(String[] args) throws IOException {
  String multicastAddr=args[0];
  int port=Integer.parseInt(args[1]);
  String nickname=args[2];
  MulticastSocket socket=new MulticastSocket(port);
  socket.joinGroup(InetAddress.getByName(multicastAddr));
  MembershipManager m=new MembershipManager(multicastAddr,socket,nickname);
  Sender sender=new Sender(m,socket,nickname);
  Receiver receiver=new Receiver(m,socket,sender);
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException {
  String addr=args[0];
  int port=Integer.parseInt(args[1]);
  String nickname=args[2];
  MulticastSocket socket=new MulticastSocket(port);
  socket.joinGroup(InetAddress.getByName(addr));
  MembershipManager m=new MembershipManager(socket,addr,port,nickname);
  Sender sender=new Sender(m,socket,nickname);
  new Receiver(m,socket,sender);
}
Program: 24521
Project: 24521
Buggy source:
public MembershipManager(String multicastAddr,MulticastSocket socket,String nickname){
  this.addr=multicastAddr;
  this.socket=socket;
  this.nickname=nickname;
  new GDayThread().start();
  System.err.println("String_Node_Str");
}

Fixed version (ground truth):
public MembershipManager(MulticastSocket socket,String multicastAddr,int port,String nickname){
  this.addr=multicastAddr;
  this.socket=socket;
  this.nickname=nickname;
  this.port=port;
  new GDayThread().start();
}
Program: 24522
Project: 24522
Buggy source:
public void run(){
  while (true) {
    try {
      socket.send(new DatagramPacket(gday,gday.length,InetAddress.getByName(addr),socket.getPort()));
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
    try {
      Thread.sleep(SEND_INTERVAL);
    }
 catch (    InterruptedException e) {
    }
  }
}

Fixed version (ground truth):
public void run(){
  while (true) {
    try {
      socket.send(new DatagramPacket(gday,gday.length,InetAddress.getByName(addr),port));
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
    try {
      Thread.sleep(SEND_INTERVAL);
    }
 catch (    InterruptedException e) {
    }
  }
}
Program: 24523
Project: 24523
Buggy source:
public Yeah(byte[] payload){
  String[] delimitedContents=Utils.byteArrayToString(payload).toString().split("String_Node_Str");
  if (delimitedContents.length != 2 || !delimitedContents[0].equals("String_Node_Str"))   throw new IllegalArgumentException("String_Node_Str");
  this.sequenceNumber=Integer.parseInt(delimitedContents[1]);
}

Fixed version (ground truth):
public Yeah(byte[] payload){
  String[] delimitedContents=Utils.byteArrayToString(payload).split("String_Node_Str");
  if (delimitedContents.length != 2 || !delimitedContents[0].equals("String_Node_Str"))   throw new IllegalArgumentException("String_Node_Str");
  this.sequenceNumber=Integer.parseInt(delimitedContents[1].trim());
}
Program: 24524
Project: 24524
Buggy source:
public Says(byte[] payload){
  String[] delimitedContents=Utils.byteArrayToString(payload).split("String_Node_Str");
  if (delimitedContents.length != 4 || !delimitedContents[0].equals("String_Node_Str"))   throw new IllegalArgumentException("String_Node_Str");
  this.nickname=delimitedContents[1];
  this.sequenceNumber=Integer.parseInt(delimitedContents[2]);
  String message=delimitedContents[3];
  for (int i=4; i < delimitedContents.length; i++) {
    message+="String_Node_Str" + delimitedContents;
  }
  this.message=delimitedContents[3];
}

Fixed version (ground truth):
public Says(byte[] payload){
  String[] delimitedContents=Utils.byteArrayToString(payload).split("String_Node_Str");
  if (delimitedContents.length < 4 || !delimitedContents[0].equals("String_Node_Str"))   throw new IllegalArgumentException("String_Node_Str");
  this.nickname=delimitedContents[1];
  this.sequenceNumber=Integer.parseInt(delimitedContents[2]);
  StringBuilder message=new StringBuilder(delimitedContents[3]);
  for (int i=4; i < delimitedContents.length; i++) {
    message.append("String_Node_Str" + delimitedContents[i].trim());
  }
  this.message=message.toString();
}
Program: 24525
Project: 24525
Buggy source:
public void run(){
  while (true) {
    try {
      byte[] buf=new byte[256];
      DatagramPacket packet=new DatagramPacket(buf,buf.length);
      socket.receive(packet);
      Packet type=Packet.getType(packet.getData());
switch (type) {
case SAYS:
        Packet.Says says=new Packet.Says(packet.getData());
      Integer lastSeqNum=lastSeqNumsReceived.get(says.nickname);
    if (lastSeqNum == null || lastSeqNum < says.sequenceNumber) {
      System.out.println(Utils.boxify(says));
      lastSeqNumsReceived.put(says.nickname,lastSeqNum);
    }
  packet=new DatagramPacket(buf,buf.length,packet.getAddress(),packet.getPort());
socket.send(packet);
break;
case YEAH:
sender.recievedYeah(new Packet.Yeah(packet.getData()));
break;
case GDAY:
manager.receivedGday(new Peer(packet.getAddress(),packet.getPort()),new Packet.GDay(packet.getData()));
break;
case GBYE:
manager.recievedGbye(new Packet.GBye(packet.getData()));
break;
default :
System.err.println("String_Node_Str" + packet.getData().toString());
}
}
 catch (IOException e) {
e.printStackTrace();
break;
}
}
socket.close();
}

Fixed version (ground truth):
public void run(){
  while (true) {
    try {
      byte[] buf=new byte[256];
      DatagramPacket packet=new DatagramPacket(buf,buf.length);
      socket.receive(packet);
      Packet type=Packet.getType(packet.getData());
switch (type) {
case SAYS:
        Packet.Says says=new Packet.Says(packet.getData());
      Integer lastSeqNum=lastSeqNumsReceived.get(says.nickname);
    if (lastSeqNum == null || lastSeqNum <= says.sequenceNumber) {
      System.out.println(Utils.boxify(says));
      lastSeqNum=says.sequenceNumber;
    }
  lastSeqNumsReceived.put(says.nickname,lastSeqNum);
buf=new Packet.Yeah(lastSeqNum).toBytes();
packet=new DatagramPacket(buf,buf.length,packet.getAddress(),packet.getPort());
socket.send(packet);
break;
case YEAH:
sender.recievedYeah(new Packet.Yeah(packet.getData()));
break;
case GDAY:
manager.receivedGday(new Peer(packet.getAddress(),packet.getPort()),new Packet.GDay(packet.getData()));
break;
case GBYE:
manager.recievedGbye(new Packet.GBye(packet.getData()));
break;
default :
System.err.println("String_Node_Str" + packet.getData().toString());
}
}
 catch (IOException e) {
e.printStackTrace();
break;
}
}
socket.close();
}
Program: 24526
Project: 24526
Buggy source:
public static String boxify(Packet.Says packet){
  String[] lines=packet.message.split("String_Node_Str");
  int width=packet.nickname.length() + 6;
  for (  String line : lines)   if (line.length() > width)   width=line.length();
  String bar=repeat("String_Node_Str",width + 4);
  String rtn=bar + "String_Node_Str";
  rtn+="String_Node_Str" + packet.nickname + repeat("String_Node_Str",width - packet.nickname.length() - 6)+ "String_Node_Str";
  for (  String line : lines)   rtn+="String_Node_Str" + line + repeat("String_Node_Str",width - line.length())+ "String_Node_Str";
  return rtn + bar;
}

Fixed version (ground truth):
public static String boxify(Packet.Says packet){
  return packet.message + "String_Node_Str" + packet.nickname+ "String_Node_Str";
}
Program: 24527
Project: 24527
Buggy source:
public Retransmitter(int sequenceNumber,DatagramPacket outgoingPacket){
  this.numberRetransmits=0;
  this.sequenceNumber=sequenceNumber;
  this.outgoingPacket=outgoingPacket;
}

Fixed version (ground truth):
public Retransmitter(int sequenceNumber,DatagramPacket outgoingPacket,int curRetransmits){
  this.numberRetransmits=curRetransmits;
  this.sequenceNumber=sequenceNumber;
  this.outgoingPacket=outgoingPacket;
}
Program: 24528
Project: 24528
Buggy source:
public void run(){
  this.cancel();
  numberRetransmits+=1;
  if (pendingYeahs.containsKey(sequenceNumber)) {
    if (numberRetransmits < MAX_RETRIES) {
      try {
        socket.send(outgoingPacket);
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
      timer.schedule(this,TIMEOUT_MILLIS);
    }
 else {
      pendingYeahs.remove(sequenceNumber);
    }
  }
}

Fixed version (ground truth):
public void run(){
  this.cancel();
  numberRetransmits+=1;
  if (pendingYeahs.containsKey(sequenceNumber)) {
    if (numberRetransmits < MAX_RETRIES) {
      try {
        socket.send(outgoingPacket);
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
      timer.schedule(new Retransmitter(this),TIMEOUT_MILLIS);
    }
 else {
      pendingYeahs.remove(sequenceNumber);
    }
  }
}
Program: 24529
Project: 24529
Buggy source:
public void run(){
  while (true) {
    try {
      byte[] buf=new byte[256];
      DatagramPacket packet=new DatagramPacket(buf,buf.length);
      socket.receive(packet);
      Packet type=Packet.getType(packet.getData());
switch (type) {
case SAYS:
        Packet.Says says=new Packet.Says(packet.getData());
      Integer lastSeqNum=lastSeqNumsReceived.get(says.nickname);
    if (lastSeqNum == null || lastSeqNum <= says.sequenceNumber) {
      System.out.println(Utils.boxify(says));
      lastSeqNum=says.sequenceNumber;
    }
  lastSeqNumsReceived.put(says.nickname,lastSeqNum);
try {
  buf=new Packet.Yeah(lastSeqNum).toBytes();
  packet=new DatagramPacket(buf,buf.length,packet.getAddress(),packet.getPort());
  socket.send(packet);
}
 catch (Exception e) {
}
break;
case YEAH:
try {
sender.recievedYeah(new Packet.Yeah(packet.getData()));
}
 catch (Exception e) {
}
break;
case GDAY:
manager.receivedGday(new Peer(packet.getAddress(),packet.getPort()),new Packet.GDay(packet.getData()));
break;
case GBYE:
manager.recievedGbye(new Packet.GBye(packet.getData()));
break;
default :
System.err.println("String_Node_Str" + packet.getData().toString());
}
}
 catch (IOException e) {
e.printStackTrace();
break;
}
}
socket.close();
}

Fixed version (ground truth):
public void run(){
  while (true) {
    try {
      byte[] buf=new byte[256];
      DatagramPacket packet=new DatagramPacket(buf,buf.length);
      socket.receive(packet);
      Packet type=Packet.getType(packet.getData());
switch (type) {
case SAYS:
        Packet.Says says=new Packet.Says(packet.getData());
      if (manager.isPeer(says.nickname)) {
        Integer lastSeqNum=lastSeqNumsReceived.get(says.nickname);
        if (lastSeqNum == null || lastSeqNum <= says.sequenceNumber) {
          System.out.println(Utils.boxify(says));
          lastSeqNum=says.sequenceNumber;
        }
        lastSeqNumsReceived.put(says.nickname,lastSeqNum);
        try {
          buf=new Packet.Yeah(lastSeqNum).toBytes();
          packet=new DatagramPacket(buf,buf.length,packet.getAddress(),packet.getPort());
          socket.send(packet);
        }
 catch (        Exception e) {
        }
      }
    break;
case YEAH:
  try {
    sender.recievedYeah(new Packet.Yeah(packet.getData()));
  }
 catch (  Exception e) {
  }
break;
case GDAY:
manager.receivedGday(new Peer(packet.getAddress(),packet.getPort()),new Packet.GDay(packet.getData()));
break;
case GBYE:
manager.recievedGbye(new Packet.GBye(packet.getData()));
break;
default :
System.err.println("String_Node_Str" + packet.getData().toString());
}
}
 catch (IOException e) {
e.printStackTrace();
break;
}
}
socket.close();
}
Program: 24530
Project: 24530
Buggy source:
public static void main(String[] args) throws IOException {
  String multicastAddr=args[0];
  int port=Integer.parseInt(args[1]);
  String nickname=args[2];
  MulticastSocket socket=new MulticastSocket(port);
  System.err.println("String_Node_Str");
  MembershipManager m=new MembershipManager(multicastAddr,socket,nickname);
  System.err.println("String_Node_Str");
  Sender sender=new Sender(m,socket,nickname);
  System.err.println("String_Node_Str");
  Receiver receiver=new Receiver(m,socket,sender);
  System.err.println("String_Node_Str");
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException {
  String multicastAddr=args[0];
  int port=Integer.parseInt(args[1]);
  String nickname=args[2];
  MulticastSocket socket=new MulticastSocket(port);
  socket.joinGroup(InetAddress.getByName(multicastAddr));
  MembershipManager m=new MembershipManager(multicastAddr,socket,nickname);
  Sender sender=new Sender(m,socket,nickname);
  Receiver receiver=new Receiver(m,socket,sender);
}
Program: 24531
Project: 24531
Buggy source:
public MembershipManager(String multicastAddr,MulticastSocket socket,String nickname){
  this.addr=multicastAddr;
  this.socket=socket;
  this.nickname=nickname;
  new GDayThread().run();
}

Fixed version (ground truth):
public MembershipManager(String multicastAddr,MulticastSocket socket,String nickname){
  this.addr=multicastAddr;
  this.socket=socket;
  this.nickname=nickname;
  new GDayThread().start();
  System.err.println("String_Node_Str");
}
Program: 24532
Project: 24532
Buggy source:
public void run(){
  while (true) {
    try {
      Thread.sleep(SEND_INTERVAL);
      socket.send(new DatagramPacket(gday,gday.length,InetAddress.getByName(addr),socket.getPort()));
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
public void run(){
  while (true) {
    try {
      socket.send(new DatagramPacket(gday,gday.length,InetAddress.getByName(addr),socket.getPort()));
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
    try {
      Thread.sleep(SEND_INTERVAL);
    }
 catch (    InterruptedException e) {
    }
  }
}
Program: 24533
Project: 24533
Buggy source:
public Receiver(MembershipManager manager,DatagramSocket sock,Sender sender) throws IOException {
  this.socket=sock;
  this.manager=manager;
  this.sender=sender;
  new UDPListenerThread().run();
}

Fixed version (ground truth):
public Receiver(MembershipManager manager,DatagramSocket sock,Sender sender) throws IOException {
  this.socket=sock;
  this.manager=manager;
  this.sender=sender;
  new UDPListenerThread().start();
}
Program: 24534
Project: 24534
Buggy source:
public Sender(MembershipManager manager,DatagramSocket sock,String nickname){
  this.manager=manager;
  this.socket=sock;
  this.ourNickname=nickname;
  nextSequenceNumber=0;
  new KeyboardListener();
}

Fixed version (ground truth):
public Sender(MembershipManager manager,DatagramSocket sock,String nickname){
  this.manager=manager;
  this.socket=sock;
  this.ourNickname=nickname;
  nextSequenceNumber=0;
  new KeyboardListener().start();
}
Program: 24535
Project: 24535
Buggy source:
/** 
 * When receiving IRC-message
 */
protected void onMessage(String channel,String sender,String login,String hostname,String message){
  if (message.equalsIgnoreCase("String_Node_Str")) {
    String time=new java.util.Date().toString();
    botManager.sendMessage(channel,sender + "String_Node_Str" + time);
  }
 else   if (message.equalsIgnoreCase("String_Node_Str")) {
    botManager.sendMessage(channel,sender + "String_Node_Str" + "String_Node_Str");
  }
 else   if (message.equalsIgnoreCase("String_Node_Str") && sender.startsWith(trustedSender)) {
    forwardMessages=false;
    botManager.sendMessage(channel,"String_Node_Str");
  }
 else   if (message.equalsIgnoreCase("String_Node_Str") && sender.startsWith(trustedSender)) {
    forwardMessages=true;
    botManager.sendMessage(channel,"String_Node_Str");
  }
 else {
    try {
      if (forwardMessages && sender.startsWith(trustedSender))       chat.sendMessage("String_Node_Str" + sender + "String_Node_Str"+ message);
    }
 catch (    Exception e) {
      System.err.println("String_Node_Str");
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
/** 
 * When receiving IRC-message
 */
protected void onMessage(String channel,String sender,String login,String hostname,String message){
  if (message.equalsIgnoreCase("String_Node_Str")) {
    String time=new java.util.Date().toString();
    botManager.sendMessage(channel,sender + "String_Node_Str" + time);
  }
 else   if (message.equalsIgnoreCase("String_Node_Str")) {
    botManager.sendMessage(channel,sender + "String_Node_Str" + "String_Node_Str");
  }
 else   if (message.equalsIgnoreCase("String_Node_Str") && sender.startsWith(trustedSender)) {
    forwardMessages=false;
    botManager.sendMessage(channel,"String_Node_Str");
  }
 else   if (message.equalsIgnoreCase("String_Node_Str") && sender.startsWith(trustedSender)) {
    forwardMessages=true;
    botManager.sendMessage(channel,"String_Node_Str");
  }
 else {
    try {
      if (forwardMessages && !sender.startsWith(trustedSender))       chat.sendMessage("String_Node_Str" + sender + "String_Node_Str"+ message);
    }
 catch (    Exception e) {
      System.err.println("String_Node_Str");
      e.printStackTrace();
    }
  }
}
Program: 24536
Project: 24536
Buggy source:
private void logMessage(String message){
  if (!getDate().equals(currentDate)) {
    try {
      logger.removeAppender(fileAppender);
      fileAppender.close();
      uploadFile(currentDate + "String_Node_Str");
      File f=new File(currentDate + "String_Node_Str");
      if (f.exists() && f.canWrite()) {
        f.delete();
      }
 else {
        System.err.println("String_Node_Str" + currentDate + "String_Node_Str"+ "String_Node_Str");
        System.exit(1);
      }
      currentDate=getDate();
      fileAppender=new FileAppender(new SimplifiedHTMLLayout(),currentDate + "String_Node_Str");
      logger.addAppender(fileAppender);
    }
 catch (    IOException e) {
      System.out.println(e.toString());
    }
  }
  logger.info(message);
  uploadFile(fileAppender.getFile());
  try {
    makeFileIndex();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
private void logMessage(String message){
  if (!getDate().equals(currentDate)) {
    try {
      logger.removeAppender(fileAppender);
      fileAppender.close();
      uploadFile(currentDate + "String_Node_Str");
      File f=new File(currentDate + "String_Node_Str");
      if (f.exists() && f.canWrite()) {
        f.delete();
      }
 else {
        System.err.println("String_Node_Str" + currentDate + "String_Node_Str"+ "String_Node_Str");
        System.exit(1);
      }
      currentDate=getDate();
      fileAppender=new FileAppender(new HTMLLayout(),currentDate + "String_Node_Str");
      logger.addAppender(fileAppender);
    }
 catch (    IOException e) {
      System.out.println(e.toString());
    }
  }
  logger.info(message);
  uploadFile(fileAppender.getFile());
  try {
    makeFileIndex();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 24537
Project: 24537
Buggy source:
private synchronized void uploadFile(String fileName){
  try {
    ftp.connect();
    ftp.uploadFile(fileName,fileName);
    ftp.disconnect();
  }
 catch (  FTPException e) {
    System.out.println(e.toString());
  }
catch (  Exception e) {
    e.printStackTrace();
  }
 finally {
    try {
      ftp.disconnect();
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
private synchronized void uploadFile(String fileName){
  try {
    ftp.connect();
    ftp.uploadFile(fileName,fileName);
  }
 catch (  FTPException e) {
    System.out.println(e.toString());
  }
catch (  Exception e) {
    e.printStackTrace();
  }
 finally {
    try {
      ftp.disconnect();
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
}
Program: 24540
Project: 24540
Buggy source:
@Override public List<NativeProcess> getMacProcesses() throws NativeAccessException {
  List<NativeProcess> processList=new ArrayList<NativeProcess>();
  try {
    IntByReference _=new IntByReference(sizeOfInt);
    IntByReference size=new IntByReference(sizeOfInt);
    Memory m;
    int nRetry=0;
    while (true) {
      if (LIBC.sysctl(MIB_PROC_ALL,3,NULL,size,NULL,_) != 0) {
        throw new IOException("String_Node_Str" + LIBC.strerror(Native.getLastError()));
      }
      m=new Memory(size.getValue());
      if (LIBC.sysctl(MIB_PROC_ALL,3,m,size,NULL,_) != 0) {
        if (Native.getLastError() == ENOMEM && nRetry++ < 16) {
          continue;
        }
        throw new IOException("String_Node_Str" + LIBC.strerror(Native.getLastError()));
      }
      break;
    }
    int count=size.getValue() / sizeOf_kinfo_proc;
    LOGGER.log(Level.FINE,"String_Node_Str",count);
    for (int base=0; base < size.getValue(); base+=sizeOf_kinfo_proc) {
      int pid=m.getInt(base + 24);
      int ppid=m.getInt(base + 416);
      processList.add(new NativeMacProcess(pid,ppid));
    }
  }
 catch (  IOException e) {
    LOGGER.log(Level.WARNING,"String_Node_Str",e);
  }
  return processList;
}

Fixed version (ground truth):
@Override public List<NativeProcess> getMacProcesses() throws NativeAccessException {
  int sizeOfInt=Native.getNativeSize(int.class);
  List<NativeProcess> processList=new ArrayList<NativeProcess>();
  String arch=System.getProperty("String_Node_Str");
  if ("String_Node_Str".equals(arch)) {
    sizeOf_kinfo_proc=sizeOf_kinfo_proc_64;
    kinfo_proc_pid_offset=kinfo_proc_pid_offset_64;
    kinfo_proc_ppid_offset=kinfo_proc_ppid_offset_64;
  }
 else {
    sizeOf_kinfo_proc=sizeOf_kinfo_proc_32;
    kinfo_proc_pid_offset=kinfo_proc_pid_offset_32;
    kinfo_proc_ppid_offset=kinfo_proc_ppid_offset_32;
  }
  try {
    IntByReference _=new IntByReference(sizeOfInt);
    IntByReference size=new IntByReference(sizeOfInt);
    Memory m;
    int nRetry=0;
    while (true) {
      if (LIBC.sysctl(MIB_PROC_ALL,3,NULL,size,NULL,_) != 0) {
        throw new IOException("String_Node_Str" + LIBC.strerror(Native.getLastError()));
      }
      m=new Memory(size.getValue());
      if (LIBC.sysctl(MIB_PROC_ALL,3,m,size,NULL,_) != 0) {
        if (Native.getLastError() == ENOMEM && nRetry++ < 16) {
          continue;
        }
        throw new IOException("String_Node_Str" + LIBC.strerror(Native.getLastError()));
      }
      break;
    }
    int count=size.getValue() / sizeOf_kinfo_proc;
    LOGGER.log(Level.FINE,"String_Node_Str",count);
    for (int base=0; base < size.getValue(); base+=sizeOf_kinfo_proc) {
      int pid=m.getInt(base + kinfo_proc_pid_offset);
      int ppid=m.getInt(base + kinfo_proc_ppid_offset);
      processList.add(new NativeMacProcess(pid,ppid));
    }
  }
 catch (  IOException e) {
    LOGGER.log(Level.WARNING,"String_Node_Str",e);
  }
  return processList;
}
Program: 24541
Project: 24541
Buggy source:
public Map<String,String> getEnvironmentVariables(){
  try {
    return nativeWindowsProcess.getEnvironmentVariables();
  }
 catch (  WinpException exc) {
    throw new NativeAccessException(exc);
  }
}

Fixed version (ground truth):
public Map<String,String> getEnvironmentVariables(){
  try {
    return nativeWindowsProcess.getEnvironmentVariables();
  }
 catch (  WinpException exc) {
    System.out.println(exc.getLocalizedMessage());
    return new HashMap();
  }
}
Program: 24542
Project: 24542
Buggy source:
public String getCommandLine(){
  return nativeWindowsProcess.getCommandLine();
}

Fixed version (ground truth):
public String getCommandLine(){
  try {
    return nativeWindowsProcess.getCommandLine();
  }
 catch (  WinpException exc) {
    System.out.println(exc.getLocalizedMessage());
    return "String_Node_Str";
  }
}