nus-yam/ex-repair huggingface dataset:
Program: 134246
Project: 134246
Buggy source:
@Override public TableElement elementForIndexInSegment(GuiTable table,int index,int segment){
  if (segment == 0) {
    TableCellString cell=new TableCellString("String_Node_Str",transformer.id());
    cell.setTooltip(IvTranslations.formatLines("String_Node_Str"));
    cell.setShowsValidityState(true);
    cell.setValidityState(StructureInfos.isSimpleIDState(transformer.id()));
    cell.addPropertyListener(cell1 -> {
      transformer.setID((String)cell1.getPropertyValue());
      ((TableCellString)cell1).setValidityState(StructureInfos.isSimpleIDState(transformer.id()));
    }
);
    return new TableElementCell(IvTranslations.get("String_Node_Str"),cell);
  }
  return super.elementForIndexInSegment(table,index,segment);
}

Fixed version (ground truth):
@Override public TableElement elementForIndexInSegment(GuiTable table,int index,int segment){
  if (segment == 0) {
    TableCellString cell=new TableCellString("String_Node_Str",transformer.id());
    cell.setTooltip(IvTranslations.formatLines("String_Node_Str"));
    cell.setShowsValidityState(true);
    cell.setValidityState(currentIDState());
    cell.addPropertyListener(cell1 -> {
      transformer.setID((String)cell1.getPropertyValue());
      ((TableCellString)cell1).setValidityState(currentIDState());
    }
);
    return new TableElementCell(IvTranslations.get("String_Node_Str"),cell);
  }
  return super.elementForIndexInSegment(table,index,segment);
}
Program: 134247
Project: 134247
Buggy source:
public TableDataSourceMazeReachability(SavedMazeReachability reachability,TableDelegate tableDelegate,TableNavigator tableNavigator,Set<SavedMazePath> expected,List<IntegerRange> bounds){
  this.reachability=reachability;
  this.tableDelegate=tableDelegate;
  this.tableNavigator=tableNavigator;
  TableCellTitle groupTitle=new TableCellTitle("String_Node_Str",IvTranslations.get("String_Node_Str"));
  groupTitle.setTooltip(IvTranslations.formatLines("String_Node_Str"));
  addManagedSection(0,new TableDataSourcePreloaded(new TableElementCell(groupTitle)));
  addManagedSection(1,new TableDataSourceMazeReachabilityGroup(reachability.groups,expected,tableDelegate,tableNavigator));
  TableCellTitle crossConnectionsTitle=new TableCellTitle("String_Node_Str",IvTranslations.get("String_Node_Str"));
  crossConnectionsTitle.setTooltip(IvTranslations.formatLines("String_Node_Str"));
  addManagedSection(2,new TableDataSourcePreloaded(new TableElementCell(crossConnectionsTitle)));
  addManagedSection(3,new TableDataSourcePathConnectionList(reachability.crossConnections,tableDelegate,tableNavigator,bounds));
}

Fixed version (ground truth):
public TableDataSourceMazeReachability(SavedMazeReachability reachability,TableDelegate tableDelegate,TableNavigator tableNavigator,Set<SavedMazePath> expected,List<IntegerRange> bounds){
  this.reachability=reachability;
  this.tableDelegate=tableDelegate;
  this.tableNavigator=tableNavigator;
  TableCellTitle groupTitle=new TableCellTitle("String_Node_Str",IvTranslations.get("String_Node_Str"));
  groupTitle.setTooltip(IvTranslations.formatLines("String_Node_Str"));
  addManagedSection(0,new TableDataSourcePreloaded(new TableElementCell(groupTitle)));
  addManagedSection(1,new TableDataSourceMazeReachabilityGroups(reachability.groups,expected,tableDelegate,tableNavigator));
  TableCellTitle crossConnectionsTitle=new TableCellTitle("String_Node_Str",IvTranslations.get("String_Node_Str"));
  crossConnectionsTitle.setTooltip(IvTranslations.formatLines("String_Node_Str"));
  addManagedSection(2,new TableDataSourcePreloaded(new TableElementCell(crossConnectionsTitle)));
  addManagedSection(3,new TableDataSourcePathConnectionList(reachability.crossConnections,tableDelegate,tableNavigator,bounds));
}
Program: 134248
Project: 134248
Buggy source:
public static GuiValidityStateIndicator.State isSimpleIDState(String id){
  return isSimpleID(id) ? GuiValidityStateIndicator.State.INVALID : GuiValidityStateIndicator.State.VALID;
}

Fixed version (ground truth):
public static GuiValidityStateIndicator.State isSimpleIDState(String id){
  return isSimpleID(id) ? GuiValidityStateIndicator.State.VALID : GuiValidityStateIndicator.State.INVALID;
}
Program: 134249
Project: 134249
Buggy source:
public static boolean isSimpleID(String id){
  return id.trim().isEmpty() || !id.chars().allMatch(Character::isJavaIdentifierPart);
}

Fixed version (ground truth):
public static boolean isSimpleID(String id){
  return !id.trim().isEmpty() && id.chars().allMatch(Character::isJavaIdentifierPart);
}
Program: 134250
Project: 134250
Buggy source:
public Collection<Pair<StructureInfo,StructureListGenerationInfo>> getStructuresInList(final String listID,final EnumFacing front){
  return getStructureGenerations(StructureListGenerationInfo.class,input -> listID.equals(input.getRight().listID) && (front == null || input.getLeft().isRotatable() || input.getRight().front == front));
}

Fixed version (ground truth):
public Collection<Pair<StructureInfo,StructureListGenerationInfo>> getStructuresInList(final String listID,@Nullable final EnumFacing front){
  return getStructureGenerations(StructureListGenerationInfo.class,input -> listID.equals(input.getRight().listID) && (front == null || input.getLeft().isRotatable() || input.getRight().front == front));
}
Program: 134251
Project: 134251
Buggy source:
@Override public void readFromNBT(NBTTagCompound compound){
  scripts.clear();
  scripts.addAll(NBTTagLists.compoundsFrom(compound,"String_Node_Str").stream().map(WorldScriptRegistry.INSTANCE::read).collect(Collectors.toList()));
}

Fixed version (ground truth):
@Override public void readFromNBT(NBTTagCompound compound){
  scripts.clear();
  scripts.addAll(NBTTagLists.compoundsFrom(compound,"String_Node_Str").stream().map(WorldScriptRegistry.INSTANCE::read).filter(Objects::nonNull).collect(Collectors.toList()));
}
Program: 134252
Project: 134252
Buggy source:
public MazeComponentStructure(double weight,String structureID,AxisAlignedTransform2D transform,ImmutableSet<MazeRoom> rooms,ImmutableMap<MazeRoomConnection,C> exits){
  this.weight=weight;
  this.structureID=structureID;
  this.transform=transform;
  this.rooms=rooms;
  this.exits=exits;
}

Fixed version (ground truth):
public MazeComponentStructure(double weight,String structureID,AxisAlignedTransform2D transform,ImmutableSet<MazeRoom> rooms,ImmutableMap<MazeRoomConnection,C> exits){
  this.weight=weight;
  this.structureID=structureID;
  this.transform=transform;
  this.rooms=rooms;
  this.exits=exits;
  ImmutableSet.Builder<Pair<MazeRoom,MazeRoom>> builder=ImmutableSet.builder();
  for (  MazeRoom left : rooms)   for (  MazeRoom right : rooms)   builder.add(Pair.of(left,right));
  this.reachability=builder.build();
}
Program: 134258
Project: 134258
Buggy source:
@Override public void writeUpdateData(ByteBuf buffer,String context){
  if ("String_Node_Str".equals(context)) {
    BlockCoord.writeCoordToBuffer(selectedPoint1,buffer);
    BlockCoord.writeCoordToBuffer(selectedPoint2,buffer);
  }
}

Fixed version (ground truth):
@Override public void writeUpdateData(ByteBuf buffer,String context,Object... params){
  if ("String_Node_Str".equals(context)) {
    BlockCoord.writeCoordToBuffer(selectedPoint1,buffer);
    BlockCoord.writeCoordToBuffer(selectedPoint2,buffer);
  }
}
Program: 134259
Project: 134259
Buggy source:
public void sendSelectionChangesToClients(Entity entity){
  IvNetworkHelperServer.sendEEPUpdatePacket(entity,"String_Node_Str","String_Node_Str",RecurrentComplex.network);
}

Fixed version (ground truth):
public void sendSelectionChangesToClients(Entity entity){
  RCNetworkHelperServer.sendEEPUpdatePacket(entity,"String_Node_Str","String_Node_Str",RecurrentComplex.network);
}
Program: 134260
Project: 134260
Buggy source:
public List<BiomeDictionary.Type> getBiomeTypes(){
  if (biomeID.startsWith("String_Node_Str")) {
    String[] typeIDs=biomeID.substring(5).split("String_Node_Str");
    List<BiomeDictionary.Type> types=new ArrayList<>(typeIDs.length);
    for (    String typeID : typeIDs) {
      BiomeDictionary.Type type=IvGsonHelper.enumForNameIgnoreCase(typeID,BiomeDictionary.Type.values());
      if (type == null)       return null;
      types.add(type);
    }
    return types;
  }
  return null;
}

Fixed version (ground truth):
public List<BiomeDictionary.Type> getBiomeTypes(){
  if (biomeID.startsWith("String_Node_Str")) {
    String[] typeIDs=biomeID.substring(5).split("String_Node_Str");
    List<BiomeDictionary.Type> types=new ArrayList<>(typeIDs.length);
    for (    String typeID : typeIDs) {
      BiomeDictionary.Type type=RCGsonHelper.enumForNameIgnoreCase(typeID,BiomeDictionary.Type.values());
      if (type == null)       return null;
      types.add(type);
    }
    return types;
  }
  return null;
}
Program: 134261
Project: 134261
Buggy source:
@Override public void fromBytes(ByteBuf buf){
  key=ByteBufUtils.readUTF8String(buf);
  String json=ByteBufUtils.readUTF8String(buf);
  inventoryGenerator=InventoryGenerationHandler.createInventoryGeneratorFromJSON(json);
}

Fixed version (ground truth):
@Override public void fromBytes(ByteBuf buf){
  key=ByteBufUtils.readUTF8String(buf);
  String json=ByteBufUtils.readUTF8String(buf);
  try {
    inventoryGenerator=InventoryGenerationHandler.createInventoryGeneratorFromJSON(json);
  }
 catch (  InventoryLoadException e) {
    e.printStackTrace();
  }
}
Program: 134262
Project: 134262
Buggy source:
@Override public GenericInventoryGenerator copyAsGenericInventoryGenerator(){
  return (GenericInventoryGenerator)clone();
}

Fixed version (ground truth):
@Override public GenericInventoryGenerator copyAsGenericInventoryGenerator(){
  return copy();
}
Program: 134263
Project: 134263
Buggy source:
@Override public GenericInventoryGenerator copyAsGenericInventoryGenerator(){
  return (GenericInventoryGenerator)genericInventoryGenerator.clone();
}

Fixed version (ground truth):
@Override public GenericInventoryGenerator copyAsGenericInventoryGenerator(){
  return genericInventoryGenerator.copy();
}
Program: 134264
Project: 134264
Buggy source:
void apply(World world,Random random,boolean beforeGeneration,int x,int y,int z,Block sourceBlock,int sourceMetadata,IvWorldData worldData);

Fixed version (ground truth):
void apply(World world,Random random,Phase phase,int x,int y,int z,Block sourceBlock,int sourceMetadata,IvWorldData worldData);
Program: 134267
Project: 134267
Buggy source:
@Override public void apply(World world,Random random,boolean beforeGeneration,int x,int y,int z,Block sourceBlock,int sourceMetadata,IvWorldData worldData){
}

Fixed version (ground truth):
@Override public void apply(World world,Random random,Phase phase,int x,int y,int z,Block sourceBlock,int sourceMetadata,IvWorldData worldData){
}
Program: 134268
Project: 134268
Buggy source:
@Override public void apply(World world,Random random,boolean beforeGeneration,int x,int y,int z,Block sourceBlock,int sourceMetadata,IvWorldData worldData){
  world.setBlock(x,y,z,destBlock,destMetadata,3);
  y--;
  while (y > 0) {
    Block block=world.getBlock(x,y,z);
    if (!(block.isReplaceable(world,x,y,z) || block.getMaterial() == Material.leaves || block.isFoliage(world,x,y,z))) {
      return;
    }
    world.setBlock(x,y,z,destBlock,destMetadata,3);
    y--;
  }
}

Fixed version (ground truth):
@Override public void apply(World world,Random random,Phase phase,int x,int y,int z,Block sourceBlock,int sourceMetadata,IvWorldData worldData){
  world.setBlock(x,y,z,destBlock,destMetadata,3);
  y--;
  while (y > 0) {
    Block block=world.getBlock(x,y,z);
    if (!(block.isReplaceable(world,x,y,z) || block.getMaterial() == Material.leaves || block.isFoliage(world,x,y,z))) {
      return;
    }
    world.setBlock(x,y,z,destBlock,destMetadata,3);
    y--;
  }
}
Program: 134269
Project: 134269
Buggy source:
@Override public void apply(World world,Random random,boolean beforeGeneration,int x,int y,int z,Block sourceBlock,int sourceMetadata,IvWorldData worldData){
  world.setBlock(x,y,z,destBlock,destMetadata[random.nextInt(destMetadata.length)],3);
}

Fixed version (ground truth):
@Override public void apply(World world,Random random,Phase phase,int x,int y,int z,Block sourceBlock,int sourceMetadata,IvWorldData worldData){
  world.setBlock(x,y,z,destBlock,destMetadata[random.nextInt(destMetadata.length)],3);
}
Program: 134272
Project: 134272
Buggy source:
@Override public void processCommand(ICommandSender commandSender,String[] args){
  int x, y, z;
  if (args.length <= 0) {
    throw new WrongUsageException("String_Node_Str");
  }
  String structureName=args[0];
  StructureInfo structureInfo=StructureHandler.getStructure(structureName);
  World world=commandSender.getEntityWorld();
  if (structureInfo == null) {
    throw new WrongUsageException("String_Node_Str",structureName);
  }
  x=commandSender.getPlayerCoordinates().posX;
  z=commandSender.getPlayerCoordinates().posZ;
  if (args.length >= 3) {
    x=MathHelper.floor_double(func_110666_a(commandSender,(double)x,args[1]));
    z=MathHelper.floor_double(func_110666_a(commandSender,(double)z,args[2]));
  }
  WorldGenStructures.generateStructureRandomly(world,world.rand,structureInfo,x,z);
}

Fixed version (ground truth):
@Override public void processCommand(ICommandSender commandSender,String[] args){
  int x, z;
  if (args.length <= 0) {
    throw new WrongUsageException("String_Node_Str");
  }
  String structureName=args[0];
  StructureInfo structureInfo=StructureHandler.getStructure(structureName);
  World world=commandSender.getEntityWorld();
  if (structureInfo == null) {
    throw new WrongUsageException("String_Node_Str",structureName);
  }
  x=commandSender.getPlayerCoordinates().posX;
  z=commandSender.getPlayerCoordinates().posZ;
  if (args.length >= 3) {
    x=MathHelper.floor_double(func_110666_a(commandSender,(double)x,args[1]));
    z=MathHelper.floor_double(func_110666_a(commandSender,(double)z,args[2]));
  }
  WorldGenStructures.generateStructureRandomly(world,world.rand,structureInfo,x,z);
}
Program: 134274
Project: 134274
Buggy source:
@Override protected void mouseDragged(Minecraft mc,int x,int y){
  if (this.visible) {
    if (this.mousePressedInsideIndex >= 0) {
      values[mousePressedInsideIndex]=(float)(x - (this.xPosition + 4)) / (float)(this.width - 8);
      values[mousePressedInsideIndex]=(values[mousePressedInsideIndex]) * (maxValue - minValue) + minValue;
      if (values[mousePressedInsideIndex] < minValue) {
        values[mousePressedInsideIndex]=minValue;
      }
      if (values[mousePressedInsideIndex] > maxValue) {
        values[mousePressedInsideIndex]=maxValue;
      }
      notifyOfChanges();
    }
    GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
    for (int i=0; i < values.length; i++) {
      float drawVal=(values[i] - this.minValue) / (this.maxValue - this.minValue);
      this.drawTexturedModalRect(this.xPosition + (int)(drawVal * (float)(this.width - 8)),this.yPosition,0,66,4,20);
      this.drawTexturedModalRect(this.xPosition + (int)(drawVal * (float)(this.width - 8)) + 4,this.yPosition,196,66,4,20);
    }
  }
}

Fixed version (ground truth):
@Override protected void mouseDragged(Minecraft mc,int x,int y){
  if (this.visible) {
    if (this.mousePressedInsideIndex >= 0) {
      values[mousePressedInsideIndex]=(float)(x - (this.xPosition + 4)) / (float)(this.width - 8);
      values[mousePressedInsideIndex]=(values[mousePressedInsideIndex]) * (maxValue - minValue) + minValue;
      if (values[mousePressedInsideIndex] < minValue) {
        values[mousePressedInsideIndex]=minValue;
      }
      if (values[mousePressedInsideIndex] > maxValue) {
        values[mousePressedInsideIndex]=maxValue;
      }
      notifyOfChanges();
    }
    GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
    for (    float value : values) {
      float drawVal=(value - this.minValue) / (this.maxValue - this.minValue);
      this.drawTexturedModalRect(this.xPosition + (int)(drawVal * (float)(this.width - 8)),this.yPosition,0,66,4,20);
      this.drawTexturedModalRect(this.xPosition + (int)(drawVal * (float)(this.width - 8)) + 4,this.yPosition,196,66,4,20);
    }
  }
}
Program: 134275
Project: 134275
Buggy source:
@Override public void markDirty(){
  for (int i=0; i < this.watchers.size(); ++i) {
    this.watchers.get(i).inventoryChanged(this);
  }
}

Fixed version (ground truth):
@Override public void markDirty(){
  for (  InventoryWatcher watcher : this.watchers) {
    watcher.inventoryChanged(this);
  }
}
Program: 134276
Project: 134276
Buggy source:
private GuiValidityStateIndicator.State currentBiomeIDState(){
  if (generationInfo.getBiomeTypes() != null)   return GuiValidityStateIndicator.State.VALID;
  String biomeID=generationInfo.getBiomeID();
  BiomeGenBase[] biomes=BiomeGenBase.getBiomeGenArray();
  for (int i=0; i < biomes.length; i++) {
    if (biomes[i] != null && biomes[i].biomeName.equals(biomeID))     return GuiValidityStateIndicator.State.VALID;
  }
  return biomeID.trim().length() > 0 ? GuiValidityStateIndicator.State.SEMI_VALID : GuiValidityStateIndicator.State.INVALID;
}

Fixed version (ground truth):
private GuiValidityStateIndicator.State currentBiomeIDState(){
  if (generationInfo.getBiomeTypes() != null) {
    return GuiValidityStateIndicator.State.VALID;
  }
  String biomeID=generationInfo.getBiomeID();
  BiomeGenBase[] biomes=BiomeGenBase.getBiomeGenArray();
  for (  BiomeGenBase biome : biomes) {
    if (biome != null && biome.biomeName.equals(biomeID)) {
      return GuiValidityStateIndicator.State.VALID;
    }
  }
  return biomeID.trim().length() > 0 ? GuiValidityStateIndicator.State.SEMI_VALID : GuiValidityStateIndicator.State.INVALID;
}
Program: 134277
Project: 134277
Buggy source:
@Override public void actionPerformed(TableElementPresetAction tableElementButton,String actionID){
  if (tableElementButton.getID().equals("String_Node_Str")) {
    if (actionID.equals("String_Node_Str")) {
      biomeGenerationInfoList.clear();
      biomeGenerationInfoList.addAll(BiomeGenerationInfo.defaultBiomeGenerationList());
    }
 else     if (actionID.equals("String_Node_Str")) {
      biomeGenerationInfoList.clear();
      biomeGenerationInfoList.addAll(BiomeGenerationInfo.oceanBiomeGenerationList());
    }
 else     if (actionID.equals("String_Node_Str")) {
      biomeGenerationInfoList.clear();
    }
    tableDelegate.reloadData();
  }
}

Fixed version (ground truth):
@Override public void actionPerformed(TableElementPresetAction tableElementButton,String actionID){
  if (tableElementButton.getID().equals("String_Node_Str")) {
switch (actionID) {
case "String_Node_Str":
      biomeGenerationInfoList.clear();
    biomeGenerationInfoList.addAll(BiomeGenerationInfo.defaultBiomeGenerationList());
  break;
case "String_Node_Str":
biomeGenerationInfoList.clear();
biomeGenerationInfoList.addAll(BiomeGenerationInfo.oceanBiomeGenerationList());
break;
case "String_Node_Str":
biomeGenerationInfoList.clear();
break;
}
tableDelegate.reloadData();
}
}
Program: 134279
Project: 134279
Buggy source:
public static String[] getLines(String content,FontRenderer fontRenderer,int maxStringWidth,int maxCharacters){
  ArrayList<String> returnList=new ArrayList<String>();
  int lastCut=0;
  for (int i=0; i < content.length(); ) {
    int wordEndIndex=i + 1;
    if (content.substring(i).indexOf("String_Node_Str") == -1) {
      wordEndIndex=content.length();
    }
 else {
      wordEndIndex=i + content.substring(i).indexOf("String_Node_Str");
    }
    String currentPageString=content.substring(lastCut,wordEndIndex);
    int realLength=fontRenderer.getStringWidth(currentPageString);
    if (!(realLength <= maxStringWidth && currentPageString.length() < maxCharacters)) {
      returnList.add(content.substring(lastCut,i));
      lastCut=i;
    }
    i=wordEndIndex + 1;
  }
  if (lastCut < content.length()) {
    returnList.add(content.substring(lastCut,content.length()));
  }
  String[] returnArray=new String[returnList.size()];
  for (int i=0; i < returnList.size(); i++) {
    returnArray[i]=returnList.get(i);
  }
  return returnArray;
}

Fixed version (ground truth):
public static String[] getLines(String content,FontRenderer fontRenderer,int maxStringWidth,int maxCharacters){
  ArrayList<String> returnList=new ArrayList<>();
  int lastCut=0;
  for (int i=0; i < content.length(); ) {
    int wordEndIndex=i + 1;
    if (content.substring(i).indexOf("String_Node_Str") == -1) {
      wordEndIndex=content.length();
    }
 else {
      wordEndIndex=i + content.substring(i).indexOf("String_Node_Str");
    }
    String currentPageString=content.substring(lastCut,wordEndIndex);
    int realLength=fontRenderer.getStringWidth(currentPageString);
    if (!(realLength <= maxStringWidth && currentPageString.length() < maxCharacters)) {
      returnList.add(content.substring(lastCut,i));
      lastCut=i;
    }
    i=wordEndIndex + 1;
  }
  if (lastCut < content.length()) {
    returnList.add(content.substring(lastCut,content.length()));
  }
  String[] returnArray=new String[returnList.size()];
  for (int i=0; i < returnList.size(); i++) {
    returnArray[i]=returnList.get(i);
  }
  return returnArray;
}
Program: 134280
Project: 134280
Buggy source:
public static String[] getPages(String content,FontRenderer fontRenderer,int maxStringWidth,int maxCharacters){
  ArrayList<String> returnList=new ArrayList<String>();
  int lastCut=0;
  for (int i=0; i < content.length(); ) {
    int wordEndIndex=i + 1;
    if (content.substring(i).indexOf("String_Node_Str") == -1) {
      wordEndIndex=content.length();
    }
 else {
      wordEndIndex=i + content.substring(i).indexOf("String_Node_Str");
    }
    String currentPageString=content.substring(lastCut,wordEndIndex);
    int realLength=fontRenderer.splitStringWidth(currentPageString,maxStringWidth);
    if (!(realLength <= maxStringWidth && currentPageString.length() < maxCharacters)) {
      returnList.add(content.substring(lastCut,i));
      lastCut=i;
    }
    i=wordEndIndex + 1;
  }
  if (lastCut < content.length()) {
    returnList.add(content.substring(lastCut,content.length()));
  }
  String[] returnArray=new String[returnList.size()];
  for (int i=0; i < returnList.size(); i++) {
    returnArray[i]=returnList.get(i);
  }
  return returnArray;
}

Fixed version (ground truth):
public static String[] getPages(String content,FontRenderer fontRenderer,int maxStringWidth,int maxCharacters){
  ArrayList<String> returnList=new ArrayList<>();
  int lastCut=0;
  for (int i=0; i < content.length(); ) {
    int wordEndIndex=!content.substring(i).contains("String_Node_Str") ? content.length() : i + content.substring(i).indexOf("String_Node_Str");
    String currentPageString=content.substring(lastCut,wordEndIndex);
    int realLength=fontRenderer.splitStringWidth(currentPageString,maxStringWidth);
    if (!(realLength <= maxStringWidth && currentPageString.length() < maxCharacters)) {
      returnList.add(content.substring(lastCut,i));
      lastCut=i;
    }
    i=wordEndIndex + 1;
  }
  if (lastCut < content.length()) {
    returnList.add(content.substring(lastCut,content.length()));
  }
  String[] returnArray=new String[returnList.size()];
  for (int i=0; i < returnList.size(); i++) {
    returnArray[i]=returnList.get(i);
  }
  return returnArray;
}
Program: 134281
Project: 134281
Buggy source:
public IvBezierPath3D(List<IvBezierPoint3D> bezierPoints){
  cachedProgresses=new ArrayList<Double>();
  cachedDistances=new ArrayList<Double>();
  setBezierPoints(bezierPoints);
}

Fixed version (ground truth):
public IvBezierPath3D(List<IvBezierPoint3D> bezierPoints){
  cachedProgresses=new ArrayList<>();
  cachedDistances=new ArrayList<>();
  setBezierPoints(bezierPoints);
}
Program: 134282
Project: 134282
Buggy source:
public void setBezierPoints(List<IvBezierPoint3D> points){
  this.bezierPoints=new ArrayList<IvBezierPoint3D>();
  this.bezierPoints.addAll(points);
  markDirty();
}

Fixed version (ground truth):
public void setBezierPoints(List<IvBezierPoint3D> points){
  this.bezierPoints=new ArrayList<>();
  this.bezierPoints.addAll(points);
  markDirty();
}
Program: 134283
Project: 134283
Buggy source:
public List<IvBezierPoint3D> getBezierPoints(){
  List<IvBezierPoint3D> l=new ArrayList<IvBezierPoint3D>(bezierPoints.size());
  l.addAll(bezierPoints);
  return l;
}

Fixed version (ground truth):
public List<IvBezierPoint3D> getBezierPoints(){
  List<IvBezierPoint3D> l=new ArrayList<>(bezierPoints.size());
  l.addAll(bezierPoints);
  return l;
}
Program: 134284
Project: 134284
Buggy source:
public static IvBezierPath3D createQuickBezierPath(IvBezierPoint3D[] points){
  ArrayList<IvBezierPoint3D> bezierPoints=new ArrayList<IvBezierPoint3D>();
  Collections.addAll(bezierPoints,points);
  return new IvBezierPath3D(bezierPoints);
}

Fixed version (ground truth):
public static IvBezierPath3D createQuickBezierPath(IvBezierPoint3D[] points){
  ArrayList<IvBezierPoint3D> bezierPoints=new ArrayList<>();
  Collections.addAll(bezierPoints,points);
  return new IvBezierPath3D(bezierPoints);
}
Program: 134289
Project: 134289
Buggy source:
public static List<int[]> getPositions(int width,int height,int length){
  ArrayList<int[]> positions=new ArrayList<int[]>();
  for (int x=0; x < width; x++) {
    for (int y=0; y < height; y++) {
      for (int z=0; z < length; z++) {
        positions.add(new int[]{x,y,z});
      }
    }
  }
  return positions;
}

Fixed version (ground truth):
public static List<int[]> getPositions(int width,int height,int length){
  ArrayList<int[]> positions=new ArrayList<>();
  for (int x=0; x < width; x++) {
    for (int y=0; y < height; y++) {
      for (int z=0; z < length; z++) {
        positions.add(new int[]{x,y,z});
      }
    }
  }
  return positions;
}
Program: 134290
Project: 134290
Buggy source:
public static List<EntityPlayerMP> getPlayersWatchingChunk(World world,int chunkX,int chunkZ){
  if (world.isRemote || !(world instanceof WorldServer)) {
    return new ArrayList<EntityPlayerMP>(0);
  }
  ArrayList<EntityPlayerMP> playersWatching=new ArrayList<EntityPlayerMP>();
  WorldServer server=(WorldServer)world;
  PlayerManager playerManager=server.getPlayerManager();
  List<EntityPlayerMP> players=server.playerEntities;
  for (  EntityPlayerMP player : players) {
    if (playerManager.isPlayerWatchingChunk(player,chunkX,chunkZ)) {
      playersWatching.add(player);
    }
  }
  return playersWatching;
}

Fixed version (ground truth):
public static List<EntityPlayerMP> getPlayersWatchingChunk(World world,int chunkX,int chunkZ){
  if (world.isRemote || !(world instanceof WorldServer)) {
    return new ArrayList<>(0);
  }
  ArrayList<EntityPlayerMP> playersWatching=new ArrayList<>();
  WorldServer server=(WorldServer)world;
  PlayerManager playerManager=server.getPlayerManager();
  List<EntityPlayerMP> players=server.playerEntities;
  for (  EntityPlayerMP player : players) {
    if (playerManager.isPlayerWatchingChunk(player,chunkX,chunkZ)) {
      playersWatching.add(player);
    }
  }
  return playersWatching;
}
Program: 134291
Project: 134291
Buggy source:
@Override public boolean execute() throws Exception {
  if (crawler.getImageUrl() != null) {
    try (InputStream is=getConnection().getInputStream();ByteArrayOutputStream os=new ByteArrayOutputStream()){
      transfer(is,os);
      BufferedImage img=ImageIO.read(new ByteArrayInputStream(os.toByteArray()));
      img=imageManager.resizeImage(img,imageManager.scaleToFit(img,Mod.MAX_IMAGE_SIZE));
      mod.setImage(img);
    }
   }
  return true;
}

Fixed version (ground truth):
@Override public boolean execute() throws Exception {
  if (crawler.getImageUrl() != null) {
    try (InputStream is=getConnection().getInputStream();ByteArrayOutputStream os=new ByteArrayOutputStream()){
      transfer(is,os);
      BufferedImage img=ImageIO.read(new ByteArrayInputStream(os.toByteArray()));
      if (img != null) {
        img=imageManager.resizeImage(img,imageManager.scaleToFit(img,Mod.MAX_IMAGE_SIZE));
        mod.setImage(img);
      }
    }
   }
  return true;
}
Program: 134292
Project: 134292
Buggy source:
@Override protected Mod getMod() throws IOException {
  crawler.updateMod();
  return crawler.getMod();
}

Fixed version (ground truth):
@Override protected Mod getMod() throws IOException {
  crawler.updateMod();
  crawler.getMod().setUpdateAvailable(false);
  return crawler.getMod();
}
Program: 134293
Project: 134293
Buggy source:
public Mod get(int id){
  try {
    return modDao.queryForId(id);
  }
 catch (  SQLException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
@Override public Mod get(int id){
  try {
    return modDao.queryForId(id);
  }
 catch (  SQLException e) {
    throw new RuntimeException(e);
  }
}
Program: 134294
Project: 134294
Buggy source:
@Override public void updateMod(Mod mod){
  try {
    modDao.createOrUpdate(mod);
  }
 catch (  SQLException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
@Override public void updateMod(Mod mod){
  try {
    Installation installation=mod.getInstallation();
    if (installation.addMod(mod)) {
      installationDao.update(installation);
    }
    modDao.createOrUpdate(mod);
  }
 catch (  SQLException e) {
    throw new RuntimeException(e);
  }
}
Program: 134295
Project: 134295
Buggy source:
@Override public String toString(){
  return name;
}

Fixed version (ground truth):
@Override public String toString(){
  return getName();
}
Program: 134296
Project: 134296
Buggy source:
@Override public int hashCode(){
  return Integer.hashCode(id);
}

Fixed version (ground truth):
@Override public int hashCode(){
  return new Integer(id).hashCode();
}
Program: 134297
Project: 134297
Buggy source:
public static TinkerConfig create(){
  ConfigBuilder builder=new ConfigBuilder();
  builder.addBooleanProperty(AUTO_CHECK_FOR_MOD_UPDATES,false,false,false);
  builder.addBooleanProperty(STARTUP_CHECK_MM_UPDATES,true,false,false);
  builder.addPathProperty(GAMEDATA_PATH,JFileChooser.DIRECTORIES_ONLY,null,false,false);
  builder.addIntProperty(NUM_CONCURRENT_DOWNLOADS,4,1,null,false,false);
  builder.addStringProperty(KSP_WIN_LAUNCH_ARGS,null,true,false);
  builder.addStringProperty(WIN_64,null,true,true);
  Config config=builder.createConfigInDocuments(String.format("String_Node_Str",TinkerTime.SAFE_NAME),TinkerTime.NAME,"String_Node_Str");
  try {
    config.reload();
  }
 catch (  InvalidInputException|IOException e) {
    new OptionsWindow(config).toDialog();
    try {
      config.reload();
    }
 catch (    IOException|InvalidInputException e1) {
      throw new RuntimeException(e);
    }
  }
  return new TinkerConfig(config);
}

Fixed version (ground truth):
public static TinkerConfig create(){
  ConfigBuilder builder=new ConfigBuilder();
  builder.addBooleanProperty(AUTO_CHECK_FOR_MOD_UPDATES,false,false,false);
  builder.addBooleanProperty(STARTUP_CHECK_MM_UPDATES,true,false,false);
  builder.addPathProperty(GAMEDATA_PATH,JFileChooser.DIRECTORIES_ONLY,null,false,false);
  builder.addIntProperty(NUM_CONCURRENT_DOWNLOADS,4,1,null,false,false);
  builder.addStringProperty(KSP_WIN_LAUNCH_ARGS,null,true,false);
  Config config=builder.createConfigInDocuments(String.format("String_Node_Str",TinkerTime.SAFE_NAME),TinkerTime.NAME,"String_Node_Str");
  try {
    config.reload();
    if (config.getProperty(GAMEDATA_PATH).getValueAsString() == null) {
      throw new IllegalStateException();
    }
  }
 catch (  InvalidInputException|IOException|IllegalStateException e) {
    new OptionsWindow(config).toDialog();
    try {
      config.reload();
    }
 catch (    IOException|InvalidInputException e1) {
      throw new RuntimeException(e);
    }
  }
  return new TinkerConfig(config);
}
Program: 134298
Project: 134298
Buggy source:
public void updateMods() throws ModUpdateFailedError, ModNotDownloadedException {
  for (  Mod mod : modLoader.getMods()) {
    updateMod(mod,false);
  }
}

Fixed version (ground truth):
public void updateMods() throws ModUpdateFailedError, ModNotDownloadedException {
  for (  Mod mod : modLoader.getMods()) {
    if (mod.isUpdateable()) {
      updateMod(mod,false);
    }
  }
}
Program: 134299
Project: 134299
Buggy source:
public void downloadMod(URL url) throws UnsupportedHostException {
  ModWorkflowBuilder builder=new ModWorkflowBuilder(Mod.newTempMod(url),crawlerFactory);
  builder.downloadNewMod(config,modLoader);
  submitDownloadWorkflow(builder);
}

Fixed version (ground truth):
public void downloadMod(URL url) throws UnsupportedHostException, MalformedURLException {
  ModWorkflowBuilder builder=new ModWorkflowBuilder(Mod.newTempMod(crawlerFactory.getCrawler(url)),crawlerFactory);
  builder.downloadNewMod(config,modLoader);
  submitDownloadWorkflow(builder);
}
Program: 134300
Project: 134300
Buggy source:
/** 
 * Loads the mods from the given file and returns them.
 * @param path file to get mods from
 * @param mm ModManager reference
 * @return set of mods loaded from the file
 */
private Set<Mod> loadMods(Path path,ModManager mm){
  Set<Mod> mods=new HashSet<>();
  try (FileReader reader=new FileReader(path.toFile())){
    Set<Mod> newMods=gson.fromJson(reader,modsType);
    for (    Mod newMod : newMods) {
      if (newMod.isUpdateable() || isDownloaded(newMod) || trySatisfyLocalFiles(newMod,mm)) {
        mods.add(newMod);
      }
    }
  }
 catch (  FileNotFoundException e) {
  }
catch (  IOException e1) {
    e1.printStackTrace();
  }
  DefaultMods.ensureDefaults(mods);
  return mods;
}

Fixed version (ground truth):
/** 
 * Loads the mods from the given file and returns them.
 * @param path file to get mods from
 * @param mm ModManager reference
 * @return set of mods loaded from the file
 */
private Set<Mod> loadMods(Path path,ModManager mm){
  Set<Mod> mods=new HashSet<>();
  try (FileReader reader=new FileReader(path.toFile())){
    Set<Mod> newMods=gson.fromJson(reader,MODS_TYPE);
    for (    Mod newMod : newMods) {
      if (newMod.isUpdateable() || isDownloaded(newMod) || trySatisfyLocalFiles(newMod,mm)) {
        mods.add(newMod);
      }
    }
  }
 catch (  FileNotFoundException e) {
  }
catch (  IOException e1) {
    e1.printStackTrace();
  }
  DefaultMods.ensureDefaults(mods);
  return mods;
}
Program: 134301
Project: 134301
Buggy source:
public synchronized boolean isEnabled(Mod mod) throws ModNotDownloadedException {
  for (  Path filePath : getModFileDestPaths(mod)) {
    if (!filePath.toFile().exists()) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
public synchronized boolean isEnabled(Mod mod) throws ModNotDownloadedException {
  for (  Path filePath : getModFileDestPaths(mod)) {
    if (filePath.getFileName().toString().contains("String_Node_Str") && !filePath.toFile().exists()) {
      return false;
    }
  }
  return true;
}
Program: 134302
Project: 134302
Buggy source:
private void saveMods(Set<Mod> mods,Path path){
  try (FileWriter writer=new FileWriter(path.toFile())){
    gson.toJson(mods,modsType,writer);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
private void saveMods(Set<Mod> mods,Path path){
  try (FileWriter writer=new FileWriter(path.toFile())){
    gson.toJson(mods,MODS_TYPE,writer);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 134303
Project: 134303
Buggy source:
public void addModZip(Path zipPath){
  ModWorkflowBuilder builder=new ModWorkflowBuilder("String_Node_Str" + zipPath);
  builder.addLocalMod(zipPath,config,loader);
  builder.addListener(new TaskCallback.WorkflowCompleteCallback(){
    @Override protected void processTaskEvent(    TaskEvent event){
      Mod mod=(Mod)event.data;
      loader.modUpdated(mod);
    }
  }
);
  submitDownloadWorkflow(builder);
}

Fixed version (ground truth):
public void addModZip(Path zipPath){
  ModWorkflowBuilder builder=new ModWorkflowBuilder("String_Node_Str" + zipPath);
  final Mod futureMod=builder.addLocalMod(zipPath,config,loader);
  builder.refreshModAfterWorkflowComplete(futureMod,loader);
  submitDownloadWorkflow(builder);
}
Program: 134304
Project: 134304
Buggy source:
public void toggleMod(final Mod mod) throws IOException {
  if (!mod.isDownloaded(config)) {
    throw new ModNotDownloadedError(mod,"String_Node_Str");
  }
  ModWorkflowBuilder builder=new ModWorkflowBuilder("String_Node_Str" + mod);
  if (mod.isEnabled(config)) {
    builder.disableMod(mod,config,loader);
  }
 else {
    builder.enableMod(mod,config,loader,cr);
  }
  builder.addListener(new TaskCallback.WorkflowCompleteCallback(){
    @Override protected void processTaskEvent(    TaskEvent event){
      loader.modUpdated(mod);
    }
  }
);
  submitEnablerWorkflow(builder);
}

Fixed version (ground truth):
public void toggleMod(final Mod mod) throws IOException {
  if (!mod.isDownloaded(config)) {
    throw new ModNotDownloadedError(mod,"String_Node_Str");
  }
  ModWorkflowBuilder builder=new ModWorkflowBuilder("String_Node_Str" + mod);
  if (mod.isEnabled(config)) {
    builder.disableMod(mod,config,loader);
  }
 else {
    builder.enableMod(mod,config,loader,cr);
  }
  builder.refreshModAfterWorkflowComplete(mod,loader);
  submitEnablerWorkflow(builder);
}
Program: 134305
Project: 134305
Buggy source:
public void addLocalMod(Path zipPath,TinkerConfig config,ModLoader sm){
  String fileName=zipPath.getFileName().toString();
  String prettyName=fileName;
  if (prettyName.indexOf("String_Node_Str") > 0) {
    prettyName=prettyName.substring(0,prettyName.lastIndexOf("String_Node_Str"));
  }
  Mod newMod=new Mod(fileName,prettyName,fileName,null,null,Calendar.getInstance().getTime(),null);
  copy(zipPath,newMod.getCachedZipPath(config));
}

Fixed version (ground truth):
public Mod addLocalMod(Path zipPath,TinkerConfig config,ModLoader sm){
  String fileName=zipPath.getFileName().toString();
  String prettyName=fileName;
  if (prettyName.indexOf("String_Node_Str") > 0) {
    prettyName=prettyName.substring(0,prettyName.lastIndexOf("String_Node_Str"));
  }
  Mod newMod=new Mod(fileName,prettyName,fileName,null,null,Calendar.getInstance().getTime(),null);
  copy(zipPath,newMod.getCachedZipPath(config));
  return newMod;
}
Program: 134306
Project: 134306
Buggy source:
public synchronized void init(ModManager mm){
  for (  SelectorInterface<Mod> l : getListeners()) {
    l.clear();
  }
  importMods(config.getModsListPath(),mm);
}

Fixed version (ground truth):
public synchronized void init(ModManager mm){
  for (  SelectorInterface<Mod> l : getListeners()) {
    l.clear();
  }
  modCache.clear();
  importMods(config.getModsListPath(),mm);
}
Program: 134307
Project: 134307
Buggy source:
@Override public JsonElement getPage(URL url) throws IOException {
  List<String> paths=Arrays.asList(url.getPath().split("String_Node_Str"));
  if (paths.contains(RELEASES)) {
    if (!paths.get(paths.size() - 1).equals(RELEASES)) {
      url=new URL(url.toString().split(RELEASES)[0]);
    }
  }
 else {
    url=new URL(url.toString() + "String_Node_Str" + RELEASES);
  }
  return super.getPage(url);
}

Fixed version (ground truth):
@Override public JsonElement getPage(URL url) throws IOException {
  List<String> paths=Arrays.asList(url.getPath().split("String_Node_Str"));
  if (paths.contains(RELEASES)) {
    if (!paths.get(paths.size() - 1).equals(RELEASES)) {
      url=new URL(url.toString().split(RELEASES)[0]);
    }
  }
 else {
    url=new URL(String.format("String_Node_Str",url,RELEASES));
  }
  return super.getPage(url);
}
Program: 134308
Project: 134308
Buggy source:
public Mod createMod() throws IOException {
  if (cachedMod != null) {
    cachedMod=new Mod(crawler.generateId(),crawler.getName(),crawler.getNewestFileName(),crawler.getCreator(),crawler.getImageUrl(),crawler.getPageUrl(),crawler.getUpdatedOn() != null ? crawler.getUpdatedOn() : Calendar.getInstance().getTime(),crawler.getSupportedVersion());
  }
  return cachedMod;
}

Fixed version (ground truth):
public Mod createMod() throws IOException {
  if (cachedMod == null) {
    cachedMod=new Mod(crawler.generateId(),crawler.getName(),crawler.getNewestFileName(),crawler.getCreator(),crawler.getImageUrl(),crawler.getPageUrl(),crawler.getUpdatedOn() != null ? crawler.getUpdatedOn() : Calendar.getInstance().getTime(),crawler.getSupportedVersion());
  }
  return cachedMod;
}
Program: 134309
Project: 134309
Buggy source:
@Override public URL getImageUrl() throws IOException {
  JsonElement bgElement=getPage(getApiUrl()).get("String_Node_Str");
  if (!bgElement.isJsonNull()) {
    return new URL("String_Node_Str","String_Node_Str",bgElement.getAsString());
  }
  return null;
}

Fixed version (ground truth):
@Override public URL getImageUrl() throws IOException {
  JsonElement bgElement=getPage(getApiUrl()).get("String_Node_Str");
  if (!bgElement.isJsonNull()) {
    return new URL("String_Node_Str",getApiUrl().getHost(),bgElement.getAsString());
  }
  return null;
}
Program: 134310
Project: 134310
Buggy source:
public void modDeleted(Mod mod){
  modCache.remove(mod);
  for (  SelectorInterface<Mod> l : getListeners()) {
    l.removeElement(mod);
  }
  saveMods(modCache,config.getModsListPath());
}

Fixed version (ground truth):
public synchronized void modDeleted(Mod mod){
  modCache.remove(mod);
  for (  SelectorInterface<Mod> l : getListeners()) {
    l.removeElement(mod);
  }
  saveMods(modCache,config.getModsListPath());
}
Program: 134311
Project: 134311
Buggy source:
private static String getReadmeText(final ZipFile zipFile){
  for (  ZipEntry entry : new HashSet<ZipEntry>(Collections.list(zipFile.entries()))) {
    if (!entry.isDirectory() && entry.getName().toLowerCase().contains("String_Node_Str")) {
      try (StringWriter writer=new StringWriter()){
        IOUtils.copy(zipFile.getInputStream(entry),writer);
        return writer.toString();
      }
 catch (      IOException e) {
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private static String getReadmeText(final ZipFile zipFile){
  for (  ZipEntry entry : new HashSet<ZipEntry>(Collections.list(zipFile.entries()))) {
    if (!entry.isDirectory() && entry.getName().toLowerCase().contains("String_Node_Str")) {
      try (StringWriter writer=new StringWriter();InputStream is=zipFile.getInputStream(entry)){
        IOUtils.copy(is,writer);
        return writer.toString();
      }
 catch (      IOException e) {
      }
    }
  }
  return null;
}
Program: 134312
Project: 134312
Buggy source:
@Override public URL getImageUrl() throws IOException {
  String imagePath=getPage(getApiUrl()).get("String_Node_Str").getAsString();
  return new URL("String_Node_Str","String_Node_Str",imagePath);
}

Fixed version (ground truth):
@Override public URL getImageUrl() throws IOException {
  JsonElement bgElement=getPage(getApiUrl()).get("String_Node_Str");
  if (!bgElement.isJsonNull()) {
    return new URL("String_Node_Str","String_Node_Str",bgElement.getAsString());
  }
  return null;
}
Program: 134313
Project: 134313
Buggy source:
private static URLGen modImageLinkGen(final ModCrawler<?> crawler){
  return new URLGen(){
    @Override public URI getURI() throws URISyntaxException {
      return getURL().toURI();
    }
    @Override public URL getURL(){
      try {
        return crawler.getImageUrl();
      }
 catch (      IOException e) {
        throw new RuntimeException(e);
      }
    }
  }
;
}

Fixed version (ground truth):
private static URLGen modImageLinkGen(final ModCrawler<?> crawler){
  return new URLGen(){
    @Override public URI getURI() throws URISyntaxException {
      URL url=getURL();
      return url != null ? url.toURI() : null;
    }
    @Override public URL getURL(){
      try {
        return crawler.getImageUrl();
      }
 catch (      IOException e) {
        throw new RuntimeException(e);
      }
    }
  }
;
}
Program: 134314
Project: 134314
Buggy source:
public void enableMod(Mod mod,TinkerConfig config,ModStateManager sm,ConflictResolver cr) throws IOException {
  if (mod.getNewestFileName().toLowerCase().endsWith("String_Node_Str")) {
    ModStructure structure=ModStructure.inspectArchive(config,mod);
    for (    ZipNode module : structure.getModules()) {
      addTask(new UnzipTask(config.getGameDataPath(),module,cr));
    }
  }
 else {
    copy(mod.getCachedZipPath(config),config.getGameDataPath());
  }
  addTask(new MarkModEnabledTask(mod,sm,true));
}

Fixed version (ground truth):
public void enableMod(Mod mod,TinkerConfig config,ModStateManager sm,ConflictResolver cr) throws IOException {
  if (modHasArchive(mod)) {
    ModStructure structure=ModStructure.inspectArchive(config,mod);
    for (    ZipNode module : structure.getModules()) {
      addTask(new UnzipTask(config.getGameDataPath(),module,cr));
    }
  }
 else {
    copy(mod.getCachedZipPath(config),config.getGameDataPath());
  }
  addTask(new MarkModEnabledTask(mod,sm,true));
}
Program: 134315
Project: 134315
Buggy source:
public void disableMod(Mod mod,TinkerConfig config,ModStateManager sm) throws IOException {
  if (mod.getNewestFileName().toLowerCase().endsWith("String_Node_Str")) {
    for (    ZipNode module : ModStructure.inspectArchive(config,mod).getModules()) {
      if (!isDependency(module,config,sm)) {
        delete(config.getGameDataPath().resolve(module.getName()));
      }
    }
  }
 else {
    delete(config.getGameDataPath().resolve(mod.getNewestFileName()));
  }
  addTask(new MarkModEnabledTask(mod,sm,false));
}

Fixed version (ground truth):
public void disableMod(Mod mod,TinkerConfig config,ModStateManager sm) throws IOException {
  if (modHasArchive(mod)) {
    for (    ZipNode module : ModStructure.inspectArchive(config,mod).getModules()) {
      if (!isDependency(module,config,sm)) {
        delete(config.getGameDataPath().resolve(module.getName()));
      }
    }
  }
 else {
    delete(config.getGameDataPath().resolve(mod.getNewestFileName()));
  }
  addTask(new MarkModEnabledTask(mod,sm,false));
}
Program: 134316
Project: 134316
Buggy source:
private boolean isDependency(ZipNode module,TinkerConfig config,ModStateManager sm) throws IOException {
  int numDependencies=0;
  for (  Mod mod : sm.getMods()) {
    try {
      if (ModStructure.inspectArchive(config,mod).usesModule(module)) {
        numDependencies++;
      }
    }
 catch (    FileNotFoundException ex) {
    }
  }
  return numDependencies > 1;
}

Fixed version (ground truth):
private boolean isDependency(ZipNode module,TinkerConfig config,ModStateManager sm) throws IOException {
  int numDependencies=0;
  for (  Mod mod : sm.getMods()) {
    try {
      if (modHasArchive(mod) && ModStructure.inspectArchive(config,mod).usesModule(module)) {
        numDependencies++;
      }
    }
 catch (    FileNotFoundException ex) {
    }
  }
  return numDependencies > 1;
}
Program: 134317
Project: 134317
Buggy source:
@Override public URL getImageUrl() throws IOException {
  String imagePath=getPage(getApiUrl()).get("String_Node_Str").getAsString();
  return new URL("String_Node_Str","String_Node_Str",imagePath);
}

Fixed version (ground truth):
@Override public URL getImageUrl() throws IOException {
  JsonElement bgElement=getPage(getApiUrl()).get("String_Node_Str");
  if (!bgElement.isJsonNull()) {
    return new URL("String_Node_Str","String_Node_Str",bgElement.getAsString());
  }
  return null;
}
Program: 134318
Project: 134318
Buggy source:
private static URLGen modImageLinkGen(final ModCrawler<?> crawler){
  return new URLGen(){
    @Override public URI getURI() throws URISyntaxException {
      return getURL().toURI();
    }
    @Override public URL getURL(){
      try {
        return crawler.getImageUrl();
      }
 catch (      IOException e) {
        throw new RuntimeException(e);
      }
    }
  }
;
}

Fixed version (ground truth):
private static URLGen modImageLinkGen(final ModCrawler<?> crawler){
  return new URLGen(){
    @Override public URI getURI() throws URISyntaxException {
      URL url=getURL();
      return url != null ? url.toURI() : null;
    }
    @Override public URL getURL(){
      try {
        return crawler.getImageUrl();
      }
 catch (      IOException e) {
        throw new RuntimeException(e);
      }
    }
  }
;
}