nus-yam/ex-repair huggingface dataset:
Program: 86646
Project: 86646
Buggy source:
/** 
 * Checks if the given Book has been signed
 * @param book the book to check
 * @return {@code true} if signed; {@code false} if not
 */
public static boolean isSigned(Item book){
  return book == null ? false : book.getType() == ItemType.WrittenBook;
}

Fixed version (ground truth):
/** 
 * Checks if the given Book has been signed
 * @param book the book to check
 * @return {@code true} if signed; {@code false} if not
 */
public static boolean isSigned(Item book){
  return book != null && book.getType() == ItemType.WrittenBook;
}
Program: 86647
Project: 86647
Buggy source:
/** 
 * Checks if the given Book can still be written in by a player
 * @param book the book to check
 * @return {@code true} if can be written in; {@code false} if not
 */
public static boolean isWritable(Item book){
  return book == null ? false : book.getType() == ItemType.BookAndQuill;
}

Fixed version (ground truth):
/** 
 * Checks if the given Book can still be written in by a player
 * @param book the book to check
 * @return {@code true} if can be written in; {@code false} if not
 */
public static boolean isWritable(Item book){
  return book != null && book.getType() == ItemType.BookAndQuill;
}
Program: 86648
Project: 86648
Buggy source:
/** 
 * Checks the book for stored enchantments
 * @param book the book to check
 * @return true if contains enchantments; false if not
 */
public static boolean containsEnchantments(Item book){
  if (book == null || book.getType() != ItemType.EnchantedBook) {
    return false;
  }
  if (!verifyTags(book,"String_Node_Str",LIST,false)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Checks the book for stored enchantments
 * @param book the book to check
 * @return true if contains enchantments; false if not
 */
public static boolean containsEnchantments(Item book){
  if (book == null || book.getType() != ItemType.EnchantedBook) {
    return false;
  }
  return verifyTags(book,"String_Node_Str",LIST,false);
}
Program: 86649
Project: 86649
Buggy source:
/** 
 * | Checks if the given Book is enchanted
 * @param book the book to check
 * @return {@code true} if enchanted; {@code false} if not
 */
public static boolean isEnchanted(Item book){
  return book == null ? false : book.getType() == ItemType.EnchantedBook;
}

Fixed version (ground truth):
/** 
 * | Checks if the given Book is enchanted
 * @param book the book to check
 * @return {@code true} if enchanted; {@code false} if not
 */
public static boolean isEnchanted(Item book){
  return book != null && book.getType() == ItemType.EnchantedBook;
}
Program: 86650
Project: 86650
Buggy source:
/** 
 * Checks if the   {@link Item} has color
 * @param item the  {@link Item} to be checked
 * @return {@code true} if colored; {@code false} if not
 */
static boolean isColored(Item item){
  if (!verifyTags(item,"String_Node_Str",NBTTagType.COMPOUND,false)) {
    return false;
  }
  if (!item.getDataTag().getCompoundTag("String_Node_Str").containsKey("String_Node_Str")) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Checks if the   {@link Item} has color
 * @param item the  {@link Item} to be checked
 * @return {@code true} if colored; {@code false} if not
 */
static boolean isColored(Item item){
  if (!verifyTags(item,"String_Node_Str",NBTTagType.COMPOUND,false)) {
    return false;
  }
  return item.getDataTag().getCompoundTag("String_Node_Str").containsKey("String_Node_Str");
}
Program: 86651
Project: 86651
Buggy source:
/** 
 * Sets the colors of the FireworkStar based on the given   {@link DyeColor}s<br> Giving   {@link DyeColor#CUSTOM} will result it the color being ignored.<br>For custom colors use  {@link #setStarColorsRaw}
 * @param fireworkStar the FireworkStar  {@link Item}
 * @param colors the  {@link DyeColor}(s) to set to the FireworkStar
 */
public static void setStarColors(Item fireworkStar,DyeColor... colors){
  if (fireworkStar == null || fireworkStar.getType() != ItemType.FireworkStar) {
    return;
  }
  if (colors == null || colors.length < 1) {
    return;
  }
  if (verifyTags(fireworkStar,"String_Node_Str",COMPOUND,true)) {
    ArrayList<Integer> rawColors=new ArrayList<Integer>();
    for (int index=0; index < colors.length; index++) {
      if (colors[index] == null || colors[index] == DyeColor.CUSTOM) {
        continue;
      }
      rawColors.add(colors[index].getDecimalCode());
    }
    int[] rawColorsArray=new int[rawColors.size()];
    for (int index=0; index < rawColors.size(); index++) {
      rawColorsArray[index]=rawColors.get(index).intValue();
    }
    setStarColorsRaw(fireworkStar,rawColorsArray);
  }
}

Fixed version (ground truth):
/** 
 * Sets the colors of the FireworkStar based on the given   {@link DyeColor}s<br> Giving   {@link DyeColor#CUSTOM} will result it the color being ignored.<br>For custom colors use  {@link #setStarColorsRaw}
 * @param fireworkStar the FireworkStar  {@link Item}
 * @param colors the  {@link DyeColor}(s) to set to the FireworkStar
 */
public static void setStarColors(Item fireworkStar,DyeColor... colors){
  if (fireworkStar == null || fireworkStar.getType() != ItemType.FireworkStar) {
    return;
  }
  if (colors == null || colors.length < 1) {
    return;
  }
  if (verifyTags(fireworkStar,"String_Node_Str",COMPOUND,true)) {
    ArrayList<Integer> rawColors=new ArrayList<Integer>();
    for (int index=0; index < colors.length; index++) {
      if (colors[index] == null || colors[index] == DyeColor.CUSTOM) {
        continue;
      }
      rawColors.add(colors[index].getDecimalCode());
    }
    int[] rawColorsArray=new int[rawColors.size()];
    for (int index=0; index < rawColors.size(); index++) {
      rawColorsArray[index]=rawColors.get(index);
    }
    setStarColorsRaw(fireworkStar,rawColorsArray);
  }
}
Program: 86652
Project: 86652
Buggy source:
/** 
 * Adds a color to the FireworkStar based on   {@link DyeColor}<br> NOTE: If the   {@link DyeColor} is {@link DyeColor#CUSTOM}, no action will be taken
 * @param fireworkStar the FireworkStar  {@link Item}
 * @param colors the  {@link DyeColor}(s) to be added
 */
public static void addStarColors(Item fireworkStar,DyeColor... colors){
  if (fireworkStar == null || fireworkStar.getType() != ItemType.FireworkStar) {
    return;
  }
  if (colors == null || colors.length < 1) {
    return;
  }
  if (verifyTags(fireworkStar,"String_Node_Str",COMPOUND,true)) {
    ArrayList<Integer> rawColors=new ArrayList<Integer>();
    for (int index=0; index < colors.length; index++) {
      if (colors[index] == null || colors[index] == DyeColor.CUSTOM) {
        continue;
      }
      rawColors.add(colors[index].getDecimalCode());
    }
    int[] rawColorsArray=new int[rawColors.size()];
    for (int index=0; index < rawColors.size(); index++) {
      rawColorsArray[index]=rawColors.get(index).intValue();
    }
    addStarColorsRaw(fireworkStar,rawColorsArray);
  }
}

Fixed version (ground truth):
/** 
 * Adds a color to the FireworkStar based on   {@link DyeColor}<br> NOTE: If the   {@link DyeColor} is {@link DyeColor#CUSTOM}, no action will be taken
 * @param fireworkStar the FireworkStar  {@link Item}
 * @param colors the  {@link DyeColor}(s) to be added
 */
public static void addStarColors(Item fireworkStar,DyeColor... colors){
  if (fireworkStar == null || fireworkStar.getType() != ItemType.FireworkStar) {
    return;
  }
  if (colors == null || colors.length < 1) {
    return;
  }
  if (verifyTags(fireworkStar,"String_Node_Str",COMPOUND,true)) {
    ArrayList<Integer> rawColors=new ArrayList<Integer>();
    for (int index=0; index < colors.length; index++) {
      if (colors[index] == null || colors[index] == DyeColor.CUSTOM) {
        continue;
      }
      rawColors.add(colors[index].getDecimalCode());
    }
    int[] rawColorsArray=new int[rawColors.size()];
    for (int index=0; index < rawColors.size(); index++) {
      rawColorsArray[index]=rawColors.get(index);
    }
    addStarColorsRaw(fireworkStar,rawColorsArray);
  }
}
Program: 86653
Project: 86653
Buggy source:
/** 
 * Removes a color from the FireworkStar
 * @param fireworkStar the FireworkStar  {@link Item}
 * @param rawColors the raw color to be removed
 */
public static void removeStarColorsRaw(Item fireworkStar,int... rawColors){
  if (fireworkStar == null || fireworkStar.getType() != ItemType.FireworkStar) {
    return;
  }
  if (rawColors == null || rawColors.length < 1) {
    return;
  }
  if (verifyTags(fireworkStar,"String_Node_Str",COMPOUND,false)) {
    int[] setColors=getExplosionTag(fireworkStar).containsKey("String_Node_Str") ? getExplosionTag(fireworkStar).getIntArray("String_Node_Str") : null;
    if (setColors != null) {
      ArrayList<Integer> colors=new ArrayList<Integer>();
      for (      int setColor : setColors) {
        colors.add(Integer.valueOf(setColor));
      }
      for (      int rawColor : rawColors) {
        colors.remove(Integer.valueOf(rawColor));
      }
      int[] newColors=new int[colors.size()];
      for (int index=0; index < colors.size(); index++) {
        newColors[index]=colors.get(index);
      }
      getExplosionTag(fireworkStar).put("String_Node_Str",newColors);
    }
  }
}

Fixed version (ground truth):
/** 
 * Removes a color from the FireworkStar
 * @param fireworkStar the FireworkStar  {@link Item}
 * @param rawColors the raw color to be removed
 */
public static void removeStarColorsRaw(Item fireworkStar,int... rawColors){
  if (fireworkStar == null || fireworkStar.getType() != ItemType.FireworkStar) {
    return;
  }
  if (rawColors == null || rawColors.length < 1) {
    return;
  }
  if (verifyTags(fireworkStar,"String_Node_Str",COMPOUND,false)) {
    int[] setColors=getExplosionTag(fireworkStar).containsKey("String_Node_Str") ? getExplosionTag(fireworkStar).getIntArray("String_Node_Str") : null;
    if (setColors != null) {
      ArrayList<Integer> colors=new ArrayList<Integer>();
      for (      int setColor : setColors) {
        colors.add(setColor);
      }
      for (      int rawColor : rawColors) {
        colors.remove(Integer.valueOf(rawColor));
      }
      int[] newColors=new int[colors.size()];
      for (int index=0; index < colors.size(); index++) {
        newColors[index]=colors.get(index);
      }
      getExplosionTag(fireworkStar).put("String_Node_Str",newColors);
    }
  }
}
Program: 86654
Project: 86654
Buggy source:
/** 
 * Adds a color to the FireworkStar based on   {@link DyeColor}<br> NOTE: If the   {@link DyeColor} is {@link DyeColor#CUSTOM}, no action will be taken
 * @param fireworkStar the FireworkStar  {@link Item}
 * @param colors the  {@link DyeColor}(s) to be added
 */
public static void addStarFadeColors(Item fireworkStar,DyeColor... colors){
  if (fireworkStar == null || fireworkStar.getType() != ItemType.FireworkStar) {
    return;
  }
  if (colors == null || colors.length < 1) {
    return;
  }
  if (verifyTags(fireworkStar,"String_Node_Str",COMPOUND,true)) {
    ArrayList<Integer> rawColors=new ArrayList<Integer>();
    for (int index=0; index < colors.length; index++) {
      if (colors[index] == null || colors[index] == DyeColor.CUSTOM) {
        continue;
      }
      rawColors.add(colors[index].getDecimalCode());
    }
    int[] rawColorsArray=new int[rawColors.size()];
    for (int index=0; index < rawColors.size(); index++) {
      rawColorsArray[index]=rawColors.get(index).intValue();
    }
    addStarFadeColorsRaw(fireworkStar,rawColorsArray);
  }
}

Fixed version (ground truth):
/** 
 * Adds a color to the FireworkStar based on   {@link DyeColor}<br> NOTE: If the   {@link DyeColor} is {@link DyeColor#CUSTOM}, no action will be taken
 * @param fireworkStar the FireworkStar  {@link Item}
 * @param colors the  {@link DyeColor}(s) to be added
 */
public static void addStarFadeColors(Item fireworkStar,DyeColor... colors){
  if (fireworkStar == null || fireworkStar.getType() != ItemType.FireworkStar) {
    return;
  }
  if (colors == null || colors.length < 1) {
    return;
  }
  if (verifyTags(fireworkStar,"String_Node_Str",COMPOUND,true)) {
    ArrayList<Integer> rawColors=new ArrayList<Integer>();
    for (int index=0; index < colors.length; index++) {
      if (colors[index] == null || colors[index] == DyeColor.CUSTOM) {
        continue;
      }
      rawColors.add(colors[index].getDecimalCode());
    }
    int[] rawColorsArray=new int[rawColors.size()];
    for (int index=0; index < rawColors.size(); index++) {
      rawColorsArray[index]=rawColors.get(index);
    }
    addStarFadeColorsRaw(fireworkStar,rawColorsArray);
  }
}
Program: 86655
Project: 86655
Buggy source:
/** 
 * Removes fade color(s) from the FireworkStar<br> NOTE: if the   {@link DyeColor} is {@link DyeColor#CUSTOM} no actions will be performed
 * @param fireworkStar the FireworkStar  {@link Item}
 * @param colors the  {@link DyeColor}(s) to remove
 */
public static void removeStarFadeColors(Item fireworkStar,DyeColor... colors){
  if (fireworkStar == null || fireworkStar.getType() != ItemType.FireworkStar) {
    return;
  }
  if (colors == null || colors.length < 1) {
    return;
  }
  if (verifyTags(fireworkStar,"String_Node_Str",COMPOUND,false)) {
    ArrayList<Integer> rawColors=new ArrayList<Integer>();
    for (int index=0; index < colors.length; index++) {
      if (colors[index] == null || colors[index] == DyeColor.CUSTOM) {
        continue;
      }
      rawColors.add(colors[index].getDecimalCode());
    }
    int[] rawColorsArray=new int[rawColors.size()];
    for (int index=0; index < rawColors.size(); index++) {
      rawColorsArray[index]=rawColors.get(index).intValue();
    }
    removeStarFadeColorsRaw(fireworkStar,rawColorsArray);
  }
}

Fixed version (ground truth):
/** 
 * Removes fade color(s) from the FireworkStar<br> NOTE: if the   {@link DyeColor} is {@link DyeColor#CUSTOM} no actions will be performed
 * @param fireworkStar the FireworkStar  {@link Item}
 * @param colors the  {@link DyeColor}(s) to remove
 */
public static void removeStarFadeColors(Item fireworkStar,DyeColor... colors){
  if (fireworkStar == null || fireworkStar.getType() != ItemType.FireworkStar) {
    return;
  }
  if (colors == null || colors.length < 1) {
    return;
  }
  if (verifyTags(fireworkStar,"String_Node_Str",COMPOUND,false)) {
    ArrayList<Integer> rawColors=new ArrayList<Integer>();
    for (int index=0; index < colors.length; index++) {
      if (colors[index] == null || colors[index] == DyeColor.CUSTOM) {
        continue;
      }
      rawColors.add(colors[index].getDecimalCode());
    }
    int[] rawColorsArray=new int[rawColors.size()];
    for (int index=0; index < rawColors.size(); index++) {
      rawColorsArray[index]=rawColors.get(index);
    }
    removeStarFadeColorsRaw(fireworkStar,rawColorsArray);
  }
}
Program: 86656
Project: 86656
Buggy source:
/** 
 * Sets the fade color(s) of the FireworkStar based on the given   {@link DyeColor}s<br> Giving   {@link DyeColor#CUSTOM} will result it the color being ignored.<br>For custom colors use  {@link #setStarFadeColorsRaw}
 * @param fireworkStar the FireworkStar  {@link Item}
 * @param colors the  {@link DyeColor}(s) to set to the FireworkStar
 */
public static void setStarFadeColors(Item fireworkStar,DyeColor... colors){
  if (fireworkStar == null || fireworkStar.getType() != ItemType.FireworkStar) {
    return;
  }
  if (colors == null || colors.length < 1) {
    return;
  }
  if (verifyTags(fireworkStar,"String_Node_Str",COMPOUND,true)) {
    ArrayList<Integer> rawColors=new ArrayList<Integer>();
    for (int index=0; index < colors.length; index++) {
      if (colors[index] == null || colors[index] == DyeColor.CUSTOM) {
        continue;
      }
      rawColors.add(colors[index].getDecimalCode());
    }
    int[] rawColorsArray=new int[rawColors.size()];
    for (int index=0; index < rawColors.size(); index++) {
      rawColorsArray[index]=rawColors.get(index).intValue();
    }
    setStarFadeColorsRaw(fireworkStar,rawColorsArray);
  }
}

Fixed version (ground truth):
/** 
 * Sets the fade color(s) of the FireworkStar based on the given   {@link DyeColor}s<br> Giving   {@link DyeColor#CUSTOM} will result it the color being ignored.<br>For custom colors use  {@link #setStarFadeColorsRaw}
 * @param fireworkStar the FireworkStar  {@link Item}
 * @param colors the  {@link DyeColor}(s) to set to the FireworkStar
 */
public static void setStarFadeColors(Item fireworkStar,DyeColor... colors){
  if (fireworkStar == null || fireworkStar.getType() != ItemType.FireworkStar) {
    return;
  }
  if (colors == null || colors.length < 1) {
    return;
  }
  if (verifyTags(fireworkStar,"String_Node_Str",COMPOUND,true)) {
    ArrayList<Integer> rawColors=new ArrayList<Integer>();
    for (int index=0; index < colors.length; index++) {
      if (colors[index] == null || colors[index] == DyeColor.CUSTOM) {
        continue;
      }
      rawColors.add(colors[index].getDecimalCode());
    }
    int[] rawColorsArray=new int[rawColors.size()];
    for (int index=0; index < rawColors.size(); index++) {
      rawColorsArray[index]=rawColors.get(index);
    }
    setStarFadeColorsRaw(fireworkStar,rawColorsArray);
  }
}
Program: 86657
Project: 86657
Buggy source:
/** 
 * Removes a color from the FireworkStar<br> NOTE: if the   {@link DyeColor} is {@link DyeColor#CUSTOM} no actions will be performed
 * @param fireworkStar the FireworkStar  {@link Item}
 * @param colors the  {@link DyeColor} to remove
 */
public static void removeStarColors(Item fireworkStar,DyeColor... colors){
  if (fireworkStar == null || fireworkStar.getType() != ItemType.FireworkStar) {
    return;
  }
  if (colors == null || colors.length < 1) {
    return;
  }
  if (verifyTags(fireworkStar,"String_Node_Str",COMPOUND,false)) {
    ArrayList<Integer> rawColors=new ArrayList<Integer>();
    for (int index=0; index < colors.length; index++) {
      if (colors[index] == null || colors[index] == DyeColor.CUSTOM) {
        continue;
      }
      rawColors.add(colors[index].getDecimalCode());
    }
    int[] rawColorsArray=new int[rawColors.size()];
    for (int index=0; index < rawColors.size(); index++) {
      rawColorsArray[index]=rawColors.get(index).intValue();
    }
    removeStarColorsRaw(fireworkStar,rawColorsArray);
  }
}

Fixed version (ground truth):
/** 
 * Removes a color from the FireworkStar<br> NOTE: if the   {@link DyeColor} is {@link DyeColor#CUSTOM} no actions will be performed
 * @param fireworkStar the FireworkStar  {@link Item}
 * @param colors the  {@link DyeColor} to remove
 */
public static void removeStarColors(Item fireworkStar,DyeColor... colors){
  if (fireworkStar == null || fireworkStar.getType() != ItemType.FireworkStar) {
    return;
  }
  if (colors == null || colors.length < 1) {
    return;
  }
  if (verifyTags(fireworkStar,"String_Node_Str",COMPOUND,false)) {
    ArrayList<Integer> rawColors=new ArrayList<Integer>();
    for (int index=0; index < colors.length; index++) {
      if (colors[index] == null || colors[index] == DyeColor.CUSTOM) {
        continue;
      }
      rawColors.add(colors[index].getDecimalCode());
    }
    int[] rawColorsArray=new int[rawColors.size()];
    for (int index=0; index < rawColors.size(); index++) {
      rawColorsArray[index]=rawColors.get(index);
    }
    removeStarColorsRaw(fireworkStar,rawColorsArray);
  }
}
Program: 86658
Project: 86658
Buggy source:
/** 
 * Removes fase color(s) from the FireworkStar
 * @param fireworkStar the FireworkStar  {@link Item}
 * @param rawColors the raw color to be removed
 */
public static void removeStarFadeColorsRaw(Item fireworkStar,int... rawColors){
  if (fireworkStar == null || fireworkStar.getType() != ItemType.FireworkStar) {
    return;
  }
  if (rawColors == null || rawColors.length < 1) {
    return;
  }
  if (verifyTags(fireworkStar,"String_Node_Str",COMPOUND,false)) {
    int[] setColors=getExplosionTag(fireworkStar).containsKey("String_Node_Str") ? getExplosionTag(fireworkStar).getIntArray("String_Node_Str") : null;
    if (setColors != null) {
      ArrayList<Integer> colors=new ArrayList<Integer>();
      for (      int setColor : setColors) {
        colors.add(Integer.valueOf(setColor));
      }
      for (      int rawColor : rawColors) {
        colors.remove(Integer.valueOf(rawColor));
      }
      int[] newColors=new int[colors.size()];
      for (int index=0; index < colors.size(); index++) {
        newColors[index]=colors.get(index);
      }
      getExplosionTag(fireworkStar).put("String_Node_Str",newColors);
    }
  }
}

Fixed version (ground truth):
/** 
 * Removes fase color(s) from the FireworkStar
 * @param fireworkStar the FireworkStar  {@link Item}
 * @param rawColors the raw color to be removed
 */
public static void removeStarFadeColorsRaw(Item fireworkStar,int... rawColors){
  if (fireworkStar == null || fireworkStar.getType() != ItemType.FireworkStar) {
    return;
  }
  if (rawColors == null || rawColors.length < 1) {
    return;
  }
  if (verifyTags(fireworkStar,"String_Node_Str",COMPOUND,false)) {
    int[] setColors=getExplosionTag(fireworkStar).containsKey("String_Node_Str") ? getExplosionTag(fireworkStar).getIntArray("String_Node_Str") : null;
    if (setColors != null) {
      ArrayList<Integer> colors=new ArrayList<Integer>();
      for (      int setColor : setColors) {
        colors.add(setColor);
      }
      for (      int rawColor : rawColors) {
        colors.remove(Integer.valueOf(rawColor));
      }
      int[] newColors=new int[colors.size()];
      for (int index=0; index < colors.size(); index++) {
        newColors[index]=colors.get(index);
      }
      getExplosionTag(fireworkStar).put("String_Node_Str",newColors);
    }
  }
}
Program: 86659
Project: 86659
Buggy source:
/** 
 * Verifies the NBTTags of the   {@link Item} are as expected
 * @param item the  {@link Item} to verify tags for
 * @param tag the name given to the tag
 * @param nbt_type the expected  {@link NBTTagType}
 * @param setTags whether to automatically generate missing tags
 * @return {@code true} if good; {@code false} if not
 */
protected final static boolean verifyTags(Item item,String tag,NBTTagType nbt_type,boolean setTags){
  if (item == null) {
    return false;
  }
  if (!item.hasDataTag()) {
    if (!setTags) {
      return false;
    }
    item.setDataTag(TAG.copy());
  }
  if (!item.getDataTag().containsKey(tag)) {
    if (!setTags) {
      return false;
    }
    item.getDataTag().put(tag,NBT_FACTO.newTagFromType(nbt_type,tag,null));
  }
  if (nbt_type != NBTTagType.getTypeFromId(item.getDataTag().get(tag).getTypeId())) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Verifies the NBTTags of the   {@link Item} are as expected
 * @param item the  {@link Item} to verify tags for
 * @param tag the name given to the tag
 * @param nbt_type the expected  {@link NBTTagType}
 * @param setTags whether to automatically generate missing tags
 * @return {@code true} if good; {@code false} if not
 */
protected final static boolean verifyTags(Item item,String tag,NBTTagType nbt_type,boolean setTags){
  if (item == null) {
    return false;
  }
  if (!item.hasDataTag()) {
    if (!setTags) {
      return false;
    }
    item.setDataTag(TAG.copy());
  }
  if (!item.getDataTag().containsKey(tag)) {
    if (!setTags) {
      return false;
    }
    item.getDataTag().put(tag,NBT_FACTO.newTagFromType(nbt_type,tag,null));
  }
  return nbt_type != NBTTagType.getTypeFromId(item.getDataTag().get(tag).getTypeId());
}
Program: 86660
Project: 86660
Buggy source:
/** 
 * Checks a Item for being a Potion
 * @param potion the  {@link Item} to check
 * @return {@code true} if Potion; {@code false} if not
 */
public static boolean isPotion(Item potion){
  return potion == null ? false : potion.getType() == Potion;
}

Fixed version (ground truth):
/** 
 * Checks a Item for being a Potion
 * @param potion the  {@link Item} to check
 * @return {@code true} if Potion; {@code false} if not
 */
public static boolean isPotion(Item potion){
  return potion != null && potion.getType() == Potion;
}
Program: 86661
Project: 86661
Buggy source:
/** 
 * Check if this ban has expired
 * @return {@code true} if expired; {@code false} if not
 */
public boolean isExpired(){
  if (timestamp == -1) {
    return false;
  }
  return ((System.currentTimeMillis() / 1000L) >= timestamp);
}

Fixed version (ground truth):
/** 
 * Check if this ban has expired
 * @return {@code true} if expired; {@code false} if not
 */
public boolean isExpired(){
  return timestamp != -1 && ((System.currentTimeMillis() / 1000L) >= timestamp);
}
Program: 86662
Project: 86662
Buggy source:
/** 
 * Take a string and parse an amount of seconds. A String should be formatted like this: number hours|days|months Ex: 1 month and it will return the amount of seconds that contain one month
 * @param ts
 * @return long amount of seconds
 */
private long parseTimeSpec(String ts) throws NumberFormatException {
  String[] split=ts.split("String_Node_Str");
  if (split.length < 2) {
    return -1;
  }
  long seconds;
  try {
    seconds=Integer.parseInt(split[0]);
  }
 catch (  NumberFormatException ex) {
    throw ex;
  }
  if (split[1].toLowerCase().startsWith("String_Node_Str")) {
    seconds*=3600;
  }
 else   if (split[1].toLowerCase().startsWith("String_Node_Str")) {
    seconds*=86400;
  }
 else   if (split[1].toLowerCase().startsWith("String_Node_Str")) {
    seconds*=604800;
  }
 else   if (split[1].toLowerCase().startsWith("String_Node_Str")) {
    seconds*=2629743;
  }
  return seconds;
}

Fixed version (ground truth):
/** 
 * Take a string and parse an amount of seconds. A String should be formatted like this: number hours|days|months Ex: 1 month and it will return the amount of seconds that contain one month
 * @param ts
 * @return long amount of seconds
 */
private long parseTimeSpec(String ts) throws NumberFormatException {
  String[] split=ts.split("String_Node_Str");
  if (split.length < 2) {
    return -1;
  }
  long seconds=Integer.parseInt(split[0]);
  if (split[1].toLowerCase().startsWith("String_Node_Str")) {
    seconds*=3600;
  }
 else   if (split[1].toLowerCase().startsWith("String_Node_Str")) {
    seconds*=86400;
  }
 else   if (split[1].toLowerCase().startsWith("String_Node_Str")) {
    seconds*=604800;
  }
 else   if (split[1].toLowerCase().startsWith("String_Node_Str")) {
    seconds*=2629743;
  }
  return seconds;
}
Program: 86663
Project: 86663
Buggy source:
public boolean canUseCommand(MessageReceiver user,String command){
  CanaryCommand cmd=commands.get(command);
  if (cmd == null) {
    return false;
  }
  return cmd.canUse(user);
}

Fixed version (ground truth):
public boolean canUseCommand(MessageReceiver user,String command){
  CanaryCommand cmd=commands.get(command);
  return cmd != null && cmd.canUse(user);
}
Program: 86665
Project: 86665
Buggy source:
/** 
 * Remove a command from the command list.
 * @param name
 * @return <tt>true</tt> if the command was removed, <tt>false</tt> otherwise.
 */
public boolean unregisterCommand(String name){
  if (name == null) {
    return false;
  }
  String[] commandchain=name.split("String_Node_Str");
  CanaryCommand temp=null;
  for (int i=0; i < commandchain.length; i++) {
    if (i == 0) {
      temp=commands.get(commandchain[i]);
    }
 else {
      if (temp == null) {
        break;
      }
      if (temp.hasSubCommand(commandchain[i])) {
        temp=temp.getSubCommand(commandchain[i]);
      }
 else {
        temp=null;
        break;
      }
    }
  }
  if (temp == null) {
    return false;
  }
 else {
    if (!temp.meta.helpLookup().isEmpty() && Canary.help().hasHelp(temp.meta.helpLookup())) {
      Canary.help().unregisterCommand(temp.owner,temp.meta.helpLookup());
    }
 else {
      Canary.help().unregisterCommand(temp.owner,temp.meta.aliases()[0]);
    }
    if (temp.getParent() != null) {
      temp.getParent().removeSubCommand(temp);
      return true;
    }
 else {
      for (int i=0; i < temp.meta.aliases().length; i++) {
        commands.remove(temp.meta.aliases()[i].toLowerCase());
      }
      return temp != null;
    }
  }
}

Fixed version (ground truth):
/** 
 * Remove a command from the command list.
 * @param name
 * @return <tt>true</tt> if the command was removed, <tt>false</tt> otherwise.
 */
public boolean unregisterCommand(String name){
  if (name == null) {
    return false;
  }
  String[] commandchain=name.split("String_Node_Str");
  CanaryCommand temp=null;
  for (int i=0; i < commandchain.length; i++) {
    if (i == 0) {
      temp=commands.get(commandchain[i]);
    }
 else {
      if (temp == null) {
        break;
      }
      if (temp.hasSubCommand(commandchain[i])) {
        temp=temp.getSubCommand(commandchain[i]);
      }
 else {
        temp=null;
        break;
      }
    }
  }
  if (temp == null) {
    return false;
  }
 else {
    if (!temp.meta.helpLookup().isEmpty() && Canary.help().hasHelp(temp.meta.helpLookup())) {
      Canary.help().unregisterCommand(temp.owner,temp.meta.helpLookup());
    }
 else {
      Canary.help().unregisterCommand(temp.owner,temp.meta.aliases()[0]);
    }
    if (temp.getParent() != null) {
      temp.getParent().removeSubCommand(temp);
      return true;
    }
 else {
      for (int i=0; i < temp.meta.aliases().length; i++) {
        commands.remove(temp.meta.aliases()[i].toLowerCase());
      }
      return true;
    }
  }
}
Program: 86666
Project: 86666
Buggy source:
public void execute(MessageReceiver caller,String[] parameters){
  CanaryToVanilla converter=new CanaryToVanilla();
  String world=Configuration.getServerConfig().getDefaultWorldName();
  world=world + "String_Node_Str";
  if (parameters.length > 1) {
    world=parameters[1];
  }
  if (converter.convert(world) == false) {
    caller.notice("String_Node_Str");
  }
 else {
    caller.message(Colors.YELLOW + "String_Node_Str");
  }
}

Fixed version (ground truth):
public void execute(MessageReceiver caller,String[] parameters){
  CanaryToVanilla converter=new CanaryToVanilla();
  String world=Configuration.getServerConfig().getDefaultWorldName();
  world=world + "String_Node_Str";
  if (parameters.length > 1) {
    world=parameters[1];
  }
  if (!converter.convert(world)) {
    caller.notice("String_Node_Str");
  }
 else {
    caller.message(Colors.YELLOW + "String_Node_Str");
  }
}
Program: 86667
Project: 86667
Buggy source:
private void server(Server server,String[] args){
  if (args.length < 4) {
    server.notice(Translator.translateAndFormat("String_Node_Str","String_Node_Str"));
    server.message(Colors.YELLOW + "String_Node_Str");
    List<Kit> kits=Canary.kits().getAllKits();
    StringBuilder kitList=new StringBuilder();
    for (    Kit k : kits) {
      kitList.append(k.getName()).append("String_Node_Str");
    }
    server.message(kitList.toString());
    return;
  }
  if (args[1].equalsIgnoreCase("String_Node_Str")) {
    if (args.length >= 4) {
      boolean override=args.length > 4 ? args[4].toLowerCase().equals("String_Node_Str") : false;
      Player recipient=Canary.getServer().matchPlayer(args[3]);
      if (recipient != null) {
        Kit kit=Canary.kits().getKit(args[2]);
        if (kit != null) {
          if (kit.giveKit(recipient,override)) {
            recipient.message(Colors.YELLOW + Translator.translateAndFormat("String_Node_Str",server.getName()));
            return;
          }
 else {
            server.notice(Translator.translateAndFormat("String_Node_Str",recipient.getName()));
            return;
          }
        }
 else {
          server.notice(Translator.translateAndFormat("String_Node_Str",args[2]));
          return;
        }
      }
 else {
        server.notice(Translator.translateAndFormat("String_Node_Str",args[3]));
        return;
      }
    }
  }
  server.notice(Translator.translateAndFormat("String_Node_Str","String_Node_Str"));
}

Fixed version (ground truth):
private void server(Server server,String[] args){
  if (args.length < 4) {
    server.notice(Translator.translateAndFormat("String_Node_Str","String_Node_Str"));
    server.message(Colors.YELLOW + "String_Node_Str");
    List<Kit> kits=Canary.kits().getAllKits();
    StringBuilder kitList=new StringBuilder();
    for (    Kit k : kits) {
      kitList.append(k.getName()).append("String_Node_Str");
    }
    server.message(kitList.toString());
    return;
  }
  if (args[1].equalsIgnoreCase("String_Node_Str")) {
    if (args.length >= 4) {
      boolean override=args.length > 4 && args[4].toLowerCase().equals("String_Node_Str");
      Player recipient=Canary.getServer().matchPlayer(args[3]);
      if (recipient != null) {
        Kit kit=Canary.kits().getKit(args[2]);
        if (kit != null) {
          if (kit.giveKit(recipient,override)) {
            recipient.message(Colors.YELLOW + Translator.translateAndFormat("String_Node_Str",server.getName()));
            return;
          }
 else {
            server.notice(Translator.translateAndFormat("String_Node_Str",recipient.getName()));
            return;
          }
        }
 else {
          server.notice(Translator.translateAndFormat("String_Node_Str",args[2]));
          return;
        }
      }
 else {
        server.notice(Translator.translateAndFormat("String_Node_Str",args[3]));
        return;
      }
    }
  }
  server.notice(Translator.translateAndFormat("String_Node_Str","String_Node_Str"));
}
Program: 86669
Project: 86669
Buggy source:
/** 
 * Check if we have a permanent disable/enable requests
 * @param params
 * @return
 */
private boolean getPermanentParameter(String[] params){
  String test=params[params.length - 2];
  if (test.equalsIgnoreCase("String_Node_Str")) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Check if we have a permanent disable/enable requests
 * @param params
 * @return
 */
private boolean getPermanentParameter(String[] params){
  return params[params.length - 2].equalsIgnoreCase("String_Node_Str");
}
Program: 86671
Project: 86671
Buggy source:
private void player(Player player,String[] args){
  World dim=player.getWorld();
  if (args[0].equals("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    player.message(Colors.YELLOW + Translator.translateAndFormat("String_Node_Str",dim.getRelativeTime(),dim.getRawTime()));
    return;
  }
  if (args[1].equalsIgnoreCase("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    player.message(Colors.YELLOW + Translator.translateAndFormat("String_Node_Str",dim.getRelativeTime(),dim.getRawTime()));
  }
 else   if (args[1].equalsIgnoreCase("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    dim.setTime(0L);
    player.message(Colors.YELLOW + Translator.translate("String_Node_Str"));
    return;
  }
 else   if (args[1].equalsIgnoreCase("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    dim.setTime(13000L);
    player.message(Colors.YELLOW + Translator.translate("String_Node_Str"));
    return;
  }
 else   if (args[1].matches("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    dim.setTime(Long.parseLong(args[1]));
    player.message(Colors.YELLOW + Translator.translate("String_Node_Str"));
    return;
  }
 else {
    Canary.help().getHelp(player,"String_Node_Str");
  }
}

Fixed version (ground truth):
private void player(Player player,String[] args){
  World dim=player.getWorld();
  if (args[0].equals("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    player.message(Colors.YELLOW + Translator.translateAndFormat("String_Node_Str",dim.getRelativeTime(),dim.getRawTime()));
    return;
  }
  if (args[1].equalsIgnoreCase("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    player.message(Colors.YELLOW + Translator.translateAndFormat("String_Node_Str",dim.getRelativeTime(),dim.getRawTime()));
  }
 else   if (args[1].equalsIgnoreCase("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    dim.setTime(0L);
    player.message(Colors.YELLOW + Translator.translate("String_Node_Str"));
  }
 else   if (args[1].equalsIgnoreCase("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    dim.setTime(13000L);
    player.message(Colors.YELLOW + Translator.translate("String_Node_Str"));
  }
 else   if (args[1].matches("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    dim.setTime(Long.parseLong(args[1]));
    player.message(Colors.YELLOW + Translator.translate("String_Node_Str"));
  }
 else {
    Canary.help().getHelp(player,"String_Node_Str");
  }
}
Program: 86672
Project: 86672
Buggy source:
private void player(Player player,String[] args){
  World dim=player.getWorld();
  if (args[1].equalsIgnoreCase("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    String weather=dim.isRaining() ? "String_Node_Str" : "String_Node_Str";
    weather=dim.isThundering() ? "String_Node_Str" : "String_Node_Str";
    player.message(Colors.YELLOW + Translator.translateAndFormat("String_Node_Str",weather));
    return;
  }
  if (args[1].equalsIgnoreCase("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    dim.setRaining(true);
    dim.setRainTime(new Random().nextInt(15000));
    player.message(Colors.YELLOW + Translator.translate("String_Node_Str"));
    return;
  }
  if (args[1].equalsIgnoreCase("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    dim.setThundering(true);
    dim.setThunderTime(new Random().nextInt(15000));
    player.message(Colors.YELLOW + Translator.translate("String_Node_Str"));
    return;
  }
  if (args[1].matches("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    dim.setRaining(false);
    dim.setRainTime(0);
    dim.setThundering(false);
    dim.setThunderTime(0);
    player.message(Colors.YELLOW + Translator.translate("String_Node_Str"));
    return;
  }
 else {
    Canary.help().getHelp(player,"String_Node_Str");
  }
}

Fixed version (ground truth):
private void player(Player player,String[] args){
  World dim=player.getWorld();
  if (args[1].equalsIgnoreCase("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    String weather=dim.isRaining() ? dim.isThundering() ? "String_Node_Str" : "String_Node_Str" : "String_Node_Str";
    player.message(Colors.YELLOW + Translator.translateAndFormat("String_Node_Str",weather));
    return;
  }
  if (args[1].equalsIgnoreCase("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    dim.setRaining(true);
    dim.setRainTime(new Random().nextInt(15000));
    player.message(Colors.YELLOW + Translator.translate("String_Node_Str"));
    return;
  }
  if (args[1].equalsIgnoreCase("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    dim.setThundering(true);
    dim.setThunderTime(new Random().nextInt(15000));
    player.message(Colors.YELLOW + Translator.translate("String_Node_Str"));
    return;
  }
  if (args[1].matches("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    dim.setRaining(false);
    dim.setRainTime(0);
    dim.setThundering(false);
    dim.setThunderTime(0);
    player.message(Colors.YELLOW + Translator.translate("String_Node_Str"));
  }
 else {
    Canary.help().getHelp(player,"String_Node_Str");
  }
}
Program: 86674
Project: 86674
Buggy source:
private boolean getBoolean(String key,boolean def){
  Boolean r=boolCache.get(key);
  if (r != null) {
    return r.booleanValue();
  }
  r=cfg.getBoolean(key,def);
  boolCache.put(key,r);
  return r;
}

Fixed version (ground truth):
private boolean getBoolean(String key,boolean def){
  Boolean r=boolCache.get(key);
  if (r != null) {
    return r;
  }
  r=cfg.getBoolean(key,def);
  boolCache.put(key,r);
  return r;
}
Program: 86675
Project: 86675
Buggy source:
public boolean convert(String world){
  if (!createFolders(world)) {
    return false;
  }
  if (!downloadMinecraft()) {
    return false;
  }
  if (!createServerProperties(world)) {
    return false;
  }
  if (!createBans()) {
    return false;
  }
  if (!createOps(world)) {
    return false;
  }
  if (!createWhitelist()) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
public boolean convert(String world){
  if (!createFolders(world)) {
    return false;
  }
  if (!downloadMinecraft()) {
    return false;
  }
  if (!createServerProperties(world)) {
    return false;
  }
  if (!createBans()) {
    return false;
  }
  if (!createOps(world)) {
    return false;
  }
  return createWhitelist();
}
Program: 86676
Project: 86676
Buggy source:
/** 
 * Checks if the connection pool is full.
 * @return true - pool is full<br>false - pool is not full
 */
private synchronized boolean isConnectionPoolFull(){
  return connectionPool.size() < config.getDatabaseMaxConnections() ? false : true;
}

Fixed version (ground truth):
/** 
 * Checks if the connection pool is full.
 * @return true - pool is full<br>false - pool is not full
 */
private synchronized boolean isConnectionPoolFull(){
  return connectionPool.size() > config.getDatabaseMaxConnections();
}
Program: 86677
Project: 86677
Buggy source:
/** 
 * Gets an ItemType according to the given ID and Data values. This will return null if there is no ItemType with this id.
 * @param id the id to get type from
 * @param data the data (damage) to get type from
 * @return the ItemType if found; {@code null} if not
 */
public static ItemType fromIdAndData(int id,int data){
  for (  ItemType type : itemTypes.values()) {
    if (type.id == id && type.data == data) {
      Canary.logDebug(type.id + "String_Node_Str" + id+ "String_Node_Str"+ type.data+ "String_Node_Str"+ data);
      return type;
    }
  }
  return fromId(id);
}

Fixed version (ground truth):
/** 
 * Gets an ItemType according to the given ID and Data values. This will return null if there is no ItemType with this id.
 * @param id the id to get type from
 * @param data the data (damage) to get type from
 * @return the ItemType if found; {@code null} if not
 */
public static ItemType fromIdAndData(int id,int data){
  for (  ItemType type : itemTypes.values()) {
    if (type.id == id && type.data == data) {
      return type;
    }
  }
  return fromId(id);
}
Program: 86678
Project: 86678
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public boolean unregisterClient(String channel,NetServerHandler handler){
  boolean toRet=false;
synchronized (lock) {
    if (clients.containsKey(channel)) {
      for (      NetServerHandler h : clients.get(channel)) {
        if (h.equals(handler)) {
          clients.get(channel).remove(h);
          toRet=true;
          Canary.logInfo(String.format("String_Node_Str" + "String_Node_Str",channel,handler.getUser().getName()));
        }
      }
    }
  }
  return toRet;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public boolean unregisterClient(String channel,NetServerHandler handler){
  if (clients.containsKey(channel)) {
synchronized (clients.get(channel)) {
      if (clients.get(channel).remove(handler)) {
        Canary.logInfo(String.format("String_Node_Str",channel,handler.getUser().getName()));
        return true;
      }
    }
  }
  return false;
}
Program: 86679
Project: 86679
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public boolean unregisterListeners(Plugin plugin){
  boolean toRet=false;
  for (  List<RegisteredChannelListener> list : listeners.values()) {
    for (    RegisteredChannelListener listener : list) {
      if (listener.getPlugin().equals(plugin)) {
        list.remove(listener);
        toRet=true;
      }
    }
  }
  return toRet;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public boolean unregisterListeners(Plugin plugin){
  boolean toRet=false;
  for (  List<RegisteredChannelListener> list : listeners.values()) {
synchronized (list) {
      for (      RegisteredChannelListener listener : list) {
        if (listener.getPlugin().equals(plugin)) {
          list.remove(listener);
          toRet=true;
        }
      }
    }
  }
  return toRet;
}
Program: 86680
Project: 86680
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public boolean unregisterClientAll(NetServerHandler handler){
  boolean toRet=false;
  for (  String channel : clients.keySet()) {
    this.unregisterClient(channel,handler);
  }
  return toRet;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public boolean unregisterClientAll(NetServerHandler handler){
  boolean toRet=true;
  for (  String channel : clients.keySet()) {
    toRet&=unregisterClient(channel,handler);
  }
  return toRet;
}
Program: 86681
Project: 86681
Buggy source:
/** 
 * Add a new Kit to the list of Kits.
 * @param kit Adds the kit instance to the list of kits.
 */
public void addKit(Kit kit){
  if (kitExists(kit)) {
    updateKit(kit);
    return;
  }
  KitDataAccess data=new KitDataAccess();
  data.groups=new ArrayList<String>(Arrays.asList(kit.getGroups()));
  data.items=kit.getItemsAsStringList();
  data.name=kit.getName();
  data.owners=new ArrayList<String>(Arrays.asList(kit.getOwner()));
  data.useDelay=kit.getDelay();
  data.id=0;
  try {
    Database.get().insert(data);
  }
 catch (  DatabaseWriteException e) {
    Canary.logStacktrace(e.getMessage(),e);
  }
}

Fixed version (ground truth):
/** 
 * Add a new Kit to the list of Kits.
 * @param kit Adds the kit instance to the list of kits.
 */
public void addKit(Kit kit){
  if (kitExists(kit)) {
    updateKit(kit);
    return;
  }
  KitDataAccess data=new KitDataAccess();
  data.groups=kit.getGroups() != null ? new ArrayList<String>(Arrays.asList(kit.getGroups())) : new ArrayList<String>();
  data.items=kit.getItemsAsStringList();
  data.name=kit.getName();
  data.owners=kit.getOwner() != null ? new ArrayList<String>(Arrays.asList(kit.getOwner())) : new ArrayList<String>();
  data.useDelay=kit.getDelay();
  data.id=0;
  try {
    Database.get().insert(data);
  }
 catch (  DatabaseWriteException e) {
    Canary.logStacktrace(e.getMessage(),e);
  }
}
Program: 86682
Project: 86682
Buggy source:
/** 
 * Get a Kit with the given name
 * @param name Name of the kit to get.
 * @return a Kit object if that Kit was found, null otherwise
 */
public Kit getKit(String name){
  KitDataAccess data=new KitDataAccess();
  try {
    Database.get().load(data,new String[]{"String_Node_Str"},new Object[]{name});
    if (!data.hasData()) {
      return null;
    }
    Kit kit=new Kit();
    kit.setContentFromStrings(data.items);
    kit.setDelay(data.useDelay);
    kit.setGroups((String[])data.groups.toArray());
    kit.setName(data.name);
    kit.setOwner((String[])data.groups.toArray());
    kit.setId(data.id);
    return kit;
  }
 catch (  DatabaseReadException e) {
    Canary.logStacktrace(e.getMessage(),e);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Get a Kit with the given name
 * @param name Name of the kit to get.
 * @return a Kit object if that Kit was found, null otherwise
 */
public Kit getKit(String name){
  KitDataAccess data=new KitDataAccess();
  try {
    Database.get().load(data,new String[]{"String_Node_Str"},new Object[]{name});
    if (!data.hasData()) {
      return null;
    }
    Kit kit=new Kit();
    kit.setContentFromStrings(data.items);
    kit.setDelay(data.useDelay);
    kit.setGroups(data.groups.toArray(new String[0]));
    kit.setName(data.name);
    kit.setOwner(data.groups.toArray(new String[0]));
    kit.setId(data.id);
    return kit;
  }
 catch (  DatabaseReadException e) {
    Canary.logStacktrace(e.getMessage(),e);
  }
  return null;
}