nus-yam/ex-repair huggingface dataset:
Program: 165908
Project: 165908
Buggy source:
private void updateSettings(){
  RFToolsMessages.INSTANCE.sendToServer(new PacketUpdateNBTItem(new Argument("String_Node_Str",parseInt(dimX.getText())),new Argument("String_Node_Str",parseInt(dimY.getText())),new Argument("String_Node_Str",parseInt(dimZ.getText())),new Argument("String_Node_Str",parseInt(offsetX.getText())),new Argument("String_Node_Str",parseInt(offsetY.getText())),new Argument("String_Node_Str",parseInt(offsetZ.getText()))));
}

Fixed version (ground truth):
private void updateSettings(){
  if (isTorus()) {
    dimZ.setText(dimX.getText());
  }
  RFToolsMessages.INSTANCE.sendToServer(new PacketUpdateNBTItem(new Argument("String_Node_Str",getCurrentShape().getIndex()),new Argument("String_Node_Str",parseInt(dimX.getText())),new Argument("String_Node_Str",parseInt(dimY.getText())),new Argument("String_Node_Str",parseInt(dimZ.getText())),new Argument("String_Node_Str",parseInt(offsetX.getText())),new Argument("String_Node_Str",parseInt(offsetY.getText())),new Argument("String_Node_Str",parseInt(offsetZ.getText()))));
}
Program: 165909
Project: 165909
Buggy source:
private int calculateRfPerTick(){
  if (!shieldActive) {
    return 0;
  }
  int rf=ShieldConfiguration.rfBase;
  if (ShieldRenderingMode.MODE_SHIELD.equals(shieldRenderingMode)) {
    rf+=ShieldConfiguration.rfShield;
  }
 else   if (ShieldRenderingMode.MODE_SOLID.equals(shieldRenderingMode)) {
    rf+=ShieldConfiguration.rfCamo;
  }
  return rf;
}

Fixed version (ground truth):
private int calculateRfPerTick(){
  if (!shieldActive) {
    return 0;
  }
  int s=shieldBlocks.size() - 50;
  if (s < 10) {
    s=10;
  }
  int rf=ShieldConfiguration.rfBase * s / 10;
  if (ShieldRenderingMode.MODE_SHIELD.equals(shieldRenderingMode)) {
    rf+=ShieldConfiguration.rfShield * s / 10;
  }
 else   if (ShieldRenderingMode.MODE_SOLID.equals(shieldRenderingMode)) {
    rf+=ShieldConfiguration.rfCamo * s / 10;
  }
  return rf;
}
Program: 165910
Project: 165910
Buggy source:
public void clearSupportBlocks(){
  if (isShapeCard()) {
    clearSupportBlocksShaped();
    return;
  }
  SpaceChamberRepository.SpaceChamberChannel chamberChannel=calculateBox();
  if (chamberChannel != null) {
    int dimension=chamberChannel.getDimension();
    World world=DimensionManager.getWorld(dimension);
    for (int x=minBox.getX(); x <= maxBox.getX(); x++) {
      for (int y=minBox.getY(); y <= maxBox.getY(); y++) {
        for (int z=minBox.getZ(); z <= maxBox.getZ(); z++) {
          Coordinate src=new Coordinate(x,y,z);
          if (world != null) {
            Block srcBlock=world.getBlock(src.getX(),src.getY(),src.getZ());
            if (srcBlock == SpaceProjectorSetup.supportBlock) {
              world.setBlockToAir(src.getX(),src.getY(),src.getZ());
            }
          }
          Coordinate dest=sourceToDest(src);
          Block dstBlock=worldObj.getBlock(dest.getX(),dest.getY(),dest.getZ());
          if (dstBlock == SpaceProjectorSetup.supportBlock) {
            worldObj.setBlockToAir(dest.getX(),dest.getY(),dest.getZ());
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
public void clearSupportBlocks(){
  if (worldObj.isRemote) {
    return;
  }
  if (isShapeCard()) {
    clearSupportBlocksShaped();
    return;
  }
  SpaceChamberRepository.SpaceChamberChannel chamberChannel=calculateBox();
  if (chamberChannel != null) {
    int dimension=chamberChannel.getDimension();
    World world=DimensionManager.getWorld(dimension);
    for (int x=minBox.getX(); x <= maxBox.getX(); x++) {
      for (int y=minBox.getY(); y <= maxBox.getY(); y++) {
        for (int z=minBox.getZ(); z <= maxBox.getZ(); z++) {
          Coordinate src=new Coordinate(x,y,z);
          if (world != null) {
            Block srcBlock=world.getBlock(src.getX(),src.getY(),src.getZ());
            if (srcBlock == SpaceProjectorSetup.supportBlock) {
              world.setBlockToAir(src.getX(),src.getY(),src.getZ());
            }
          }
          Coordinate dest=sourceToDest(src);
          Block dstBlock=worldObj.getBlock(dest.getX(),dest.getY(),dest.getZ());
          if (dstBlock == SpaceProjectorSetup.supportBlock) {
            worldObj.setBlockToAir(dest.getX(),dest.getY(),dest.getZ());
          }
        }
      }
    }
  }
}
Program: 165911
Project: 165911
Buggy source:
private void clearInvisibleBlocks(World world,int x,int y,int z,int meta,int size){
  if (meta == 2) {
    for (int i=0; i <= size; i++) {
      for (int j=0; j <= size; j++) {
        if (i != 0 && j != 0) {
          clearInvisibleBlockSafe(world,x - i,y - j,z);
        }
      }
    }
  }
  if (meta == 3) {
    for (int i=0; i <= size; i++) {
      for (int j=0; j <= size; j++) {
        if (i != 0 && j != 0) {
          clearInvisibleBlockSafe(world,x + i,y - j,z);
        }
      }
    }
  }
  if (meta == 4) {
    for (int i=0; i <= size; i++) {
      for (int j=0; j <= size; j++) {
        if (i != 0 && j != 0) {
          clearInvisibleBlockSafe(world,x,y - i,z + j);
        }
      }
    }
  }
  if (meta == 5) {
    for (int i=0; i <= size; i++) {
      for (int j=0; j <= size; j++) {
        if (i != 0 && j != 0) {
          clearInvisibleBlockSafe(world,x,y - i,z - j);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void clearInvisibleBlocks(World world,int x,int y,int z,int meta,int size){
  if (meta == 2) {
    for (int i=0; i <= size; i++) {
      for (int j=0; j <= size; j++) {
        if (i != 0 || j != 0) {
          clearInvisibleBlockSafe(world,x - i,y - j,z);
        }
      }
    }
  }
  if (meta == 3) {
    for (int i=0; i <= size; i++) {
      for (int j=0; j <= size; j++) {
        if (i != 0 || j != 0) {
          clearInvisibleBlockSafe(world,x + i,y - j,z);
        }
      }
    }
  }
  if (meta == 4) {
    for (int i=0; i <= size; i++) {
      for (int j=0; j <= size; j++) {
        if (i != 0 || j != 0) {
          clearInvisibleBlockSafe(world,x,y - i,z + j);
        }
      }
    }
  }
  if (meta == 5) {
    for (int i=0; i <= size; i++) {
      for (int j=0; j <= size; j++) {
        if (i != 0 || j != 0) {
          clearInvisibleBlockSafe(world,x,y - i,z - j);
        }
      }
    }
  }
}
Program: 165912
Project: 165912
Buggy source:
private void setInvisibleBlocks(World world,int x,int y,int z,int size){
  int meta=world.getBlockMetadata(x,y,z);
  if (meta == 2) {
    for (int i=0; i <= size; i++) {
      for (int j=0; j <= size; j++) {
        if (i != 0 && j != 0) {
          setInvisibleBlockSafe(world,x,y,z,-i,-j,0,meta);
        }
      }
    }
  }
  if (meta == 3) {
    for (int i=0; i <= size; i++) {
      for (int j=0; j <= size; j++) {
        if (i != 0 && j != 0) {
          setInvisibleBlockSafe(world,x,y,z,i,-j,0,meta);
        }
      }
    }
  }
  if (meta == 4) {
    for (int i=0; i <= size; i++) {
      for (int j=0; j <= size; j++) {
        if (i != 0 && j != 0) {
          setInvisibleBlockSafe(world,x,y,z,0,-i,j,meta);
        }
      }
    }
  }
  if (meta == 5) {
    for (int i=0; i <= size; i++) {
      for (int j=0; j <= size; j++) {
        if (i != 0 && j != 0) {
          setInvisibleBlockSafe(world,x,y,z,0,-i,-j,meta);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void setInvisibleBlocks(World world,int x,int y,int z,int size){
  int meta=world.getBlockMetadata(x,y,z);
  if (meta == 2) {
    for (int i=0; i <= size; i++) {
      for (int j=0; j <= size; j++) {
        if (i != 0 || j != 0) {
          setInvisibleBlockSafe(world,x,y,z,-i,-j,0,meta);
        }
      }
    }
  }
  if (meta == 3) {
    for (int i=0; i <= size; i++) {
      for (int j=0; j <= size; j++) {
        if (i != 0 || j != 0) {
          setInvisibleBlockSafe(world,x,y,z,i,-j,0,meta);
        }
      }
    }
  }
  if (meta == 4) {
    for (int i=0; i <= size; i++) {
      for (int j=0; j <= size; j++) {
        if (i != 0 || j != 0) {
          setInvisibleBlockSafe(world,x,y,z,0,-i,j,meta);
        }
      }
    }
  }
  if (meta == 5) {
    for (int i=0; i <= size; i++) {
      for (int j=0; j <= size; j++) {
        if (i != 0 || j != 0) {
          setInvisibleBlockSafe(world,x,y,z,0,-i,-j,meta);
        }
      }
    }
  }
}
Program: 165913
Project: 165913
Buggy source:
@Override public void updateWeather(){
  super.updateWeather();
  if (!worldObj.isRemote) {
    getDimensionInformation();
    if (dimensionInformation != null) {
      WeatherDescriptor descriptor=dimensionInformation.getWeatherDescriptor();
      float rs=descriptor.getRainStrength();
      if (rs > -0.5f) {
        worldObj.rainingStrength=rs;
        if (Math.abs(worldObj.rainingStrength) < 0.001) {
          worldObj.setRainStrength(0);
          worldObj.getWorldInfo().setRaining(false);
        }
      }
      float ts=descriptor.getThunderStrength();
      if (ts > -0.5f) {
        worldObj.thunderingStrength=ts;
        if (Math.abs(worldObj.thunderingStrength) < 0.001) {
          worldObj.setThunderStrength(0);
          worldObj.getWorldInfo().setThundering(false);
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void updateWeather(){
  super.updateWeather();
  if (!worldObj.isRemote) {
    getDimensionInformation();
    if (dimensionInformation != null) {
      WeatherDescriptor descriptor=dimensionInformation.getWeatherDescriptor();
      float rs=descriptor.getRainStrength();
      if (rs > -0.5f) {
        worldObj.rainingStrength=rs;
        if (Math.abs(worldObj.rainingStrength) < 0.001) {
          worldObj.prevRainingStrength=0;
          worldObj.rainingStrength=0;
          worldObj.getWorldInfo().setRaining(false);
        }
      }
      float ts=descriptor.getThunderStrength();
      if (ts > -0.5f) {
        worldObj.thunderingStrength=ts;
        if (Math.abs(worldObj.thunderingStrength) < 0.001) {
          worldObj.prevThunderingStrength=0;
          worldObj.thunderingStrength=0;
          worldObj.getWorldInfo().setThundering(false);
        }
      }
    }
  }
}
Program: 165914
Project: 165914
Buggy source:
public void copyFromModule(ItemStack stack){
  for (int i=ModularStorageContainer.SLOT_STORAGE; i < inventoryHelper.getCount(); i++) {
    inventoryHelper.setInventorySlotContents(0,i,null);
  }
  if (stack == null) {
    setMaxSize(0);
    numStacks=-1;
    return;
  }
  System.out.println("String_Node_Str" + stack);
  remoteId=0;
  if (stack.getItemDamage() == StorageModuleItem.STORAGE_REMOTE) {
    NBTTagCompound tagCompound=stack.getTagCompound();
    if (tagCompound == null || !tagCompound.hasKey("String_Node_Str")) {
      setMaxSize(0);
      numStacks=-1;
      return;
    }
    remoteId=tagCompound.getInteger("String_Node_Str");
    RemoteStorageTileEntity remoteStorageTileEntity=getRemoteStorage(remoteId);
    if (remoteStorageTileEntity == null) {
      setMaxSize(0);
      numStacks=-1;
      return;
    }
    ItemStack storageStack=remoteStorageTileEntity.findStorageWithId(remoteId);
    if (storageStack == null) {
      setMaxSize(0);
      numStacks=-1;
      return;
    }
    setMaxSize(StorageModuleItem.MAXSIZE[storageStack.getItemDamage()]);
  }
 else {
    setMaxSize(StorageModuleItem.MAXSIZE[stack.getItemDamage()]);
    NBTTagCompound tagCompound=stack.getTagCompound();
    if (tagCompound != null) {
      readBufferFromItemNBT(tagCompound);
    }
  }
  updateStackCount();
}

Fixed version (ground truth):
public void copyFromModule(ItemStack stack){
  for (int i=ModularStorageContainer.SLOT_STORAGE; i < inventoryHelper.getCount(); i++) {
    inventoryHelper.setInventorySlotContents(0,i,null);
  }
  if (stack == null) {
    setMaxSize(0);
    numStacks=-1;
    return;
  }
  remoteId=0;
  if (stack.getItemDamage() == StorageModuleItem.STORAGE_REMOTE) {
    NBTTagCompound tagCompound=stack.getTagCompound();
    if (tagCompound == null || !tagCompound.hasKey("String_Node_Str")) {
      setMaxSize(0);
      numStacks=-1;
      return;
    }
    remoteId=tagCompound.getInteger("String_Node_Str");
    RemoteStorageTileEntity remoteStorageTileEntity=getRemoteStorage(remoteId);
    if (remoteStorageTileEntity == null) {
      setMaxSize(0);
      numStacks=-1;
      return;
    }
    ItemStack storageStack=remoteStorageTileEntity.findStorageWithId(remoteId);
    if (storageStack == null) {
      setMaxSize(0);
      numStacks=-1;
      return;
    }
    setMaxSize(StorageModuleItem.MAXSIZE[storageStack.getItemDamage()]);
  }
 else {
    setMaxSize(StorageModuleItem.MAXSIZE[stack.getItemDamage()]);
    NBTTagCompound tagCompound=stack.getTagCompound();
    if (tagCompound != null) {
      readBufferFromItemNBT(tagCompound);
    }
  }
  updateStackCount();
}
Program: 165915
Project: 165915
Buggy source:
public void copyToModule(){
  ItemStack stack=inventoryHelper.getStackInSlot(ModularStorageContainer.SLOT_STORAGE_MODULE);
  if (stack == null) {
    return;
  }
  System.out.println("String_Node_Str" + stack);
  if (stack.getItemDamage() == StorageModuleItem.STORAGE_REMOTE) {
    return;
  }
  NBTTagCompound tagCompound=stack.getTagCompound();
  if (tagCompound == null) {
    tagCompound=new NBTTagCompound();
    stack.setTagCompound(tagCompound);
  }
  int cnt=writeBufferToItemNBT(tagCompound);
  tagCompound.setInteger("String_Node_Str",cnt);
}

Fixed version (ground truth):
public void copyToModule(){
  ItemStack stack=inventoryHelper.getStackInSlot(ModularStorageContainer.SLOT_STORAGE_MODULE);
  if (stack == null) {
    return;
  }
  if (stack.getItemDamage() == StorageModuleItem.STORAGE_REMOTE) {
    remoteId=0;
    return;
  }
  NBTTagCompound tagCompound=stack.getTagCompound();
  if (tagCompound == null) {
    tagCompound=new NBTTagCompound();
    stack.setTagCompound(tagCompound);
  }
  int cnt=writeBufferToItemNBT(tagCompound);
  tagCompound.setInteger("String_Node_Str",cnt);
}
Program: 165916
Project: 165916
Buggy source:
@Override protected Slot createSlot(SlotFactory slotFactory,IInventory inventory,int index,int x,int y,SlotType slotType){
  if (index >= SLOT_BUFFER && index < SLOT_BUFFEROUT && slotType == SlotType.SLOT_INPUT) {
    return new BaseSlot(inventory,index,x,y){
      @Override public boolean isItemValid(      ItemStack stack){
        if (!crafterBaseTE.isItemValidForSlot(getSlotIndex(),stack)) {
          return false;
        }
        return super.isItemValid(stack);
      }
    }
;
  }
  return super.createSlot(slotFactory,inventory,index,x,y,slotType);
}

Fixed version (ground truth):
@Override protected Slot createSlot(SlotFactory slotFactory,IInventory inventory,int index,int x,int y,SlotType slotType){
  if (index >= SLOT_BUFFER && index < SLOT_BUFFEROUT && slotType == SlotType.SLOT_INPUT) {
    return new BaseSlot(inventory,index,x,y){
      @Override public boolean isItemValid(      ItemStack stack){
        if (!crafterBaseTE.isItemValidForSlot(getSlotIndex(),stack)) {
          return false;
        }
        return super.isItemValid(stack);
      }
    }
;
  }
  if (index == SLOT_CRAFTOUTPUT) {
    return new GhostOutputSlot(inventory,index,x,y){
      @Override public boolean isItemValid(      ItemStack stack){
        return false;
      }
    }
;
  }
  return super.createSlot(slotFactory,inventory,index,x,y,slotType);
}
Program: 165917
Project: 165917
Buggy source:
@Override public boolean isItemValid(ItemStack stack){
  if (!crafterBaseTE.isItemValidForSlot(getSlotIndex(),stack)) {
    return false;
  }
  return super.isItemValid(stack);
}

Fixed version (ground truth):
@Override public boolean isItemValid(ItemStack stack){
  return false;
}
Program: 165918
Project: 165918
Buggy source:
/** 
 * Consume energy on the receiving side and return a number indicating how good this went.
 * @param c
 * @param dimension
 * @return 0 in case of success. 10 in case of severe failure
 */
private static int consumeReceiverEnergy(EntityPlayer player,Coordinate c,int dimension){
  World world=DimensionManager.getWorld(dimension);
  TileEntity te=world.getTileEntity(c.getX(),c.getY(),c.getZ());
  if (!(te instanceof MatterReceiverTileEntity)) {
    Logging.warn(player,"String_Node_Str");
    return 0;
  }
  MatterReceiverTileEntity matterReceiverTileEntity=(MatterReceiverTileEntity)te;
  int rf=TeleportConfiguration.rfPerTeleportReceiver;
  rf=(int)(rf * (2.0f - matterReceiverTileEntity.getInfusedFactor()) / 2.0f);
  int extracted=rf;
  if (rf > matterReceiverTileEntity.getEnergyStored(ForgeDirection.DOWN)) {
    extracted=matterReceiverTileEntity.getEnergyStored(ForgeDirection.DOWN);
  }
  matterReceiverTileEntity.consumeEnergy(rf);
  int remainingRf=matterReceiverTileEntity.getEnergyStored(ForgeDirection.DOWN);
  if (remainingRf <= 1) {
    Logging.warn(player,"String_Node_Str");
  }
 else   if (remainingRf < (TeleportConfiguration.RECEIVER_MAXENERGY / 10)) {
    Logging.warn(player,"String_Node_Str");
  }
 else   if (remainingRf < (TeleportConfiguration.RECEIVER_MAXENERGY / 5)) {
    Logging.warn(player,"String_Node_Str");
  }
  return 10 - (extracted * 10 / rf);
}

Fixed version (ground truth):
/** 
 * Consume energy on the receiving side and return a number indicating how good this went.
 * @param c
 * @param dimension
 * @return 0 in case of success. 10 in case of severe failure
 */
private static int consumeReceiverEnergy(EntityPlayer player,Coordinate c,int dimension){
  World world=DimensionManager.getWorld(dimension);
  TileEntity te=world.getTileEntity(c.getX(),c.getY(),c.getZ());
  if (!(te instanceof MatterReceiverTileEntity)) {
    Logging.warn(player,"String_Node_Str");
    return 0;
  }
  MatterReceiverTileEntity matterReceiverTileEntity=(MatterReceiverTileEntity)te;
  int rf=TeleportConfiguration.rfPerTeleportReceiver;
  rf=(int)(rf * (2.0f - matterReceiverTileEntity.getInfusedFactor()) / 2.0f);
  if (rf <= 0) {
    return 0;
  }
  int extracted=rf;
  if (rf > matterReceiverTileEntity.getEnergyStored(ForgeDirection.DOWN)) {
    extracted=matterReceiverTileEntity.getEnergyStored(ForgeDirection.DOWN);
  }
  matterReceiverTileEntity.consumeEnergy(rf);
  int remainingRf=matterReceiverTileEntity.getEnergyStored(ForgeDirection.DOWN);
  if (remainingRf <= 1) {
    Logging.warn(player,"String_Node_Str");
  }
 else   if (remainingRf < (TeleportConfiguration.RECEIVER_MAXENERGY / 10)) {
    Logging.warn(player,"String_Node_Str");
  }
 else   if (remainingRf < (TeleportConfiguration.RECEIVER_MAXENERGY / 5)) {
    Logging.warn(player,"String_Node_Str");
  }
  return 10 - (extracted * 10 / rf);
}
Program: 165920
Project: 165920
Buggy source:
private boolean craftOneItemNew(CraftingRecipe craftingRecipe){
  IRecipe recipe=craftingRecipe.getCachedRecipe(worldObj);
  if (recipe == null) {
    return false;
  }
  Map<Integer,ItemStack> undo=new HashMap<Integer,ItemStack>();
  if (!testAndConsumeCraftingItems(craftingRecipe,undo)) {
    undo(undo);
    return false;
  }
  ItemStack result=recipe.getCraftingResult(craftingRecipe.getInventory());
  if (result != null && placeResult(craftingRecipe.isCraftInternal(),result,undo)) {
    return true;
  }
 else {
    undo(undo);
    return false;
  }
}

Fixed version (ground truth):
private boolean craftOneItemNew(CraftingRecipe craftingRecipe){
  IRecipe recipe=craftingRecipe.getCachedRecipe(worldObj);
  if (recipe == null) {
    return false;
  }
  Map<Integer,ItemStack> undo=new HashMap<Integer,ItemStack>();
  if (!testAndConsumeCraftingItems(craftingRecipe,undo)) {
    undo(undo);
    return false;
  }
  ItemStack result=recipe.getCraftingResult(workInventory);
  if (result != null && placeResult(craftingRecipe.isCraftInternal(),result,undo)) {
    return true;
  }
 else {
    undo(undo);
    return false;
  }
}
Program: 165921
Project: 165921
Buggy source:
public static void logError(String msg){
  if (instance == null) {
    instance=new Logging();
  }
  instance.logger.log(Level.ERROR,msg);
}

Fixed version (ground truth):
public static void logError(String msg){
  getInstance().logger.log(Level.ERROR,msg);
}
Program: 165922
Project: 165922
Buggy source:
public static void log(String message){
  instance.logger.log(Level.INFO,message);
}

Fixed version (ground truth):
public static void log(String message){
  getInstance().logger.log(Level.INFO,message);
}
Program: 165923
Project: 165923
Buggy source:
public static void logDebug(String message){
  if (debugMode) {
    instance.logger.log(Level.INFO,message);
  }
}

Fixed version (ground truth):
public static void logDebug(String message){
  if (debugMode) {
    getInstance().logger.log(Level.INFO,message);
  }
}
Program: 165924
Project: 165924
Buggy source:
@Override public void onBlockPlacedBy(World world,int x,int y,int z,EntityLivingBase entityLivingBase,ItemStack itemStack){
  if (horizRotation) {
    ForgeDirection dir=BlockTools.determineOrientationHoriz(entityLivingBase);
    int meta=world.getBlockMetadata(x,y,z);
    int power=world.isBlockProvidingPowerTo(x + dir.offsetX,y + dir.offsetY,z + dir.offsetZ,dir.ordinal());
    meta=BlockTools.setRedstoneSignalIn(meta,power > 0);
    world.setBlockMetadataWithNotify(x,y,z,BlockTools.setOrientationHoriz(meta,dir),2);
  }
 else {
    ForgeDirection dir=BlockTools.determineOrientation(x,y,z,entityLivingBase);
    int meta=world.getBlockMetadata(x,y,z);
    world.setBlockMetadataWithNotify(x,y,z,BlockTools.setOrientation(meta,dir),2);
  }
  restoreBlockFromNBT(world,x,y,z,itemStack);
  if (!world.isRemote) {
    setOwner(world,x,y,z,entityLivingBase);
  }
}

Fixed version (ground truth):
@Override public void onBlockPlacedBy(World world,int x,int y,int z,EntityLivingBase entityLivingBase,ItemStack itemStack){
  ForgeDirection dir=getOrientation(x,y,z,entityLivingBase);
  int meta=world.getBlockMetadata(x,y,z);
  if (horizRotation) {
    int power=world.isBlockProvidingPowerTo(x + dir.offsetX,y + dir.offsetY,z + dir.offsetZ,dir.ordinal());
    meta=BlockTools.setRedstoneSignalIn(meta,power > 0);
    world.setBlockMetadataWithNotify(x,y,z,BlockTools.setOrientationHoriz(meta,dir),2);
  }
 else {
    world.setBlockMetadataWithNotify(x,y,z,BlockTools.setOrientation(meta,dir),2);
  }
  restoreBlockFromNBT(world,x,y,z,itemStack);
  if (!world.isRemote) {
    setOwner(world,x,y,z,entityLivingBase);
  }
}
Program: 165925
Project: 165925
Buggy source:
/** 
 * Updates the blocks bounds based on its current state. Args: world, x, y, z
 */
@Override public void setBlockBoundsBasedOnState(IBlockAccess world,int x,int y,int z){
  int meta=world.getBlockMetadata(x,y,z);
  this.setBlockBounds(0.0F,0.0F,0.0F,1.0F,1.0F,1.0F);
  if (meta == 2) {
    this.setBlockBounds(0.0F,0.0F,1.0F - 0.125F,1.0F,1.0F,1.0F);
  }
  if (meta == 3) {
    this.setBlockBounds(0.0F,0.0F,0.0F,1.0F,1.0F,0.125F);
  }
  if (meta == 4) {
    this.setBlockBounds(1.0F - 0.125F,0.0F,0.0F,1.0F,1.0F,1.0F);
  }
  if (meta == 5) {
    this.setBlockBounds(0.0F,0.0F,0.0F,0.125F,1.0F,1.0F);
  }
}

Fixed version (ground truth):
/** 
 * Updates the blocks bounds based on its current state. Args: world, x, y, z
 */
@Override public void setBlockBoundsBasedOnState(IBlockAccess world,int x,int y,int z){
  int meta=world.getBlockMetadata(x,y,z);
  this.setBlockBounds(0.0F,0.0F,0.0F,1.0F,1.0F,1.0F);
  if (meta == ForgeDirection.NORTH.ordinal()) {
    this.setBlockBounds(0.0F,0.0F,1.0F - 0.125F,1.0F,1.0F,1.0F);
  }
  if (meta == ForgeDirection.SOUTH.ordinal()) {
    this.setBlockBounds(0.0F,0.0F,0.0F,1.0F,1.0F,0.125F);
  }
  if (meta == ForgeDirection.WEST.ordinal()) {
    this.setBlockBounds(1.0F - 0.125F,0.0F,0.0F,1.0F,1.0F,1.0F);
  }
  if (meta == ForgeDirection.EAST.ordinal()) {
    this.setBlockBounds(0.0F,0.0F,0.0F,0.125F,1.0F,1.0F);
  }
}
Program: 165926
Project: 165926
Buggy source:
@Override public void renderTileEntityAt(TileEntity tileEntity,double x,double y,double z,float f){
  GL11.glPushMatrix();
  float f3;
  int meta=tileEntity.getBlockMetadata();
  f3=0.0F;
  if (meta == 2) {
    f3=180.0F;
  }
  if (meta == 4) {
    f3=90.0F;
  }
  if (meta == 5) {
    f3=-90.0F;
  }
  GL11.glTranslatef((float)x + 0.5F,(float)y + 0.75F,(float)z + 0.5F);
  GL11.glRotatef(-f3,0.0F,1.0F,0.0F);
  GL11.glTranslatef(0.0F,-0.2500F,-0.4375F);
  ScreenTileEntity screenTileEntity=(ScreenTileEntity)tileEntity;
  boolean lightingEnabled=GL11.glIsEnabled(GL11.GL_LIGHTING);
  if (!screenTileEntity.isTransparent()) {
    GL11.glDisable(GL11.GL_LIGHTING);
    renderScreenBoard(screenTileEntity.isLarge(),screenTileEntity.getColor());
  }
  if (screenTileEntity.isPowerOn()) {
    FontRenderer fontrenderer=this.func_147498_b();
    ClientScreenModule.TransformMode mode=ClientScreenModule.TransformMode.NONE;
    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_LIGHTING);
    Map<Integer,Object[]> screenData=updateScreenData(screenTileEntity);
    List<ClientScreenModule> modules=screenTileEntity.getClientScreenModules();
    renderModules(fontrenderer,mode,modules,screenData,screenTileEntity.isLarge());
    GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
    if (lightingEnabled) {
      GL11.glEnable(GL11.GL_LIGHTING);
    }
  }
  if (lightingEnabled) {
    GL11.glEnable(GL11.GL_LIGHTING);
  }
  GL11.glDepthMask(true);
  GL11.glPopMatrix();
}

Fixed version (ground truth):
@Override public void renderTileEntityAt(TileEntity tileEntity,double x,double y,double z,float f){
  GL11.glPushMatrix();
  float f3;
  int meta=tileEntity.getBlockMetadata();
  f3=0.0F;
  if (meta == 2) {
    f3=180.0F;
  }
  if (meta == 4) {
    f3=90.0F;
  }
  if (meta == 5) {
    f3=-90.0F;
  }
  GL11.glTranslatef((float)x + 0.5F,(float)y + 0.75F,(float)z + 0.5F);
  GL11.glRotatef(-f3,0.0F,1.0F,0.0F);
  GL11.glTranslatef(0.0F,-0.2500F,-0.4375F);
  ScreenTileEntity screenTileEntity=(ScreenTileEntity)tileEntity;
  boolean lightingEnabled=GL11.glIsEnabled(GL11.GL_LIGHTING);
  if (!screenTileEntity.isTransparent()) {
    GL11.glDisable(GL11.GL_LIGHTING);
    renderScreenBoard(screenTileEntity.isLarge(),screenTileEntity.getColor());
  }
  if (screenTileEntity.isPowerOn()) {
    FontRenderer fontrenderer=this.func_147498_b();
    ClientScreenModule.TransformMode mode=ClientScreenModule.TransformMode.NONE;
    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_LIGHTING);
    Map<Integer,Object[]> screenData=updateScreenData(screenTileEntity);
    List<ClientScreenModule> modules=screenTileEntity.getClientScreenModules();
    renderModules(fontrenderer,mode,modules,screenData,screenTileEntity.isLarge());
  }
  if (lightingEnabled) {
    GL11.glEnable(GL11.GL_LIGHTING);
  }
  GL11.glDepthMask(true);
  GL11.glPopMatrix();
}
Program: 165927
Project: 165927
Buggy source:
@Override public void render(FontRenderer fontRenderer,int currenty,Object[] screenData,float factor){
  if (screenData == null) {
    return;
  }
  RenderHelper.enableGUIStandardItemLighting();
  GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
  GL11.glDepthMask(true);
  boolean lighting=GL11.glIsEnabled(GL11.GL_LIGHTING);
  if (!lighting) {
    GL11.glEnable(GL11.GL_LIGHTING);
  }
  boolean depthTest=GL11.glIsEnabled(GL11.GL_DEPTH_TEST);
  if (!depthTest) {
    GL11.glEnable(GL11.GL_DEPTH_TEST);
  }
  GL11.glPushMatrix();
  float f3=0.0075F;
  GL11.glTranslatef(-0.5F,0.5F,0.06F);
  GL11.glScalef(f3 * factor,-f3 * factor,0.0001f);
  int x=10;
  x=renderSlot(fontRenderer,currenty,screenData,slot1,0,x);
  x=renderSlot(fontRenderer,currenty,screenData,slot2,1,x);
  x=renderSlot(fontRenderer,currenty,screenData,slot3,2,x);
  renderSlot(fontRenderer,currenty,screenData,slot4,3,x);
  GL11.glPopMatrix();
  GL11.glPushMatrix();
  GL11.glTranslatef(-0.5F,0.5F,0.08F);
  GL11.glScalef(f3 * factor,-f3 * factor,0.0001f);
  x=10;
  x=renderSlotOverlay(fontRenderer,currenty,screenData,slot1,0,x);
  x=renderSlotOverlay(fontRenderer,currenty,screenData,slot2,1,x);
  x=renderSlotOverlay(fontRenderer,currenty,screenData,slot3,2,x);
  renderSlotOverlay(fontRenderer,currenty,screenData,slot4,3,x);
  GL11.glPopMatrix();
  if (!lighting) {
    GL11.glDisable(GL11.GL_LIGHTING);
  }
  if (!depthTest) {
    GL11.glDisable(GL11.GL_DEPTH_TEST);
  }
  GL11.glDepthMask(false);
}

Fixed version (ground truth):
@Override public void render(FontRenderer fontRenderer,int currenty,Object[] screenData,float factor){
  if (screenData == null) {
    return;
  }
  RenderHelper.enableGUIStandardItemLighting();
  GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
  GL11.glDepthMask(true);
  boolean lighting=GL11.glIsEnabled(GL11.GL_LIGHTING);
  if (!lighting) {
    GL11.glEnable(GL11.GL_LIGHTING);
  }
  boolean depthTest=GL11.glIsEnabled(GL11.GL_DEPTH_TEST);
  if (!depthTest) {
    GL11.glEnable(GL11.GL_DEPTH_TEST);
  }
  GL11.glPushMatrix();
  float f3=0.0075F;
  GL11.glTranslatef(-0.5F,0.5F,0.06F);
  GL11.glScalef(f3 * factor,-f3 * factor,0.0001f);
  int x=10;
  x=renderSlot(fontRenderer,currenty,screenData,slot1,0,x);
  x=renderSlot(fontRenderer,currenty,screenData,slot2,1,x);
  x=renderSlot(fontRenderer,currenty,screenData,slot3,2,x);
  renderSlot(fontRenderer,currenty,screenData,slot4,3,x);
  GL11.glPopMatrix();
  GL11.glPushMatrix();
  GL11.glTranslatef(-0.5F,0.5F,0.08F);
  GL11.glScalef(f3 * factor,-f3 * factor,0.0001f);
  x=10;
  x=renderSlotOverlay(fontRenderer,currenty,screenData,slot1,0,x);
  x=renderSlotOverlay(fontRenderer,currenty,screenData,slot2,1,x);
  x=renderSlotOverlay(fontRenderer,currenty,screenData,slot3,2,x);
  renderSlotOverlay(fontRenderer,currenty,screenData,slot4,3,x);
  GL11.glPopMatrix();
  if (!lighting) {
    GL11.glDisable(GL11.GL_LIGHTING);
  }
  if (!depthTest) {
    GL11.glDisable(GL11.GL_DEPTH_TEST);
  }
  GL11.glDepthMask(false);
  RenderHelper.enableStandardItemLighting();
}
Program: 165928
Project: 165928
Buggy source:
@Override protected void drawGuiContainerForegroundLayer(int i,int i2){
  List<String> tooltips=window.getTooltips();
  if (tooltips != null) {
    int x=Mouse.getEventX() * width / mc.displayWidth;
    int y=height - Mouse.getEventY() * height / mc.displayHeight - 1;
    drawHoveringText(tooltips,x - guiLeft,y - guiTop,mc.fontRenderer);
  }
  tooltips=sideWindow.getWindow().getTooltips();
  if (tooltips != null) {
    int x=Mouse.getEventX() * width / mc.displayWidth;
    int y=height - Mouse.getEventY() * height / mc.displayHeight - 1;
    drawHoveringText(tooltips,x - guiLeft,y - guiTop,mc.fontRenderer);
  }
}

Fixed version (ground truth):
@Override protected void drawGuiContainerForegroundLayer(int i,int i2){
  List<String> tooltips=window.getTooltips();
  if (tooltips != null) {
    int x=Mouse.getEventX() * width / mc.displayWidth;
    int y=height - Mouse.getEventY() * height / mc.displayHeight - 1;
    drawHoveringText(tooltips,x - guiLeft,y - guiTop,mc.fontRenderer);
  }
  tooltips=sideWindow.getWindow().getTooltips();
  if (tooltips != null) {
    int x=Mouse.getEventX() * width / mc.displayWidth;
    int y=height - Mouse.getEventY() * height / mc.displayHeight - 1;
    drawHoveringText(tooltips,x - guiLeft,y - guiTop,mc.fontRenderer);
  }
  RenderHelper.enableGUIStandardItemLighting();
}
Program: 165930
Project: 165930
Buggy source:
@Override public void inject(DimletKey key,DimensionInformation dimensionInformation){
  if ("String_Node_Str".equals(key.getName())) {
    dimensionInformation.setPatreonBit(Patreons.PATREON_FIREWORKS);
  }
 else   if ("String_Node_Str".equals(key.getName())) {
    dimensionInformation.setPatreonBit(Patreons.PATREON_SICKMOON);
    dimensionInformation.setPatreonBit(Patreons.PATREON_SICKSUN);
  }
 else   if ("String_Node_Str".equals(key.getName())) {
    dimensionInformation.setPatreonBit(Patreons.PATREON_PINKGRASS);
  }
}

Fixed version (ground truth):
@Override public void inject(DimletKey key,DimensionInformation dimensionInformation){
  if ("String_Node_Str".equals(key.getName())) {
    dimensionInformation.setPatreonBit(Patreons.PATREON_FIREWORKS);
  }
 else   if ("String_Node_Str".equals(key.getName())) {
    dimensionInformation.setPatreonBit(Patreons.PATREON_SICKMOON);
    dimensionInformation.setPatreonBit(Patreons.PATREON_SICKSUN);
  }
 else   if ("String_Node_Str".equals(key.getName())) {
    dimensionInformation.setPatreonBit(Patreons.PATREON_PINKPILLARS);
  }
}
Program: 165931
Project: 165931
Buggy source:
@Override public void generateSlots(){
  for (  SlotFactory slotFactory : factory.getSlots()) {
    Slot slot;
    if (slotFactory.getSlotType() == SlotType.SLOT_PLAYERINV || slotFactory.getSlotType() == SlotType.SLOT_PLAYERHOTBAR) {
      slot=new BaseSlot(inventories.get(slotFactory.getInventoryName()),slotFactory.getIndex(),slotFactory.getX(),slotFactory.getY());
    }
 else {
      slot=new BaseSlot(inventories.get(slotFactory.getInventoryName()),slotFactory.getIndex(),slotFactory.getX(),slotFactory.getY()){
        @Override public boolean isItemValid(        ItemStack stack){
          return getSlotIndex() < getMaxSize();
        }
      }
;
    }
    addSlotToContainer(slot);
  }
}

Fixed version (ground truth):
@Override public void generateSlots(){
  for (  SlotFactory slotFactory : factory.getSlots()) {
    Slot slot;
    if (slotFactory.getSlotType() == SlotType.SLOT_PLAYERHOTBAR) {
      if (slotFactory.getIndex() == tabletIndex) {
        slot=new BaseSlot(inventories.get(slotFactory.getInventoryName()),slotFactory.getIndex(),slotFactory.getX(),slotFactory.getY()){
          @Override public boolean canTakeStack(          EntityPlayer player){
            return false;
          }
        }
;
      }
 else {
        slot=new BaseSlot(inventories.get(slotFactory.getInventoryName()),slotFactory.getIndex(),slotFactory.getX(),slotFactory.getY());
      }
    }
 else     if (slotFactory.getSlotType() == SlotType.SLOT_PLAYERINV) {
      slot=new BaseSlot(inventories.get(slotFactory.getInventoryName()),slotFactory.getIndex(),slotFactory.getX(),slotFactory.getY());
    }
 else {
      slot=new BaseSlot(inventories.get(slotFactory.getInventoryName()),slotFactory.getIndex(),slotFactory.getX(),slotFactory.getY()){
        @Override public boolean isItemValid(        ItemStack stack){
          return getSlotIndex() < getMaxSize();
        }
      }
;
    }
    addSlotToContainer(slot);
  }
}
Program: 165932
Project: 165932
Buggy source:
public ModularStorageItemContainer(EntityPlayer player){
  super(factory);
  this.entityPlayer=player;
  addInventory(CONTAINER_INVENTORY,new ModularStorageItemInventory(player));
  addInventory(ContainerFactory.CONTAINER_PLAYER,player.inventory);
  generateSlots();
}

Fixed version (ground truth):
public ModularStorageItemContainer(EntityPlayer player){
  super(factory);
  this.entityPlayer=player;
  addInventory(CONTAINER_INVENTORY,new ModularStorageItemInventory(player));
  addInventory(ContainerFactory.CONTAINER_PLAYER,player.inventory);
  tabletIndex=player.inventory.currentItem;
  generateSlots();
}
Program: 165933
Project: 165933
Buggy source:
@Override protected void setup(){
  addSlotBox(new SlotDefinition(SlotType.SLOT_SPECIFICITEM,new ItemStack(DimletSetup.knownDimlet)),CONTAINER_INVENTORY,SLOT_DIMLETS,13,6,13,18,7,18);
  addSlotBox(new SlotDefinition(SlotType.SLOT_OUTPUT),CONTAINER_INVENTORY,SLOT_TAB,13,142,1,18,1,18);
  layoutPlayerInventorySlots(85,142);
}

Fixed version (ground truth):
@Override protected void setup(){
  addSlotBox(new SlotDefinition(SlotType.SLOT_SPECIFICITEM,new ItemStack(DimletSetup.knownDimlet)),CONTAINER_INVENTORY,SLOT_DIMLETS,13,7,13,18,7,18);
  addSlotBox(new SlotDefinition(SlotType.SLOT_OUTPUT),CONTAINER_INVENTORY,SLOT_TAB,13,142,1,18,1,18);
  layoutPlayerInventorySlots(85,142);
}
Program: 165934
Project: 165934
Buggy source:
private void restartScan(){
  if (loopMode || (powered > 0 && scan == null)) {
    scan=minBox;
  }
 else {
    scan=null;
  }
}

Fixed version (ground truth):
private void restartScan(){
  if (loopMode || (powered > 0 && scan == null)) {
    calculateBox();
    scan=minBox;
  }
 else {
    scan=null;
  }
}
Program: 165935
Project: 165935
Buggy source:
@Override public ItemStack getCraftingResult(InventoryCrafting inventoryCrafting){
  ItemStack stack=super.getCraftingResult(inventoryCrafting);
  if (stack != null) {
    NBTTagCompound tagCompound=getNBTFromObject(inventoryCrafting);
    if (tagCompound != null) {
      int damage=tagCompound.getInteger("String_Node_Str");
      tagCompound.removeTag("String_Node_Str");
      stack.setTagCompound(tagCompound);
      stack.setItemDamage(damage);
    }
  }
  return stack;
}

Fixed version (ground truth):
@Override public ItemStack getCraftingResult(InventoryCrafting inventoryCrafting){
  ItemStack stack=super.getCraftingResult(inventoryCrafting);
  if (stack != null) {
    NBTTagCompound tagCompound=getNBTFromObject(inventoryCrafting);
    if (tagCompound != null) {
      int damage=tagCompound.getInteger("String_Node_Str");
      NBTTagCompound newtag=new NBTTagCompound();
      for (      Object o : tagCompound.func_150296_c()) {
        String tag=(String)o;
        if (!"String_Node_Str".equals(tag)) {
          newtag.setTag(tag,tagCompound.getTag(tag));
        }
      }
      stack.setTagCompound(newtag);
      stack.setItemDamage(damage);
    }
  }
  return stack;
}
Program: 165937
Project: 165937
Buggy source:
private void dumpInfo(World world,int x,int y,int z){
  Block block=world.getBlock(x,y,z);
  if (block == null || block.getMaterial() == Material.air) {
    return;
  }
  int meta=world.getBlockMetadata(x,y,z);
  String modid=RFToolsTools.getModidForBlock(block);
  RFTools.log("String_Node_Str" + block.getUnlocalizedName() + "String_Node_Str"+ meta+ "String_Node_Str"+ modid);
  TileEntity tileEntity=world.getTileEntity(x,y,z);
  if (tileEntity != null) {
    NBTTagCompound tag=new NBTTagCompound();
    tileEntity.writeToNBT(tag);
    StringBuffer buffer=new StringBuffer();
    RFToolsTools.convertNBTtoJson(buffer,tag,0);
    RFTools.log(buffer.toString());
  }
}

Fixed version (ground truth):
private void dumpInfo(World world,int x,int y,int z){
  Block block=world.getBlock(x,y,z);
  if (block == null || block.getMaterial() == Material.air) {
    return;
  }
  int meta=world.getBlockMetadata(x,y,z);
  String modid=RFToolsTools.getModidForBlock(block);
  RFTools.log("String_Node_Str" + block.getUnlocalizedName() + "String_Node_Str"+ meta+ "String_Node_Str"+ modid);
  TileEntity tileEntity=world.getTileEntity(x,y,z);
  if (tileEntity != null) {
    NBTTagCompound tag=new NBTTagCompound();
    try {
      tileEntity.writeToNBT(tag);
      StringBuffer buffer=new StringBuffer();
      RFToolsTools.convertNBTtoJson(buffer,tag,0);
      RFTools.log(buffer.toString());
    }
 catch (    Exception e) {
      RFTools.log("String_Node_Str");
    }
  }
}
Program: 165938
Project: 165938
Buggy source:
StorageFilterCache(ItemStack stack){
  NBTTagCompound tagCompound=stack.getTagCompound();
  if (tagCompound != null) {
    matchDamage=tagCompound.getBoolean("String_Node_Str");
    oredictMode=tagCompound.getBoolean("String_Node_Str");
    nbtMode=tagCompound.getBoolean("String_Node_Str");
    modMode=tagCompound.getBoolean("String_Node_Str");
    blacklistMode="String_Node_Str".equals(tagCompound.getString("String_Node_Str"));
    NBTTagList bufferTagList=tagCompound.getTagList("String_Node_Str",Constants.NBT.TAG_COMPOUND);
    int cnt=0;
    for (int i=0; i < bufferTagList.tagCount(); i++) {
      NBTTagCompound nbtTagCompound=bufferTagList.getCompoundTagAt(i);
      ItemStack s=ItemStack.loadItemStackFromNBT(nbtTagCompound);
      if (s != null && s.stackSize > 0) {
        cnt++;
      }
    }
    stacks=new ItemStack[cnt];
    cnt=0;
    for (int i=0; i < bufferTagList.tagCount(); i++) {
      NBTTagCompound nbtTagCompound=bufferTagList.getCompoundTagAt(i);
      ItemStack s=ItemStack.loadItemStackFromNBT(nbtTagCompound);
      if (s != null && s.stackSize > 0) {
        stacks[cnt++]=s;
        if (oredictMode) {
          for (          int id : OreDictionary.getOreIDs(s)) {
            oredictMatches.add(id);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
StorageFilterCache(ItemStack stack){
  NBTTagCompound tagCompound=stack.getTagCompound();
  if (tagCompound != null) {
    matchDamage=tagCompound.getBoolean("String_Node_Str");
    oredictMode=tagCompound.getBoolean("String_Node_Str");
    nbtMode=tagCompound.getBoolean("String_Node_Str");
    modMode=tagCompound.getBoolean("String_Node_Str");
    blacklistMode="String_Node_Str".equals(tagCompound.getString("String_Node_Str"));
    NBTTagList bufferTagList=tagCompound.getTagList("String_Node_Str",Constants.NBT.TAG_COMPOUND);
    int cnt=0;
    for (int i=0; i < bufferTagList.tagCount(); i++) {
      NBTTagCompound nbtTagCompound=bufferTagList.getCompoundTagAt(i);
      ItemStack s=ItemStack.loadItemStackFromNBT(nbtTagCompound);
      if (s != null && s.stackSize > 0) {
        cnt++;
      }
    }
    stacks=new ItemStack[cnt];
    cnt=0;
    for (int i=0; i < bufferTagList.tagCount(); i++) {
      NBTTagCompound nbtTagCompound=bufferTagList.getCompoundTagAt(i);
      ItemStack s=ItemStack.loadItemStackFromNBT(nbtTagCompound);
      if (s != null && s.stackSize > 0) {
        stacks[cnt++]=s;
        if (oredictMode) {
          for (          int id : OreDictionary.getOreIDs(s)) {
            oredictMatches.add(id);
          }
        }
      }
    }
  }
 else {
    stacks=new ItemStack[0];
  }
}
Program: 165939
Project: 165939
Buggy source:
public boolean match(ItemStack stack){
  if (stack != null) {
    boolean match=false;
    String modName="String_Node_Str";
    if (modMode) {
      modName=ModItemSorter.getMod(stack);
    }
    if (oredictMode) {
      for (      int id : OreDictionary.getOreIDs(stack)) {
        if (oredictMatches.contains(id)) {
          match=true;
          break;
        }
      }
    }
 else {
      for (      ItemStack itemStack : stacks) {
        if (matchDamage && itemStack.getItemDamage() != stack.getItemDamage()) {
          continue;
        }
        if (nbtMode && !ItemStack.areItemStackTagsEqual(itemStack,stack)) {
          continue;
        }
        if (modMode) {
          if (modName.equals(ModItemSorter.getMod(itemStack))) {
            match=true;
            break;
          }
        }
 else         if (itemStack.getItem().equals(stack.getItem())) {
          match=true;
          break;
        }
      }
    }
    return match != blacklistMode;
  }
  return true;
}

Fixed version (ground truth):
public boolean match(ItemStack stack){
  if (stack != null) {
    boolean match=false;
    String modName="String_Node_Str";
    if (modMode) {
      modName=ModItemSorter.getMod(stack);
    }
    if (oredictMode) {
      for (      int id : OreDictionary.getOreIDs(stack)) {
        if (oredictMatches.contains(id)) {
          match=true;
          break;
        }
      }
    }
 else     if (stacks != null) {
      for (      ItemStack itemStack : stacks) {
        if (matchDamage && itemStack.getItemDamage() != stack.getItemDamage()) {
          continue;
        }
        if (nbtMode && !ItemStack.areItemStackTagsEqual(itemStack,stack)) {
          continue;
        }
        if (modMode) {
          if (modName.equals(ModItemSorter.getMod(itemStack))) {
            match=true;
            break;
          }
        }
 else         if (itemStack.getItem().equals(stack.getItem())) {
          match=true;
          break;
        }
      }
    }
    return match != blacklistMode;
  }
  return true;
}
Program: 165940
Project: 165940
Buggy source:
@Override public void setInventorySlotContents(int index,ItemStack stack){
  if (index == ModularStorageContainer.SLOT_STORAGE_MODULE) {
    if (isServer()) {
      copyFromModule(stack);
    }
  }
 else   if (index == ModularStorageContainer.SLOT_TYPE_MODULE) {
    worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
  }
 else   if (index == ModularStorageContainer.SLOT_FILTER_MODULE) {
    filterCache=null;
  }
  boolean s1=containsItem(index);
  setInventorySlotContentsHelper(getInventoryStackLimit(),index,stack);
  handleNewAmount(s1,index);
}

Fixed version (ground truth):
@Override public void setInventorySlotContents(int index,ItemStack stack){
  if (index == ModularStorageContainer.SLOT_STORAGE_MODULE) {
  }
 else   if (index == ModularStorageContainer.SLOT_TYPE_MODULE) {
    worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
  }
 else   if (index == ModularStorageContainer.SLOT_FILTER_MODULE) {
    filterCache=null;
  }
  boolean s1=containsItem(index);
  setInventorySlotContentsHelper(getInventoryStackLimit(),index,stack);
  if (index == ModularStorageContainer.SLOT_STORAGE_MODULE) {
    if (isServer()) {
      copyFromModule(stack);
    }
  }
  handleNewAmount(s1,index);
}
Program: 165941
Project: 165941
Buggy source:
public void copyFromModule(ItemStack stack){
  for (int i=ModularStorageContainer.SLOT_STORAGE; i < inventoryHelper.getCount(); i++) {
    inventoryHelper.setInventorySlotContents(0,i,null);
  }
  if (stack == null) {
    setMaxSize(0);
    numStacks=-1;
    return;
  }
  remoteId=0;
  if (stack.getItemDamage() == StorageModuleItem.STORAGE_REMOTE) {
    NBTTagCompound tagCompound=stack.getTagCompound();
    if (tagCompound == null || !tagCompound.hasKey("String_Node_Str")) {
      setMaxSize(0);
      numStacks=-1;
      return;
    }
    remoteId=tagCompound.getInteger("String_Node_Str");
    RemoteStorageTileEntity remoteStorageTileEntity=getRemoteStorage(remoteId);
    if (remoteStorageTileEntity == null) {
      setMaxSize(0);
      numStacks=-1;
      return;
    }
    ItemStack storageStack=remoteStorageTileEntity.findStorageWithId(remoteId);
    if (storageStack == null) {
      setMaxSize(0);
      numStacks=-1;
      return;
    }
    setMaxSize(StorageModuleItem.MAXSIZE[storageStack.getItemDamage()]);
  }
 else {
    setMaxSize(StorageModuleItem.MAXSIZE[stack.getItemDamage()]);
    NBTTagCompound tagCompound=stack.getTagCompound();
    if (tagCompound != null) {
      readBufferFromItemNBT(tagCompound);
    }
  }
  updateStackCount();
}

Fixed version (ground truth):
public void copyFromModule(ItemStack stack){
  for (int i=ModularStorageContainer.SLOT_STORAGE; i < inventoryHelper.getCount(); i++) {
    inventoryHelper.setInventorySlotContents(0,i,null);
  }
  if (stack == null) {
    setMaxSize(0);
    numStacks=-1;
    return;
  }
  System.out.println("String_Node_Str" + stack);
  remoteId=0;
  if (stack.getItemDamage() == StorageModuleItem.STORAGE_REMOTE) {
    NBTTagCompound tagCompound=stack.getTagCompound();
    if (tagCompound == null || !tagCompound.hasKey("String_Node_Str")) {
      setMaxSize(0);
      numStacks=-1;
      return;
    }
    remoteId=tagCompound.getInteger("String_Node_Str");
    RemoteStorageTileEntity remoteStorageTileEntity=getRemoteStorage(remoteId);
    if (remoteStorageTileEntity == null) {
      setMaxSize(0);
      numStacks=-1;
      return;
    }
    ItemStack storageStack=remoteStorageTileEntity.findStorageWithId(remoteId);
    if (storageStack == null) {
      setMaxSize(0);
      numStacks=-1;
      return;
    }
    setMaxSize(StorageModuleItem.MAXSIZE[storageStack.getItemDamage()]);
  }
 else {
    setMaxSize(StorageModuleItem.MAXSIZE[stack.getItemDamage()]);
    NBTTagCompound tagCompound=stack.getTagCompound();
    if (tagCompound != null) {
      readBufferFromItemNBT(tagCompound);
    }
  }
  updateStackCount();
}
Program: 165942
Project: 165942
Buggy source:
public void copyToModule(){
  ItemStack stack=inventoryHelper.getStackInSlot(ModularStorageContainer.SLOT_STORAGE_MODULE);
  if (stack == null) {
    return;
  }
  if (stack.getItemDamage() == StorageModuleItem.STORAGE_REMOTE) {
    return;
  }
  NBTTagCompound tagCompound=stack.getTagCompound();
  if (tagCompound == null) {
    tagCompound=new NBTTagCompound();
    stack.setTagCompound(tagCompound);
  }
  int cnt=writeBufferToItemNBT(tagCompound);
  tagCompound.setInteger("String_Node_Str",cnt);
  for (int i=ModularStorageContainer.SLOT_STORAGE; i < inventoryHelper.getCount(); i++) {
    inventoryHelper.setInventorySlotContents(0,i,null);
  }
  numStacks=-1;
  remoteId=0;
  markDirty();
  worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
}

Fixed version (ground truth):
public void copyToModule(){
  ItemStack stack=inventoryHelper.getStackInSlot(ModularStorageContainer.SLOT_STORAGE_MODULE);
  if (stack == null) {
    return;
  }
  System.out.println("String_Node_Str" + stack);
  if (stack.getItemDamage() == StorageModuleItem.STORAGE_REMOTE) {
    return;
  }
  NBTTagCompound tagCompound=stack.getTagCompound();
  if (tagCompound == null) {
    tagCompound=new NBTTagCompound();
    stack.setTagCompound(tagCompound);
  }
  int cnt=writeBufferToItemNBT(tagCompound);
  tagCompound.setInteger("String_Node_Str",cnt);
}