nus-yam/ex-repair huggingface dataset:
Program: 44973
Project: 44973
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: 44974
Project: 44974
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: 44976
Project: 44976
Buggy source:
@Override public void onFinish(){
}

Fixed version (ground truth):
@Override public void onFinish(){
  step=-1;
  exit=false;
  reaper=null;
}
Program: 44978
Project: 44978
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: 44979
Project: 44979
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: 44980
Project: 44980
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: 44981
Project: 44981
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: 44983
Project: 44983
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: 44984
Project: 44984
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: 44985
Project: 44985
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: 44987
Project: 44987
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: 44988
Project: 44988
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: 44989
Project: 44989
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: 44990
Project: 44990
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: 44992
Project: 44992
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: 44993
Project: 44993
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: 44994
Project: 44994
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: 44995
Project: 44995
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: 44997
Project: 44997
Buggy source:
/** 
 * Generate the table of premade wolf names.
 */
private void initRandomNames(){
  try {
    BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(WolfManager.class.getResourceAsStream("String_Node_Str")));
    while (true) {
      String s1;
      if ((s1=bufferedReader.readLine()) == null) {
        break;
      }
      s1=s1.trim();
      if (s1.length() > 0) {
        wolfNames.add(s1);
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  if (wolfNames.size() == 0) {
    logger.log(Level.SEVERE,"String_Node_Str");
    wolfNames.add("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Generate the table of premade wolf names.
 */
private void initRandomNames(){
  try {
    BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(RandomNameUtil.class.getResourceAsStream("String_Node_Str")));
    while (true) {
      String s1;
      if ((s1=bufferedReader.readLine()) == null) {
        break;
      }
      s1=s1.trim();
      if (s1.length() > 0) {
        wolfNames.add(s1);
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  if (wolfNames.size() == 0) {
    logger.log(Level.SEVERE,"String_Node_Str");
    wolfNames.add("String_Node_Str");
  }
}
Program: 44998
Project: 44998
Buggy source:
/** 
 * Generate a random name.
 * @return String
 */
public static String getRandomName(){
  Random random=new Random();
  return wolfNames.get(random.nextInt(wolfNames.size()));
}

Fixed version (ground truth):
/** 
 * Generate a random name.
 * @return String
 */
public static String getRandomName(){
  Random random=new Random();
  return wolfNames.get(random.nextInt(wolfNames.size() - 1));
}
Program: 44999
Project: 44999
Buggy source:
@Override public void onEnable(){
  pm=this.getServer().getPluginManager();
  pdfFile=this.getDescription();
  name=pdfFile.getName();
  version=pdfFile.getVersion();
  configManager.load();
  pm.registerEvent(Event.Type.CREATURE_SPAWN,entityListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.ENTITY_DEATH,entityListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.ENTITY_TAME,entityListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.ENTITY_TARGET,entityListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.PLAYER_INTERACT,playerListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.PLAYER_INTERACT_ENTITY,playerListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.PLUGIN_ENABLE,serverListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.PLUGIN_ENABLE,serverListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.CHUNK_LOAD,worldListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.CHUNK_UNLOAD,worldListener,Event.Priority.Normal,this);
  this.getCommand("String_Node_Str").setExecutor(new WolfCommandExecutor(this));
  log(Level.INFO,"String_Node_Str" + version + "String_Node_Str");
  setupPermissions();
  setupDatabase();
}

Fixed version (ground truth):
@Override public void onEnable(){
  pm=this.getServer().getPluginManager();
  pdfFile=this.getDescription();
  name=pdfFile.getName();
  version=pdfFile.getVersion();
  configManager.load();
  pm.registerEvent(Event.Type.CREATURE_SPAWN,entityListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.ENTITY_DEATH,entityListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.ENTITY_TAME,entityListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.ENTITY_TARGET,entityListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.PLAYER_INTERACT,playerListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.PLAYER_INTERACT_ENTITY,playerListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.PLUGIN_ENABLE,serverListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.PLUGIN_ENABLE,serverListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.CHUNK_LOAD,worldListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.CHUNK_UNLOAD,worldListener,Event.Priority.Normal,this);
  this.getCommand("String_Node_Str").setExecutor(new WolfCommandExecutor(this));
  log(Level.INFO,"String_Node_Str" + version + "String_Node_Str");
  setupPermissions();
  setupDatabase();
  wolfManager.load();
  wolfInventoryManager.load();
}
Program: 45000
Project: 45000
Buggy source:
@Override public void onDisable(){
  configManager.save();
  log(Level.INFO,"String_Node_Str");
}

Fixed version (ground truth):
@Override public void onDisable(){
  configManager.save();
  wolfManager.unload();
  wolfInventoryManager.unload();
  log(Level.INFO,"String_Node_Str");
}
Program: 45002
Project: 45002
Buggy source:
public WolfServerListener(final WolfPlugin plugin){
  this.wolfManager=plugin.getWolfManager();
  this.wolfInventoryManager=plugin.getWolfInventoryManager();
}

Fixed version (ground truth):
public WolfServerListener(final WolfPlugin plugin){
}
Program: 45003
Project: 45003
Buggy source:
@Override public void onPluginEnable(PluginEnableEvent event){
  wolfManager.load();
  wolfInventoryManager.load();
}

Fixed version (ground truth):
@Override public void onPluginEnable(PluginEnableEvent event){
}
Program: 45004
Project: 45004
Buggy source:
@Override public void onPluginDisable(PluginDisableEvent event){
  wolfManager.unload();
  wolfInventoryManager.unload();
}

Fixed version (ground truth):
@Override public void onPluginDisable(PluginDisableEvent event){
}
Program: 45005
Project: 45005
Buggy source:
@Override public void onChunkLoad(ChunkLoadEvent event){
  List<Entity> entities=Arrays.asList(event.getChunk().getEntities());
  for (  Entity entity : entities) {
    if (entity instanceof Wolf) {
      Wolf wolf=(Wolf)entity;
      if (wolf.isTamed()) {
        if (wolfManager.hasWolf(wolf)) {
          wolfManager.loadWolf(wolf);
        }
 else {
          wolfManager.addWolf(wolf);
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onChunkLoad(ChunkLoadEvent event){
  List<Entity> entities=Arrays.asList(event.getChunk().getEntities());
  for (  Entity entity : entities) {
    if (entity instanceof Wolf) {
      Wolf wolf=(Wolf)entity;
      if (wolf.isTamed()) {
        if (wolfManager.hasWolf(wolf.getUniqueId())) {
          wolfManager.loadWolf(wolf);
        }
 else {
          wolfManager.addWolf(wolf);
        }
      }
    }
  }
}
Program: 45006
Project: 45006
Buggy source:
@Override public void onChunkUnload(ChunkUnloadEvent event){
  List<Entity> entities=Arrays.asList(event.getChunk().getEntities());
  for (  Entity entity : entities) {
    if (entity instanceof Wolf) {
      Wolf wolf=(Wolf)entity;
      if (wolf.isTamed()) {
        if (wolfManager.hasWolf(wolf)) {
          wolfManager.unloadWolf(wolf);
        }
 else {
          wolfManager.addWolf(wolf);
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onChunkUnload(ChunkUnloadEvent event){
  List<Entity> entities=Arrays.asList(event.getChunk().getEntities());
  for (  Entity entity : entities) {
    if (entity instanceof Wolf) {
    }
  }
}
Program: 45007
Project: 45007
Buggy source:
public void fillFromDBTable(String[] rows){
  String[] chestRow1=rows[0].split("String_Node_Str");
  String[] chestRow2=rows[1].split("String_Node_Str");
  String[] chestRow3=rows[2].split("String_Node_Str");
  for (int i=0; i < getSize(); i++) {
    String[] item=null;
    if (i >= 0 && i <= 8) {
      item=chestRow1[i].split("String_Node_Str");
    }
 else     if (i >= 9 && i <= 17) {
      item=chestRow2[i - 9].split("String_Node_Str");
    }
 else     if (i >= 18 && i <= 26) {
      item=chestRow3[i - 18].split("String_Node_Str");
    }
    int typeId=(item[0] == null ? 0 : Integer.valueOf(item[0]));
    short damage=(item[1] == null ? -1 : Short.valueOf(item[1]));
    int amount=(item[2] == null ? 0 : Integer.valueOf(item[2]));
    if (typeId < 1 || damage < 0 || amount < 1) {
      setItem(i,new ItemStack(null));
    }
 else {
      setItem(i,new ItemStack(typeId,amount,damage));
    }
  }
}

Fixed version (ground truth):
public void fillFromDBTable(String[] rows){
  String[] chestRow1=rows[0].split("String_Node_Str");
  String[] chestRow2=rows[1].split("String_Node_Str");
  String[] chestRow3=rows[2].split("String_Node_Str");
  for (int i=0; i < getSize(); i++) {
    String[] item=null;
    if (i >= 0 && i <= 8) {
      item=chestRow1[i].split("String_Node_Str");
    }
 else     if (i >= 9 && i <= 17) {
      item=chestRow2[i - 9].split("String_Node_Str");
    }
 else     if (i >= 18 && i <= 26) {
      item=chestRow3[i - 18].split("String_Node_Str");
    }
    int typeId=(item[0] == null ? 0 : Integer.valueOf(item[0]));
    short damage=(item[1] == null ? -1 : Short.valueOf(item[1]));
    int amount=(item[2] == null ? 0 : Integer.valueOf(item[2]));
    if (typeId < 1 || damage < 0 || amount < 1) {
      super.setItem(i,null);
    }
 else {
      setItem(i,new ItemStack(typeId,amount,damage));
    }
  }
}
Program: 45008
Project: 45008
Buggy source:
private void setupPermissions(){
  Plugin permissions=this.getServer().getPluginManager().getPlugin("String_Node_Str");
  if (Permissions == null) {
    if (permissions != null) {
      Permissions=((Permissions)permissions).getHandler();
    }
 else {
      log(Level.INFO,"String_Node_Str");
    }
  }
}

Fixed version (ground truth):
private void setupPermissions(){
  Plugin permissions=getServer().getPluginManager().getPlugin("String_Node_Str");
  if (Permissions == null) {
    if (permissions != null) {
      Permissions=((Permissions)permissions).getHandler();
    }
 else {
      log(Level.INFO,"String_Node_Str");
    }
  }
}
Program: 45009
Project: 45009
Buggy source:
@Override public void onEnable(){
  pm=this.getServer().getPluginManager();
  pdfFile=this.getDescription();
  name=pdfFile.getName();
  version=pdfFile.getVersion();
  configManager.load();
  pm.registerEvent(Event.Type.CREATURE_SPAWN,entityListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.ENTITY_DEATH,entityListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.ENTITY_TAME,entityListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.ENTITY_TARGET,entityListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.PLAYER_INTERACT,playerListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.PLAYER_INTERACT_ENTITY,playerListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.CHUNK_LOAD,worldListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.CHUNK_UNLOAD,worldListener,Event.Priority.Normal,this);
  this.getCommand("String_Node_Str").setExecutor(new WolfCommandExecutor(this));
  log(Level.INFO,"String_Node_Str" + version + "String_Node_Str");
  setupPermissions();
  setupDatabase();
  wolfManager.load();
  wolfInventoryManager.load();
}

Fixed version (ground truth):
@Override public void onEnable(){
  pm=getServer().getPluginManager();
  pdfFile=getDescription();
  name=pdfFile.getName();
  version=pdfFile.getVersion();
  configManager.load();
  pm.registerEvent(Event.Type.CREATURE_SPAWN,entityListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.ENTITY_DEATH,entityListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.ENTITY_TAME,entityListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.ENTITY_TARGET,entityListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.PLAYER_INTERACT,playerListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.PLAYER_INTERACT_ENTITY,playerListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.CHUNK_LOAD,worldListener,Event.Priority.Normal,this);
  pm.registerEvent(Event.Type.CHUNK_UNLOAD,worldListener,Event.Priority.Normal,this);
  getCommand("String_Node_Str").setExecutor(new WolfCommandExecutor(this));
  log(Level.INFO,"String_Node_Str" + version + "String_Node_Str");
  setupPermissions();
  setupDatabase();
  wolfManager.load();
  wolfInventoryManager.load();
}
Program: 45010
Project: 45010
Buggy source:
private void setupDatabase(){
  try {
    this.getDatabase().find(WolfTable.class).findRowCount();
    this.getDatabase().find(WolfInventoryTable.class).findRowCount();
  }
 catch (  PersistenceException ex) {
    log(Level.INFO,"String_Node_Str" + getDescription().getName() + "String_Node_Str");
    installDDL();
  }
}

Fixed version (ground truth):
private void setupDatabase(){
  try {
    getDatabase().find(WolfTable.class).findRowCount();
    getDatabase().find(WolfInventoryTable.class).findRowCount();
  }
 catch (  PersistenceException ex) {
    log(Level.INFO,"String_Node_Str" + getDescription().getName() + "String_Node_Str");
    installDDL();
  }
}
Program: 45011
Project: 45011
Buggy source:
@Override public void onEntityTame(EntityTameEvent event){
  if (!event.isCancelled()) {
    Entity entity=event.getEntity();
    Player owner=(Player)event.getOwner();
    World world=entity.getWorld();
    WorldConfig worldConfig=configManager.getWorldConfig(world);
    if (entity instanceof Wolf) {
      Wolf wolf=(Wolf)entity;
      if (worldConfig.limitEnable) {
        List<WolfTable> wts=wolfManager.getWolfTables(owner);
        int size=wts.size();
        int limit=worldConfig.limitValue;
        if (size >= limit) {
          owner.sendMessage("String_Node_Str" + ChatColor.YELLOW + Integer.toString(limit));
          event.setCancelled(true);
          return;
        }
      }
      wolfManager.addWolf(wolf);
      if (wolfManager.hasWolf(wolf)) {
        com.halvors.wolf.wolf.Wolf wolf1=wolfManager.getWolf(wolf);
        owner.sendMessage("String_Node_Str" + ChatColor.YELLOW + wolf1.getName());
        owner.sendMessage("String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onEntityTame(EntityTameEvent event){
  if (!event.isCancelled()) {
    Entity entity=event.getEntity();
    Player owner=(Player)event.getOwner();
    World world=entity.getWorld();
    WorldConfig worldConfig=configManager.getWorldConfig(world);
    if (entity instanceof Wolf) {
      Wolf wolf=(Wolf)entity;
      if (worldConfig.limitEnable) {
        List<WolfTable> wts=wolfManager.getWolfTables(owner);
        int size=wts.size();
        int limit=worldConfig.limitValue;
        if (size >= limit) {
          owner.sendMessage("String_Node_Str" + ChatColor.YELLOW + Integer.toString(limit));
          event.setCancelled(true);
          return;
        }
      }
      if (wolfManager.addWolf(wolf)) {
        com.halvors.wolf.wolf.Wolf wolf1=wolfManager.getWolf(wolf);
        owner.sendMessage("String_Node_Str" + ChatColor.YELLOW + wolf1.getName());
        owner.sendMessage("String_Node_Str");
      }
 else {
      }
    }
  }
}
Program: 45012
Project: 45012
Buggy source:
@Override public void onEntityTame(EntityTameEvent event){
  if (!event.isCancelled()) {
    Entity entity=event.getEntity();
    Player owner=(Player)event.getOwner();
    World world=entity.getWorld();
    WorldConfig worldConfig=configManager.getWorldConfig(world);
    if (entity instanceof Wolf) {
      Wolf wolf=(Wolf)entity;
      if (worldConfig.limitEnable) {
        List<WolfTable> wts=wolfManager.getWolfTables(owner.getName());
        int size=wts.size();
        int limit=2;
        if (size >= limit) {
          owner.sendMessage("String_Node_Str" + ChatColor.YELLOW + Integer.toString(limit));
          event.setCancelled(true);
          return;
        }
      }
      if (wolfManager.addWolf(wolf)) {
        com.halvors.wolf.wolf.Wolf wolf1=wolfManager.getWolf(wolf);
        owner.sendMessage("String_Node_Str" + ChatColor.YELLOW + wolf1.getName());
        owner.sendMessage("String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onEntityTame(EntityTameEvent event){
  if (!event.isCancelled()) {
    Entity entity=event.getEntity();
    Player owner=(Player)event.getOwner();
    World world=entity.getWorld();
    WorldConfig worldConfig=configManager.getWorldConfig(world);
    if (entity instanceof Wolf) {
      Wolf wolf=(Wolf)entity;
      if (worldConfig.limitEnable) {
        List<WolfTable> wts=wolfManager.getWolfTables(owner.getName());
        int size=wts.size();
        int limit=2;
        if (size >= limit) {
          owner.sendMessage("String_Node_Str" + ChatColor.YELLOW + Integer.toString(limit));
          event.setCancelled(true);
          return;
        }
      }
      wolfManager.addWolf(wolf);
      if (wolfManager.hasWolf(wolf)) {
        com.halvors.wolf.wolf.Wolf wolf1=wolfManager.getWolf(wolf);
        owner.sendMessage("String_Node_Str" + ChatColor.YELLOW + wolf1.getName());
        owner.sendMessage("String_Node_Str");
      }
    }
  }
}
Program: 45014
Project: 45014
Buggy source:
public WolfManager(final WolfPlugin plugin){
  this.plugin=plugin;
  this.wolves=new HashMap<UUID,Wolf>();
}

Fixed version (ground truth):
public WolfManager(final WolfPlugin plugin){
  this.plugin=plugin;
  initializeRandomNames();
  this.wolves=new HashMap<UUID,Wolf>();
}
Program: 45015
Project: 45015
Buggy source:
/** 
 * Generate a random name
 * @return String
 */
public String getRandomName(){
  Random random=new Random();
  List<String> names=new ArrayList<String>();
  String name=null;
  try {
    BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(WolfManager.class.getResourceAsStream("String_Node_Str")));
    do {
      String s1;
      if ((s1=bufferedReader.readLine()) == null) {
        break;
      }
      s1=s1.trim();
      if (s1.length() > 0) {
        names.add(s1);
      }
    }
 while (true);
    name=names.get(random.nextInt(names.size()));
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return name;
}

Fixed version (ground truth):
/** 
 * Generate a random name
 * @return String
 */
public String getRandomName(){
  Random random=new Random();
  String name=null;
  name=wolfnames.get(random.nextInt(wolfnames.size()));
  return name;
}
Program: 45017
Project: 45017
Buggy source:
private void showWolves(Player player){
  List<WolfTable> wolfTables=wolfManager.getWolfTables(player.getName());
  player.sendMessage(ChatColor.GREEN + plugin.name + ChatColor.GREEN+ "String_Node_Str"+ ChatColor.WHITE+ plugin.version+ ChatColor.GREEN+ "String_Node_Str");
  if (!wolfTables.isEmpty()) {
    for (    WolfTable wolfTable : wolfTables) {
      Wolf wolf=wolfManager.getWolf(wolfTable.getUniqueId());
      Location pos=wolf.getLocation();
      player.sendMessage(ChatColor.YELLOW + wolfTable.getName() + ChatColor.WHITE+ "String_Node_Str"+ pos.getBlockX()+ "String_Node_Str"+ pos.getBlockY()+ "String_Node_Str"+ pos.getBlockZ()+ "String_Node_Str");
    }
  }
 else {
    player.sendMessage(ChatColor.RED + "String_Node_Str");
  }
}

Fixed version (ground truth):
private void showWolves(Player player){
  List<WolfTable> wolfTables=wolfManager.getWolfTables(player.getName());
  player.sendMessage(ChatColor.GREEN + plugin.name + ChatColor.GREEN+ "String_Node_Str"+ ChatColor.WHITE+ plugin.version+ ChatColor.GREEN+ "String_Node_Str");
  if (!wolfTables.isEmpty()) {
    for (    WolfTable wolfTable : wolfTables) {
      Wolf wolf=wolfManager.getWolf(UUID.fromString(wolfTable.getUniqueId()));
      Location pos=wolf.getLocation();
      player.sendMessage(ChatColor.YELLOW + wolfTable.getName() + ChatColor.WHITE+ "String_Node_Str"+ pos.getBlockX()+ "String_Node_Str"+ pos.getBlockY()+ "String_Node_Str"+ pos.getBlockZ()+ "String_Node_Str");
    }
  }
 else {
    player.sendMessage(ChatColor.RED + "String_Node_Str");
  }
}
Program: 45019
Project: 45019
Buggy source:
/** 
 * Get uniqueId
 * @param name
 * @param owner
 * @return UUID
 */
public UUID getUniqueId(String name,String owner){
  WolfTable wt=getWolfTable(name,owner);
  if (wt != null) {
    return wt.getUniqueId();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Get uniqueId
 * @param name
 * @param owner
 * @return UUID
 */
public UUID getUniqueId(String name,String owner){
  WolfTable wt=getWolfTable(name,owner);
  if (wt != null) {
    return UUID.fromString(wt.getUniqueId());
  }
  return null;
}
Program: 45020
Project: 45020
Buggy source:
/** 
 * Get owners wolves
 * @param owner
 * @return List<Wolf>
 */
public List<Wolf> getWolves(String owner){
  List<WolfTable> wts=getWolfTables(owner);
  List<Wolf> wolves=new ArrayList<Wolf>();
  for (  WolfTable wt : wts) {
    for (    Entity entity : plugin.getServer().getWorld(wt.getWorld()).getEntities()) {
      if (entity instanceof Wolf && entity.getUniqueId() == wt.getUniqueId()) {
        wolves.add((Wolf)entity);
      }
    }
  }
  return wolves;
}

Fixed version (ground truth):
/** 
 * Get owners wolves
 * @param owner
 * @return List<Wolf>
 */
public List<Wolf> getWolves(String owner){
  List<WolfTable> wts=getWolfTables(owner);
  List<Wolf> wolves=new ArrayList<Wolf>();
  for (  WolfTable wt : wts) {
    for (    Entity entity : plugin.getServer().getWorld(wt.getWorld()).getEntities()) {
      if (entity instanceof Wolf && UUID.fromString(wt.getUniqueId()) == entity.getUniqueId()) {
        wolves.add((Wolf)entity);
      }
    }
  }
  return wolves;
}
Program: 45021
Project: 45021
Buggy source:
public UUID getUniqueId(){
  return UUID.fromString(uniqueId);
}

Fixed version (ground truth):
public String getUniqueId(){
  return uniqueId;
}
Program: 45023
Project: 45023
Buggy source:
/** 
 * Add wolf inventory
 * @param uniqueId
 */
public void addInventory(UUID uniqueId){
  WolfTable wt=getWolfTable(uniqueId);
  if (wt != null) {
    wt.setInventory(true);
    plugin.getWolfInventoryManager().addWolfInventory(uniqueId);
  }
}

Fixed version (ground truth):
/** 
 * Add wolf inventory
 * @param uniqueId
 */
public void addInventory(UUID uniqueId){
  WolfTable wt=getWolfTable(uniqueId);
  if (wt != null) {
    wt.setInventory(true);
    updateWolfTable(wt);
    plugin.getWolfInventoryManager().addWolfInventory(uniqueId);
  }
}
Program: 45024
Project: 45024
Buggy source:
@Override public void onPlayerInteractEntity(PlayerInteractEntityEvent event){
  if (!event.isCancelled()) {
    Player player=event.getPlayer();
    Entity entity=event.getRightClicked();
    if (entity instanceof Wolf) {
      Wolf wolf=(Wolf)entity;
      if (wolf.isTamed() && wolf.getOwner().equals(player)) {
        Material item=player.getItemInHand().getType();
        if (item.equals(Material.BONE)) {
          if (plugin.hasPermissions(player,"String_Node_Str")) {
            if (!wolfManager.hasWolf(wolf.getEntityId())) {
              wolfManager.addWolf(wolf);
              player.sendMessage(ChatColor.GREEN + "String_Node_Str" + ChatColor.YELLOW+ wolfManager.getName(wolf.getEntityId()));
              player.sendMessage("String_Node_Str" + wolf.getEntityId() + "String_Node_Str"+ wolfManager.getWolfTable(wolf.getEntityId()).getId());
            }
            selectedWolfManager.addSelectedWolf(player.getName(),wolf);
            player.sendMessage(ChatColor.GREEN + "String_Node_Str");
          }
        }
 else         if (item.equals(Material.CHEST)) {
          if (plugin.hasPermissions(player,"String_Node_Str")) {
            if (wolfManager.hasWolf(wolf.getEntityId())) {
              WolfTable wt=wolfManager.getWolfTable(wolf.getEntityId());
              EntityPlayer entityPlayer=((CraftPlayer)player).getHandle();
              entityPlayer.a(plugin.getWolfInventoryManager().getWolfInventory(wt.getId()).getInventory());
            }
 else {
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onPlayerInteractEntity(PlayerInteractEntityEvent event){
  if (!event.isCancelled()) {
    Player player=event.getPlayer();
    Entity entity=event.getRightClicked();
    if (entity instanceof Wolf) {
      Wolf wolf=(Wolf)entity;
      if (wolf.isTamed() && wolf.getOwner().equals(player)) {
        Material item=player.getItemInHand().getType();
        if (item.equals(Material.BONE)) {
          if (plugin.hasPermissions(player,"String_Node_Str")) {
            if (!wolfManager.hasWolf(wolf.getEntityId())) {
              wolfManager.addWolf(wolf);
              player.sendMessage(ChatColor.GREEN + "String_Node_Str" + ChatColor.YELLOW+ wolfManager.getName(wolf.getEntityId()));
              player.sendMessage("String_Node_Str" + wolf.getEntityId() + "String_Node_Str"+ wolfManager.getWolfTable(wolf.getEntityId()).getId());
            }
            selectedWolfManager.addSelectedWolf(player.getName(),wolf);
            player.sendMessage(ChatColor.GREEN + "String_Node_Str");
          }
        }
 else         if (item.equals(Material.CHEST)) {
          if (plugin.hasPermissions(player,"String_Node_Str")) {
            if (wolfManager.hasWolf(wolf.getEntityId())) {
              WolfTable wt=wolfManager.getWolfTable(wolf.getEntityId());
              EntityPlayer entityPlayer=((CraftPlayer)player).getHandle();
              wolf.setSitting(true);
              entityPlayer.a(plugin.getWolfInventoryManager().getWolfInventory(wt.getId()).getInventory());
            }
 else {
            }
          }
        }
      }
    }
  }
}
Program: 45025
Project: 45025
Buggy source:
/** 
 * Add a selected wolf
 * @param owner
 * @param wolf
 */
public void addSelectedWolf(final String owner,final Wolf wolf){
  if (!selectedWolfs.containsKey(owner)) {
    selectedWolfs.put(owner,wolf);
  }
}

Fixed version (ground truth):
/** 
 * Add a selected wolf
 * @param owner
 * @param wolf
 */
public void addSelectedWolf(final String owner,final Wolf wolf){
  if (!selectedWolfs.containsKey(owner)) {
    selectedWolfs.put(owner,wolf);
  }
 else {
    selectedWolfs.remove(owner);
    selectedWolfs.put(owner,wolf);
  }
}
Program: 45026
Project: 45026
Buggy source:
public WolfInventory(){
  this.inventory=new TileEntityVirtualChest();
}

Fixed version (ground truth):
public WolfInventory(int wolfId){
  this.inventory=new TileEntityVirtualChest();
  this.wolfId=wolfId;
}
Program: 45027
Project: 45027
Buggy source:
/** 
 * Add WolfInventory
 * @param id
 */
public void addWolfInventory(int id){
  addWolfInventory(id,new WolfInventory());
}

Fixed version (ground truth):
/** 
 * Add WolfInventory
 * @param id
 */
public void addWolfInventory(int id){
  addWolfInventory(id,new WolfInventory(id));
}
Program: 45028
Project: 45028
Buggy source:
public void load(World world){
  wolfInventorys.clear();
}

Fixed version (ground truth):
public void load(World world){
  List<WolfInventoryTable> wits=plugin.getDatabase().find(WolfInventoryTable.class).where().findList();
  for (  WolfInventoryTable wit : wits) {
    addWolfInventory(wit.getId(),loadWolfInventory(wit));
  }
}
Program: 45029
Project: 45029
Buggy source:
public void save(World world){
}

Fixed version (ground truth):
public void save(World world){
  for (  WolfInventory wi : wolfInventorys.values()) {
    WolfInventoryTable wit=new WolfInventoryTable();
    wit.setId(wi.getWolfId());
    wit.setContents(wi.getContents());
    if (plugin.getDatabase().find(WolfInventoryTable.class).where().eq("String_Node_Str",wi.getWolfId()) != null) {
      plugin.getDatabase().update(wit);
    }
 else {
      plugin.getDatabase().save(wit);
    }
  }
}
Program: 45030
Project: 45030
Buggy source:
public WolfInventoryManager(final Wolf plugin){
  this.wolfInventorys=new HashMap<Integer,WolfInventory>();
}

Fixed version (ground truth):
public WolfInventoryManager(final Wolf plugin){
  this.plugin=plugin;
  this.wolfInventorys=new HashMap<Integer,WolfInventory>();
}
Program: 45031
Project: 45031
Buggy source:
public void setId(int id){
  this.id=id;
}

Fixed version (ground truth):
public void setId(final int id){
  this.id=id;
}