nus-yam/ex-repair huggingface dataset:
Program: 84347
Project: 84347
Buggy source:
public RSTile getNearestBank(final RSTile tile){
  double dist=-1.0D;
  RSTile finalTile=null;
  final RSTile[] BANKS={new RSTile(3093,3243,0),new RSTile(3209,3219,2),new RSTile(3270,3167,0),new RSTile(3253,3421,0),new RSTile(3188,3437,0),new RSTile(3094,3491,0),new RSTile(3097,3496,0),new RSTile(2946,3369,0),new RSTile(3012,3356,0)};
  for (  RSTile bank : BANKS) {
    double cdist=methods.calc.distanceBetween(tile,bank);
    if ((dist < cdist || dist == -1.0D) && (tile.getZ() == bank.getZ())) {
      dist=cdist;
      finalTile=bank;
    }
  }
  return finalTile;
}

Fixed version (ground truth):
public RSTile getNearestBank(final RSTile tile){
  double dist=-1.0D;
  RSTile finalTile=null;
  final RSTile[] BANKS={new RSTile(3093,3243,0),new RSTile(3209,3219,2),new RSTile(3270,3167,0),new RSTile(3253,3421,0),new RSTile(3188,3437,0),new RSTile(3094,3491,0),new RSTile(3097,3496,0),new RSTile(2946,3369,0),new RSTile(3012,3356,0)};
  for (  RSTile bank : BANKS) {
    double cdist=methods.calc.distanceBetween(tile,bank);
    if ((dist > cdist || dist == -1.0D) && (tile.getZ() == bank.getZ())) {
      dist=cdist;
      finalTile=bank;
    }
  }
  return finalTile;
}
Program: 84348
Project: 84348
Buggy source:
public ArrayList<String> getAllowedHosts(){
  final ArrayList<String> whitelist=new ArrayList<String>(32);
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  return whitelist;
}

Fixed version (ground truth):
public ArrayList<String> getAllowedHosts(){
  final ArrayList<String> whitelist=new ArrayList<String>(32);
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  return whitelist;
}
Program: 84351
Project: 84351
Buggy source:
public ArrayList<String> getAllowedHosts(){
  final ArrayList<String> whitelist=new ArrayList<String>(32);
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  return whitelist;
}

Fixed version (ground truth):
public ArrayList<String> getAllowedHosts(){
  final ArrayList<String> whitelist=new ArrayList<String>(32);
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  return whitelist;
}
Program: 84352
Project: 84352
Buggy source:
public ArrayList<String> getAllowedHosts(){
  final ArrayList<String> whitelist=new ArrayList<String>(32);
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  return whitelist;
}

Fixed version (ground truth):
public ArrayList<String> getAllowedHosts(){
  final ArrayList<String> whitelist=new ArrayList<String>(32);
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  return whitelist;
}
Program: 84355
Project: 84355
Buggy source:
public ArrayList<String> getAllowedHosts(){
  final ArrayList<String> whitelist=new ArrayList<String>(32);
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  return whitelist;
}

Fixed version (ground truth):
public ArrayList<String> getAllowedHosts(){
  final ArrayList<String> whitelist=new ArrayList<String>(32);
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  whitelist.add("String_Node_Str");
  return whitelist;
}
Program: 84357
Project: 84357
Buggy source:
private void constructItemIcons(){
  final HashMap<String,String> map=new HashMap<String,String>(16);
  map.put(Messages.NEWBOT,GlobalConfiguration.Paths.Resources.ICON_APPADD);
  map.put(Messages.CLOSEBOT,GlobalConfiguration.Paths.Resources.ICON_APPDELETE);
  map.put(Messages.SERVICEKEY,GlobalConfiguration.Paths.Resources.ICON_KEY);
  map.put(Messages.ADDSCRIPT,GlobalConfiguration.Paths.Resources.ICON_SCRIPT_ADD);
  map.put(Messages.RUNSCRIPT,GlobalConfiguration.Paths.Resources.ICON_PLAY);
  map.put(Messages.STOPSCRIPT,GlobalConfiguration.Paths.Resources.ICON_DELETE);
  map.put(Messages.PAUSESCRIPT,GlobalConfiguration.Paths.Resources.ICON_PAUSE);
  map.put(Messages.SAVESCREENSHOT,GlobalConfiguration.Paths.Resources.ICON_PHOTO);
  map.put(Messages.EXIT,GlobalConfiguration.Paths.Resources.ICON_CLOSE);
  map.put("String_Node_Str",GlobalConfiguration.Paths.Resources.ICON_REPORTKEY);
  map.put("String_Node_Str",GlobalConfiguration.Paths.Resources.ICON_WEBLINK);
  map.put("String_Node_Str",GlobalConfiguration.Paths.Resources.ICON_USEREDIT);
  map.put("String_Node_Str",GlobalConfiguration.Paths.Resources.ICON_INFO);
  for (  final Entry<String,String> item : map.entrySet()) {
    final JMenuItem menu=commandMenuItem.get(item.getKey());
    menu.setIcon(new ImageIcon(GlobalConfiguration.getImage(item.getValue())));
  }
}

Fixed version (ground truth):
private void constructItemIcons(){
  final HashMap<String,String> map=new HashMap<String,String>(16);
  map.put(Messages.NEWBOT,GlobalConfiguration.Paths.Resources.ICON_APPADD);
  map.put(Messages.CLOSEBOT,GlobalConfiguration.Paths.Resources.ICON_APPDELETE);
  map.put(Messages.SERVICEKEY,GlobalConfiguration.Paths.Resources.ICON_KEY);
  map.put(Messages.ADDSCRIPT,GlobalConfiguration.Paths.Resources.ICON_SCRIPT_ADD);
  map.put(Messages.RUNSCRIPT,GlobalConfiguration.Paths.Resources.ICON_PLAY);
  map.put(Messages.STOPSCRIPT,GlobalConfiguration.Paths.Resources.ICON_DELETE);
  map.put(Messages.PAUSESCRIPT,GlobalConfiguration.Paths.Resources.ICON_PAUSE);
  map.put(Messages.SAVESCREENSHOT,GlobalConfiguration.Paths.Resources.ICON_PHOTO);
  map.put(Messages.HIDEBOT,GlobalConfiguration.Paths.Resources.ICON_TRAY_DOWN);
  map.put(Messages.EXIT,GlobalConfiguration.Paths.Resources.ICON_CLOSE);
  map.put("String_Node_Str",GlobalConfiguration.Paths.Resources.ICON_REPORTKEY);
  map.put("String_Node_Str",GlobalConfiguration.Paths.Resources.ICON_WEBLINK);
  map.put("String_Node_Str",GlobalConfiguration.Paths.Resources.ICON_USEREDIT);
  map.put("String_Node_Str",GlobalConfiguration.Paths.Resources.ICON_INFO);
  for (  final Entry<String,String> item : map.entrySet()) {
    final JMenuItem menu=commandMenuItem.get(item.getKey());
    menu.setIcon(new ImageIcon(GlobalConfiguration.getImage(item.getValue())));
  }
}
Program: 84359
Project: 84359
Buggy source:
private String downloadPage(final String url,final String referer){
  try {
    HttpURLConnection con=GlobalConfiguration.getHttpConnection(new URL(url));
    if (referer != null && !referer.isEmpty())     con.addRequestProperty("String_Node_Str",referer);
    final BufferedReader reader=new BufferedReader(new InputStreamReader(con.getInputStream()));
    final StringBuilder buf=new StringBuilder();
    String line;
    while ((line=reader.readLine()) != null) {
      buf.append(line);
    }
    reader.close();
    return buf.toString();
  }
 catch (  final Exception e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
private String downloadPage(final String url,final String referer){
  try {
    HttpURLConnection con=GlobalConfiguration.getHttpConnection(new URL(url));
    if (referer != null && !referer.isEmpty()) {
      con.addRequestProperty("String_Node_Str",referer);
    }
    final BufferedReader reader=new BufferedReader(new InputStreamReader(con.getInputStream()));
    final StringBuilder buf=new StringBuilder();
    String line;
    while ((line=reader.readLine()) != null) {
      buf.append(line);
    }
    reader.close();
    return buf.toString();
  }
 catch (  final Exception e) {
    e.printStackTrace();
  }
  return null;
}
Program: 84360
Project: 84360
Buggy source:
public void init(URL script,File cache) throws IOException, ParseException {
  byte[] data=null;
  FileInputStream fis=null;
  try {
    HttpAgent.download(script,cache);
    fis=new FileInputStream(cache);
    data=load(fis);
  }
 catch (  IOException ioe) {
    log.severe("String_Node_Str");
  }
 finally {
    try {
      if (fis != null)       fis.close();
    }
 catch (    IOException ioe1) {
    }
  }
  this.script=new ModScript(data);
}

Fixed version (ground truth):
public void init(URL script,File cache) throws IOException, ParseException {
  byte[] data=null;
  FileInputStream fis=null;
  try {
    HttpAgent.download(script,cache);
    fis=new FileInputStream(cache);
    data=load(fis);
  }
 catch (  IOException ioe) {
    log.severe("String_Node_Str");
  }
 finally {
    try {
      if (fis != null) {
        fis.close();
      }
    }
 catch (    IOException ioe1) {
    }
  }
  this.script=new ModScript(data);
}
Program: 84362
Project: 84362
Buggy source:
@Override public void onFinish(){
}

Fixed version (ground truth):
@Override public void onFinish(){
  step=-1;
  exit=false;
  reaper=null;
}
Program: 84364
Project: 84364
Buggy source:
@Override public boolean activateCondition(){
  if ((settings.getSetting(696) != 0) && (objects.getNearest(12731) != null)) {
    tmpID=tmpStatus=-1;
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean activateCondition(){
  if ((settings.getSetting(696) != 0) && (objects.getNearest(12731) != null)) {
    return true;
  }
  return false;
}
Program: 84365
Project: 84365
Buggy source:
public void stopAllScripts(){
  for (  int i : scripts.keySet()) {
    stopScript(i);
  }
}

Fixed version (ground truth):
public void stopAllScripts(){
  Set<Integer> theSet=scripts.keySet();
  int[] arr=new int[theSet.size()];
  int c=0;
  for (  int i : theSet) {
    arr[c]=i;
    c++;
  }
  for (  int id : arr) {
    stopScript(id);
  }
}
Program: 84366
Project: 84366
Buggy source:
public static void Add(final HashMap<RSTile,TileFlags> theFlagsList){
  new Thread(){
    public void run(){
      String addedString="String_Node_Str";
      final Map<RSTile,TileFlags> tl=Collections.unmodifiableMap(theFlagsList);
      Iterator<Map.Entry<RSTile,TileFlags>> tileFlagsIterator=tl.entrySet().iterator();
      while (tileFlagsIterator.hasNext()) {
        TileFlags tileFlags=tileFlagsIterator.next().getValue();
        if (tileFlags != null) {
          addedString+=tileFlags.toString() + "String_Node_Str";
        }
      }
      Web.map.putAll(theFlagsList);
      cacheWriter.add(addedString);
      addedString=null;
    }
  }
.start();
}

Fixed version (ground truth):
public static void Add(final HashMap<RSTile,TileFlags> theFlagsList){
  new Thread(){
    public void run(){
      String addedString="String_Node_Str";
      final HashMap<RSTile,TileFlags> theFlagsList2=new HashMap<RSTile,TileFlags>();
      theFlagsList2.putAll(theFlagsList);
      final Map<RSTile,TileFlags> tl=Collections.unmodifiableMap(theFlagsList2);
      Iterator<Map.Entry<RSTile,TileFlags>> tileFlagsIterator=tl.entrySet().iterator();
      while (tileFlagsIterator.hasNext()) {
        TileFlags tileFlags=tileFlagsIterator.next().getValue();
        if (tileFlags != null) {
          addedString+=tileFlags.toString() + "String_Node_Str";
        }
      }
      Web.map.putAll(theFlagsList);
      cacheWriter.add(addedString);
      addedString=null;
      theFlagsList2.clear();
    }
  }
.start();
}
Program: 84367
Project: 84367
Buggy source:
public void run(){
  String addedString="String_Node_Str";
  final Map<RSTile,TileFlags> tl=Collections.unmodifiableMap(theFlagsList);
  Iterator<Map.Entry<RSTile,TileFlags>> tileFlagsIterator=tl.entrySet().iterator();
  while (tileFlagsIterator.hasNext()) {
    TileFlags tileFlags=tileFlagsIterator.next().getValue();
    if (tileFlags != null) {
      addedString+=tileFlags.toString() + "String_Node_Str";
    }
  }
  Web.map.putAll(theFlagsList);
  cacheWriter.add(addedString);
  addedString=null;
}

Fixed version (ground truth):
public void run(){
  String addedString="String_Node_Str";
  final HashMap<RSTile,TileFlags> theFlagsList2=new HashMap<RSTile,TileFlags>();
  theFlagsList2.putAll(theFlagsList);
  final Map<RSTile,TileFlags> tl=Collections.unmodifiableMap(theFlagsList2);
  Iterator<Map.Entry<RSTile,TileFlags>> tileFlagsIterator=tl.entrySet().iterator();
  while (tileFlagsIterator.hasNext()) {
    TileFlags tileFlags=tileFlagsIterator.next().getValue();
    if (tileFlags != null) {
      addedString+=tileFlags.toString() + "String_Node_Str";
    }
  }
  Web.map.putAll(theFlagsList);
  cacheWriter.add(addedString);
  addedString=null;
  theFlagsList2.clear();
}
Program: 84369
Project: 84369
Buggy source:
public static void Add(final List<TileFlags> tileFlagsList){
  String addedString="String_Node_Str";
  Iterator<TileFlags> tileFlagsIterator=tileFlagsList.listIterator();
  while (tileFlagsIterator.hasNext()) {
    TileFlags tileFlags=tileFlagsIterator.next();
    if (tileFlags != null) {
      addedString+=tileFlags.toString() + "String_Node_Str";
    }
  }
  cacheWriter.add(addedString);
  Web.map.putAll(rs_map);
  rs_map.clear();
  addedString=null;
}

Fixed version (ground truth):
public static void Add(final HashMap<RSTile,TileFlags> theFlagsList){
  String addedString="String_Node_Str";
  Iterator<Map.Entry<RSTile,TileFlags>> tileFlagsIterator=theFlagsList.entrySet().iterator();
  while (tileFlagsIterator.hasNext()) {
    TileFlags tileFlags=tileFlagsIterator.next().getValue();
    if (tileFlags != null) {
      addedString+=tileFlags.toString() + "String_Node_Str";
    }
  }
  Web.map.putAll(theFlagsList);
  cacheWriter.add(addedString);
  addedString=null;
}
Program: 84370
Project: 84370
Buggy source:
public static void addHook(Hook hook){
  if (!isHookValid(hook.getHookName())) {
    hooks.put(hook.getHookName(),hook);
  }
}

Fixed version (ground truth):
public static void addHook(Hook hook){
  if (!isHookValid(hook.getHookName())) {
    Hooks.hooks.put(hook.getHookName(),hook);
  }
}
Program: 84371
Project: 84371
Buggy source:
private Field getHookField(String hookName){
  if (hookName == null || !isHookValid(hookName)) {
    return null;
  }
  Hook data=Hooks.hooks.get(hookName);
  if (data == null) {
    return null;
  }
  return getHookField(data.getClassName(),data.getFieldName());
}

Fixed version (ground truth):
private Field getHookField(String hookName){
  if (hookName == null || !isHookValid(hookName)) {
    return null;
  }
  Hook hook=Hooks.hooks.get(hookName);
  if (hook == null) {
    return null;
  }
  return getHookField(hook.getClassName(),hook.getFieldName());
}
Program: 84373
Project: 84373
Buggy source:
private Point[] genControls(Point start,Point end){
  int rand=random(1,8);
  ArrayList<Point> controls=new ArrayList<Point>();
  controls.add(start);
  if (random(1,2) == 1) {
    int x=random(0,game.getWidth());
    int y=random(0,game.getHeight());
    Point cp1=new Point(x,y);
    Point cp2=new Point(x,y);
    int loops=0;
    while (calc.distanceBetween(cp1,cp2) <= 200 && ((loops++) < 200)) {
      if (loops >= 200) {
        break;
      }
      x=random(0,game.getWidth() + 200);
      x=x - random(0,200);
      y=random(0,game.getHeight() + 200);
      y=y - random(0,200);
      cp2=new Point(x,y);
    }
    if (loops >= 200) {
      cp2=new Point(cp2.y,cp2.x);
    }
    if (random(1,2) == random(1,2)) {
      controls.add(cp1);
      controls.add(cp2);
    }
 else {
      controls.add(cp2);
      controls.add(cp1);
    }
    controls.add(end);
    return controls.toArray(new Point[controls.size()]);
  }
 else {
    Point[] controls2=genRelativeControls(start,end,4);
    return controls2;
  }
}

Fixed version (ground truth):
private Point[] genControls(Point start,Point end){
  random(1,8);
  ArrayList<Point> controls=new ArrayList<Point>();
  controls.add(start);
  if (random(1,2) == 1) {
    int x=random(0,game.getWidth());
    int y=random(0,game.getHeight());
    Point cp1=new Point(x,y);
    Point cp2=new Point(x,y);
    int loops=0;
    while (calc.distanceBetween(cp1,cp2) <= 200 && ((loops++) < 200)) {
      if (loops >= 200) {
        break;
      }
      x=random(0,game.getWidth() + 200);
      x=x - random(0,200);
      y=random(0,game.getHeight() + 200);
      y=y - random(0,200);
      cp2=new Point(x,y);
    }
    if (loops >= 200) {
      cp2=new Point(cp2.y,cp2.x);
    }
    if (random(1,2) == random(1,2)) {
      controls.add(cp1);
      controls.add(cp2);
    }
 else {
      controls.add(cp2);
      controls.add(cp1);
    }
    controls.add(end);
    return controls.toArray(new Point[controls.size()]);
  }
 else {
    Point[] controls2=genRelativeControls(start,end,4);
    return controls2;
  }
}
Program: 84374
Project: 84374
Buggy source:
@Override public boolean onStart(){
  log("String_Node_Str");
  sleep(100);
  if (!game.isLoggedIn() || game.isLoginScreen() || game.isWelcomeScreen()) {
    env.enableRandom("String_Node_Str");
  }
  Thread priceloader=new Thread(new PriceLoader());
  priceloader.start();
  createAndWaitforGUI();
  sleep(75);
  if (gui.isCanceled() == true) {
    return false;
  }
  final int pp=(int)gui.softenLocation();
switch (pp) {
case locVar.fally:
    loc=new Falador();
  break;
case locVar.edge:
loc=new Edgeville();
break;
default :
return false;
}
running=true;
inv=new InventoryListener();
invThread=new Thread(inv);
invThread.start();
while (priceloader.isAlive()) {
sleep(100);
}
if (softClayPrice == -1 || clayPrice == -1) {
log.severe("String_Node_Str");
return false;
}
 else {
if (nclicked == null || nmouse == null) {
log.severe("String_Node_Str");
log.severe("String_Node_Str");
return false;
}
log("String_Node_Str" + softClayPrice + "String_Node_Str"+ clayPrice+ "String_Node_Str");
}
mouse.setSpeed(random(mouseLo,mouseHi));
mouseCheck=new MouseMovementChecker();
cameraCheck=new CameraMovementChecker();
Antiban=new antiban();
canAB=true;
lastMessageTyped=System.currentTimeMillis();
return true;
}

Fixed version (ground truth):
@Override public boolean onStart(){
  log("String_Node_Str");
  sleep(100);
  if (!game.isLoggedIn() || game.isLoginScreen() || game.isWelcomeScreen()) {
    env.enableRandom("String_Node_Str");
  }
  Thread priceloader=new Thread(new PriceLoader());
  priceloader.start();
  createAndWaitforGUI();
  sleep(75);
  if (gui.isCanceled() == true) {
    return false;
  }
  final int pp=(int)gui.softenLocation();
switch (pp) {
case locVar.fally:
    loc=new Falador();
  break;
case locVar.edge:
loc=new Edgeville();
break;
default :
return false;
}
running=true;
inv=new InventoryListener();
invThread=new Thread(inv);
invThread.start();
while (priceloader.isAlive()) {
sleep(100);
}
if (softClayPrice == -1 || clayPrice == -1) {
log.severe("String_Node_Str");
return false;
}
 else {
if (nclicked == null || nmouse == null) {
log.severe("String_Node_Str");
log.severe("String_Node_Str");
return false;
}
log("String_Node_Str" + softClayPrice + "String_Node_Str"+ clayPrice+ "String_Node_Str");
}
mouse.setSpeed(random(mouseLo,mouseHi));
mouseCheck=new MouseMovementChecker();
cameraCheck=new CameraMovementChecker();
Antiban=new antiban();
canAB=true;
System.currentTimeMillis();
return true;
}
Program: 84375
Project: 84375
Buggy source:
private Point[] genRelativeControls(Point start,Point end,int numofcontrols){
  if (numofcontrols < 3 || numofcontrols > 4) {
    return null;
  }
  double dist=calc.distanceBetween(start,end);
  double angle=Math.atan2(end.y - start.y,end.x - start.x);
  ArrayList<Point> result=new ArrayList<Point>();
  result.add(start);
  int ctrlSpacing=random(70,80);
  for (int i=1; i < numofcontrols; i++) {
    ctrlSpacing=random(70,80);
    double radius=ctrlSpacing * i;
    Point cur=new Point((int)(start.x + radius * Math.cos(angle)),(int)(start.y + radius * Math.sin(angle)));
    double percent=1D - (double)(i - 1) / (double)numofcontrols;
    percent=percent > 0.5 ? percent - 0.5 : percent;
    percent+=0.25;
    int curVariance=(int)(random(115,130) * percent);
    cur.setLocation((int)(cur.y + curVariance * 2 * rand.nextDouble() - curVariance),(int)(cur.x + curVariance * 2 * rand.nextDouble() - curVariance));
    result.add(cur);
  }
  if (numofcontrols == 3) {
    result.add(result.get(result.size() - 1));
  }
  result.add(end);
  return result.toArray(new Point[result.size()]);
}

Fixed version (ground truth):
private Point[] genRelativeControls(Point start,Point end,int numofcontrols){
  if (numofcontrols < 3 || numofcontrols > 4) {
    return null;
  }
  calc.distanceBetween(start,end);
  double angle=Math.atan2(end.y - start.y,end.x - start.x);
  ArrayList<Point> result=new ArrayList<Point>();
  result.add(start);
  int ctrlSpacing=random(70,80);
  for (int i=1; i < numofcontrols; i++) {
    ctrlSpacing=random(70,80);
    double radius=ctrlSpacing * i;
    Point cur=new Point((int)(start.x + radius * Math.cos(angle)),(int)(start.y + radius * Math.sin(angle)));
    double percent=1D - (double)(i - 1) / (double)numofcontrols;
    percent=percent > 0.5 ? percent - 0.5 : percent;
    percent+=0.25;
    int curVariance=(int)(random(115,130) * percent);
    cur.setLocation((int)(cur.y + curVariance * 2 * rand.nextDouble() - curVariance),(int)(cur.x + curVariance * 2 * rand.nextDouble() - curVariance));
    result.add(cur);
  }
  if (numofcontrols == 3) {
    result.add(result.get(result.size() - 1));
  }
  result.add(end);
  return result.toArray(new Point[result.size()]);
}
Program: 84376
Project: 84376
Buggy source:
private void antiban(){
  int rand=random(1,6);
  if (rand <= 2 && !bank.isOpen()) {
    antibancamera();
  }
 else   if (rand >= 5) {
    antibanmouse();
  }
 else {
    if (random(1,3) >= random(1,3)) {
      antibanmouse();
    }
 else     if (!bank.isOpen()) {
      antibancamera();
    }
 else {
      antibanmouse();
    }
  }
}

Fixed version (ground truth):
public antiban(){
switch (numABThreads) {
case 0:
{
      break;
    }
case 1:
{
    new Thread(this).start();
    break;
  }
case 2:
{
  new Thread(this).start();
  new Thread(this).start();
  break;
}
case 3:
{
new Thread(this).start();
new Thread(this).start();
new Thread(this).start();
break;
}
case 4:
{
new Thread(this).start();
new Thread(this).start();
new Thread(this).start();
new Thread(this).start();
break;
}
case 5:
{
new Thread(this).start();
new Thread(this).start();
new Thread(this).start();
new Thread(this).start();
new Thread(this).start();
break;
}
default :
{
new Thread(this).start();
break;
}
}
}
Program: 84378
Project: 84378
Buggy source:
public boolean onStart(){
  try {
    final URL cursorURL=new URL("String_Node_Str");
    final URL cursor80URL=new URL("String_Node_Str");
    normal=ImageIO.read(cursorURL);
    clicked=ImageIO.read(cursor80URL);
  }
 catch (  MalformedURLException e) {
    log("String_Node_Str");
  }
catch (  IOException e) {
    log("String_Node_Str");
  }
  gui=new BloddyMasterFarmerGUI();
  gui.setVisible(true);
  while (guiWait) {
    sleep(100);
  }
  startTime=System.currentTimeMillis();
  startXP=skills.getCurrentExp(Skills.THIEVING);
  startLvl=skills.getCurrentLevel(Skills.THIEVING);
  mouse.setSpeed(6);
  camRotate.isActive=true;
  camRotate.start();
  camHeight.isActive=true;
  camHeight.start();
  log("String_Node_Str");
  return !guiExit;
}

Fixed version (ground truth):
@Override public boolean onStart(){
  try {
    final URL cursorURL=new URL("String_Node_Str");
    final URL cursor80URL=new URL("String_Node_Str");
    normal=ImageIO.read(cursorURL);
    clicked=ImageIO.read(cursor80URL);
  }
 catch (  MalformedURLException e) {
    log("String_Node_Str");
  }
catch (  IOException e) {
    log("String_Node_Str");
  }
  gui=new BloddyMasterFarmerGUI();
  gui.setVisible(true);
  while (guiWait) {
    sleep(100);
  }
  startTime=System.currentTimeMillis();
  startXP=skills.getCurrentExp(Skills.THIEVING);
  startLvl=skills.getCurrentLevel(Skills.THIEVING);
  mouse.setSpeed(6);
  camRotate.isActive=true;
  camRotate.start();
  camHeight.isActive=true;
  camHeight.start();
  log("String_Node_Str");
  return !guiExit;
}
Program: 84379
Project: 84379
Buggy source:
public void onFinish(){
  mouse.moveOffScreen();
  camHeight.isActive=false;
  camRotate.isActive=false;
}

Fixed version (ground truth):
@Override public void onFinish(){
  mouse.moveOffScreen();
  camHeight.isActive=false;
  camRotate.isActive=false;
}
Program: 84380
Project: 84380
Buggy source:
public boolean onStart(){
  try {
    final URL cursorURL=new URL("String_Node_Str");
    final URL cursor80URL=new URL("String_Node_Str");
    normal=ImageIO.read(cursorURL);
    clicked=ImageIO.read(cursor80URL);
  }
 catch (  MalformedURLException e) {
    log("String_Node_Str");
  }
catch (  IOException e) {
    log("String_Node_Str");
  }
  gui=new BloddyMasterFarmerGUI();
  gui.setVisible(true);
  while (guiWait) {
    sleep(100);
  }
  startTime=System.currentTimeMillis();
  startXP=skills.getCurrentExp(Skills.THIEVING);
  startLvl=skills.getCurrentLevel(Skills.THIEVING);
  mouse.setSpeed(6);
  camRotate.isActive=true;
  camRotate.start();
  camHeight.isActive=true;
  camHeight.start();
  log("String_Node_Str");
  return !guiExit;
}

Fixed version (ground truth):
@Override public boolean onStart(){
  try {
    final URL cursorURL=new URL("String_Node_Str");
    final URL cursor80URL=new URL("String_Node_Str");
    normal=ImageIO.read(cursorURL);
    clicked=ImageIO.read(cursor80URL);
  }
 catch (  MalformedURLException e) {
    log("String_Node_Str");
  }
catch (  IOException e) {
    log("String_Node_Str");
  }
  gui=new BloddyMasterFarmerGUI();
  gui.setVisible(true);
  while (guiWait) {
    sleep(100);
  }
  startTime=System.currentTimeMillis();
  startXP=skills.getCurrentExp(Skills.THIEVING);
  startLvl=skills.getCurrentLevel(Skills.THIEVING);
  mouse.setSpeed(6);
  camRotate.isActive=true;
  camRotate.start();
  camHeight.isActive=true;
  camHeight.start();
  log("String_Node_Str");
  return !guiExit;
}
Program: 84381
Project: 84381
Buggy source:
public void onFinish(){
  mouse.moveOffScreen();
  camHeight.isActive=false;
  camRotate.isActive=false;
}

Fixed version (ground truth):
@Override public void onFinish(){
  mouse.moveOffScreen();
  camHeight.isActive=false;
  camRotate.isActive=false;
}
Program: 84383
Project: 84383
Buggy source:
@Override public void actionPerformed(ActionEvent arg0){
  exitEvent.fire(new GameExitEvent());
}

Fixed version (ground truth):
@Override public void actionPerformed(final ActionEvent arg0){
  exitEvent.fire(new GameExitEvent());
}
Program: 84384
Project: 84384
Buggy source:
public void pointsEventListener(@Observes PointsEvent event){
  movesLabel.setText("String_Node_Str" + event.getPoints());
}

Fixed version (ground truth):
public void pointsEventListener(@Observes final PointsEvent event){
  movesLabel.setText("String_Node_Str" + event.getPoints());
}
Program: 84385
Project: 84385
Buggy source:
public MainMenuBar(){
  JMenu menu=new JMenu("String_Node_Str");
  add(menu);
  JMenuItem menuItemPlayAgain=new JMenuItem("String_Node_Str");
  menuItemPlayAgain.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      restartEvent.fire(new GameRestartEvent());
    }
  }
);
  menu.add(menuItemPlayAgain);
  JMenuItem menuItemExit=new JMenuItem("String_Node_Str");
  menuItemExit.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      exitEvent.fire(new GameExitEvent());
    }
  }
);
  menu.addSeparator();
  menu.add(menuItemExit);
  movesLabel=new JLabel("String_Node_Str");
  add(movesLabel);
}

Fixed version (ground truth):
public MainMenuBar(){
  System.out.println("String_Node_Str");
  JMenu menu=new JMenu("String_Node_Str");
  add(menu);
  JMenuItem menuItemPlayAgain=new JMenuItem("String_Node_Str");
  menuItemPlayAgain.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    final ActionEvent e){
      restartEvent.fire(new GameRestartEvent());
    }
  }
);
  menu.add(menuItemPlayAgain);
  JMenuItem menuItemExit=new JMenuItem("String_Node_Str");
  menuItemExit.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    final ActionEvent arg0){
      exitEvent.fire(new GameExitEvent());
    }
  }
);
  menu.addSeparator();
  menu.add(menuItemExit);
  movesLabel=new JLabel("String_Node_Str");
  add(movesLabel);
}
Program: 84386
Project: 84386
Buggy source:
public void setColor(Color color){
  Point temp=findFirstSelectedField();
  if (color != grid.getColor(temp.x,temp.y)) {
    counter++;
    for (int i=0; i < grid.getHeight(); i++) {
      for (int j=0; j < grid.getWidth(); j++) {
        if (grid.isSelected(i,j)) {
          grid.setColor(i,j,color);
        }
      }
    }
  }
}

Fixed version (ground truth):
public void setColor(final Color color){
  Point temp=findFirstSelectedField();
  if (color != grid.getColor(temp.x,temp.y)) {
    counter++;
    for (int i=0; i < grid.getHeight(); i++) {
      for (int j=0; j < grid.getWidth(); j++) {
        if (grid.isSelected(i,j)) {
          grid.setColor(i,j,color);
        }
      }
    }
  }
}
Program: 84387
Project: 84387
Buggy source:
private void checkNeighbours(Point point){
  if (point == null) {
    return;
  }
  if (checkedPoints.contains(point)) {
    return;
  }
  checkedPoints.add(point);
  Piece thisPiece=grid.getPiece(point.x,point.y);
  Point[] points=new Point[4];
  points[0]=new Point(point.x + 1,point.y);
  points[1]=new Point(point.x - 1,point.y);
  points[2]=new Point(point.x,point.y - 1);
  points[3]=new Point(point.x,point.y + 1);
  for (int i=0; i < points.length; i++) {
    Piece temp=grid.getPiece(points[i].x,points[i].y);
    if (temp == null) {
      continue;
    }
    if (temp.getColor().equals(thisPiece.getColor())) {
      temp.setSelected(true);
      checkNeighbours(points[i]);
    }
  }
}

Fixed version (ground truth):
private void checkNeighbours(final Point point){
  if (point == null) {
    return;
  }
  if (checkedPoints.contains(point)) {
    return;
  }
  checkedPoints.add(point);
  Piece thisPiece=grid.getPiece(point.x,point.y);
  Point[] points=new Point[4];
  points[0]=new Point(point.x + 1,point.y);
  points[1]=new Point(point.x - 1,point.y);
  points[2]=new Point(point.x,point.y - 1);
  points[3]=new Point(point.x,point.y + 1);
  for (int i=0; i < points.length; i++) {
    Piece temp=grid.getPiece(points[i].x,points[i].y);
    if (temp == null) {
      continue;
    }
    if (temp.getColor().equals(thisPiece.getColor())) {
      temp.setSelected(true);
      checkNeighbours(points[i]);
    }
  }
}
Program: 84388
Project: 84388
Buggy source:
public void checkAndSelect(){
  checkedPoints=new ArrayList<Point>();
  Point temp=findFirstSelectedField();
  if (temp == null) {
    return;
  }
  checkNeighbours(temp);
  pointsEvent.fire(new PointsEvent(getCounter()));
  if (checkedPoints.size() == grid.size()) {
    finishEvent.fire(new FinishEvent());
    finished=true;
  }
}

Fixed version (ground truth):
public void checkAndSelect(){
  checkedPoints=new ArrayList<Point>();
  Point temp=findFirstSelectedField();
  if (temp == null) {
    return;
  }
  checkNeighbours(temp);
  pointsEvent.fire(new PointsEvent(getCounter()));
  if (checkedPoints.size() == grid.size()) {
    finished=true;
    finishEvent.fire(new FinishEvent());
  }
}
Program: 84389
Project: 84389
Buggy source:
public void colorChangedListener(@Observes ColorButtonPressedEvent event){
  this.setColor(event.getColor());
  checkAndSelect();
  repaintEvent.fire(new RepaintEvent());
}

Fixed version (ground truth):
public void colorChangedListener(@Observes final ColorButtonPressedEvent event){
  setColor(event.getColor());
  checkAndSelect();
  repaintEvent.fire(new RepaintEvent());
}
Program: 84390
Project: 84390
Buggy source:
@Inject public GameLogic(Grid grid,Event<RepaintEvent> repaintEvent,Event<FinishEvent> finishEvent,Event<PointsEvent> pointsEvent){
  this.grid=grid;
  this.repaintEvent=repaintEvent;
  this.finishEvent=finishEvent;
  this.pointsEvent=pointsEvent;
}

Fixed version (ground truth):
@Inject public GameLogic(final Grid grid,final Event<RepaintEvent> repaintEvent,final Event<FinishEvent> finishEvent,final Event<PointsEvent> pointsEvent){
  this.grid=grid;
  this.repaintEvent=repaintEvent;
  this.finishEvent=finishEvent;
  this.pointsEvent=pointsEvent;
}
Program: 84391
Project: 84391
Buggy source:
public void gameRestartListener(@Observes GameRestartEvent event){
  counter=0;
  grid.fill();
  finished=false;
}

Fixed version (ground truth):
public void gameRestartListener(@Observes final GameRestartEvent event){
  counter=0;
  grid.fill();
  finished=false;
}
Program: 84392
Project: 84392
Buggy source:
public void repaintListener(@Observes RepaintEvent event){
  repaint();
}

Fixed version (ground truth):
public void repaintListener(@Observes final RepaintEvent event){
  repaint();
}
Program: 84393
Project: 84393
Buggy source:
private void drawBoard(Graphics2D g2d){
  int shadowOffset=2;
  g2d.setColor(BOARD_BACKGROUND_COLOR);
  int shadowWidth=boardWidth + shadowOffset;
  int shadowHeight=boardHeight + shadowOffset;
  Shape shadowShape=new RoundRectangle2D.Double(BORDER + shadowOffset,BORDER + shadowOffset,shadowWidth,shadowHeight,BORDER,BORDER);
  g2d.fill(shadowShape);
  g2d.setColor(BOARD_BACKGROUND_SHADOW_COLOR);
  double radius=5;
  Shape board=new RoundRectangle2D.Double(BORDER,BORDER,boardWidth,boardHeight,radius,radius);
  g2d.fill(board);
  g2d.setStroke(new BasicStroke(2,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));
  g2d.setColor(BOARD_BACKGROUND_BORDER_COLOR);
  g2d.draw(board);
}

Fixed version (ground truth):
private void drawBoard(final Graphics2D g2d){
  int shadowOffset=2;
  g2d.setColor(BOARD_BACKGROUND_COLOR);
  int shadowWidth=boardWidth + shadowOffset;
  int shadowHeight=boardHeight + shadowOffset;
  Shape shadowShape=new RoundRectangle2D.Double(BORDER + shadowOffset,BORDER + shadowOffset,shadowWidth,shadowHeight,BORDER,BORDER);
  g2d.fill(shadowShape);
  g2d.setColor(BOARD_BACKGROUND_SHADOW_COLOR);
  double radius=5;
  Shape board=new RoundRectangle2D.Double(BORDER,BORDER,boardWidth,boardHeight,radius,radius);
  g2d.fill(board);
  g2d.setStroke(new BasicStroke(2,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));
  g2d.setColor(BOARD_BACKGROUND_BORDER_COLOR);
  g2d.draw(board);
}
Program: 84394
Project: 84394
Buggy source:
public void finishListener(@Observes FinishEvent enent){
  finished=true;
  repaint();
}

Fixed version (ground truth):
public void finishListener(@Observes final FinishEvent enent){
  finished=true;
  repaint();
}
Program: 84395
Project: 84395
Buggy source:
@Override public void paintComponent(Graphics g){
  super.paintComponent(g);
  log.debug("String_Node_Str");
  boardWidth=getWidth() - (2 * BORDER);
  boardHeight=getHeight() - (2 * BORDER);
  Graphics2D g2d=(Graphics2D)g;
  g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
  drawBoard(g2d);
  drawGrid(g2d);
  if (finished) {
    drawFinish(g2d);
  }
}

Fixed version (ground truth):
@Override public void paintComponent(final Graphics g){
  super.paintComponent(g);
  log.debug("String_Node_Str");
  boardWidth=getWidth() - (2 * BORDER);
  boardHeight=getHeight() - (2 * BORDER);
  Graphics2D g2d=(Graphics2D)g;
  g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
  drawBoard(g2d);
  drawGrid(g2d);
  if (finished) {
    drawFinish(g2d);
  }
}
Program: 84396
Project: 84396
Buggy source:
private void drawFinish(Graphics2D g2d){
  int finishBackgroundWidth=boardWidth / 2;
  int finishBackgroundHeight=boardHeight / 2;
  int finishBackgroundX=finishBackgroundWidth / 2;
  int finishBackgroundY=finishBackgroundHeight / 2;
  int arch=20;
  int shadowOffset=5;
  Shape background=new RoundRectangle2D.Double(finishBackgroundX,finishBackgroundY,finishBackgroundWidth,finishBackgroundHeight,arch,arch);
  Shape shadow=new RoundRectangle2D.Double(finishBackgroundX + shadowOffset,finishBackgroundY + shadowOffset,finishBackgroundWidth + shadowOffset,finishBackgroundHeight + shadowOffset,arch,arch);
  g2d.setColor(new Color(0,0,0,120));
  g2d.fill(shadow);
  g2d.setColor(Color.white);
  g2d.fill(background);
  g2d.setStroke(new BasicStroke(3,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));
  g2d.setColor(Color.black);
  g2d.draw(background);
  Font finishFont=new Font("String_Node_Str",Font.PLAIN,40);
  Rectangle2D fontRect=g2d.getFontMetrics(finishFont).getStringBounds(Configurator.getWinMessage(),g2d);
  int winMessageX=finishBackgroundX + (int)(finishBackgroundWidth - fontRect.getWidth()) / 2;
  int winMessageY=finishBackgroundY + (int)((finishBackgroundHeight - fontRect.getHeight()) / 2 + fontRect.getHeight() / 2);
  g2d.setFont(finishFont);
  g2d.drawString(Configurator.getWinMessage(),winMessageX,winMessageY);
  finishFont=new Font("String_Node_Str",Font.PLAIN,30);
  g2d.setFont(finishFont);
}

Fixed version (ground truth):
private void drawFinish(final Graphics2D g2d){
  int finishBackgroundWidth=boardWidth / 2;
  int finishBackgroundHeight=boardHeight / 2;
  int finishBackgroundX=finishBackgroundWidth / 2;
  int finishBackgroundY=finishBackgroundHeight / 2;
  int arch=20;
  int shadowOffset=5;
  Shape background=new RoundRectangle2D.Double(finishBackgroundX,finishBackgroundY,finishBackgroundWidth,finishBackgroundHeight,arch,arch);
  Shape shadow=new RoundRectangle2D.Double(finishBackgroundX + shadowOffset,finishBackgroundY + shadowOffset,finishBackgroundWidth + shadowOffset,finishBackgroundHeight + shadowOffset,arch,arch);
  g2d.setColor(new Color(0,0,0,120));
  g2d.fill(shadow);
  g2d.setColor(Color.white);
  g2d.fill(background);
  g2d.setStroke(new BasicStroke(3,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));
  g2d.setColor(Color.black);
  g2d.draw(background);
  Font finishFont=new Font("String_Node_Str",Font.PLAIN,40);
  Rectangle2D fontRect=g2d.getFontMetrics(finishFont).getStringBounds(Configurator.getWinMessage(),g2d);
  int winMessageX=finishBackgroundX + (int)(finishBackgroundWidth - fontRect.getWidth()) / 2;
  int winMessageY=finishBackgroundY + (int)((finishBackgroundHeight - fontRect.getHeight()) / 2 + fontRect.getHeight() / 2);
  g2d.setFont(finishFont);
  g2d.drawString(Configurator.getWinMessage(),winMessageX,winMessageY);
  finishFont=new Font("String_Node_Str",Font.PLAIN,30);
  g2d.setFont(finishFont);
}
Program: 84397
Project: 84397
Buggy source:
private void drawGrid(Graphics2D g2d){
  int gridWidth=boardWidth - (2 * BORDER_PADDING);
  int gridHeight=boardWidth - (2 * BORDER_PADDING);
  int fieldWidth=(int)gridWidth / grid.getWidth();
  int fieldHeight=(int)gridHeight / grid.getHeight();
  int fieldStartPositionX=BORDER + BORDER_PADDING;
  int fieldStartPositionY=BORDER + BORDER_PADDING;
  if (gridWidth % grid.getWidth() != 0) {
    fieldStartPositionX+=(gridWidth - fieldWidth * grid.getWidth()) / 2;
  }
  if (gridHeight % grid.getHeight() != 0) {
    fieldStartPositionY+=(gridHeight - fieldHeight * grid.getHeight()) / 2;
  }
  g2d.setStroke(new BasicStroke(1,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));
  g2d.setColor(Color.black);
  g2d.drawRect(fieldStartPositionX - 1,fieldStartPositionY - 1,(grid.getWidth() * fieldWidth) + 1,(grid.getHeight() * fieldHeight) + 1);
  for (int i=0; i < grid.getWidth(); i++) {
    int tempX=fieldStartPositionX;
    for (int j=0; j < grid.getHeight(); j++) {
      g2d.setColor(grid.getColor(i,j));
      g2d.fillRect(tempX,fieldStartPositionY,fieldWidth,fieldHeight);
      g2d.setColor(Color.gray);
      tempX=tempX + fieldWidth;
    }
    fieldStartPositionY=fieldStartPositionY + fieldHeight;
  }
}

Fixed version (ground truth):
private void drawGrid(final Graphics2D g2d){
  int gridWidth=boardWidth - (2 * BORDER_PADDING);
  int gridHeight=boardWidth - (2 * BORDER_PADDING);
  int fieldWidth=gridWidth / grid.getWidth();
  int fieldHeight=gridHeight / grid.getHeight();
  int fieldStartPositionX=BORDER + BORDER_PADDING;
  int fieldStartPositionY=BORDER + BORDER_PADDING;
  if (gridWidth % grid.getWidth() != 0) {
    fieldStartPositionX+=(gridWidth - fieldWidth * grid.getWidth()) / 2;
  }
  if (gridHeight % grid.getHeight() != 0) {
    fieldStartPositionY+=(gridHeight - fieldHeight * grid.getHeight()) / 2;
  }
  g2d.setStroke(new BasicStroke(1,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));
  g2d.setColor(Color.black);
  g2d.drawRect(fieldStartPositionX - 1,fieldStartPositionY - 1,(grid.getWidth() * fieldWidth) + 1,(grid.getHeight() * fieldHeight) + 1);
  for (int i=0; i < grid.getWidth(); i++) {
    int tempX=fieldStartPositionX;
    for (int j=0; j < grid.getHeight(); j++) {
      g2d.setColor(grid.getColor(i,j));
      g2d.fillRect(tempX,fieldStartPositionY,fieldWidth,fieldHeight);
      g2d.setColor(Color.gray);
      tempX=tempX + fieldWidth;
    }
    fieldStartPositionY=fieldStartPositionY + fieldHeight;
  }
}
Program: 84398
Project: 84398
Buggy source:
@Inject public GameCanvas(@Width int width,@Height int height,Grid grid){
  this.grid=grid;
  Dimension dimension=new Dimension(width,height);
  setPreferredSize(dimension);
  setMaximumSize(dimension);
  setMinimumSize(dimension);
  setBackground(Color.white);
  setSize(width,height);
}

Fixed version (ground truth):
@Inject public GameCanvas(@Width final int width,@Height final int height,final Grid grid){
  this.grid=grid;
  Dimension dimension=new Dimension(width,height);
  setPreferredSize(dimension);
  setMaximumSize(dimension);
  setMinimumSize(dimension);
  setBackground(Color.white);
  setSize(width,height);
}
Program: 84399
Project: 84399
Buggy source:
public void gameRestartListener(@Observes GameRestartEvent event){
  finished=false;
  repaint();
}

Fixed version (ground truth):
public void gameRestartListener(@Observes final GameRestartEvent event){
  finished=false;
  repaint();
}