nus-yam/ex-repair huggingface dataset:
Program: 154464
Project: 154464
Buggy source:
public boolean onCommand(CommandSender _sender,Command _command,String _label,String[] _args){
  Player player=(_sender instanceof Player) ? (Player)_sender : null;
  if (_label.equals("String_Node_Str")) {
    if (_args.length >= 2) {
      String commandName=_args[0];
      String playerName=_args[1];
      ArrayList<String> flags=new ArrayList<String>();
      for (int i=2; i < _args.length; i++) {
        flags.add(_args[i]);
      }
      Executioner executioner=ExecutionManager.getExecutioner(commandName);
      if (executioner != null) {
        Player target=findPlayer(playerName);
        if (target != null) {
          if (executioner.hasPermission(player)) {
            if (ExecutionManager.isExecuting(target))             ExecutionManager.release(target);
            ExecutionManager.execute(executioner,player,target,flags);
            communicationManager.message(player,"String_Node_Str" + commandName + "String_Node_Str"+ playerName+ "String_Node_Str");
          }
 else           communicationManager.error(player,"String_Node_Str" + commandName + "String_Node_Str");
        }
 else         communicationManager.error(player,"String_Node_Str" + playerName + "String_Node_Str");
      }
 else       communicationManager.error(player,"String_Node_Str" + commandName + "String_Node_Str");
    }
 else {
      if (player != null) {
        if (permissionManager.hasStrikePermission(player))         communicationManager.command(player,"String_Node_Str","String_Node_Str");
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean onCommand(CommandSender _sender,Command _command,String _label,String[] _args){
  Player player=(_sender instanceof Player) ? (Player)_sender : null;
  if (_label.equals("String_Node_Str")) {
    if (_args.length >= 2) {
      String commandName=_args[0];
      String playerName=_args[1];
      ArrayList<String> flags=new ArrayList<String>();
      for (int i=2; i < _args.length; i++) {
        flags.add(_args[i]);
      }
      Executioner executioner=ExecutionManager.createExecutioner(commandName);
      if (executioner != null) {
        Player target=findPlayer(playerName);
        if (target != null) {
          if (executioner.hasPermission(player)) {
            ExecutionManager.add(executioner,player,target,flags);
            communicationManager.message(player,"String_Node_Str" + commandName + "String_Node_Str"+ playerName+ "String_Node_Str");
          }
 else           communicationManager.error(player,"String_Node_Str" + commandName + "String_Node_Str");
        }
 else         communicationManager.error(player,"String_Node_Str" + playerName + "String_Node_Str");
      }
 else       communicationManager.error(player,"String_Node_Str" + commandName + "String_Node_Str");
    }
 else {
      if (player != null) {
        if (permissionManager.hasStrikePermission(player))         communicationManager.command(player,"String_Node_Str","String_Node_Str");
      }
    }
    return true;
  }
  return false;
}
Program: 154465
Project: 154465
Buggy source:
private static Executioner createExecutioner(String _name){
  if (_name.equalsIgnoreCase("String_Node_Str"))   return new Strike();
  return null;
}

Fixed version (ground truth):
public static Executioner createExecutioner(String _name){
  if (_name.equalsIgnoreCase("String_Node_Str"))   return new Strike();
  return null;
}
Program: 154466
Project: 154466
Buggy source:
public static void killed(Player _player){
  Sentence sentence=sentences.get(_player.getName());
  if (sentence != null) {
    String message=sentence.executioner.getMessage();
    if (message != null && !sentence.flags.contains("String_Node_Str")) {
      message=Wrath.get().getComms().parse(message,sentence.player,sentence.target);
      Wrath.get().getComms().broadcast(null,message);
    }
    release(_player);
  }
}

Fixed version (ground truth):
public static void killed(Player _player){
  Sentence sentence=sentences.get(_player.getName());
  if (sentence != null) {
    String message=sentence.executioner.getMessage();
    if (message != null && !sentence.flags.contains("String_Node_Str")) {
      message=Wrath.get().getComms().parse(message,sentence.player,sentence.target);
      Wrath.get().getComms().broadcast(null,message);
    }
    remove(_player);
  }
}
Program: 154467
Project: 154467
Buggy source:
/** 
 * Performs a minimax search on a subtree of the game's state space and computes the value of the best move for MIN. This method implements Alpha-Beta pruning.
 * @param state The board from which to start this portion of the search
 * @param alpha The best known utility for MAX along the current search path
 * @param beta The best known utility for MIN along the current search path
 * @return The utility of the best branch to take from this board state
 */
private int alphaBetaMinVal(Board state,double alpha,double beta){
  ++nodesVisited;
  if (state.isGameOver()) {
    int utility=heuristic.evaluate(state);
    state.setValue(utility);
    return utility;
  }
  Vector<Board> children=state.generateSuccessors();
  for (  Board b : children) {
    int child=alphaBetaMaxVal(b,alpha,beta);
    beta=Math.min(beta,child);
    if (alpha >= beta) {
      state.setValue(child);
      return child;
    }
  }
  state.setValue((int)beta);
  return (int)beta;
}

Fixed version (ground truth):
/** 
 * Performs a minimax search on a subtree of the game's state space and computes the value of the best move for MIN. This method implements Alpha-Beta pruning.
 * @param state The board from which to start this portion of the search
 * @param alpha The best known utility for MAX along the current search path
 * @param beta The best known utility for MIN along the current search path
 * @return The utility of the best branch to take from this board state
 */
private int alphaBetaMinVal(Board state,double alpha,double beta,int depth){
  ++nodesVisited;
  if (state.isGameOver() || state.getFilledPositions() >= depth || timeExpired) {
    System.out.println("String_Node_Str" + state.getFilledPositions());
    int utility=heuristic.evaluate(state);
    state.setValue(utility);
    return utility;
  }
  Vector<Board> children=state.generateSuccessors();
  for (  Board b : children) {
    int child=alphaBetaMaxVal(b,alpha,beta,depth);
    beta=Math.min(beta,child);
    if (alpha >= beta) {
      state.setValue(child);
      return child;
    }
  }
  state.setValue((int)beta);
  return (int)beta;
}
Program: 154468
Project: 154468
Buggy source:
/** 
 * Gets or computes the next move for this Player object, depending on whether this Player is an AI agent or not.
 * @param b The board's current state
 */
public void move(Board b){
  String move;
  if (!human) {
    move=minimax(b);
  }
 else {
    System.out.print("String_Node_Str");
    Scanner in=new Scanner(System.in);
    move=in.nextLine();
  }
  String[] parsed=move.split("String_Node_Str");
  int row=Integer.parseInt(parsed[0]);
  int col=Integer.parseInt(parsed[1]);
  b.move(player,row,col);
}

Fixed version (ground truth):
/** 
 * Gets or computes the next move for this Player object, depending on whether this Player is an AI agent or not.
 * @param b The board's current state
 */
public void move(Board b){
  String move;
  if (!human) {
    timeExpired=false;
    Timer t=new Timer();
    MoveTimer mt=new MoveTimer();
    t.schedule(mt,1000);
    move=minimax(b);
  }
 else {
    System.out.print("String_Node_Str");
    Scanner in=new Scanner(System.in);
    move=in.nextLine();
  }
  String[] parsed=move.split("String_Node_Str");
  int row=Integer.parseInt(parsed[0]);
  int col=Integer.parseInt(parsed[1]);
  b.move(player,row,col);
}
Program: 154469
Project: 154469
Buggy source:
/** 
 * Performs a minimax search on a subtree of the game's state space and computes the value of the best move for MAX. This method implements Alpha-Beta pruning.
 * @param state The board from which to start this portion of the search
 * @param alpha The best known utility for MAX along the current search path
 * @param beta The best known utility for MIN along the current search path
 * @return The utility of the best branch to take from this board state
 */
private int alphaBetaMaxVal(Board state,double alpha,double beta){
  ++nodesVisited;
  if (state.isGameOver()) {
    int utility=heuristic.evaluate(state);
    state.setValue(utility);
    return utility;
  }
  Vector<Board> children=state.generateSuccessors();
  for (  Board b : children) {
    int child=alphaBetaMinVal(b,alpha,beta);
    alpha=Math.max(alpha,child);
    if (alpha >= beta) {
      state.setValue(child);
      return child;
    }
  }
  state.setValue((int)alpha);
  return (int)alpha;
}

Fixed version (ground truth):
/** 
 * Performs a minimax search on a subtree of the game's state space and computes the value of the best move for MAX. This method implements Alpha-Beta pruning.
 * @param state The board from which to start this portion of the search
 * @param alpha The best known utility for MAX along the current search path
 * @param beta The best known utility for MIN along the current search path
 * @return The utility of the best branch to take from this board state
 */
private int alphaBetaMaxVal(Board state,double alpha,double beta,int depth){
  ++nodesVisited;
  if (state.isGameOver() || state.getFilledPositions() >= depth || timeExpired) {
    System.out.println("String_Node_Str" + state.getFilledPositions());
    int utility=heuristic.evaluate(state);
    state.setValue(utility);
    return utility;
  }
  Vector<Board> children=state.generateSuccessors();
  for (  Board b : children) {
    int child=alphaBetaMinVal(b,alpha,beta,depth);
    alpha=Math.max(alpha,child);
    if (alpha >= beta) {
      state.setValue(child);
      return child;
    }
  }
  state.setValue((int)alpha);
  return (int)alpha;
}
Program: 154470
Project: 154470
Buggy source:
/** 
 * Uses minimax search to find the value of the best move.
 * @param currentState The current state of the board
 * @return A String representation of the best move (e.g. "1 2")
 */
public String minimax(Board currentState){
  int val;
  String move="String_Node_Str";
  if (player == 'X') {
    val=alphaBetaMaxVal(currentState,Double.NEGATIVE_INFINITY,Double.POSITIVE_INFINITY);
    Vector<Board> children=currentState.getSuccessors();
    for (    Board b : children) {
      if (b.getValue() == 1 && b.isGameOver()) {
        move=Board.generateMove(currentState,b);
        return move;
      }
    }
    for (    Board b : children) {
      if (b.getValue() == val) {
        move=Board.generateMove(currentState,b);
        return move;
      }
    }
  }
 else {
    val=alphaBetaMinVal(currentState,Double.NEGATIVE_INFINITY,Double.POSITIVE_INFINITY);
    Vector<Board> children=currentState.getSuccessors();
    for (    Board b : children) {
      if (b.getValue() == -1 && b.isGameOver()) {
        move=Board.generateMove(currentState,b);
        return move;
      }
    }
    for (    Board b : children) {
      if (b.getValue() == val) {
        move=Board.generateMove(currentState,b);
        return move;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Uses minimax search to find the value of the best move.
 * @param currentState The current state of the board
 * @return A String representation of the best move (e.g. "1 2")
 */
public String minimax(Board currentState){
  int val=-1;
  String move="String_Node_Str";
  if (player == 'X') {
    for (int i=1; i <= 9 && !timeExpired; ++i) {
      val=alphaBetaMaxVal(currentState,Double.NEGATIVE_INFINITY,Double.POSITIVE_INFINITY,i);
      try {
        Thread.sleep(300);
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
      System.out.println("String_Node_Str");
    }
    Vector<Board> children=currentState.getSuccessors();
    for (    Board b : children) {
      if (b.getValue() == 1 && b.isGameOver()) {
        move=Board.generateMove(currentState,b);
        return move;
      }
    }
    for (    Board b : children) {
      if (b.getValue() == val) {
        move=Board.generateMove(currentState,b);
        return move;
      }
    }
  }
 else {
    for (int i=1; i <= 9; ++i) {
      val=alphaBetaMinVal(currentState,Double.NEGATIVE_INFINITY,Double.POSITIVE_INFINITY,i);
      System.out.println("String_Node_Str");
    }
    Vector<Board> children=currentState.getSuccessors();
    for (    Board b : children) {
      if (b.getValue() == -1 && b.isGameOver()) {
        move=Board.generateMove(currentState,b);
        return move;
      }
    }
    for (    Board b : children) {
      if (b.getValue() == val) {
        move=Board.generateMove(currentState,b);
        return move;
      }
    }
  }
  return null;
}
Program: 154471
Project: 154471
Buggy source:
/** 
 * copia los atributos a otro 
 */
protected final void copyTo(final XMPPMessageAttributes other,final Map<String,Object> model){
  other.setMessageType(getMessageType());
  other.setMessageType(getMessageType());
  other.setLangBodies(translateLangBodies());
  if (getHtmlStringMessage() != null) {
    other.setHtmlMessage(new StringResource(renderString(getHtmlStringMessage(),model)));
  }
  final List<PacketExtension> packetExtensions=new LinkedList<PacketExtension>(getExtensions());
  for (  final XMPPMessagePacketExtensionTemplate template : packetExtensionTemplates) {
    packetExtensions.add(template.render(model));
  }
  other.setExtensions(packetExtensions);
  other.setConnection(getConnection());
}

Fixed version (ground truth):
/** 
 * copia los atributos a otro 
 */
protected final void copyTo(final XMPPMessageAttributes other,final Map<String,Object> model){
  other.setMessageType(getMessageType());
  other.setMessageType(getMessageType());
  other.setLangBodies(translateLangBodies());
  if (getHtmlStringMessage() != null) {
    other.setHtmlMessage(new StringResource(renderString(getHtmlStringMessage(),model)));
  }
  final List<PacketExtension> packetExtensions=new LinkedList<PacketExtension>(getExtensions());
  for (  final XMPPMessagePacketExtensionTemplate template : packetExtensionTemplates) {
    packetExtensions.add(template.render(model));
  }
  if (packetExtensions != null) {
    other.setExtensions(packetExtensions);
  }
  other.setConnection(getConnection());
}
Program: 154475
Project: 154475
Buggy source:
/** 
 * Indicates to the emulator framework that this cube needs to have its virtual screen refreshed. Call after making any change that impacts the current graphics. (Usually called from within a Game subclass.)
 */
public void needsRefresh(){
  this.panel.needsRefresh();
}

Fixed version (ground truth):
/** 
 * Indicates to the emulator framework that this cube needs to have its virtual screen refreshed. Call after making any change that impacts the current graphics. (Usually called from within a Game subclass.)
 */
public void needsRefresh(){
  if (this.panel != null) {
    this.panel.needsRefresh();
  }
}
Program: 154476
Project: 154476
Buggy source:
public void rotateCounterclockwise(){
  this.rotation=(this.rotation - 1 + 4) % 4;
  this.needsRefresh();
}

Fixed version (ground truth):
public void rotateCounterclockwise(){
  this.rotation=(this.rotation - 1 + 4) % 4;
  Cube tmp=this.adjacent[EDGE_NORTH];
  this.adjacent[EDGE_NORTH]=this.adjacent[EDGE_WEST];
  this.adjacent[EDGE_WEST]=this.adjacent[EDGE_SOUTH];
  this.adjacent[EDGE_SOUTH]=this.adjacent[EDGE_EAST];
  this.adjacent[EDGE_EAST]=tmp;
  for (int i=0; i < 4; i++) {
    if (this.adjacent[i] != null) {
      this.adjacent[i].getPanel().updateAdjacencies();
    }
  }
  this.needsRefresh();
}
Program: 154477
Project: 154477
Buggy source:
public void rotateClockwise(){
  this.rotation=(this.rotation + 1) % 4;
  this.needsRefresh();
}

Fixed version (ground truth):
public void rotateClockwise(){
  this.rotation=(this.rotation + 1) % 4;
  Cube tmp=this.adjacent[EDGE_NORTH];
  this.adjacent[EDGE_NORTH]=this.adjacent[EDGE_EAST];
  this.adjacent[EDGE_EAST]=this.adjacent[EDGE_SOUTH];
  this.adjacent[EDGE_SOUTH]=this.adjacent[EDGE_WEST];
  this.adjacent[EDGE_WEST]=tmp;
  for (int i=0; i < 4; i++) {
    if (this.adjacent[i] != null) {
      this.adjacent[i].getPanel().updateAdjacencies();
    }
  }
  this.needsRefresh();
}
Program: 154478
Project: 154478
Buggy source:
/** 
 * Notify this cube that it is no longer adjacent to another Cube along an  absolute edge.
 */
public void separatedCube(Cube cube,int edge){
  assert(this.adjacent[edge] == cube || this.adjacent[edge] == null);
  this.adjacent[edge]=null;
}

Fixed version (ground truth):
/** 
 * Notify this cube that it is no longer adjacent to another Cube along an  absolute edge.
 */
public void separatedCube(Cube cube,int edge){
  assert(this.adjacent[edge] == cube);
  this.adjacent[edge]=null;
}
Program: 154479
Project: 154479
Buggy source:
@Override public void paint(Graphics g){
  super.paint(g);
  System.out.println("String_Node_Str" + CubePanel.this.getCube().getRotationDegrees());
  Graphics2D g2=(Graphics2D)g;
  int xt=0;
  int yt=0;
switch (CubePanel.this.getCube().getRotation()) {
case Cube.ROTATION_90:
    xt=0;
  yt=-128;
break;
case Cube.ROTATION_180:
xt=-128;
yt=-128;
break;
case Cube.ROTATION_270:
xt=-128;
yt=0;
break;
case Cube.ROTATION_0:
default :
xt=0;
yt=0;
break;
}
AffineTransform savedTransform=g2.getTransform();
g2.rotate(Math.toRadians(CubePanel.this.getCube().getRotationDegrees()));
g2.translate(xt,yt);
Emulator.getActiveGame().renderCube(CubePanel.this.cube,g2);
g2.setTransform(savedTransform);
}

Fixed version (ground truth):
@Override public void paint(Graphics g){
  super.paint(g);
  Graphics2D g2=(Graphics2D)g;
  int xt=0;
  int yt=0;
switch (CubePanel.this.getCube().getRotation()) {
case Cube.ROTATION_90:
    xt=0;
  yt=-128;
break;
case Cube.ROTATION_180:
xt=-128;
yt=-128;
break;
case Cube.ROTATION_270:
xt=-128;
yt=0;
break;
case Cube.ROTATION_0:
default :
xt=0;
yt=0;
break;
}
AffineTransform savedTransform=g2.getTransform();
g2.rotate(Math.toRadians(CubePanel.this.getCube().getRotationDegrees()));
g2.translate(xt,yt);
Emulator.getActiveGame().renderCube(CubePanel.this.cube,g2);
g2.setTransform(savedTransform);
}
Program: 154481
Project: 154481
Buggy source:
public static void foundAdjacent(Cube c1,int e1,Cube c2,int e2){
  System.out.println("String_Node_Str" + c1 + "String_Node_Str"+ c2);
  if (activeGame != null && c1.adjacencyAlong(e1) == null && c2.adjacencyAlong(e2) == null) {
    activeGame.cubesJoined(c1,e1,c2,e2);
  }
  if (c1.adjacencyAlong(e1) == null) {
    c1.joinedCube(c2,e1);
  }
  if (c2.adjacencyAlong(e2) == null) {
    c2.joinedCube(c1,e2);
  }
}

Fixed version (ground truth):
public static void foundAdjacent(Cube c1,int e1,Cube c2,int e2){
  if (c1.adjacencyAlong(e1) == null && c2.adjacencyAlong(e2) == null) {
    if (activeGame != null) {
      activeGame.cubesJoined(c1,e1,c2,e2);
    }
    c1.joinedCube(c2,e1);
    c2.joinedCube(c1,e2);
  }
}
Program: 154482
Project: 154482
Buggy source:
public static void foundSeparate(Cube c1,int e1,Cube c2,int e2){
  System.out.println("String_Node_Str" + c1 + "String_Node_Str"+ c2);
  if (activeGame != null && c1.adjacencyAlong(e1).equals(c2) && c2.adjacencyAlong(e2).equals(c1)) {
    activeGame.cubesSeparated(c1,e1,c2,e2);
  }
  if (c1.adjacencyAlong(e1) != null && c1.adjacencyAlong(e1).equals(c2)) {
    c1.separatedCube(c2,e1);
  }
  if (c2.adjacencyAlong(e2) != null && c2.adjacencyAlong(e2).equals(c1)) {
    c2.separatedCube(c1,e2);
  }
}

Fixed version (ground truth):
public static void foundSeparate(Cube c1,int e1,Cube c2,int e2){
  if (c1.adjacencyAlong(e1) == c2 && c2.adjacencyAlong(e2) == c1) {
    if (activeGame != null) {
      activeGame.cubesSeparated(c1,e1,c2,e2);
    }
    c1.separatedCube(c2,e1);
    c2.separatedCube(c1,e2);
  }
}
Program: 154483
Project: 154483
Buggy source:
public static void removeCube(Cube cube){
  cubes.remove(cube);
  emulatorFrame.removedCube(cube);
}

Fixed version (ground truth):
public static void removeCube(Cube cube){
  cubes.remove(cube);
  if (activeGame != null) {
    activeGame.removedCube(cube);
  }
  emulatorFrame.removedCube(cube);
}
Program: 154484
Project: 154484
Buggy source:
/** 
 * Do post-initialization startup. Commonly used to register games.
 */
public static void load(){
  registerGame(new NullGame());
  registerGame(new RGBStripeGame());
  registerGame(new ColorBlockGame());
}

Fixed version (ground truth):
/** 
 * Do post-initialization startup. Commonly used to register games.
 */
public static void load(){
  registerGame(new NullGame());
  registerGame(new RGBStripeGame());
  registerGame(new ColorBlockGame());
  registerGame(new AdjacencyTestGame());
  registerGame(new ProximityTestGame());
}
Program: 154485
Project: 154485
Buggy source:
/** 
 * Add a new cube to active emulation.
 */
public static void addCube(){
  Cube cube=new Cube();
  cubes.add(cube);
  emulatorFrame.addedCube(cube);
}

Fixed version (ground truth):
/** 
 * Add a new cube to active emulation.
 */
public static void addCube(){
  Cube cube=new Cube();
  cubes.add(cube);
  if (activeGame != null) {
    activeGame.addedCube(cube);
  }
  emulatorFrame.addedCube(cube);
}
Program: 154486
Project: 154486
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  Emulator.quit();
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  System.out.println("String_Node_Str");
  for (  Cube cube : Emulator.getCubes()) {
    for (int i=0; i < 4; i++) {
      System.out.println(Emulator.formatCubeEdge(cube,i) + "String_Node_Str" + cube.adjacencyAlong(i));
    }
  }
  System.out.println("String_Node_Str");
}
Program: 154487
Project: 154487
Buggy source:
/** 
 * Construct a new EmulatorFrame with new workspace and control panels.
 */
public EmulatorFrame(){
  super("String_Node_Str");
  this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  this.setSize(1024,768);
  this.workspacePanel=new WorkspacePanel();
  this.controlPanel=new ControlPanel();
  this.getContentPane().add(this.workspacePanel,BorderLayout.CENTER);
  this.getContentPane().add(this.controlPanel,BorderLayout.EAST);
  this.menuBar=new JMenuBar();
  JMenu fileMenu=new JMenu("String_Node_Str");
  this.menuBar.add(fileMenu);
  JMenuItem quitItem=new JMenuItem("String_Node_Str");
  quitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q,ActionEvent.CTRL_MASK));
  quitItem.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      Emulator.quit();
    }
  }
);
  fileMenu.add(quitItem);
  this.setJMenuBar(this.menuBar);
}

Fixed version (ground truth):
/** 
 * Construct a new EmulatorFrame with new workspace and control panels.
 */
public EmulatorFrame(){
  super("String_Node_Str");
  this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  this.setSize(1024,768);
  this.workspacePanel=new WorkspacePanel();
  this.controlPanel=new ControlPanel();
  this.getContentPane().add(this.workspacePanel,BorderLayout.CENTER);
  this.getContentPane().add(this.controlPanel,BorderLayout.EAST);
  this.menuBar=new JMenuBar();
  JMenu fileMenu=new JMenu("String_Node_Str");
  this.menuBar.add(fileMenu);
  JMenuItem quitItem=new JMenuItem("String_Node_Str");
  quitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q,ActionEvent.CTRL_MASK));
  quitItem.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      Emulator.quit();
    }
  }
);
  fileMenu.add(quitItem);
  JMenu debugMenu=new JMenu("String_Node_Str");
  this.menuBar.add(debugMenu);
  JMenuItem adjacencyItem=new JMenuItem("String_Node_Str");
  adjacencyItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D,ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK));
  adjacencyItem.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      System.out.println("String_Node_Str");
      for (      Cube cube : Emulator.getCubes()) {
        for (int i=0; i < 4; i++) {
          System.out.println(Emulator.formatCubeEdge(cube,i) + "String_Node_Str" + cube.adjacencyAlong(i));
        }
      }
      System.out.println("String_Node_Str");
    }
  }
);
  debugMenu.add(adjacencyItem);
  this.setJMenuBar(this.menuBar);
}
Program: 154488
Project: 154488
Buggy source:
@NotNull private static Expression parseOneElement(Lexer lexer){
  TokenType tokenType=lexer.getTokenType();
  if (tokenType == null) {
    throw new ParserException(UNEXPECTED_END,lexer.getPrevEnd());
  }
switch (tokenType) {
case NUMBER:
    String text=lexer.getTokenText();
  ExNumber res=new ExNumber(Double.parseDouble(text.replace(',','.')));
lexer.advance();
return res;
case SYMBOL:
if (lexer.getTokenChar() == '(') {
lexer.advance();
Expression expr=parseExpression(lexer);
if (!lexer.isSymbol(')')) throw new ParserException(CLOSED_BRACKET_NOT_FOUND,lexer.getPrevEnd());
lexer.advance();
return expr;
}
throw new ParserException(UNKNOWN_SYMBOL,lexer);
case IDENTIFIER:
{
String name=lexer.getTokenText();
lexer.advance();
if (!lexer.isSymbol('(')) return new ExVariable(name);
lexer.advance();
if (lexer.isSymbol(')')) {
lexer.advance();
return new ExFunction(name);
}
Expression argument=parseExpression(lexer);
Expression[] arguments;
if (lexer.isSymbol(',')) {
List<Expression> list=new ArrayList<Expression>();
list.add(argument);
do {
lexer.advance();
list.add(parseExpression(lexer));
}
 while (lexer.isSymbol(','));
arguments=list.toArray(new Expression[list.size()]);
}
 else if (lexer.isSymbol(')')) {
lexer.advance();
arguments=new Expression[]{argument};
}
 else {
throw new ParserException(CLOSED_BRACKET_NOT_FOUND,lexer);
}
return new ExFunction(name,arguments);
}
default :
throw new RuntimeException();
}
}

Fixed version (ground truth):
@NotNull private static Expression parseOneElement(Lexer lexer){
  TokenType tokenType=lexer.getTokenType();
  if (tokenType == null) {
    throw new ParserException(UNEXPECTED_END,lexer.getPrevEnd());
  }
switch (tokenType) {
case NUMBER:
    String text=lexer.getTokenText();
  ExNumber res=new ExNumber(Double.parseDouble(text.replace(',','.')));
lexer.advance();
return res;
case SYMBOL:
if (lexer.getTokenChar() == '(') {
lexer.advance();
Expression expr=parseExpression(lexer);
if (!lexer.isSymbol(')')) throw new ParserException(CLOSED_BRACKET_NOT_FOUND,lexer.getPrevEnd());
lexer.advance();
return expr;
}
throw new ParserException(UNKNOWN_SYMBOL,lexer);
case IDENTIFIER:
{
String name=lexer.getTokenText();
lexer.advance();
if (!lexer.isSymbol('(')) return new ExVariable(name);
lexer.advance();
if (lexer.isSymbol(')')) {
lexer.advance();
return new ExFunction(name);
}
Expression argument=parseExpression(lexer);
Expression[] arguments;
if (lexer.isSymbol(',')) {
List<Expression> list=new ArrayList<Expression>();
list.add(argument);
do {
lexer.advance();
list.add(parseExpression(lexer));
}
 while (lexer.isSymbol(','));
arguments=list.toArray(new Expression[list.size()]);
}
 else {
arguments=new Expression[]{argument};
}
if (lexer.isSymbol(')')) {
lexer.advance();
}
 else {
throw new ParserException(CLOSED_BRACKET_NOT_FOUND,lexer);
}
return new ExFunction(name,arguments);
}
default :
throw new RuntimeException();
}
}
Program: 154489
Project: 154489
Buggy source:
private static CharSequence recreateView(String text,int caret,int selectionLength,boolean hasFocus,Highlighter... highlighters){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  ColorModel colorModel=new ColorModel(text.length());
  for (  Highlighter highlighter : highlighters) {
    highlighter.highlight(text,caret,selectionLength,hasFocus,colorModel);
  }
  if (hasFocus) {
    if (selectionLength != 0) {
      colorModel.addStyle(caret,caret + selectionLength,"String_Node_Str");
    }
 else {
      if (caret < text.length()) {
        colorModel.addStyle(caret,"String_Node_Str");
      }
    }
  }
  for (int i=0; i < text.length(); ) {
    int next=colorModel.getNextDifferent(i);
    CharSequence style=colorModel.getStyle(i);
    if (style == null) {
      sb.append(text,i,next);
    }
 else {
      sb.append("String_Node_Str").append(style).append("String_Node_Str");
      sb.append(text,i,next);
      sb.append("String_Node_Str");
    }
    i=next;
  }
  if (hasFocus && caret == text.length()) {
    sb.append("String_Node_Str");
  }
  sb.append(' ');
  sb.append("String_Node_Str");
  return sb;
}

Fixed version (ground truth):
private static CharSequence recreateView(String text,int caret,int selectionLength,boolean hasFocus,Highlighter... highlighters){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  ColorModel colorModel=new ColorModel(text.length());
  for (  Highlighter highlighter : highlighters) {
    highlighter.highlight(text,caret,selectionLength,hasFocus,colorModel);
  }
  if (hasFocus) {
    if (selectionLength != 0) {
      colorModel.addStyle(caret,caret + selectionLength,"String_Node_Str");
    }
 else {
      if (caret < text.length()) {
        colorModel.addStyle(caret,"String_Node_Str");
      }
    }
  }
  for (int i=0; i < text.length(); ) {
    int next=colorModel.getNextDifferent(i);
    CharSequence style=colorModel.getStyle(i);
    if (style == null) {
      sb.append(text,i,next);
    }
 else {
      sb.append("String_Node_Str").append(style).append("String_Node_Str");
      sb.append(text,i,next);
      sb.append("String_Node_Str");
    }
    i=next;
  }
  if (hasFocus && caret == text.length()) {
    sb.append("String_Node_Str");
  }
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  return sb;
}
Program: 154490
Project: 154490
Buggy source:
@Override public void highlight(@NotNull String text,int caret,int selectionLength,boolean hasFocus,@NotNull ColorModel model){
  if (selectionLength > 0 || !hasFocus)   return;
  if (caret > 0 && text.charAt(caret - 1) == ')') {
    int paired=findParent(text,caret - 1,-1,')','(');
    if (paired == -1) {
      model.addStyle(caret - 1,"String_Node_Str");
    }
 else {
      model.addStyle(caret - 1,"String_Node_Str");
      model.addStyle(paired,"String_Node_Str");
    }
  }
  if (caret < text.length() && text.charAt(caret) == '(') {
    int paired=findParent(text,caret,1,'(',')');
    if (paired == -1) {
      model.addStyle(caret - 1,"String_Node_Str");
    }
 else {
      model.addStyle(caret,"String_Node_Str");
      model.addStyle(paired,"String_Node_Str");
    }
  }
}

Fixed version (ground truth):
@Override public void highlight(@NotNull String text,int caret,int selectionLength,boolean hasFocus,@NotNull ColorModel model){
  if (selectionLength > 0 || !hasFocus)   return;
  if (caret > 0 && text.charAt(caret - 1) == ')') {
    int paired=findParent(text,caret - 1,-1,')','(');
    if (paired == -1) {
      model.addStyle(caret - 1,"String_Node_Str");
    }
 else {
      model.addStyle(caret - 1,"String_Node_Str");
      model.addStyle(paired,"String_Node_Str");
    }
  }
  if (caret < text.length() && text.charAt(caret) == '(') {
    int paired=findParent(text,caret,1,'(',')');
    if (paired == -1) {
      model.addStyle(caret,"String_Node_Str");
    }
 else {
      model.addStyle(caret,"String_Node_Str");
      model.addStyle(paired,"String_Node_Str");
    }
  }
}
Program: 154491
Project: 154491
Buggy source:
public int getNextDifferent(int index){
  CharSequence first=array[index];
  for (int i=index + 1; i < array.length; i++) {
    if (first == null ? array[i] != null : !first.equals(array[i])) {
      return i;
    }
  }
  return array.length;
}

Fixed version (ground truth):
public int getNextDifferent(int index){
  CharSequence first=array[index];
  for (int i=index + 1; i < array.length; i++) {
    if (first == null ? array[i] != null : !StringUtil.equals(first,array[i])) {
      return i;
    }
  }
  return array.length;
}
Program: 154492
Project: 154492
Buggy source:
@Override public final void apply(@NotNull Expression expression,Consumer<Expression> consumer){
  if (expression.getClass() != aClass)   return;
  Expression[] expressions=((AbstractMultiargumentExpression)expression).getExpressions();
  for (int i=0; i < expressions.length; i++) {
    Expression e=expressions[i];
    if (e instanceof ExNumber && ((ExNumber)e).isInteger()) {
      for (int k=i + 1; k < expressions.length; k++) {
        Expression e2=expressions[k];
        if (e2 instanceof ExNumber && ((ExNumber)e2).isInteger()) {
          double sum=sum(((ExNumber)e).getValue(),((ExNumber)e2).getValue());
          if (expressions.length == 2) {
            consumer.consume(new ExNumber(sum));
            return;
          }
          Expression[] m=new Expression[expressions.length - 1];
          m[0]=new ExNumber(sum);
          int pos=1;
          for (int j=0; j < expressions.length; j++) {
            if (j != i && j != k) {
              m[pos++]=expressions[j];
            }
          }
          consumer.consume(new ExSum(m));
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public final void apply(@NotNull Expression expression,Consumer<Expression> consumer){
  if (expression.getClass() != aClass)   return;
  AbstractMultiargumentExpression abstractExpression=(AbstractMultiargumentExpression)expression;
  Expression[] expressions=abstractExpression.getExpressions();
  for (int i=0; i < expressions.length; i++) {
    Expression e=expressions[i];
    if (e instanceof ExNumber && ((ExNumber)e).isInteger()) {
      for (int k=i + 1; k < expressions.length; k++) {
        Expression e2=expressions[k];
        if (e2 instanceof ExNumber && ((ExNumber)e2).isInteger()) {
          double sum=sum(((ExNumber)e).getValue(),((ExNumber)e2).getValue());
          if (expressions.length == 2) {
            consumer.consume(new ExNumber(sum));
            return;
          }
          Expression[] m=new Expression[expressions.length - 1];
          m[0]=new ExNumber(sum);
          int pos=1;
          for (int j=0; j < expressions.length; j++) {
            if (j != i && j != k) {
              m[pos++]=expressions[j];
            }
          }
          consumer.consume(abstractExpression.createInstance(m));
        }
      }
    }
  }
}
Program: 154493
Project: 154493
Buggy source:
@Override public final void apply(@NotNull Expression expression,Consumer<Expression> consumer){
  if (!(expression instanceof ExMul)) {
    return;
  }
  Expression[] expressions=((ExMul)expression).getExpressions();
  for (int i=0; i < expressions.length; i++) {
    Expression e=expressions[i];
    Expression e1x=getX(e);
    Expression e1Level=getLevel(e);
    for (int k=i + 1; k < expressions.length; k++) {
      Expression e2=expressions[k];
      Expression e2x=getX(e2);
      Expression e2Level=getLevel(e2);
      if (e1x.orderIndependentEquals(e2x)) {
        consumer.consume(new ExPower(e1x,newExSum(e1Level,e2Level)));
      }
    }
  }
}

Fixed version (ground truth):
@Override public final void apply(@NotNull Expression expression,Consumer<Expression> consumer){
  if (!(expression instanceof ExMul)) {
    return;
  }
  Expression[] expressions=((ExMul)expression).getExpressions();
  for (int i=0; i < expressions.length; i++) {
    Expression e=expressions[i];
    Expression e1x=getX(e);
    Expression e1Level=getLevel(e);
    for (int k=i + 1; k < expressions.length; k++) {
      Expression e2=expressions[k];
      Expression e2x=getX(e2);
      if (e1x.orderIndependentEquals(e2x)) {
        Expression e2Level=getLevel(e2);
        Expression[] ee=ArrayUtils.removeAt(expressions,k);
        ee[i]=new ExPower(e1x,newExSum(e1Level,e2Level));
        consumer.consume(ExMul.newExMul(ee));
      }
    }
  }
}
Program: 154494
Project: 154494
Buggy source:
public void testSum(){
  doTest("String_Node_Str",new ExNumber(4));
  doTest("String_Node_Str",new ExNumber(20));
  doTest("String_Node_Str",new ExNumber(10));
  doTest("String_Node_Str",Parser.parseExpression("String_Node_Str"));
  doTest("String_Node_Str",Parser.parseExpression("String_Node_Str"));
  doTest("String_Node_Str",Parser.parseExpression("String_Node_Str"));
  doTest("String_Node_Str",Parser.parseExpression("String_Node_Str"));
  doTest("String_Node_Str",Parser.parseExpression("String_Node_Str"));
  doTest("String_Node_Str",Parser.parseExpression("String_Node_Str"));
  doTest("String_Node_Str",Parser.parseExpression("String_Node_Str"));
  doTest("String_Node_Str",Parser.parseExpression("String_Node_Str"));
  doTest("String_Node_Str",Parser.parseExpression("String_Node_Str"));
  doTest("String_Node_Str",Parser.parseExpression("String_Node_Str"));
}

Fixed version (ground truth):
public void testSum(){
  doTest("String_Node_Str",new ExNumber(4));
  doTest("String_Node_Str",new ExNumber(20));
  doTest("String_Node_Str",new ExNumber(10));
  doTest("String_Node_Str",Parser.parseExpression("String_Node_Str"));
  doTest("String_Node_Str",Parser.parseExpression("String_Node_Str"));
  doTest("String_Node_Str",Parser.parseExpression("String_Node_Str"));
  doTest("String_Node_Str",Parser.parseExpression("String_Node_Str"));
  doTest("String_Node_Str",Parser.parseExpression("String_Node_Str"));
  doTest("String_Node_Str",Parser.parseExpression("String_Node_Str"));
  doTest("String_Node_Str",Parser.parseExpression("String_Node_Str"));
  doTest("String_Node_Str",Parser.parseExpression("String_Node_Str"));
  doTest("String_Node_Str",Parser.parseExpression("String_Node_Str"));
  doTest("String_Node_Str",Parser.parseExpression("String_Node_Str"));
  doTest("String_Node_Str",Parser.parseExpression("String_Node_Str"));
}
Program: 154495
Project: 154495
Buggy source:
public void appendToSum(StringBuilder sb){
  if (expressions.length == 1) {
    toString(sb);
  }
 else {
    for (int i=0; i < expressions.length; i++) {
      Expression e=expressions[i];
      if (e instanceof ExNumber && ((ExNumber)e).isNegative()) {
        sb.append('-');
        append(sb,i);
        return;
      }
    }
    sb.append('+');
    append(sb,-1);
  }
}

Fixed version (ground truth):
public void appendToSum(StringBuilder sb,boolean isFirst){
  if (expressions.length == 1) {
    toString(sb);
  }
 else {
    for (int i=0; i < expressions.length; i++) {
      Expression e=expressions[i];
      if (e instanceof ExNumber && ((ExNumber)e).isNegative()) {
        sb.append('-');
        append(sb,i);
        return;
      }
    }
    if (!isFirst) {
      sb.append('+');
    }
    append(sb,-1);
  }
}
Program: 154496
Project: 154496
Buggy source:
@Override protected void toString(StringBuilder sb){
  for (int i=0; i < expressions.length; i++) {
    Expression expression=expressions[i];
    if (expression instanceof ExNumber) {
      if (((ExNumber)expression).isNegative()) {
        expression.toString(sb);
      }
 else {
        if (i > 0) {
          sb.append('+');
        }
        expression.toString(sb,getPriority());
      }
    }
 else     if (expression instanceof ExMul) {
      ((ExMul)expression).appendToSum(sb);
    }
 else {
      if (i > 0) {
        sb.append('+');
      }
      sb.append('+');
      expression.toString(sb,getPriority());
    }
  }
}

Fixed version (ground truth):
@Override protected void toString(StringBuilder sb){
  for (int i=0; i < expressions.length; i++) {
    Expression expression=expressions[i];
    if (expression instanceof ExNumber) {
      if (((ExNumber)expression).isNegative()) {
        expression.toString(sb);
      }
 else {
        if (i > 0) {
          sb.append('+');
        }
        expression.toString(sb,getPriority());
      }
    }
 else     if (expression instanceof ExMul) {
      ((ExMul)expression).appendToSum(sb,i == 0);
    }
 else {
      if (i > 0) {
        sb.append('+');
      }
      expression.toString(sb,getPriority());
    }
  }
}
Program: 154497
Project: 154497
Buggy source:
@NotNull private static Expression getOneElement(Lexer lexer){
  TokenType tokenType=lexer.getTokenType();
  if (tokenType == null) {
    throw new ParserException("String_Node_Str",lexer);
  }
switch (tokenType) {
case NUMBER:
    ExNumber res=new ExNumber(Double.parseDouble(lexer.getTokenText()));
  lexer.advance();
return res;
case SYMBOL:
if (lexer.getTokenChar() == '(') {
lexer.advance();
Expression expr=getSum(lexer);
if (!lexer.isSymbol(')')) throw new ParserException(lexer);
lexer.advance();
return expr;
}
throw new ParserException("String_Node_Str",lexer);
case IDENTIFIER:
{
String text=lexer.getTokenText();
lexer.advance();
if (!lexer.isSymbol('(')) return new ExVariable(text);
lexer.advance();
Expression argument=getSum(lexer);
if (!lexer.isSymbol(')')) throw new ParserException(lexer);
return new ExFunction(text,argument);
}
default :
throw new RuntimeException();
}
}

Fixed version (ground truth):
@NotNull private static Expression getOneElement(Lexer lexer){
  TokenType tokenType=lexer.getTokenType();
  if (tokenType == null) {
    throw new ParserException("String_Node_Str",lexer);
  }
switch (tokenType) {
case NUMBER:
    ExNumber res=new ExNumber(Double.parseDouble(lexer.getTokenText()));
  lexer.advance();
return res;
case SYMBOL:
if (lexer.getTokenChar() == '(') {
lexer.advance();
Expression expr=getSum(lexer);
if (!lexer.isSymbol(')')) throw new ParserException(lexer);
lexer.advance();
return expr;
}
throw new ParserException("String_Node_Str",lexer);
case IDENTIFIER:
{
String text=lexer.getTokenText();
lexer.advance();
if (!lexer.isSymbol('(')) return new ExVariable(text);
lexer.advance();
Expression argument=getSum(lexer);
if (!lexer.isSymbol(')')) throw new ParserException(lexer);
lexer.advance();
return new ExFunction(text,argument);
}
default :
throw new RuntimeException();
}
}
Program: 154498
Project: 154498
Buggy source:
public void testTestCalculate(){
  doTest("String_Node_Str",12);
  doTest("String_Node_Str",3);
  doTest("String_Node_Str",11);
  doTest("String_Node_Str",11);
  doTest("String_Node_Str",-9);
  doTest("String_Node_Str",12);
  doTest("String_Node_Str",-4);
  doTest("String_Node_Str",256);
}

Fixed version (ground truth):
public void testTestCalculate(){
  doTest("String_Node_Str",1);
  doTest("String_Node_Str",1);
}
Program: 154499
Project: 154499
Buggy source:
/** 
 * Called with the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.skeleton_activity);
  mPreview=((SurfaceView)findViewById(R.id.streamingVideo));
  holder=mPreview.getHolder();
  holder.addCallback(this);
  holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
  try {
    sock=new Socket("String_Node_Str",666);
    input=new DataInputStream(sock.getInputStream());
    output=new DataOutputStream(sock.getOutputStream());
  }
 catch (  UnknownHostException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Called with the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.skeleton_activity);
  mPreview=((SurfaceView)findViewById(R.id.streamingVideo));
  holder=mPreview.getHolder();
  holder.addCallback(this);
  holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
Program: 154500
Project: 154500
Buggy source:
@Override public void surfaceDestroyed(SurfaceHolder holder){
  try {
    output.close();
    input.close();
    sock.close();
  }
 catch (  IOException e) {
    System.out.println(e);
  }
}

Fixed version (ground truth):
@Override public void surfaceDestroyed(SurfaceHolder holder){
}
Program: 154503
Project: 154503
Buggy source:
public void onItemHeldChange(PlayerItemHeldEvent event){
  Player p=event.getPlayer();
  ItemStack item=p.getInventory().getContents()[event.getNewSlot()];
  if (item == null) {
    return;
  }
  if (item.getType() == Material.BOW) {
    p.sendMessage("String_Node_Str" + EnumBowMaterial.fromData(item.getDurability()).getName());
  }
}

Fixed version (ground truth):
public void onItemHeldChange(PlayerItemHeldEvent event){
  Player p=event.getPlayer();
  ItemStack item=p.getInventory().getContents()[event.getNewSlot()];
  if (item == null) {
    return;
  }
  if (item.getType() == Material.BOW) {
    p.sendMessage(ChatColor.DARK_GREEN + "String_Node_Str" + ChatColor.YELLOW+ EnumBowMaterial.fromData(item.getDurability()).getName());
  }
}
Program: 154504
Project: 154504
Buggy source:
public static void processDir(Path inputDir,Path outputFile,String packageName){
  areDirs(inputDir);
  G4JVisitor g4jVisitor=new G4JVisitor();
  try {
    Files.walkFileTree(inputDir,g4jVisitor);
  }
 catch (  IOException ex) {
    Logger.getLogger(G4JUtil.class.getName()).log(Level.SEVERE,null,ex);
  }
  String code=g4jVisitor.getFinalCode();
  G4J g4j=new G4J();
  code=g4j.process(code);
  code="String_Node_Str" + packageName + "String_Node_Str"+ code;
  if (!Files.exists(outputFile.getParent())) {
    try {
      Files.createDirectories(outputFile.getParent());
    }
 catch (    IOException ex) {
      Logger.getLogger(G4JUtil.class.getName()).log(Level.SEVERE,null,ex);
    }
  }
  try {
    Files.write(outputFile,code.getBytes("String_Node_Str"));
  }
 catch (  UnsupportedEncodingException ex) {
    Logger.getLogger(G4JUtil.class.getName()).log(Level.SEVERE,null,ex);
  }
catch (  IOException ex) {
    Logger.getLogger(G4JUtil.class.getName()).log(Level.SEVERE,null,ex);
  }
}

Fixed version (ground truth):
public static void processDir(Path inputDir,Path outputFile,String packageName){
  areDirs(inputDir);
  G4JVisitor g4jVisitor=new G4JVisitor();
  try {
    Files.walkFileTree(inputDir,g4jVisitor);
  }
 catch (  IOException ex) {
    Logger.getLogger(G4JUtil.class.getName()).log(Level.SEVERE,null,ex);
  }
  String code=g4jVisitor.getFinalCode();
  G4J g4j=new G4J();
  code=g4j.process(code);
  code="String_Node_Str" + packageName + "String_Node_Str"+ code;
  Path outputParent=outputFile.getParent();
  if (!Files.exists(outputFile.toAbsolutePath().getParent())) {
    try {
      Files.createDirectories(outputFile.getParent());
    }
 catch (    IOException ex) {
      Logger.getLogger(G4JUtil.class.getName()).log(Level.SEVERE,null,ex);
    }
  }
  try {
    Files.write(outputFile,code.getBytes("String_Node_Str"));
  }
 catch (  UnsupportedEncodingException ex) {
    Logger.getLogger(G4JUtil.class.getName()).log(Level.SEVERE,null,ex);
  }
catch (  IOException ex) {
    Logger.getLogger(G4JUtil.class.getName()).log(Level.SEVERE,null,ex);
  }
}
Program: 154505
Project: 154505
Buggy source:
public Integer start(String[] args){
  try {
    StartupHealthCheck startupHealthCheck=new StartupHealthCheck(rules());
    Jetty6WebServer webServer=new Jetty6WebServer();
    server=new NeoServerWithEmbeddedWebServer(getGraphDatabaseFactory(),new AddressResolver(),startupHealthCheck,getConfigFile(),webServer,getServerModules());
    server.start();
    Runtime.getRuntime().addShutdownHook(new Thread(){
      @Override public void run(){
        log.info("String_Node_Str");
        if (server != null) {
          server.stop();
        }
      }
    }
);
    return OK;
  }
 catch (  TransactionFailureException tfe) {
    tfe.printStackTrace();
    log.error(String.format("String_Node_Str",server.getWebServerPort()) + tfe + "String_Node_Str"+ server.getDatabase().getLocation());
    return GRAPH_DATABASE_STARTUP_ERROR_CODE;
  }
catch (  Exception e) {
    e.printStackTrace();
    log.error("String_Node_Str",server.getWebServerPort());
    return WEB_SERVER_STARTUP_ERROR_CODE;
  }
}

Fixed version (ground truth):
public Integer start(String[] args){
  try {
    StartupHealthCheck startupHealthCheck=new StartupHealthCheck(rules());
    Jetty6WebServer webServer=new Jetty6WebServer();
    server=new NeoServerWithEmbeddedWebServer(getGraphDatabaseFactory(),new AddressResolver(),startupHealthCheck,getConfigFile(),webServer,getServerModules());
    server.start();
    log.info("String_Node_Str",server.baseUri());
    Runtime.getRuntime().addShutdownHook(new Thread(){
      @Override public void run(){
        log.info("String_Node_Str");
        if (server != null) {
          server.stop();
        }
      }
    }
);
    return OK;
  }
 catch (  TransactionFailureException tfe) {
    tfe.printStackTrace();
    log.error(String.format("String_Node_Str",server.getWebServerPort()) + tfe + "String_Node_Str"+ server.getDatabase().getLocation());
    return GRAPH_DATABASE_STARTUP_ERROR_CODE;
  }
catch (  Exception e) {
    e.printStackTrace();
    log.error("String_Node_Str",server.getWebServerPort());
    return WEB_SERVER_STARTUP_ERROR_CODE;
  }
}