nus-yam/ex-repair huggingface dataset:
Program: 68917
Project: 68917
Buggy source:
/** 
 * Holds entity attributes.
 * @param name        Name
 * @param description Entity description
 * @param speed       How much energy is gotten back each turn
 * @param vision      How many cells they see around them
 * @param toughness   How much strength they can soak up
 * @param strength    How much strength they do
 */
public AttributesComponent(String name,String description,int speed,int vision,int toughness,int strength){
  this.name=name;
  this.description=description;
  this.energy=speed;
  this.speed=speed;
  this.vision=vision;
  this.toughness=toughness;
  this.strength=strength;
  this.maxHealth=toughness * 10;
  this.health=maxHealth;
}

Fixed version (ground truth):
/** 
 * Holds entity attributes.
 * @param name        Name
 * @param description Entity description
 * @param speed       How much energy is gotten back each turn
 * @param vision      How many cells they see around them
 * @param toughness   How much strength they can soak up
 * @param strength    How much strength they do
 */
public AttributesComponent(String name,String description,int speed,int vision,int toughness,int strength){
  this.name=name;
  this.description=description;
  this.energy=speed;
  this.speed=speed;
  this.vision=vision;
  this.toughness=toughness;
  this.strength=strength;
  this.maxHealth=toughness * 100;
  this.health=maxHealth;
}
Program: 68918
Project: 68918
Buggy source:
@Override public void dispose(){
  batch.dispose();
  WorldManager.state=null;
}

Fixed version (ground truth):
@Override public void dispose(){
  batch.dispose();
}
Program: 68920
Project: 68920
Buggy source:
/** 
 * Get item from a location.
 * @param position Where the item is
 * @return The item
 */
public Entity getItemAt(Vector2 position){
  ImmutableArray<Entity> entities=engine.getEntitiesFor(Family.all(ItemComponent.class).get());
  for (  Entity entity : entities) {
    if (entity.getComponent(PositionComponent.class).pos.epsilonEquals(position,0.00001f)) {
      return entity;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Get item from a location.
 * @param position Where the item is
 * @return The item
 */
public Entity getItemAt(Vector2 position){
  ImmutableArray<Entity> entities=engine.getEntitiesFor(Family.all(ItemComponent.class,PositionComponent.class).get());
  for (  Entity entity : entities) {
    if (entity.getComponent(PositionComponent.class).pos.epsilonEquals(position,0.00001f)) {
      return entity;
    }
  }
  return null;
}
Program: 68921
Project: 68921
Buggy source:
@Override public void render(float delta){
  Gdx.gl.glClearColor(0,0,0,1);
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  refillInventory();
  stage.act(delta);
  stage.draw();
  if (Gdx.input.isKeyJustPressed(Input.Keys.J)) {
    if (selected < items.size() - 1) {
      selected+=1;
    }
  }
  if (Gdx.input.isKeyJustPressed(Input.Keys.K)) {
    if (selected > 0) {
      selected-=1;
    }
  }
  if (Gdx.input.isKeyJustPressed(Input.Keys.H)) {
    main.equipmentHelpers.holdItem(main.player,items.get(selected));
  }
  if (Gdx.input.isKeyJustPressed(Input.Keys.W)) {
    main.equipmentHelpers.wearItem(main.player,items.get(selected));
  }
  if (Gdx.input.isKeyJustPressed(Input.Keys.R)) {
    main.equipmentHelpers.removeItem(main.player,items.get(selected));
  }
  if (Gdx.input.isKeyJustPressed(Input.Keys.D)) {
    main.inventoryHelpers.dropItem(main.player,items.get(selected));
  }
  if (Gdx.input.isKeyJustPressed(Input.Keys.T)) {
    items.get(selected).getComponent(ItemComponent.class).throwing=true;
    main.state=Main.State.TARGETING;
    main.setScreen(main.playScreen);
  }
  if (Gdx.input.isKeyJustPressed(Input.Keys.NUM_1)) {
    main.setScreen(new CharacterScreen(main));
  }
  if (Gdx.input.isKeyJustPressed(Input.Keys.Q)) {
    main.setScreen(main.playScreen);
  }
}

Fixed version (ground truth):
@Override public void render(float delta){
  Gdx.gl.glClearColor(0,0,0,1);
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  refillInventory();
  stage.act(delta);
  stage.draw();
  if (Gdx.input.isKeyJustPressed(Input.Keys.J)) {
    if (selected < items.size() - 1) {
      selected+=1;
    }
  }
  if (Gdx.input.isKeyJustPressed(Input.Keys.K)) {
    if (selected > 0) {
      selected-=1;
    }
  }
  if (items.size() >= 1) {
    ItemComponent item=items.get(selected).getComponent(ItemComponent.class);
    if (Gdx.input.isKeyJustPressed(Input.Keys.H) && item.actions.get("String_Node_Str")) {
      main.equipmentHelpers.holdItem(main.player,items.get(selected));
    }
    if (Gdx.input.isKeyJustPressed(Input.Keys.W) && item.actions.get("String_Node_Str")) {
      main.equipmentHelpers.wearItem(main.player,items.get(selected));
    }
    if (Gdx.input.isKeyJustPressed(Input.Keys.T) && item.actions.get("String_Node_Str")) {
      items.get(selected).getComponent(ItemComponent.class).throwing=true;
      main.state=Main.State.TARGETING;
      main.setScreen(main.playScreen);
    }
    if (Gdx.input.isKeyJustPressed(Input.Keys.R)) {
      main.equipmentHelpers.removeItem(main.player,items.get(selected));
    }
    if (Gdx.input.isKeyJustPressed(Input.Keys.D)) {
      main.inventoryHelpers.dropItem(main.player,items.get(selected));
    }
  }
  if (Gdx.input.isKeyJustPressed(Input.Keys.NUM_1)) {
    main.setScreen(new CharacterScreen(main));
  }
  if (Gdx.input.isKeyJustPressed(Input.Keys.Q)) {
    main.setScreen(main.playScreen);
  }
}
Program: 68922
Project: 68922
Buggy source:
public Entity getThrowingItem(Entity entity){
  ArrayList<Entity> items=entity.getComponent(InventoryComponent.class).items;
  for (  Entity item : items) {
    ItemComponent itemComponent=item.getComponent(ItemComponent.class);
    if (itemComponent.throwing) {
      return entity;
    }
  }
  return null;
}

Fixed version (ground truth):
public Entity getThrowingItem(Entity entity){
  ArrayList<Entity> items=entity.getComponent(InventoryComponent.class).items;
  for (  Entity item : items) {
    ItemComponent itemComponent=item.getComponent(ItemComponent.class);
    if (itemComponent.throwing) {
      return item;
    }
  }
  return null;
}
Program: 68923
Project: 68923
Buggy source:
private void renderItems(float[][] lightMap){
  ImmutableArray<Entity> entities=engine.getEntitiesFor(Family.all(ItemComponent.class,PositionComponent.class,VisualComponent.class).get());
  for (  Entity entity : entities) {
    PositionComponent position=ComponentMappers.position.get(entity);
    if (!map.getCell(position.pos).hidden) {
      VisualComponent visual=ComponentMappers.visual.get(entity);
      batch.setColor(1f,1f,1f,lightMap[(int)position.pos.x][(int)position.pos.y]);
      batch.draw(visual.sprite,position.pos.x * SPRITE_WIDTH,(position.pos.y * SPRITE_HEIGHT) + (SPRITE_HEIGHT / 2));
      batch.setColor(1f,1f,1f,1f);
    }
  }
}

Fixed version (ground truth):
private void renderItems(float[][] lightMap){
  ImmutableArray<Entity> entities=engine.getEntitiesFor(Family.all(ItemComponent.class,PositionComponent.class,VisualComponent.class).get());
  for (  Entity entity : entities) {
    PositionComponent position=ComponentMappers.position.get(entity);
    if (!map.getCell(position.pos).hidden) {
      VisualComponent visual=ComponentMappers.visual.get(entity);
      batch.setColor(1f,1f,1f,lightMap[(int)position.pos.x][(int)position.pos.y]);
      batch.draw(visual.sprite,position.pos.x * SPRITE_WIDTH,position.pos.y * SPRITE_HEIGHT);
      batch.setColor(1f,1f,1f,1f);
    }
  }
}
Program: 68924
Project: 68924
Buggy source:
public void wieldItem(){
  Entity item=getShowing();
  if (item != null) {
    item.getComponent(ItemComponent.class).equipped=true;
    item.getComponent(ItemComponent.class).lookingAt=false;
  }
}

Fixed version (ground truth):
public void wieldItem(){
  Entity entity=getShowing();
  if (entity != null) {
    ItemComponent item=entity.getComponent(ItemComponent.class);
    if (item.actions.get("String_Node_Str")) {
      ArrayList<Entity> others=player.getComponent(InventoryComponent.class).items;
      for (      Entity other : others) {
        other.getComponent(ItemComponent.class).equipped=false;
      }
      item.equipped=true;
      item.lookingAt=false;
    }
  }
}
Program: 68925
Project: 68925
Buggy source:
Entity getShowing(){
  ArrayList<Entity> items=player.getComponent(InventoryComponent.class).items;
  Entity showing=null;
  for (  Entity entity : items) {
    ItemComponent item=entity.getComponent(ItemComponent.class);
    if (item.lookingAt && item.actions.get("String_Node_Str")) {
      showing=entity;
      for (      Entity other : player.getComponent(InventoryComponent.class).items) {
        ItemComponent otherItem=other.getComponent(ItemComponent.class);
        if (Objects.equals(item.type,otherItem.type) && otherItem.equipped) {
          otherItem.equipped=false;
        }
      }
      break;
    }
  }
  return showing;
}

Fixed version (ground truth):
Entity getShowing(){
  ArrayList<Entity> items=player.getComponent(InventoryComponent.class).items;
  Entity showing=null;
  for (  Entity entity : items) {
    ItemComponent item=entity.getComponent(ItemComponent.class);
    if (item.lookingAt) {
      showing=entity;
      break;
    }
  }
  return showing;
}
Program: 68926
Project: 68926
Buggy source:
/** 
 * Use   {@link ServiceLoader} to load converter sets and return in order of priority (lower first) 
 */
static List<Converters> loadConverters(ClassLoader cl){
  List<Converters> ret=new ArrayList<>();
  ServiceLoader.load(Converters.class).iterator().forEachRemaining(ret::add);
  ret.sort(Comparator.comparing(Converters::getPriority));
  return ret;
}

Fixed version (ground truth):
/** 
 * Use   {@link ServiceLoader} to load converter sets and return in order of priority (lower first) 
 */
static List<Converters> loadConverters(@Nullable ClassLoader cl){
  List<Converters> ret=new ArrayList<>();
  ServiceLoader.load(Converters.class,cl).iterator().forEachRemaining(ret::add);
  ret.sort(Comparator.comparing(Converters::getPriority));
  return ret;
}
Program: 68927
Project: 68927
Buggy source:
public static String encode(String input){
  StringBuilder resultStr=new StringBuilder();
  for (  char ch : input.toCharArray()) {
    if (isUnsafe(ch)) {
      resultStr.append('%');
      resultStr.append(toHex(ch / 16));
      resultStr.append(toHex(ch % 16));
    }
 else {
      resultStr.append(ch);
    }
  }
  return resultStr.toString();
}

Fixed version (ground truth):
public static String encode(String input){
  try {
    return URLEncoder.encode(input,"String_Node_Str");
  }
 catch (  UnsupportedEncodingException e) {
    throw new RuntimeException(e);
  }
}
Program: 68928
Project: 68928
Buggy source:
public RequestCapture(Request req){
  url=req.url();
  queryString=req.queryString();
  method=HttpMethod.valueOf(req.requestMethod());
  writeHeaders(req);
  writeQuery(req);
}

Fixed version (ground truth):
public RequestCapture(Request req){
  url=req.url();
  queryString=req.queryString();
  method=HttpMethod.valueOf(req.requestMethod());
  writeHeaders(req);
  writeQuery(req);
  param=req.params("String_Node_Str");
}
Program: 68931
Project: 68931
Buggy source:
@SuppressWarnings("String_Node_Str") public static <T>MashapeResponse<T> getResponse(ResponseType responseType,HttpResponse response){
  MashapeResponse<T> mashapeResponse=null;
  HttpEntity entity=response.getEntity();
  if (entity != null) {
    try {
      byte[] rawBody;
      try {
        rawBody=getBytes(entity.getContent());
      }
 catch (      IOException e2) {
        throw new RuntimeException(e2);
      }
      InputStream inputStream=new ByteArrayInputStream(rawBody);
switch (responseType) {
case BINARY:
        mashapeResponse=(MashapeResponse<T>)new MashapeResponse<InputStream>(response,inputStream,inputStream);
      break;
case STRING:
    mashapeResponse=(MashapeResponse<T>)new MashapeResponse<String>(response,inputStream,new String(rawBody));
  break;
case JSON:
String jsonString=new String(rawBody).trim();
if (jsonString.startsWith("String_Node_Str")) {
try {
  mashapeResponse=(MashapeResponse<T>)new MashapeResponse<JSONArray>(response,inputStream,new JSONArray(jsonString));
}
 catch (Exception e) {
  throw new RuntimeException("String_Node_Str" + jsonString);
}
}
 else {
try {
  mashapeResponse=(MashapeResponse<T>)new MashapeResponse<JSONObject>(response,inputStream,new JSONObject(jsonString));
}
 catch (Exception e) {
  throw new InvalidJsonResponseException(jsonString);
}
}
break;
}
}
 catch (Exception e1) {
throw new RuntimeException(e1);
}
}
return mashapeResponse;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static <T>MashapeResponse<T> getResponse(ResponseType responseType,HttpResponse response){
  MashapeResponse<T> mashapeResponse=null;
  HttpEntity entity=response.getEntity();
  if (entity != null) {
    try {
      byte[] rawBody;
      try {
        rawBody=getBytes(entity.getContent());
      }
 catch (      IOException e2) {
        throw new RuntimeException(e2);
      }
      InputStream inputStream=new ByteArrayInputStream(rawBody);
switch (responseType) {
case BINARY:
        mashapeResponse=(MashapeResponse<T>)new MashapeResponse<InputStream>(response,inputStream,inputStream);
      break;
case STRING:
    mashapeResponse=(MashapeResponse<T>)new MashapeResponse<String>(response,inputStream,new String(rawBody));
  break;
case JSON:
String jsonString=new String(rawBody).trim();
if (jsonString.startsWith("String_Node_Str")) {
try {
  mashapeResponse=(MashapeResponse<T>)new MashapeResponse<JSONArray>(response,inputStream,new JSONArray(jsonString));
}
 catch (Exception e) {
  throw new InvalidJsonArrayException(jsonString);
}
}
 else {
try {
  mashapeResponse=(MashapeResponse<T>)new MashapeResponse<JSONObject>(response,inputStream,new JSONObject(jsonString));
}
 catch (Exception e) {
  throw new InvalidJsonObjectException(jsonString);
}
}
break;
}
}
 catch (Exception e1) {
throw new RuntimeException(e1);
}
}
return mashapeResponse;
}
Program: 68932
Project: 68932
Buggy source:
public static RequestPrepareResult prepareRequest(String url,Map<String,String> parameters,boolean addRegularQueryStringParameters) throws UnsupportedEncodingException {
  if (parameters == null) {
    parameters=new HashMap<String,String>();
  }
  Set<String> keySet=new HashSet<String>(parameters.keySet());
  for (  String key : keySet) {
    if (parameters.get(key) == null) {
      parameters.remove(key);
    }
  }
  Pattern p=Pattern.compile("String_Node_Str");
  Matcher matcher=p.matcher(url);
  String finalUrl=url;
  while (matcher.find()) {
    String key=matcher.group(1);
    if (parameters.containsKey(key)) {
      String parameterValue=parameters.get(key);
      finalUrl=finalUrl.replaceAll("String_Node_Str" + key + "String_Node_Str","String_Node_Str" + URLEncoder.encode(parameterValue,"String_Node_Str"));
      finalUrl=finalUrl.replaceAll("String_Node_Str" + key + "String_Node_Str",UriUtils.encodeUri(parameterValue,"String_Node_Str"));
    }
 else {
      finalUrl=finalUrl.replaceAll("String_Node_Str" + key + "String_Node_Str","String_Node_Str");
    }
  }
  finalUrl=finalUrl.replaceAll("String_Node_Str","String_Node_Str");
  finalUrl=finalUrl.replaceAll("String_Node_Str","String_Node_Str");
  if (addRegularQueryStringParameters) {
    addRegularQueryStringParameters(finalUrl,parameters);
  }
  return new RequestPrepareResult(finalUrl,parameters);
}

Fixed version (ground truth):
public static RequestPrepareResult prepareRequest(String url,Map<String,String> parameters,boolean addRegularQueryStringParameters) throws UnsupportedEncodingException {
  if (parameters == null) {
    parameters=new HashMap<String,String>();
  }
  Set<String> keySet=new HashSet<String>(parameters.keySet());
  for (  String key : keySet) {
    if (parameters.get(key) == null) {
      parameters.remove(key);
    }
  }
  Pattern p=Pattern.compile("String_Node_Str");
  Matcher matcher=p.matcher(url);
  String finalUrl=url;
  while (matcher.find()) {
    String key=matcher.group(1);
    if (parameters.containsKey(key)) {
      String parameterValue=parameters.get(key);
      finalUrl=finalUrl.replaceAll("String_Node_Str" + key + "String_Node_Str","String_Node_Str" + URLEncoder.encode(parameterValue,"String_Node_Str"));
      finalUrl=finalUrl.replaceAll("String_Node_Str" + key + "String_Node_Str",UriUtils.encodeUri(parameterValue,"String_Node_Str"));
    }
 else {
      finalUrl=finalUrl.replaceAll("String_Node_Str" + key + "String_Node_Str","String_Node_Str");
    }
  }
  finalUrl=finalUrl.replaceAll("String_Node_Str","String_Node_Str");
  finalUrl=finalUrl.replaceAll("String_Node_Str","String_Node_Str");
  if (addRegularQueryStringParameters) {
    addRegularQueryStringParameters(finalUrl,parameters);
  }
 else {
    for (    String key : parameters.keySet()) {
      String delimiter=(finalUrl.indexOf("String_Node_Str") > 0) ? "String_Node_Str" : "String_Node_Str";
      finalUrl+=delimiter + key + "String_Node_Str"+ parameters.get(key);
    }
  }
  return new RequestPrepareResult(finalUrl,parameters);
}
Program: 68935
Project: 68935
Buggy source:
private MutableIntList getScoreStatistics(){
  List<String> response=gtpClient.sendCommand("String_Node_Str");
  return GtpClient.parseResponseIntTable(response);
}

Fixed version (ground truth):
private MutableIntList getScoreStatistics(){
  List<String> response=gtpClient.sendCommand("String_Node_Str");
  return GtpCommand.parseResponseIntTable(response);
}
Program: 68936
Project: 68936
Buggy source:
@Override public double[] estimateInfluences(){
  List<String> response=estimateInfluencesRaw();
  MutableIntList territories=GtpClient.parseResponseIntTable(response);
  MutableDoubleList influences=territories.collectDouble(influence -> {
    if (-300 < influence && influence < 300) {
      influence=0;
    }
 else     if (influence > 800) {
      influence=800;
    }
 else     if (influence < -800) {
      influence=-800;
    }
    return influence / 800.0;
  }
,new DoubleArrayList(Board.BOARD_SIZE * Board.BOARD_SIZE));
  double[] influencesAdjusted=new double[Board.BOARD_SIZE * Board.BOARD_SIZE];
  for (int i=0; i < Board.BOARD_SIZE; i++) {
    for (int j=0; j < Board.BOARD_SIZE; j++) {
      influencesAdjusted[Board.getIndex(j,Board.BOARD_SIZE - 1 - i)]=influences.get(Board.getIndex(i,j));
    }
  }
  return influencesAdjusted;
}

Fixed version (ground truth):
@Override public double[] estimateInfluences(){
  List<String> response=estimateInfluencesRaw();
  MutableIntList territories=GtpCommand.parseResponseIntTable(response);
  MutableDoubleList influences=territories.collectDouble(influence -> {
    if (-300 < influence && influence < 300) {
      influence=0;
    }
 else     if (influence > 800) {
      influence=800;
    }
 else     if (influence < -800) {
      influence=-800;
    }
    return influence / 800.0;
  }
,new DoubleArrayList(Board.BOARD_SIZE * Board.BOARD_SIZE));
  double[] influencesAdjusted=new double[Board.BOARD_SIZE * Board.BOARD_SIZE];
  for (int i=0; i < Board.BOARD_SIZE; i++) {
    for (int j=0; j < Board.BOARD_SIZE; j++) {
      influencesAdjusted[Board.getIndex(j,Board.BOARD_SIZE - 1 - i)]=influences.get(Board.getIndex(i,j));
    }
  }
  return influencesAdjusted;
}
Program: 68937
Project: 68937
Buggy source:
public void clear(){
  try {
    document.remove(0,document.getLength());
  }
 catch (  BadLocationException e) {
    throw new GenericLizzieException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public void clear(){
  try {
    document.remove(0,document.getLength());
    documentLines.clear();
  }
 catch (  BadLocationException e) {
    throw new GenericLizzieException("String_Node_Str",e);
  }
}
Program: 68938
Project: 68938
Buggy source:
@Override public void headMoved(BoardHistoryNode oldHead,BoardHistoryNode newHead){
  int lastMoveNumberInTable=histogramEntryList.get(histogramEntryList.size() - 1).getMoveNumber();
  if (newHead.getData().getMoveNumber() > lastMoveNumberInTable) {
    BoardHistoryNode node=oldHead.getNext();
    do {
      addHistogramData(node.getData());
    }
 while (node != newHead);
  }
 else {
    histogramEntryList.removeIf(entry -> entry.getMoveNumber() > newHead.getData().getMoveNumber());
  }
  rebuildFilteredHistogramData();
  if (refreshObserver != null) {
    Lizzie.miscExecutor.execute(() -> refreshObserver.accept(WinrateHistogramTableModel.this));
  }
}

Fixed version (ground truth):
@Override public void headMoved(BoardHistoryNode oldHead,BoardHistoryNode newHead){
  int lastMoveNumberInTable=histogramEntryList.get(histogramEntryList.size() - 1).getMoveNumber();
  if (newHead.getData().getMoveNumber() > lastMoveNumberInTable) {
    BoardHistoryNode node;
    do {
      node=oldHead.getNext();
      addHistogramData(node.getData());
    }
 while (node != newHead);
  }
 else {
    histogramEntryList.removeIf(entry -> entry.getMoveNumber() > newHead.getData().getMoveNumber());
  }
  rebuildFilteredHistogramData();
  if (refreshObserver != null) {
    Lizzie.miscExecutor.execute(() -> refreshObserver.accept(WinrateHistogramTableModel.this));
  }
}
Program: 68940
Project: 68940
Buggy source:
/** 
 * Creates a window and refreshes the game state at FPS.
 */
public LizzieFrame(){
  super();
  setTitle(LIZZIE_TITLE + "String_Node_Str" + engineProfile+ "String_Node_Str");
  Input input=new Input();
  this.addKeyListener(input);
  this.addMouseWheelListener(input);
  this.addWindowListener(new WindowAdapter(){
    public void windowClosing(    WindowEvent e){
      if (Lizzie.board.getHistory().getInitialNode().getNext() != null) {
        Lizzie.storeGameByFile(Paths.get("String_Node_Str"));
      }
      Lizzie.leelaz.setNormalExit(true);
      Lizzie.readGuiPosition();
      Lizzie.writeSettingFile();
      Lizzie.leelaz.close();
      Lizzie.exitLizzie(0);
    }
  }
);
  initMenu(input);
  boardRenderer=new BoardRenderer();
  mainPanel=new JPanel(true){
    @Override protected void paintComponent(    Graphics g){
      super.paintComponent(g);
      paintBoardAndBackground(g);
    }
  }
;
  mainPanel.addMouseMotionListener(input);
  mainPanel.addMouseListener(input);
  setAlwaysOnTop(Lizzie.optionSetting.isMainWindowAlwaysOnTop());
  getContentPane().add(mainPanel,BorderLayout.CENTER);
  setVisible(true);
}

Fixed version (ground truth):
/** 
 * Creates a window and refreshes the game state at FPS.
 */
public LizzieFrame(){
  super();
  setTitle(LIZZIE_TITLE + "String_Node_Str" + engineProfile+ "String_Node_Str");
  this.addWindowListener(new WindowAdapter(){
    public void windowClosing(    WindowEvent e){
      if (Lizzie.board.getHistory().getInitialNode().getNext() != null) {
        Lizzie.storeGameByFile(Paths.get("String_Node_Str"));
      }
      Lizzie.leelaz.setNormalExit(true);
      Lizzie.readGuiPosition();
      Lizzie.writeSettingFile();
      Lizzie.leelaz.close();
      Lizzie.exitLizzie(0);
    }
  }
);
  Input input=new Input();
  initMenu(input);
  boardRenderer=new BoardRenderer();
  mainPanel=new JPanel(true){
    @Override protected void paintComponent(    Graphics g){
      super.paintComponent(g);
      paintBoardAndBackground(g);
    }
  }
;
  mainPanel.addMouseMotionListener(input);
  mainPanel.addMouseListener(input);
  mainPanel.addMouseWheelListener(input);
  this.addKeyListener(input);
  setAlwaysOnTop(Lizzie.optionSetting.isMainWindowAlwaysOnTop());
  getContentPane().add(mainPanel,BorderLayout.CENTER);
  setVisible(true);
}
Program: 68942
Project: 68942
Buggy source:
@Override public void mouseWheelMoved(MouseWheelEvent e){
  Lizzie.analysisFrame.getAnalysisTableModel().setSelectedMove(null);
  if (e.getWheelRotation() > 0) {
    Lizzie.board.nextMove();
  }
 else   if (e.getWheelRotation() < 0) {
    Lizzie.board.previousMove();
  }
  Lizzie.frame.repaint();
}

Fixed version (ground truth):
@Override public void mouseWheelMoved(MouseWheelEvent e){
  if (e.getWheelRotation() > 0) {
    Lizzie.board.nextMove();
  }
 else   if (e.getWheelRotation() < 0) {
    Lizzie.board.previousMove();
  }
  Lizzie.frame.repaint();
}
Program: 68944
Project: 68944
Buggy source:
/** 
 * Goes to the next coordinate, thread safe
 */
public void nextMove(){
synchronized (this) {
    BoardHistoryNode oldHead=history.getHead();
    if (history.next() != null) {
      observerCollection.headMoved(oldHead,history.getHead());
      final Stone colorToPlay=history.getLastMoveColor();
      if (history.getData().getLastMove() == null) {
        leelazExecutor.execute(() -> {
          Lizzie.leelaz.playMove(colorToPlay,"String_Node_Str");
          Lizzie.leelaz.ponder();
        }
);
      }
 else {
        final String locationToPlay=convertCoordinatesToName(history.getLastMove()[0],history.getLastMove()[1]);
        leelazExecutor.execute(() -> {
          Lizzie.leelaz.playMove(colorToPlay,locationToPlay);
          Lizzie.leelaz.ponder();
        }
);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Goes to the next coordinate, thread safe
 */
public boolean nextMove(){
synchronized (this) {
    BoardHistoryNode oldHead=history.getHead();
    if (history.next() != null) {
      observerCollection.headMoved(oldHead,history.getHead());
      final Stone colorToPlay=history.getLastMoveColor();
      if (history.getData().getLastMove() == null) {
        leelazExecutor.execute(() -> {
          Lizzie.leelaz.playMove(colorToPlay,"String_Node_Str");
          Lizzie.leelaz.ponder();
        }
);
      }
 else {
        final String locationToPlay=convertCoordinatesToName(history.getLastMove()[0],history.getLastMove()[1]);
        leelazExecutor.execute(() -> {
          Lizzie.leelaz.playMove(colorToPlay,locationToPlay);
          Lizzie.leelaz.ponder();
        }
);
      }
      return true;
    }
 else {
      return false;
    }
  }
}
Program: 68945
Project: 68945
Buggy source:
/** 
 * Goes to the previous coordinate, thread safe
 */
public void previousMove(){
synchronized (this) {
    BoardHistoryNode oldHead=history.getHead();
    if (history.previous() != null) {
      observerCollection.headMoved(oldHead,history.getHead());
      leelazExecutor.execute(() -> {
        Lizzie.leelaz.undo();
        Lizzie.leelaz.ponder();
      }
);
    }
  }
}

Fixed version (ground truth):
/** 
 * Goes to the previous coordinate, thread safe
 */
public boolean previousMove(){
synchronized (this) {
    BoardHistoryNode oldHead=history.getHead();
    if (history.previous() != null) {
      observerCollection.headMoved(oldHead,history.getHead());
      leelazExecutor.execute(() -> {
        Lizzie.leelaz.undo();
        Lizzie.leelaz.ponder();
      }
);
      return true;
    }
 else {
      return false;
    }
  }
}
Program: 68946
Project: 68946
Buggy source:
private void goBackward(int count){
  for (int i=0; i < count; ++i) {
    previousMove();
  }
}

Fixed version (ground truth):
private void goBackward(int count){
  for (int i=0; i < count; ++i) {
    if (!previousMove()) {
      break;
    }
  }
}
Program: 68947
Project: 68947
Buggy source:
private void goForward(int count){
  for (int i=0; i < count; ++i) {
    nextMove();
  }
}

Fixed version (ground truth):
private void goForward(int count){
  for (int i=0; i < count; ++i) {
    if (!nextMove()) {
      break;
    }
  }
}
Program: 68948
Project: 68948
Buggy source:
private void initVariables(){
  userApproved=false;
  profileList=Lizzie.optionSetting.getEngineProfileList();
}

Fixed version (ground truth):
private void initVariables(){
  userApproved=false;
  profileList=Lizzie.optionSetting.getEngineProfileList();
  if (CollectionUtils.isNotEmpty(profileList)) {
    textFieldProfile1.setText(profileList.get(0));
    textFieldProfile2.setText(profileList.get(1));
    textFieldProfile3.setText(profileList.get(2));
    textFieldProfile4.setText(profileList.get(3));
    textFieldProfile5.setText(profileList.get(4));
  }
}
Program: 68950
Project: 68950
Buggy source:
/** 
 * Goes to the next coordinate, thread safe
 */
public void nextMove(){
synchronized (this) {
    BoardHistoryNode oldHead=history.getHead();
    if (history.next() != null) {
      observerCollection.headMoved(oldHead,history.getHead());
      if (history.getData().getLastMove() == null) {
        leelazExecutor.execute(() -> {
          Lizzie.leelaz.playMove(history.getLastMoveColor(),"String_Node_Str");
          Lizzie.leelaz.ponder();
        }
);
      }
 else {
        leelazExecutor.execute(() -> {
          Lizzie.leelaz.playMove(history.getLastMoveColor(),convertCoordinatesToName(history.getLastMove()[0],history.getLastMove()[1]));
          Lizzie.leelaz.ponder();
        }
);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Goes to the next coordinate, thread safe
 */
public void nextMove(){
synchronized (this) {
    BoardHistoryNode oldHead=history.getHead();
    if (history.next() != null) {
      observerCollection.headMoved(oldHead,history.getHead());
      final Stone colorToPlay=history.getLastMoveColor();
      if (history.getData().getLastMove() == null) {
        leelazExecutor.execute(() -> {
          Lizzie.leelaz.playMove(colorToPlay,"String_Node_Str");
          Lizzie.leelaz.ponder();
        }
);
      }
 else {
        final String locationToPlay=convertCoordinatesToName(history.getLastMove()[0],history.getLastMove()[1]);
        leelazExecutor.execute(() -> {
          Lizzie.leelaz.playMove(colorToPlay,locationToPlay);
          Lizzie.leelaz.ponder();
        }
);
      }
    }
  }
}
Program: 68951
Project: 68951
Buggy source:
private void handleTableClick(int row,int col){
  if (row == analysisTableModel.getSelectedMoveIndex()) {
    analysisTableModel.setSelectedMove(null);
  }
 else {
    analysisTableModel.setSelectedMoveByIndex(row);
  }
}

Fixed version (ground truth):
private void handleTableClick(int row,int col){
  if (row == analysisTableModel.getSelectedMoveIndex()) {
    analysisTable.clearSelection();
    analysisTableModel.setSelectedMove(null);
  }
 else {
    analysisTableModel.setSelectedMoveByIndex(row);
  }
  Lizzie.frame.repaint();
}
Program: 68952
Project: 68952
Buggy source:
public void selectOrDeselectMoveByCoord(int[] mouseCoords){
  MoveData mouseOnMove=null;
  for (  MoveData data : bestMoves) {
    int[] coords=Board.convertNameToCoordinates(data.getCoordinate());
    if (coords[0] == mouseCoords[0] && coords[1] == mouseCoords[1]) {
      mouseOnMove=data;
      break;
    }
  }
  selectedMove=mouseOnMove;
}

Fixed version (ground truth):
public void selectOrDeselectMoveByCoord(int[] mouseCoords){
  MoveData mouseOnMove=null;
  if (mouseCoords != null) {
    for (    MoveData data : bestMoves) {
      int[] coords=Board.convertNameToCoordinates(data.getCoordinate());
      if (coords[0] == mouseCoords[0] && coords[1] == mouseCoords[1]) {
        mouseOnMove=data;
        break;
      }
    }
  }
  selectedMove=mouseOnMove;
  int selectedIndex=getSelectedMoveIndex();
  if (selectedIndex >= 0) {
    SwingUtilities.invokeLater(() -> hostTable.setRowSelectionInterval(selectedIndex,selectedIndex));
  }
 else {
    SwingUtilities.invokeLater(() -> hostTable.clearSelection());
  }
}
Program: 68953
Project: 68953
Buggy source:
public void onMouseMove(int x,int y){
  if (Lizzie.optionSetting.isMouseOverShowMove()) {
    int[] boardCoordinates=boardRenderer.convertScreenToCoordinates(x,y);
    if (boardCoordinates != null) {
      Lizzie.analysisFrame.getAnalysisTableModel().selectOrDeselectMoveByCoord(boardCoordinates);
    }
  }
}

Fixed version (ground truth):
public void onMouseMove(int x,int y){
  if (Lizzie.optionSetting.isMouseOverShowMove()) {
    int[] boardCoordinates=boardRenderer.convertScreenToCoordinates(x,y);
    int[] previousCoordinates=lastBoardCoordinates.getAndSet(boardCoordinates);
    if (!Arrays.equals(previousCoordinates,boardCoordinates)) {
      Lizzie.analysisFrame.getAnalysisTableModel().selectOrDeselectMoveByCoord(boardCoordinates);
      repaint();
    }
  }
}
Program: 68958
Project: 68958
Buggy source:
/** 
 * Draw the 'ghost stones' which show a variation Leelaz is thinking about
 */
private void drawBranch(){
  branchStonesImage=new BufferedImage(boardLength,boardLength,BufferedImage.TYPE_INT_ARGB);
  branchStonesShadowImage=new BufferedImage(boardLength,boardLength,BufferedImage.TYPE_INT_ARGB);
  if (Lizzie.frame.isPlayingAgainstLeelaz) {
    return;
  }
  branch=Lizzie.analysisFrame.getAnalysisTableModel().getSelectedMove();
  if (branch == null) {
    return;
  }
  Graphics2D g=(Graphics2D)branchStonesImage.getGraphics();
  Graphics2D gShadow=(Graphics2D)branchStonesShadowImage.getGraphics();
  g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
  Stone color=Lizzie.board.getData().getLastMoveColor();
  if (color == Stone.EMPTY) {
    color=Stone.WHITE;
  }
  for (  String variation : branch.getVariation()) {
    color=color.opposite();
    int[] coords=Board.convertNameToCoordinates(variation);
    if (Board.isValid(coords[0],coords[1])) {
      int stoneX=scaledMargin + squareLength * coords[0];
      int stoneY=scaledMargin + squareLength * coords[1];
      if (Lizzie.board.getStones()[Board.getIndex(coords[0],coords[1])] == Stone.EMPTY)       drawStone(g,gShadow,stoneX,stoneY,color.unGhosted());
    }
  }
  g.dispose();
  gShadow.dispose();
}

Fixed version (ground truth):
/** 
 * Draw the 'ghost stones' which show a variation Leelaz is thinking about
 */
private void drawBranch(){
  branchStonesImage=new BufferedImage(boardLength,boardLength,BufferedImage.TYPE_INT_ARGB);
  branchStonesShadowImage=new BufferedImage(boardLength,boardLength,BufferedImage.TYPE_INT_ARGB);
  if (Lizzie.frame.isPlayingAgainstLeelaz) {
    return;
  }
  branch=Lizzie.analysisFrame.getAnalysisTableModel().getSelectedMove();
  if (branch == null) {
    return;
  }
  Graphics2D g=(Graphics2D)branchStonesImage.getGraphics();
  Graphics2D gShadow=(Graphics2D)branchStonesShadowImage.getGraphics();
  g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
  Stone color=Lizzie.board.getData().getLastMoveColor();
  if (color == Stone.EMPTY) {
    color=Stone.WHITE;
  }
  int variationCount=0;
  for (  String variation : branch.getVariation()) {
    color=color.opposite();
    ++variationCount;
    if (variationCount > Lizzie.optionSetting.getVariationLimit()) {
      break;
    }
    int[] coords=Board.convertNameToCoordinates(variation);
    if (Board.isValid(coords[0],coords[1])) {
      int stoneX=scaledMargin + squareLength * coords[0];
      int stoneY=scaledMargin + squareLength * coords[1];
      if (Lizzie.board.getStones()[Board.getIndex(coords[0],coords[1])] == Stone.EMPTY)       drawStone(g,gShadow,stoneX,stoneY,color.unGhosted());
    }
  }
  g.dispose();
  gShadow.dispose();
}
Program: 68960
Project: 68960
Buggy source:
private static String prepareToken(String token){
  token=token.replaceAll("String_Node_Str","String_Node_Str");
  token=token.replaceAll("String_Node_Str","String_Node_Str");
  return token;
}

Fixed version (ground truth):
private static String prepareToken(String token){
  token=token.replaceAll("String_Node_Str","String_Node_Str");
  token=token.replaceAll("String_Node_Str","String_Node_Str");
  token=REGEX_REMOVE_LINE_BREAK.matcher(token).replaceAll("String_Node_Str");
  return token;
}
Program: 68963
Project: 68963
Buggy source:
@Override public int size(){
  return initialNode.distanceToEnd() + 1;
}

Fixed version (ground truth):
@Override public int size(){
  return initialNode.distanceToEnd();
}
Program: 68964
Project: 68964
Buggy source:
private static String transformAxisForMove(String move){
  int[] coords=Board.convertNameToCoordinates(move);
  int x=coords[0], y=coords[1];
  return Board.alphabet.substring(x,x + 1) + (19 - y);
}

Fixed version (ground truth):
private static String transformAxisForMove(String move){
  int[] coords=Board.convertNameToCoordinates(move);
  int x=coords[0], y=coords[1];
  if (Board.isValid(x,y)) {
    return Board.alphabet.substring(x,x + 1) + (19 - y);
  }
 else {
    return "String_Node_Str";
  }
}
Program: 68966
Project: 68966
Buggy source:
/** 
 * Converts a x and y coordinate to a named coordinate eg C16, T5, K10, etc
 * @param x x coordinate -- must be valid
 * @param y y coordinate -- must be valid
 * @return a string representing the coordinate
 */
public static String convertCoordinatesToName(int x,int y){
  return alphabet.charAt(x) + "String_Node_Str" + (y + 1);
}

Fixed version (ground truth):
/** 
 * Converts a x and y coordinate to a named coordinate eg C16, T5, K10, etc
 * @param x x coordinate -- must be valid
 * @param y y coordinate -- must be valid
 * @return a string representing the coordinate
 */
public static String convertCoordinatesToName(int x,int y){
  if (isValid(x,y)) {
    return alphabet.charAt(x) + "String_Node_Str" + (y + 1);
  }
 else {
    return "String_Node_Str";
  }
}
Program: 68967
Project: 68967
Buggy source:
/** 
 * Converts a named coordinate eg C16, T5, K10, etc to an x and y coordinate
 * @param namedCoordinate a capitalized version of the named coordinate. Must be a valid 19x19 Go coordinate, without I
 * @return an array containing x, followed by y
 */
public static int[] convertNameToCoordinates(String namedCoordinate){
  int x=alphabet.indexOf(namedCoordinate.charAt(0));
  int y=Integer.parseInt(namedCoordinate.substring(1)) - 1;
  return new int[]{x,y};
}

Fixed version (ground truth):
/** 
 * Converts a named coordinate eg C16, T5, K10, etc to an x and y coordinate
 * @param namedCoordinate a capitalized version of the named coordinate. Must be a valid 19x19 Go coordinate, without I
 * @return an array containing x, followed by y
 */
public static int[] convertNameToCoordinates(String namedCoordinate){
  if (StringUtils.equalsIgnoreCase(namedCoordinate,"String_Node_Str")) {
    return new int[]{BOARD_SIZE,BOARD_SIZE};
  }
 else {
    int x=alphabet.indexOf(namedCoordinate.charAt(0));
    if (x < 0) {
      return new int[]{BOARD_SIZE,BOARD_SIZE};
    }
    int y;
    try {
      y=Integer.parseInt(namedCoordinate.substring(1)) - 1;
    }
 catch (    NumberFormatException e) {
      return new int[]{BOARD_SIZE,BOARD_SIZE};
    }
    return new int[]{x,y};
  }
}
Program: 68970
Project: 68970
Buggy source:
public static void loadGameByFile(Path gameFilePath){
  try {
    Game game=Sgf.createFromPath(gameFilePath);
    GameNode node=game.getRootNode();
    if (!Objects.equals(game.getProperty("String_Node_Str"),"String_Node_Str")) {
      JOptionPane.showMessageDialog(frame,"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE);
      return;
    }
    if (!Objects.equals(game.getProperty("String_Node_Str"),"String_Node_Str")) {
      JOptionPane.showMessageDialog(frame,"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE);
      return;
    }
    clearBoardAndState();
    do {
      if (node.getMoveNo() < 0 || StringUtils.isEmpty(node.getMoveString())) {
        continue;
      }
      int[] coords=node.getCoords();
      if (coords[0] >= 19 || coords[0] < 0 || coords[1] >= 19 || coords[1] < 0) {
        System.out.printf("String_Node_Str",node.getColor());
        Lizzie.board.pass();
      }
 else {
        System.out.printf("String_Node_Str",node.getColor(),coords[0],coords[1]);
        Lizzie.board.place(coords[0],coords[1]);
      }
    }
 while ((node=node.getNextNode()) != null);
  }
 catch (  SgfParseException e) {
    JOptionPane.showMessageDialog(frame,"String_Node_Str" + e.getMessage(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
  }
}

Fixed version (ground truth):
public static void loadGameByFile(Path gameFilePath){
  try {
    Game game=Sgf.createFromPath(gameFilePath);
    GameNode node=game.getRootNode();
    if (game.getProperty("String_Node_Str") != null && !Objects.equals(game.getProperty("String_Node_Str"),"String_Node_Str")) {
      JOptionPane.showMessageDialog(frame,"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE);
      return;
    }
    if (game.getProperty("String_Node_Str") != null && !Objects.equals(game.getProperty("String_Node_Str"),"String_Node_Str")) {
      JOptionPane.showMessageDialog(frame,"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE);
      return;
    }
    if (game.getProperty("String_Node_Str") != null && !Objects.equals(game.getProperty("String_Node_Str"),"String_Node_Str")) {
      JOptionPane.showMessageDialog(frame,"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE);
      return;
    }
    clearBoardAndState();
    do {
      if (node.getMoveNo() < 0 || StringUtils.isEmpty(node.getMoveString())) {
        continue;
      }
      int[] coords=node.getCoords();
      if (coords[0] >= 19 || coords[0] < 0 || coords[1] >= 19 || coords[1] < 0) {
        System.out.printf("String_Node_Str",node.getColor());
        Lizzie.board.pass();
      }
 else {
        System.out.printf("String_Node_Str",node.getColor(),coords[0],coords[1]);
        Lizzie.board.place(coords[0],coords[1]);
      }
    }
 while ((node=node.getNextNode()) != null);
  }
 catch (  SgfParseException e) {
    JOptionPane.showMessageDialog(frame,"String_Node_Str" + e.getMessage(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
  }
}
Program: 68971
Project: 68971
Buggy source:
public static AppDatabase getDatabase(Context context){
  if (INSTANCE == null) {
    INSTANCE=Room.databaseBuilder(context.getApplicationContext(),AppDatabase.class,"String_Node_Str").build();
  }
  return INSTANCE;
}

Fixed version (ground truth):
public static AppDatabase getDatabase(Context context){
  if (INSTANCE == null) {
    INSTANCE=Room.databaseBuilder(context.getApplicationContext(),AppDatabase.class,"String_Node_Str").allowMainThreadQueries().build();
  }
  return INSTANCE;
}
Program: 68973
Project: 68973
Buggy source:
public static int themeIndex(){
  int themeIndex=0;
  try {
    themeIndex=Integer.parseInt(defaultPrefs.getString("String_Node_Str","String_Node_Str"));
  }
 catch (  Exception e) {
    Timber.e(e);
  }
  return themeIndex;
}

Fixed version (ground truth):
public static int themeIndex(){
  int themeIndex=1;
  try {
    themeIndex=Integer.parseInt(defaultPrefs.getString("String_Node_Str","String_Node_Str"));
  }
 catch (  Exception e) {
    Timber.e(e);
  }
  return themeIndex;
}
Program: 68975
Project: 68975
Buggy source:
@Test public void testFormatGenericSpannerStructAsTextFnTest() throws Exception {
  FormatGenericSpannerStructAsTextFn simpleFn=new FormatGenericSpannerStructAsTextFn(TestHelper.TABLE_NAME);
  assertEquals(TestHelper.STRUCT_1_BASE64_SERIALIZED,simpleFn.apply(TestHelper.STRUCT_1));
  assertEquals(TestHelper.STRUCT_2_BASE64_SERIALIZED,simpleFn.apply(TestHelper.STRUCT_2));
}

Fixed version (ground truth):
@Test public void testFormatGenericSpannerStructAsTextFnTest() throws Exception {
  FormatGenericSpannerStructAsTextFn simpleFn=new FormatGenericSpannerStructAsTextFn(TestHelper.TABLE_NAME);
  assertEquals(TestHelper.STRUCT_1_BASE64_SERIALIZED,simpleFn.apply(TestHelper.STRUCT_1));
  assertEquals(TestHelper.STRUCT_2_BASE64_SERIALIZED,simpleFn.apply(TestHelper.STRUCT_2));
  assertEquals(TestHelper.STRUCT_3_BASE64_SERIALIZED,simpleFn.apply(TestHelper.STRUCT_3));
  assertEquals(TestHelper.STRUCT_4_BASE64_SERIALIZED,simpleFn.apply(TestHelper.STRUCT_4));
}
Program: 68976
Project: 68976
Buggy source:
@Test public void methodUnderTest_expectedResult() throws Exception {
  FormatTextAsGenericSpannerMutationFn simpleFn=new FormatTextAsGenericSpannerMutationFn(TestHelper.TABLE_NAME);
  assertEquals(TestHelper.MUTATION_1,simpleFn.apply(TestHelper.STRUCT_1_BASE64_SERIALIZED));
}

Fixed version (ground truth):
@Test public void methodUnderTest_expectedResult() throws Exception {
  FormatTextAsGenericSpannerMutationFn simpleFn=new FormatTextAsGenericSpannerMutationFn(TestHelper.TABLE_NAME);
  assertEquals(TestHelper.MUTATION_1,simpleFn.apply(TestHelper.STRUCT_1_BASE64_SERIALIZED));
  assertEquals(TestHelper.MUTATION_2,simpleFn.apply(TestHelper.STRUCT_2_BASE64_SERIALIZED));
  assertEquals(TestHelper.MUTATION_3,simpleFn.apply(TestHelper.STRUCT_3_BASE64_SERIALIZED));
  assertEquals(TestHelper.MUTATION_4,simpleFn.apply(TestHelper.STRUCT_4_BASE64_SERIALIZED));
}
Program: 68977
Project: 68977
Buggy source:
@Test public void testFormatGenericSpannerStructAsTextFnTest() throws Exception {
  FormatGenericSpannerStructAsTextFn simpleFn=new FormatGenericSpannerStructAsTextFn(TestHelper.TABLE_NAME);
  assertEquals(TestHelper.STRUCT_1_BASE64_SERIALIZED,simpleFn.apply(TestHelper.STRUCT_1));
  assertEquals(TestHelper.STRUCT_2_BASE64_SERIALIZED,simpleFn.apply(TestHelper.STRUCT_2));
  assertEquals(TestHelper.STRUCT_3_BASE64_SERIALIZED,simpleFn.apply(TestHelper.STRUCT_3));
  assertEquals(TestHelper.STRUCT_4_BASE64_SERIALIZED,simpleFn.apply(TestHelper.STRUCT_4));
}

Fixed version (ground truth):
@Test public void testFormatGenericSpannerStructAsTextFnTest() throws Exception {
  FormatGenericSpannerStructAsTextFn simpleFn=new FormatGenericSpannerStructAsTextFn(TestHelper.TABLE_NAME);
  assertEquals(TestHelper.STRUCT_1_BASE64_SERIALIZED,simpleFn.apply(TestHelper.STRUCT_1));
  assertEquals(TestHelper.STRUCT_2_BASE64_SERIALIZED,simpleFn.apply(TestHelper.STRUCT_2));
  assertEquals(TestHelper.STRUCT_3_BASE64_SERIALIZED,simpleFn.apply(TestHelper.STRUCT_3));
}
Program: 68978
Project: 68978
Buggy source:
@Test public void methodUnderTest_expectedResult() throws Exception {
  FormatTextAsGenericSpannerMutationFn simpleFn=new FormatTextAsGenericSpannerMutationFn(TestHelper.TABLE_NAME);
  assertEquals(TestHelper.MUTATION_1,simpleFn.apply(TestHelper.STRUCT_1_BASE64_SERIALIZED));
  assertEquals(TestHelper.MUTATION_2,simpleFn.apply(TestHelper.STRUCT_2_BASE64_SERIALIZED));
  assertEquals(TestHelper.MUTATION_3,simpleFn.apply(TestHelper.STRUCT_3_BASE64_SERIALIZED));
  assertEquals(TestHelper.MUTATION_4,simpleFn.apply(TestHelper.STRUCT_4_BASE64_SERIALIZED));
}

Fixed version (ground truth):
@Test public void methodUnderTest_expectedResult() throws Exception {
  FormatTextAsGenericSpannerMutationFn simpleFn=new FormatTextAsGenericSpannerMutationFn(TestHelper.TABLE_NAME);
  assertEquals(TestHelper.MUTATION_1,simpleFn.apply(TestHelper.STRUCT_1_BASE64_SERIALIZED));
  assertEquals(TestHelper.MUTATION_2,simpleFn.apply(TestHelper.STRUCT_2_BASE64_SERIALIZED));
  assertEquals(TestHelper.MUTATION_3,simpleFn.apply(TestHelper.STRUCT_3_BASE64_SERIALIZED));
  assertEquals(TestHelper.MUTATION_4,simpleFn.apply(TestHelper.STRUCT_4_BASE64_SERIALIZED));
  assertEquals(TestHelper.MUTATION_5,simpleFn.apply(TestHelper.STRUCT_5_BASE64_SERIALIZED));
}
Program: 68979
Project: 68979
Buggy source:
/** 
 * Temporary workaround put in until https://github.com/apache/beam/pull/4946 is live. Gets the list of tables to backup.
 */
public static ImmutableList<String> getTableNamesBeingBackedUp(String projectId,String instance,String databaseId,String tableNamesQuery,Util util){
  ImmutableList<Struct> tableNames=util.performSingleSpannerQuery(projectId,instance,databaseId,tableNamesQuery);
  ArrayList<String> tableNamesAsStrings=new ArrayList<String>();
  String parentTableName="String_Node_Str";
  for (  Struct inputRow : tableNames) {
    if (!inputRow.isNull("String_Node_Str")) {
      parentTableName=inputRow.getString("String_Node_Str");
    }
    tableNamesAsStrings.add(inputRow.getString("String_Node_Str") + "String_Node_Str" + parentTableName);
  }
  return ImmutableList.copyOf(tableNamesAsStrings);
}

Fixed version (ground truth):
/** 
 * Temporary workaround put in until https://github.com/apache/beam/pull/4946 is live. Gets the list of tables to backup.
 */
public static ImmutableList<String> getTableNamesBeingBackedUp(String projectId,String instance,String databaseId,String tableNamesQuery,Util util){
  ImmutableList<Struct> tableNames=util.performSingleSpannerQuery(projectId,instance,databaseId,tableNamesQuery);
  ArrayList<String> tableNamesAsStrings=new ArrayList<String>();
  for (  Struct inputRow : tableNames) {
    String parentTableName="String_Node_Str";
    if (!inputRow.isNull("String_Node_Str")) {
      parentTableName=inputRow.getString("String_Node_Str");
    }
    tableNamesAsStrings.add(inputRow.getString("String_Node_Str") + "String_Node_Str" + parentTableName);
  }
  return ImmutableList.copyOf(tableNamesAsStrings);
}