nus-yam/ex-repair huggingface dataset:
Program: 166099
Project: 166099
Buggy source:
@Override public float calculateCelestialAngle(long time,float p_76563_3_){
  if (dimensionInformation.getCelestialAngle() == null) {
    if (dimensionInformation.getTimeSpeed() == null) {
      return super.calculateCelestialAngle(time,p_76563_3_);
    }
 else {
      return super.calculateCelestialAngle((long)(time * dimensionInformation.getTimeSpeed()),p_76563_3_);
    }
  }
 else {
    return dimensionInformation.getCelestialAngle();
  }
}

Fixed version (ground truth):
@Override public float calculateCelestialAngle(long time,float p_76563_3_){
  getDimensionInformation();
  if (dimensionInformation == null) {
    return super.calculateCelestialAngle(time,p_76563_3_);
  }
  if (dimensionInformation.getCelestialAngle() == null) {
    if (dimensionInformation.getTimeSpeed() == null) {
      return super.calculateCelestialAngle(time,p_76563_3_);
    }
 else {
      return super.calculateCelestialAngle((long)(time * dimensionInformation.getTimeSpeed()),p_76563_3_);
    }
  }
 else {
    return dimensionInformation.getCelestialAngle();
  }
}
Program: 166100
Project: 166100
Buggy source:
@Override public ItemStack onItemRightClick(ItemStack stack,World world,EntityPlayer player){
  if (!world.isRemote) {
    int id=player.worldObj.provider.dimensionId;
    RfToolsDimensionManager dimensionManager=RfToolsDimensionManager.getDimensionManager(player.worldObj);
    DimensionInformation dimensionInformation=dimensionManager.getDimensionInformation(id);
    if (dimensionInformation == null) {
      RFTools.message(player,"String_Node_Str");
    }
 else {
      if (System.currentTimeMillis() - lastTime > 500) {
        lastTime=System.currentTimeMillis();
        PacketHandler.INSTANCE.sendToServer(new PacketGetDimensionEnergy(id));
      }
      String name=dimensionInformation.getName();
      DimensionStorage storage=DimensionStorage.getDimensionStorage(player.getEntityWorld());
      int power=storage != null ? storage.getEnergyLevel(id) : 0;
      RFTools.message(player,EnumChatFormatting.BLUE + "String_Node_Str" + name+ "String_Node_Str"+ id+ "String_Node_Str"+ EnumChatFormatting.YELLOW+ "String_Node_Str"+ power+ "String_Node_Str");
      if (player.isSneaking()) {
        RFTools.message(player,EnumChatFormatting.RED + "String_Node_Str" + dimensionInformation.getDescriptor().getDescriptionString());
        System.out.println("String_Node_Str" + dimensionInformation.getDescriptor().getDescriptionString());
      }
    }
    return stack;
  }
  return stack;
}

Fixed version (ground truth):
@Override public ItemStack onItemRightClick(ItemStack stack,World world,EntityPlayer player){
  if (!world.isRemote) {
    int id=player.worldObj.provider.dimensionId;
    RfToolsDimensionManager dimensionManager=RfToolsDimensionManager.getDimensionManager(player.worldObj);
    DimensionInformation dimensionInformation=dimensionManager.getDimensionInformation(id);
    if (dimensionInformation == null) {
      RFTools.message(player,"String_Node_Str");
    }
 else {
      String name=dimensionInformation.getName();
      DimensionStorage storage=DimensionStorage.getDimensionStorage(player.getEntityWorld());
      int power=storage != null ? storage.getEnergyLevel(id) : 0;
      RFTools.message(player,EnumChatFormatting.BLUE + "String_Node_Str" + name+ "String_Node_Str"+ id+ "String_Node_Str"+ EnumChatFormatting.YELLOW+ "String_Node_Str"+ power+ "String_Node_Str");
      if (player.isSneaking()) {
        RFTools.message(player,EnumChatFormatting.RED + "String_Node_Str" + dimensionInformation.getDescriptor().getDescriptionString());
        System.out.println("String_Node_Str" + dimensionInformation.getDescriptor().getDescriptionString());
      }
    }
    return stack;
  }
  return stack;
}
Program: 166101
Project: 166101
Buggy source:
@Override protected void checkStateServer(){
  if (researching > 0) {
    researching--;
    if (researching == 0) {
      int id=KnownDimletConfiguration.getRandomDimlet();
      InventoryHelper.mergeItemStack(this,new ItemStack(ModItems.knownDimlet,1,id),1,2);
    }
    markDirty();
  }
 else {
    ItemStack inputStack=inventoryHelper.getStacks()[0];
    ItemStack outputStack=inventoryHelper.getStacks()[1];
    if (inputStack != null && inputStack.getItem() == ModItems.unknownDimlet && outputStack == null) {
      startResearching();
    }
  }
}

Fixed version (ground truth):
@Override protected void checkStateServer(){
  if (researching > 0) {
    researching--;
    if (researching == 0) {
      int id=KnownDimletConfiguration.getRandomDimlet(worldObj.rand);
      InventoryHelper.mergeItemStack(this,new ItemStack(ModItems.knownDimlet,1,id),1,2);
    }
    markDirty();
  }
 else {
    ItemStack inputStack=inventoryHelper.getStacks()[0];
    ItemStack outputStack=inventoryHelper.getStacks()[1];
    if (inputStack != null && inputStack.getItem() == ModItems.unknownDimlet && outputStack == null) {
      startResearching();
    }
  }
}
Program: 166102
Project: 166102
Buggy source:
@Override protected void checkStateServer(){
  if (scrambling > 0) {
    scrambling--;
    if (scrambling == 0) {
      int id=KnownDimletConfiguration.getRandomDimlet(bonus);
      InventoryHelper.mergeItemStack(this,new ItemStack(ModItems.knownDimlet,1,id),3,4);
    }
    markDirty();
  }
 else {
    ItemStack input1=inventoryHelper.getStacks()[0];
    ItemStack input2=inventoryHelper.getStacks()[1];
    ItemStack input3=inventoryHelper.getStacks()[2];
    ItemStack outputStack=inventoryHelper.getStacks()[3];
    if (isValidInput(input1,input2,input3) && outputStack == null) {
      startScrambling();
    }
  }
}

Fixed version (ground truth):
@Override protected void checkStateServer(){
  if (scrambling > 0) {
    scrambling--;
    if (scrambling == 0) {
      int id=KnownDimletConfiguration.getRandomDimlet(bonus,worldObj.rand);
      InventoryHelper.mergeItemStack(this,new ItemStack(ModItems.knownDimlet,1,id),3,4);
    }
    markDirty();
  }
 else {
    ItemStack input1=inventoryHelper.getStacks()[0];
    ItemStack input2=inventoryHelper.getStacks()[1];
    ItemStack input3=inventoryHelper.getStacks()[2];
    ItemStack outputStack=inventoryHelper.getStacks()[3];
    if (isValidInput(input1,input2,input3) && outputStack == null) {
      startScrambling();
    }
  }
}
Program: 166103
Project: 166103
Buggy source:
private void calculateFeatureType(Map<DimletType,List<Integer>> dimlets,List<DimensionDescriptor.DimletDescriptor> modifiers,Random random){
  List<Integer> list=dimlets.get(DimletType.DIMLET_FEATURE);
  if (list.isEmpty()) {
    for (    FeatureType type : FeatureType.values()) {
      if (random.nextFloat() < .4f) {
        featureTypes.add(type);
      }
    }
  }
 else {
    for (    Integer id : list) {
      featureTypes.add(KnownDimletConfiguration.idToFeatureType.get(id));
    }
  }
  List<Block> blocks=new ArrayList<Block>();
  List<Block> fluids=new ArrayList<Block>();
  getMaterialAndFluidModifiers(modifiers,blocks,fluids);
  if (blocks.isEmpty()) {
    while (random.nextFloat() < 0.2f) {
      blocks.add(KnownDimletConfiguration.getRandomMaterialBlock());
    }
  }
 else   if (blocks.size() == 1 && blocks.get(0) == null) {
    blocks.clear();
  }
  extraOregen=blocks.toArray(new Block[blocks.size()]);
  if (fluids.isEmpty()) {
    while (random.nextFloat() < 0.2f) {
      fluids.add(KnownDimletConfiguration.getRandomFluidBlock());
    }
  }
 else   if (fluids.size() == 1 && fluids.get(0) == null) {
    fluids.clear();
  }
  fluidsForLakes=fluids.toArray(new Block[fluids.size()]);
}

Fixed version (ground truth):
private void calculateFeatureType(Map<DimletType,List<Integer>> dimlets,List<DimensionDescriptor.DimletDescriptor> modifiers,Random random){
  List<Integer> list=dimlets.get(DimletType.DIMLET_FEATURE);
  if (list.isEmpty()) {
    for (    FeatureType type : FeatureType.values()) {
      if (random.nextFloat() < .4f) {
        featureTypes.add(type);
      }
    }
  }
 else {
    for (    Integer id : list) {
      featureTypes.add(KnownDimletConfiguration.idToFeatureType.get(id));
    }
  }
  List<Block> blocks=new ArrayList<Block>();
  List<Block> fluids=new ArrayList<Block>();
  getMaterialAndFluidModifiers(modifiers,blocks,fluids);
  if (blocks.isEmpty()) {
    while (random.nextFloat() < 0.2f) {
      blocks.add(KnownDimletConfiguration.getRandomMaterialBlock(random));
    }
  }
 else   if (blocks.size() == 1 && blocks.get(0) == null) {
    blocks.clear();
  }
  extraOregen=blocks.toArray(new Block[blocks.size()]);
  if (fluids.isEmpty()) {
    while (random.nextFloat() < 0.2f) {
      fluids.add(KnownDimletConfiguration.getRandomFluidBlock(random));
    }
  }
 else   if (fluids.size() == 1 && fluids.get(0) == null) {
    fluids.clear();
  }
  fluidsForLakes=fluids.toArray(new Block[fluids.size()]);
}
Program: 166104
Project: 166104
Buggy source:
private void calculateTerrainType(Map<DimletType,List<Integer>> dimlets,List<DimensionDescriptor.DimletDescriptor> modifiers,Random random){
  List<Integer> list=dimlets.get(DimletType.DIMLET_TERRAIN);
  terrainType=TerrainType.TERRAIN_VOID;
  if (list.isEmpty()) {
    terrainType=TerrainType.values()[random.nextInt(TerrainType.values().length)];
  }
 else {
    terrainType=KnownDimletConfiguration.idToTerrainType.get(list.get(random.nextInt(list.size())));
  }
  List<Block> blocks=new ArrayList<Block>();
  List<Block> fluids=new ArrayList<Block>();
  getMaterialAndFluidModifiers(modifiers,blocks,fluids);
  if (!blocks.isEmpty()) {
    baseBlockForTerrain=blocks.get(random.nextInt(blocks.size()));
    if (baseBlockForTerrain == null) {
      baseBlockForTerrain=Blocks.stone;
    }
  }
 else {
    if (random.nextFloat() < 0.6f) {
      baseBlockForTerrain=Blocks.stone;
    }
 else {
      baseBlockForTerrain=KnownDimletConfiguration.getRandomMaterialBlock();
    }
  }
  if (!fluids.isEmpty()) {
    fluidForTerrain=fluids.get(random.nextInt(fluids.size()));
    if (fluidForTerrain == null) {
      fluidForTerrain=Blocks.water;
    }
  }
 else {
    if (random.nextFloat() < 0.6f) {
      fluidForTerrain=Blocks.water;
    }
 else {
      fluidForTerrain=KnownDimletConfiguration.getRandomFluidBlock();
    }
  }
}

Fixed version (ground truth):
private void calculateTerrainType(Map<DimletType,List<Integer>> dimlets,List<DimensionDescriptor.DimletDescriptor> modifiers,Random random){
  List<Integer> list=dimlets.get(DimletType.DIMLET_TERRAIN);
  terrainType=TerrainType.TERRAIN_VOID;
  if (list.isEmpty()) {
    terrainType=TerrainType.values()[random.nextInt(TerrainType.values().length)];
  }
 else {
    terrainType=KnownDimletConfiguration.idToTerrainType.get(list.get(random.nextInt(list.size())));
  }
  List<Block> blocks=new ArrayList<Block>();
  List<Block> fluids=new ArrayList<Block>();
  getMaterialAndFluidModifiers(modifiers,blocks,fluids);
  if (!blocks.isEmpty()) {
    baseBlockForTerrain=blocks.get(random.nextInt(blocks.size()));
    if (baseBlockForTerrain == null) {
      baseBlockForTerrain=Blocks.stone;
    }
  }
 else {
    if (random.nextFloat() < 0.6f) {
      baseBlockForTerrain=Blocks.stone;
    }
 else {
      baseBlockForTerrain=KnownDimletConfiguration.getRandomMaterialBlock(random);
    }
  }
  if (!fluids.isEmpty()) {
    fluidForTerrain=fluids.get(random.nextInt(fluids.size()));
    if (fluidForTerrain == null) {
      fluidForTerrain=Blocks.water;
    }
  }
 else {
    if (random.nextFloat() < 0.6f) {
      fluidForTerrain=Blocks.water;
    }
 else {
      fluidForTerrain=KnownDimletConfiguration.getRandomFluidBlock(random);
    }
  }
}
Program: 166106
Project: 166106
Buggy source:
public static int getRandomDimlet(WeightedRandomSelector.Distribution<Integer> distribution){
  return randomDimlets.select(distribution);
}

Fixed version (ground truth):
public static int getRandomDimlet(WeightedRandomSelector.Distribution<Integer> distribution,Random random){
  return randomDimlets.select(distribution,random);
}
Program: 166107
Project: 166107
Buggy source:
public static void dumpRarityDistribution(float bonus){
  Map<Integer,Integer> counter=new HashMap<Integer,Integer>();
  WeightedRandomSelector.Distribution<Integer> distribution=randomDimlets.createDistribution(bonus);
  for (  Integer id : dimletIds) {
    counter.put(id,0);
  }
  final int total=10000000;
  for (int i=0; i < total; i++) {
    int id=randomDimlets.select(distribution);
    counter.put(id,counter.get(id) + 1);
  }
  RFTools.log("String_Node_Str" + bonus);
  List<Pair<Integer,Integer>> sortedCounters=new ArrayList<Pair<Integer,Integer>>();
  for (  Map.Entry<Integer,Integer> entry : counter.entrySet()) {
    sortedCounters.add(Pair.of(entry.getValue(),entry.getKey()));
  }
  Collections.sort(sortedCounters);
  for (  Pair<Integer,Integer> entry : sortedCounters) {
    int count=entry.getKey();
    int id=entry.getValue();
    float percentage=count * 100.0f / total;
    RFTools.log("String_Node_Str" + id + "String_Node_Str"+ idToDimlet.get(id).getKey().getName()+ "String_Node_Str"+ idToDisplayName.get(id)+ "String_Node_Str"+ count+ "String_Node_Str"+ percentage+ "String_Node_Str");
  }
}

Fixed version (ground truth):
public static void dumpRarityDistribution(float bonus){
  Random random=new Random();
  Map<Integer,Integer> counter=new HashMap<Integer,Integer>();
  WeightedRandomSelector.Distribution<Integer> distribution=randomDimlets.createDistribution(bonus);
  for (  Integer id : dimletIds) {
    counter.put(id,0);
  }
  final int total=10000000;
  for (int i=0; i < total; i++) {
    int id=randomDimlets.select(distribution,random);
    counter.put(id,counter.get(id) + 1);
  }
  RFTools.log("String_Node_Str" + bonus);
  List<Pair<Integer,Integer>> sortedCounters=new ArrayList<Pair<Integer,Integer>>();
  for (  Map.Entry<Integer,Integer> entry : counter.entrySet()) {
    sortedCounters.add(Pair.of(entry.getValue(),entry.getKey()));
  }
  Collections.sort(sortedCounters);
  for (  Pair<Integer,Integer> entry : sortedCounters) {
    int count=entry.getKey();
    int id=entry.getValue();
    float percentage=count * 100.0f / total;
    RFTools.log("String_Node_Str" + id + "String_Node_Str"+ idToDimlet.get(id).getKey().getName()+ "String_Node_Str"+ idToDisplayName.get(id)+ "String_Node_Str"+ count+ "String_Node_Str"+ percentage+ "String_Node_Str");
  }
}
Program: 166108
Project: 166108
Buggy source:
public static Block getRandomMaterialBlock(){
  return idToBlock.get(randomMaterialDimlets.select());
}

Fixed version (ground truth):
public static Block getRandomMaterialBlock(Random random){
  return idToBlock.get(randomMaterialDimlets.select(random));
}
Program: 166109
Project: 166109
Buggy source:
public static Block getRandomFluidBlock(){
  return idToFluid.get(randomLiquidDimlets.select());
}

Fixed version (ground truth):
public static Block getRandomFluidBlock(Random random){
  return idToFluid.get(randomLiquidDimlets.select(random));
}
Program: 166111
Project: 166111
Buggy source:
/** 
 * Return a random element.
 */
public E select(){
  return select(defaultDistribution);
}

Fixed version (ground truth):
/** 
 * Return a random element.
 */
public E select(Random random){
  return select(defaultDistribution,random);
}
Program: 166112
Project: 166112
Buggy source:
public WeightedRandomSelector(Random random){
  this.random=random;
}

Fixed version (ground truth):
public WeightedRandomSelector(){
}
Program: 166113
Project: 166113
Buggy source:
private void calculateFeatureType(Map<DimletType,List<Integer>> dimlets,List<DimensionDescriptor.DimletDescriptor> modifiers,Random random){
  List<Integer> list=dimlets.get(DimletType.DIMLET_FEATURE);
  if (list.isEmpty()) {
    for (    FeatureType type : FeatureType.values()) {
      if (random.nextFloat() < .4f) {
        featureTypes.add(type);
      }
    }
  }
 else {
    for (    Integer id : list) {
      featureTypes.add(KnownDimletConfiguration.idToFeatureType.get(id));
    }
  }
  List<Block> blocks=new ArrayList<Block>();
  List<Block> fluids=new ArrayList<Block>();
  for (  DimensionDescriptor.DimletDescriptor modifier : modifiers) {
    if (modifier.getType() == DimletType.DIMLET_MATERIAL) {
      Block block=KnownDimletConfiguration.idToBlock.get(modifier.getId());
      blocks.add(block);
    }
 else     if (modifier.getType() == DimletType.DIMLET_LIQUID) {
      Block fluid=KnownDimletConfiguration.idToFluid.get(modifier.getId());
      fluids.add(fluid);
    }
  }
  extraOregen=blocks.toArray(new Block[blocks.size()]);
  fluidsForLakes=fluids.toArray(new Block[fluids.size()]);
}

Fixed version (ground truth):
private void calculateFeatureType(Map<DimletType,List<Integer>> dimlets,List<DimensionDescriptor.DimletDescriptor> modifiers,Random random){
  List<Integer> list=dimlets.get(DimletType.DIMLET_FEATURE);
  if (list.isEmpty()) {
    for (    FeatureType type : FeatureType.values()) {
      if (random.nextFloat() < .4f) {
        featureTypes.add(type);
      }
    }
  }
 else {
    for (    Integer id : list) {
      featureTypes.add(KnownDimletConfiguration.idToFeatureType.get(id));
    }
  }
  List<Block> blocks=new ArrayList<Block>();
  List<Block> fluids=new ArrayList<Block>();
  getMaterialAndFluidModifiers(modifiers,blocks,fluids);
  if (blocks.isEmpty()) {
    while (random.nextFloat() < 0.2f) {
      blocks.add(KnownDimletConfiguration.getRandomMaterialBlock());
    }
  }
  extraOregen=blocks.toArray(new Block[blocks.size()]);
  if (fluids.isEmpty()) {
    while (random.nextFloat() < 0.2f) {
      fluids.add(KnownDimletConfiguration.getRandomFluidBlock());
    }
  }
  fluidsForLakes=fluids.toArray(new Block[fluids.size()]);
}
Program: 166114
Project: 166114
Buggy source:
private void calculateBiomes(Map<DimletType,List<Integer>> dimlets,Random random){
  List<Integer> list=dimlets.get(DimletType.DIMLET_BIOME);
  for (  Integer id : list) {
    String biomeName=KnownDimletConfiguration.idToBiome.get(id);
    BiomeManager.BiomeEntry entry=findBiomeEntry(biomeName,BiomeManager.BiomeType.COOL);
    entry=entry != null ? entry : findBiomeEntry(biomeName,BiomeManager.BiomeType.WARM);
    entry=entry != null ? entry : findBiomeEntry(biomeName,BiomeManager.BiomeType.DESERT);
    entry=entry != null ? entry : findBiomeEntry(biomeName,BiomeManager.BiomeType.ICY);
    if (entry != null) {
      biomes.add(entry.biome);
    }
  }
}

Fixed version (ground truth):
private void calculateBiomes(Map<DimletType,List<Integer>> dimlets,Random random){
  List<Integer> list=dimlets.get(DimletType.DIMLET_BIOME);
  for (  Integer id : list) {
    biomes.add(KnownDimletConfiguration.idToBiome.get(id));
  }
}
Program: 166115
Project: 166115
Buggy source:
private void calculateTerrainType(Map<DimletType,List<Integer>> dimlets,List<DimensionDescriptor.DimletDescriptor> modifiers,Random random){
  List<Integer> list=dimlets.get(DimletType.DIMLET_TERRAIN);
  terrainType=TerrainType.TERRAIN_VOID;
  if (list.isEmpty()) {
    terrainType=TerrainType.values()[random.nextInt(TerrainType.values().length)];
  }
 else {
    terrainType=KnownDimletConfiguration.idToTerrainType.get(list.get(random.nextInt(list.size())));
  }
  List<Block> blocks=new ArrayList<Block>();
  List<Block> fluids=new ArrayList<Block>();
  for (  DimensionDescriptor.DimletDescriptor modifier : modifiers) {
    if (modifier.getType() == DimletType.DIMLET_MATERIAL) {
      Block block=KnownDimletConfiguration.idToBlock.get(modifier.getId());
      blocks.add(block);
    }
 else     if (modifier.getType() == DimletType.DIMLET_LIQUID) {
      Block fluid=KnownDimletConfiguration.idToFluid.get(modifier.getId());
      fluids.add(fluid);
    }
  }
  if (!blocks.isEmpty()) {
    baseBlockForTerrain=blocks.get(random.nextInt(blocks.size()));
  }
 else {
    baseBlockForTerrain=Blocks.stone;
  }
  if (!fluids.isEmpty()) {
    fluidForTerrain=fluids.get(random.nextInt(fluids.size()));
  }
 else {
    fluidForTerrain=Blocks.water;
  }
}

Fixed version (ground truth):
private void calculateTerrainType(Map<DimletType,List<Integer>> dimlets,List<DimensionDescriptor.DimletDescriptor> modifiers,Random random){
  List<Integer> list=dimlets.get(DimletType.DIMLET_TERRAIN);
  terrainType=TerrainType.TERRAIN_VOID;
  if (list.isEmpty()) {
    terrainType=TerrainType.values()[random.nextInt(TerrainType.values().length)];
  }
 else {
    terrainType=KnownDimletConfiguration.idToTerrainType.get(list.get(random.nextInt(list.size())));
  }
  List<Block> blocks=new ArrayList<Block>();
  List<Block> fluids=new ArrayList<Block>();
  getMaterialAndFluidModifiers(modifiers,blocks,fluids);
  if (!blocks.isEmpty()) {
    baseBlockForTerrain=blocks.get(random.nextInt(blocks.size()));
  }
 else {
    if (random.nextFloat() < 0.6f) {
      baseBlockForTerrain=Blocks.stone;
    }
 else {
      baseBlockForTerrain=KnownDimletConfiguration.getRandomMaterialBlock();
    }
  }
  if (!fluids.isEmpty()) {
    fluidForTerrain=fluids.get(random.nextInt(fluids.size()));
  }
 else {
    if (random.nextFloat() < 0.6f) {
      fluidForTerrain=Blocks.water;
    }
 else {
      fluidForTerrain=KnownDimletConfiguration.getRandomFluidBlock();
    }
  }
}
Program: 166116
Project: 166116
Buggy source:
/** 
 * Get all dimlets which are currently already registered in the config file.
 * @param cfg
 * @return
 */
private static Map<DimletKey,Integer> getDimletsFromConfig(Configuration cfg){
  Map<DimletKey,Integer> idsInConfig;
  idsInConfig=new HashMap<DimletKey,Integer>();
  ConfigCategory category=cfg.getCategory(CATEGORY_KNOWNDIMLETS);
  for (  Map.Entry<String,Property> entry : category.entrySet()) {
    String key=entry.getKey();
    if (key.startsWith("String_Node_Str")) {
      int indexDotAfterType=key.indexOf('.',7);
      String typeName=key.substring(7,indexDotAfterType);
      DimletType type=DimletType.getTypeByName(typeName);
      String name=key.substring(indexDotAfterType + 1);
      Integer id=entry.getValue().getInt();
      if (id != -1) {
        if (id > lastId) {
          lastId=id;
        }
        idsInConfig.put(new DimletKey(type,name),id);
      }
    }
  }
  return idsInConfig;
}

Fixed version (ground truth):
/** 
 * Get all dimlets which are currently already registered in the config file.
 */
private static Map<DimletKey,Integer> getDimletsFromConfig(Configuration cfg){
  Map<DimletKey,Integer> idsInConfig;
  idsInConfig=new HashMap<DimletKey,Integer>();
  ConfigCategory category=cfg.getCategory(CATEGORY_KNOWNDIMLETS);
  for (  Map.Entry<String,Property> entry : category.entrySet()) {
    String key=entry.getKey();
    if (key.startsWith("String_Node_Str")) {
      int indexDotAfterType=key.indexOf('.',7);
      String typeName=key.substring(7,indexDotAfterType);
      DimletType type=DimletType.getTypeByName(typeName);
      String name=key.substring(indexDotAfterType + 1);
      Integer id=entry.getValue().getInt();
      if (id != -1) {
        if (id > lastId) {
          lastId=id;
        }
        idsInConfig.put(new DimletKey(type,name),id);
      }
    }
  }
  return idsInConfig;
}
Program: 166117
Project: 166117
Buggy source:
private static void initBiomeItems(Configuration cfg,Map<DimletKey,Integer> idsInConfig){
  BiomeGenBase[] biomeGenArray=BiomeGenBase.getBiomeGenArray();
  for (  BiomeGenBase biome : biomeGenArray) {
    if (biome != null) {
      String name=biome.biomeName;
      int id=registerDimlet(cfg,idsInConfig,new DimletKey(DimletType.DIMLET_BIOME,name));
      idToBiome.put(id,name);
      idToDisplayName.put(id,DimletType.DIMLET_BIOME.getName() + "String_Node_Str" + name+ "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
private static void initBiomeItems(Configuration cfg,Map<DimletKey,Integer> idsInConfig){
  BiomeGenBase[] biomeGenArray=BiomeGenBase.getBiomeGenArray();
  for (  BiomeGenBase biome : biomeGenArray) {
    if (biome != null) {
      String name=biome.biomeName;
      int id=registerDimlet(cfg,idsInConfig,new DimletKey(DimletType.DIMLET_BIOME,name));
      idToBiome.put(id,biome);
      idToDisplayName.put(id,DimletType.DIMLET_BIOME.getName() + "String_Node_Str" + name+ "String_Node_Str");
    }
  }
}
Program: 166118
Project: 166118
Buggy source:
private static void setupWeightedRandomList(Configuration cfg){
  randomDimlets=new WeightedRandomSelector<Integer,Integer>(new Random());
  randomDimlets.addRarity(RARITY_0,(float)cfg.get(CATEGORY_RARITY,"String_Node_Str",250.0f).getDouble());
  randomDimlets.addRarity(RARITY_1,(float)cfg.get(CATEGORY_RARITY,"String_Node_Str",150.0f).getDouble());
  randomDimlets.addRarity(RARITY_2,(float)cfg.get(CATEGORY_RARITY,"String_Node_Str",90.0f).getDouble());
  randomDimlets.addRarity(RARITY_3,(float)cfg.get(CATEGORY_RARITY,"String_Node_Str",40.0f).getDouble());
  randomDimlets.addRarity(RARITY_4,(float)cfg.get(CATEGORY_RARITY,"String_Node_Str",20.0f).getDouble());
  randomDimlets.addRarity(RARITY_5,(float)cfg.get(CATEGORY_RARITY,"String_Node_Str",1.0f).getDouble());
  for (  Map.Entry<Integer,DimletEntry> entry : idToDimlet.entrySet()) {
    randomDimlets.addItem(entry.getValue().getRarity(),entry.getKey());
  }
}

Fixed version (ground truth):
private static void setupWeightedRandomList(Configuration cfg){
  float rarity0=(float)cfg.get(CATEGORY_RARITY,"String_Node_Str",250.0f).getDouble();
  float rarity1=(float)cfg.get(CATEGORY_RARITY,"String_Node_Str",150.0f).getDouble();
  float rarity2=(float)cfg.get(CATEGORY_RARITY,"String_Node_Str",90.0f).getDouble();
  float rarity3=(float)cfg.get(CATEGORY_RARITY,"String_Node_Str",40.0f).getDouble();
  float rarity4=(float)cfg.get(CATEGORY_RARITY,"String_Node_Str",20.0f).getDouble();
  float rarity5=(float)cfg.get(CATEGORY_RARITY,"String_Node_Str",1.0f).getDouble();
  randomDimlets=new WeightedRandomSelector<Integer,Integer>(new Random());
  setupRarity(randomDimlets,rarity0,rarity1,rarity2,rarity3,rarity4,rarity5);
  randomMaterialDimlets=new WeightedRandomSelector<Integer,Integer>(new Random());
  setupRarity(randomMaterialDimlets,rarity0,rarity1,rarity2,rarity3,rarity4,rarity5);
  randomLiquidDimlets=new WeightedRandomSelector<Integer,Integer>(new Random());
  setupRarity(randomLiquidDimlets,rarity0,rarity1,rarity2,rarity3,rarity4,rarity5);
  for (  Map.Entry<Integer,DimletEntry> entry : idToDimlet.entrySet()) {
    randomDimlets.addItem(entry.getValue().getRarity(),entry.getKey());
    if (entry.getValue().getKey().getType() == DimletType.DIMLET_MATERIAL) {
      randomMaterialDimlets.addItem(entry.getValue().getRarity(),entry.getKey());
    }
 else     if (entry.getValue().getKey().getType() == DimletType.DIMLET_LIQUID) {
      randomLiquidDimlets.addItem(entry.getValue().getRarity(),entry.getKey());
    }
  }
}
Program: 166119
Project: 166119
Buggy source:
private void groupDimletsAndModifiers(List<DimletDescriptor> descriptors,Map<DimletType,List<Integer>> dimlets,Map<DimletType,List<DimletDescriptor>> modifiers,List<DimletDescriptor> currentModifiers){
  for (  DimletDescriptor descriptor : descriptors) {
    DimletType type=descriptor.getType();
    int id=descriptor.getId();
    if (type.isModifier()) {
      currentModifiers.add(descriptor);
    }
 else {
      if (!currentModifiers.isEmpty()) {
        List<DimletDescriptor> newModifiers=new ArrayList<DimletDescriptor>();
        for (        DimletDescriptor modifier : currentModifiers) {
          if (type.isModifiedBy(modifier.getType())) {
            add(modifiers,type,modifier);
          }
 else {
            newModifiers.add(modifier);
          }
        }
        currentModifiers=newModifiers;
      }
      add(dimlets,type,id);
    }
  }
}

Fixed version (ground truth):
private void groupDimletsAndModifiers(List<DimletDescriptor> descriptors,Map<DimletType,List<Integer>> dimlets,Map<DimletType,List<DimletDescriptor>> modifiers,List<DimletDescriptor> currentModifiers){
  for (  DimletDescriptor descriptor : descriptors) {
    DimletType type=descriptor.getType();
    int id=descriptor.getId();
    if (type.isModifier()) {
      currentModifiers.add(descriptor);
    }
 else {
      if (!currentModifiers.isEmpty()) {
        List<DimletDescriptor> copy=new ArrayList<DimletDescriptor>(currentModifiers);
        for (        DimletDescriptor modifier : copy) {
          if (type.isModifiedBy(modifier.getType())) {
            add(modifiers,type,modifier);
            currentModifiers.remove(modifier);
          }
        }
      }
      add(dimlets,type,id);
    }
  }
}
Program: 166120
Project: 166120
Buggy source:
public void postInit(FMLPostInitializationEvent e){
  KnownDimletConfiguration.init(dimletConfig);
  if (mainConfig.hasChanged()) {
    mainConfig.save();
  }
  if (dimletConfig.hasChanged()) {
    dimletConfig.save();
  }
  mainConfig=null;
  dimletConfig=null;
  WrenchChecker.init();
}

Fixed version (ground truth):
public void postInit(FMLPostInitializationEvent e){
  dimletConfig.load();
  KnownDimletConfiguration.init(dimletConfig);
  if (mainConfig.hasChanged()) {
    mainConfig.save();
  }
  if (dimletConfig.hasChanged()) {
    dimletConfig.save();
  }
  mainConfig=null;
  dimletConfig=null;
  WrenchChecker.init();
}
Program: 166121
Project: 166121
Buggy source:
private static int registerDimlet(Configuration cfg,DimletKey key){
  String k="String_Node_Str" + key.getType().getName() + "String_Node_Str"+ key.getName();
  int id=-1;
  if (dimletBlackList.contains(key)) {
    id=cfg.get(CATEGORY_KNOWNDIMLETS,k,-1).getInt();
  }
 else {
    id=cfg.get(CATEGORY_KNOWNDIMLETS,k,lastId + 1).getInt();
    if (id > lastId) {
      lastId=id;
    }
  }
  if (id == -1) {
    return -1;
  }
  int rfCreateCost=checkCostConfig(cfg,"String_Node_Str",key,dimletBuiltinRfCreate,typeRfCreateCost);
  int rfMaintainCost=checkCostConfig(cfg,"String_Node_Str",key,dimletBuiltinRfMaintain,typeRfMaintainCost);
  int tickCost=checkCostConfig(cfg,"String_Node_Str",key,dimletBuiltinTickCost,typeTickCost);
  int rarity=checkCostConfig(cfg,"String_Node_Str",key,dimletBuiltinRarity,typeRarity);
  DimletEntry entry=new DimletEntry(key,rfCreateCost,rfMaintainCost,tickCost,rarity);
  registerDimletEntry(id,entry);
  return id;
}

Fixed version (ground truth):
private static int registerDimlet(Configuration cfg,Map<DimletKey,Integer> idsInConfig,DimletKey key){
  String k="String_Node_Str" + key.getType().getName() + "String_Node_Str"+ key.getName();
  int id=-1;
  if (dimletBlackList.contains(key)) {
    id=cfg.get(CATEGORY_KNOWNDIMLETS,k,-1).getInt();
  }
 else {
    if (idsInConfig.containsKey(key)) {
      id=idsInConfig.get(key);
    }
 else {
      id=cfg.get(CATEGORY_KNOWNDIMLETS,k,lastId + 1).getInt();
      if (id > lastId) {
        lastId=id;
      }
    }
  }
  if (id == -1) {
    return -1;
  }
  int rfCreateCost=checkCostConfig(cfg,"String_Node_Str",key,dimletBuiltinRfCreate,typeRfCreateCost);
  int rfMaintainCost=checkCostConfig(cfg,"String_Node_Str",key,dimletBuiltinRfMaintain,typeRfMaintainCost);
  int tickCost=checkCostConfig(cfg,"String_Node_Str",key,dimletBuiltinTickCost,typeTickCost);
  int rarity=checkCostConfig(cfg,"String_Node_Str",key,dimletBuiltinRarity,typeRarity);
  DimletEntry entry=new DimletEntry(key,rfCreateCost,rfMaintainCost,tickCost,rarity);
  registerDimletEntry(id,entry);
  return id;
}
Program: 166122
Project: 166122
Buggy source:
private static void initLiquidItems(Configuration cfg){
  Map<String,Fluid> fluidMap=FluidRegistry.getRegisteredFluids();
  for (  Map.Entry<String,Fluid> me : fluidMap.entrySet()) {
    if (me.getValue().canBePlacedInWorld()) {
      int id=registerDimlet(cfg,new DimletKey(DimletType.DIMLET_LIQUID,me.getKey()));
      String displayName=new FluidStack(me.getValue(),1).getLocalizedName();
      idToDisplayName.put(id,DimletType.DIMLET_LIQUID.getName() + "String_Node_Str" + displayName+ "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
private static void initLiquidItems(Configuration cfg,Map<DimletKey,Integer> idsInConfig){
  Map<String,Fluid> fluidMap=FluidRegistry.getRegisteredFluids();
  for (  Map.Entry<String,Fluid> me : fluidMap.entrySet()) {
    if (me.getValue().canBePlacedInWorld()) {
      int id=registerDimlet(cfg,idsInConfig,new DimletKey(DimletType.DIMLET_LIQUID,me.getKey()));
      String displayName=new FluidStack(me.getValue(),1).getLocalizedName();
      idToDisplayName.put(id,DimletType.DIMLET_LIQUID.getName() + "String_Node_Str" + displayName+ "String_Node_Str");
    }
  }
}
Program: 166123
Project: 166123
Buggy source:
private static int initFeatureItem(Configuration cfg,String name,FeatureType featureType){
  int id=registerDimlet(cfg,new DimletKey(DimletType.DIMLET_FEATURE,name));
  idToFeatureType.put(id,featureType);
  idToDisplayName.put(id,DimletType.DIMLET_FEATURE.getName() + "String_Node_Str" + name+ "String_Node_Str");
  return id;
}

Fixed version (ground truth):
private static int initFeatureItem(Configuration cfg,Map<DimletKey,Integer> idsInConfig,String name,FeatureType featureType){
  int id=registerDimlet(cfg,idsInConfig,new DimletKey(DimletType.DIMLET_FEATURE,name));
  idToFeatureType.put(id,featureType);
  idToDisplayName.put(id,DimletType.DIMLET_FEATURE.getName() + "String_Node_Str" + name+ "String_Node_Str");
  return id;
}
Program: 166124
Project: 166124
Buggy source:
private static void initMaterialItem(Configuration cfg,Block block){
  int id=registerDimlet(cfg,new DimletKey(DimletType.DIMLET_MATERIAL,block.getUnlocalizedName()));
  ItemStack stack=new ItemStack(block);
  idToDisplayName.put(id,DimletType.DIMLET_MATERIAL.getName() + "String_Node_Str" + stack.getDisplayName()+ "String_Node_Str");
}

Fixed version (ground truth):
private static void initMaterialItem(Configuration cfg,Map<DimletKey,Integer> idsInConfig,Block block){
  int id=registerDimlet(cfg,idsInConfig,new DimletKey(DimletType.DIMLET_MATERIAL,block.getUnlocalizedName()));
  ItemStack stack=new ItemStack(block);
  idToDisplayName.put(id,DimletType.DIMLET_MATERIAL.getName() + "String_Node_Str" + stack.getDisplayName()+ "String_Node_Str");
}
Program: 166125
Project: 166125
Buggy source:
private static int initSkyItem(Configuration cfg,String name){
  int id=registerDimlet(cfg,new DimletKey(DimletType.DIMLET_SKY,name));
  idToDisplayName.put(id,DimletType.DIMLET_SKY.getName() + "String_Node_Str" + name+ "String_Node_Str");
  return id;
}

Fixed version (ground truth):
private static int initSkyItem(Configuration cfg,Map<DimletKey,Integer> idsInConfig,String name){
  int id=registerDimlet(cfg,idsInConfig,new DimletKey(DimletType.DIMLET_SKY,name));
  idToDisplayName.put(id,DimletType.DIMLET_SKY.getName() + "String_Node_Str" + name+ "String_Node_Str");
  return id;
}
Program: 166126
Project: 166126
Buggy source:
private static int initStructureItem(Configuration cfg,String name,StructureType structureType){
  int id=registerDimlet(cfg,new DimletKey(DimletType.DIMLET_STRUCTURE,name));
  idToStructureType.put(id,structureType);
  idToDisplayName.put(id,DimletType.DIMLET_STRUCTURE.getName() + "String_Node_Str" + name+ "String_Node_Str");
  return id;
}

Fixed version (ground truth):
private static int initStructureItem(Configuration cfg,Map<DimletKey,Integer> idsInConfig,String name,StructureType structureType){
  int id=registerDimlet(cfg,idsInConfig,new DimletKey(DimletType.DIMLET_STRUCTURE,name));
  idToStructureType.put(id,structureType);
  idToDisplayName.put(id,DimletType.DIMLET_STRUCTURE.getName() + "String_Node_Str" + name+ "String_Node_Str");
  return id;
}
Program: 166127
Project: 166127
Buggy source:
private static int initTerrainItem(Configuration cfg,String name,TerrainType terrainType){
  int id=registerDimlet(cfg,new DimletKey(DimletType.DIMLET_TERRAIN,name));
  idToTerrainType.put(id,terrainType);
  idToDisplayName.put(id,DimletType.DIMLET_TERRAIN.getName() + "String_Node_Str" + name+ "String_Node_Str");
  return id;
}

Fixed version (ground truth):
private static int initTerrainItem(Configuration cfg,Map<DimletKey,Integer> idsInConfig,String name,TerrainType terrainType){
  int id=registerDimlet(cfg,idsInConfig,new DimletKey(DimletType.DIMLET_TERRAIN,name));
  idToTerrainType.put(id,terrainType);
  idToDisplayName.put(id,DimletType.DIMLET_TERRAIN.getName() + "String_Node_Str" + name+ "String_Node_Str");
  return id;
}
Program: 166129
Project: 166129
Buggy source:
private static int initMobItem(Configuration cfg,Class<? extends EntityLiving> entity,String name){
  int id=registerDimlet(cfg,new DimletKey(DimletType.DIMLET_MOBS,name));
  idToDisplayName.put(id,DimletType.DIMLET_MOBS.getName() + "String_Node_Str" + name+ "String_Node_Str");
  return id;
}

Fixed version (ground truth):
private static int initMobItem(Configuration cfg,Map<DimletKey,Integer> idsInConfig,Class<? extends EntityLiving> entity,String name){
  int id=registerDimlet(cfg,idsInConfig,new DimletKey(DimletType.DIMLET_MOBS,name));
  idToDisplayName.put(id,DimletType.DIMLET_MOBS.getName() + "String_Node_Str" + name+ "String_Node_Str");
  return id;
}
Program: 166130
Project: 166130
Buggy source:
private static void initFoliageItem(Configuration cfg){
  int id=registerDimlet(cfg,new DimletKey(DimletType.DIMLET_FOLIAGE,"String_Node_Str"));
  idToDisplayName.put(id,"String_Node_Str");
}

Fixed version (ground truth):
private static void initFoliageItem(Configuration cfg,Map<DimletKey,Integer> idsInConfig){
  int id=registerDimlet(cfg,idsInConfig,new DimletKey(DimletType.DIMLET_FOLIAGE,"String_Node_Str"));
  idToDisplayName.put(id,"String_Node_Str");
}
Program: 166131
Project: 166131
Buggy source:
private static void initBiomeItems(Configuration cfg){
  BiomeGenBase[] biomeGenArray=BiomeGenBase.getBiomeGenArray();
  for (  BiomeGenBase biome : biomeGenArray) {
    if (biome != null) {
      String name=biome.biomeName;
      int id=registerDimlet(cfg,new DimletKey(DimletType.DIMLET_BIOME,name));
      idToBiome.put(id,name);
      idToDisplayName.put(id,DimletType.DIMLET_BIOME.getName() + "String_Node_Str" + name+ "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
private static void initBiomeItems(Configuration cfg,Map<DimletKey,Integer> idsInConfig){
  BiomeGenBase[] biomeGenArray=BiomeGenBase.getBiomeGenArray();
  for (  BiomeGenBase biome : biomeGenArray) {
    if (biome != null) {
      String name=biome.biomeName;
      int id=registerDimlet(cfg,idsInConfig,new DimletKey(DimletType.DIMLET_BIOME,name));
      idToBiome.put(id,name);
      idToDisplayName.put(id,DimletType.DIMLET_BIOME.getName() + "String_Node_Str" + name+ "String_Node_Str");
    }
  }
}
Program: 166132
Project: 166132
Buggy source:
private static int initTimeItem(Configuration cfg,String name){
  int id=registerDimlet(cfg,new DimletKey(DimletType.DIMLET_TIME,name));
  idToDisplayName.put(id,DimletType.DIMLET_TIME.getName() + "String_Node_Str" + name+ "String_Node_Str");
  return id;
}

Fixed version (ground truth):
private static int initTimeItem(Configuration cfg,Map<DimletKey,Integer> idsInConfig,String name){
  int id=registerDimlet(cfg,idsInConfig,new DimletKey(DimletType.DIMLET_TIME,name));
  idToDisplayName.put(id,DimletType.DIMLET_TIME.getName() + "String_Node_Str" + name+ "String_Node_Str");
  return id;
}
Program: 166133
Project: 166133
Buggy source:
/** 
 * Do your mod setup. Build whatever data structures you care about. Register recipes.
 */
@EventHandler public void init(FMLInitializationEvent e){
  this.proxy.init(e);
}

Fixed version (ground truth):
/** 
 * Do your mod setup. Build whatever data structures you care about. Register recipes.
 */
@EventHandler public void init(FMLInitializationEvent e){
  this.proxy.init(e);
  channels=NetworkRegistry.INSTANCE.newChannel("String_Node_Str",DimensionSyncChannelHandler.instance);
}
Program: 166134
Project: 166134
Buggy source:
@SubscribeEvent public void unloadEvent(WorldEvent.Unload evt){
  if (evt.world.isRemote) {
    return;
  }
  RfToolsDimensionManager.unregisterDimensions();
}

Fixed version (ground truth):
@SubscribeEvent public void unloadEvent(WorldEvent.Unload evt){
  if (evt.world.isRemote) {
    return;
  }
  int d=evt.world.provider.dimensionId;
  if (d == 0) {
    RfToolsDimensionManager.unregisterDimensions();
  }
}
Program: 166135
Project: 166135
Buggy source:
private void performTeleport(){
  if (!isDestinationStillValid()) {
    applyBadEffectIfNeeded(10);
    RFTools.warn(teleportingPlayer,"String_Node_Str");
    clearTeleport(200);
    return;
  }
  int currentId=teleportingPlayer.worldObj.provider.dimensionId;
  if (currentId != teleportDestination.getDimension()) {
    MinecraftServer.getServer().getConfigurationManager().transferPlayerToDimension((EntityPlayerMP)teleportingPlayer,teleportDestination.getDimension());
  }
  Coordinate c=teleportDestination.getCoordinate();
  RFTools.message(teleportingPlayer,"String_Node_Str");
  teleportingPlayer.setPositionAndUpdate(c.getX(),c.getY() + 1,c.getZ());
  int severity=consumeReceiverEnergy(c,teleportDestination.getDimension());
  if (!applyBadEffectIfNeeded(severity)) {
    if (TeleportConfiguration.teleportVolume >= 0.01) {
      worldObj.playSoundAtEntity(teleportingPlayer,RFTools.MODID + "String_Node_Str",TeleportConfiguration.teleportVolume,1.0f);
    }
  }
  teleportingPlayer=null;
}

Fixed version (ground truth):
private void performTeleport(){
  if (!isDestinationStillValid()) {
    applyBadEffectIfNeeded(10);
    RFTools.warn(teleportingPlayer,"String_Node_Str");
    clearTeleport(200);
    return;
  }
  Coordinate c=teleportDestination.getCoordinate();
  int currentId=teleportingPlayer.worldObj.provider.dimensionId;
  if (currentId != teleportDestination.getDimension()) {
    WorldServer worldServerForDimension=MinecraftServer.getServer().worldServerForDimension(teleportDestination.getDimension());
    MinecraftServer.getServer().getConfigurationManager().transferPlayerToDimension((EntityPlayerMP)teleportingPlayer,teleportDestination.getDimension(),new RfToolsTeleporter(worldServerForDimension,c.getX(),c.getY() + 1,c.getZ()));
  }
 else {
    teleportingPlayer.setPositionAndUpdate(c.getX(),c.getY() + 1,c.getZ());
  }
  RFTools.message(teleportingPlayer,"String_Node_Str");
  int severity=consumeReceiverEnergy(c,teleportDestination.getDimension());
  if (!applyBadEffectIfNeeded(severity)) {
    if (TeleportConfiguration.teleportVolume >= 0.01) {
      worldObj.playSoundAtEntity(teleportingPlayer,RFTools.MODID + "String_Node_Str",TeleportConfiguration.teleportVolume,1.0f);
    }
  }
  teleportingPlayer=null;
}
Program: 166136
Project: 166136
Buggy source:
@Override public void execute(ICommandSender sender,String[] args){
  if (args.length < 5) {
    sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "String_Node_Str"));
    return;
  }
 else   if (args.length > 5) {
    sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "String_Node_Str"));
    return;
  }
  int dim=fetchInt(sender,args,1);
  int x=fetchInt(sender,args,2);
  int y=fetchInt(sender,args,3);
  int z=fetchInt(sender,args,4);
  if (sender instanceof EntityPlayer) {
    EntityPlayer player=(EntityPlayer)sender;
    int currentId=player.worldObj.provider.dimensionId;
    if (currentId != dim) {
      MinecraftServer.getServer().getConfigurationManager().transferPlayerToDimension((EntityPlayerMP)player,dim);
    }
    player.setPositionAndUpdate(x,y,z);
  }
}

Fixed version (ground truth):
@Override public void execute(ICommandSender sender,String[] args){
  if (args.length < 5) {
    sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "String_Node_Str"));
    return;
  }
 else   if (args.length > 5) {
    sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "String_Node_Str"));
    return;
  }
  int dim=fetchInt(sender,args,1);
  int x=fetchInt(sender,args,2);
  int y=fetchInt(sender,args,3);
  int z=fetchInt(sender,args,4);
  if (sender instanceof EntityPlayer) {
    EntityPlayer player=(EntityPlayer)sender;
    int currentId=player.worldObj.provider.dimensionId;
    if (currentId != dim) {
      WorldServer worldServerForDimension=MinecraftServer.getServer().worldServerForDimension(dim);
      MinecraftServer.getServer().getConfigurationManager().transferPlayerToDimension((EntityPlayerMP)player,dim,new RfToolsTeleporter(worldServerForDimension,x,y,z));
    }
 else {
      player.setPositionAndUpdate(x,y,z);
    }
  }
}
Program: 166137
Project: 166137
Buggy source:
@Override public IMessage onMessage(PacketForceTeleport message,MessageContext ctx){
  EntityPlayer player=ctx.getServerHandler().playerEntity;
  int currentId=player.worldObj.provider.dimensionId;
  if (currentId != message.dim) {
    MinecraftServer.getServer().getConfigurationManager().transferPlayerToDimension((EntityPlayerMP)player,message.dim);
  }
  player.setPositionAndUpdate(message.x,message.y + 1,message.z);
  return null;
}

Fixed version (ground truth):
@Override public IMessage onMessage(PacketForceTeleport message,MessageContext ctx){
  EntityPlayer player=ctx.getServerHandler().playerEntity;
  int currentId=player.worldObj.provider.dimensionId;
  if (currentId != message.dim) {
    WorldServer worldServerForDimension=MinecraftServer.getServer().worldServerForDimension(message.dim);
    MinecraftServer.getServer().getConfigurationManager().transferPlayerToDimension((EntityPlayerMP)player,message.dim,new RfToolsTeleporter(worldServerForDimension,message.x,message.y + 1,message.z));
  }
 else {
    player.setPositionAndUpdate(message.x,message.y + 1,message.z);
  }
  return null;
}
Program: 166139
Project: 166139
Buggy source:
public List<TeleportDestinationClientInfo> searchReceivers(){
  TeleportDestinations destinations=TeleportDestinations.getDestinations(worldObj);
  Set<TeleportDestination> duplicateChecker=new HashSet<TeleportDestination>();
  List<TeleportDestinationClientInfo> list=new ArrayList<TeleportDestinationClientInfo>(destinations.getValidDestinations());
  for (  TeleportDestinationClientInfo c : list) {
    duplicateChecker.add(new TeleportDestination(c.getCoordinate(),c.getDimension()));
  }
  RfToolsDimensionManager dimensionManager=RfToolsDimensionManager.getDimensionManager(worldObj);
  Map<Integer,DimensionDescriptor> dimensions=dimensionManager.getDimensions();
  for (  Map.Entry<Integer,DimensionDescriptor> me : dimensions.entrySet()) {
    Integer id=me.getKey();
    TeleportDestination c=new TeleportDestination(new Coordinate(0,70,0),id);
    if (!duplicateChecker.contains(c)) {
      duplicateChecker.add(c);
      TeleportDestinationClientInfo destinationClientInfo=new TeleportDestinationClientInfo(c);
      World w=DimensionManager.getWorld(id);
      String dimName=null;
      if (w != null) {
        dimName=DimensionManager.getProvider(id).getDimensionName();
      }
 else {
        DimensionInformation info=dimensionManager.getDimensionInformation(id);
        dimName=info.getName();
      }
      if (dimName == null || dimName.trim().isEmpty()) {
        dimName="String_Node_Str" + id;
      }
      destinationClientInfo.setDimensionName(dimName);
      list.add(destinationClientInfo);
    }
  }
  return list;
}

Fixed version (ground truth):
private List<TeleportDestinationClientInfo> searchReceivers(){
  TeleportDestinations destinations=TeleportDestinations.getDestinations(worldObj);
  Set<TeleportDestination> duplicateChecker=new HashSet<TeleportDestination>();
  List<TeleportDestinationClientInfo> list=new ArrayList<TeleportDestinationClientInfo>(destinations.getValidDestinations());
  for (  TeleportDestinationClientInfo c : list) {
    duplicateChecker.add(new TeleportDestination(c.getCoordinate(),c.getDimension()));
  }
  RfToolsDimensionManager dimensionManager=RfToolsDimensionManager.getDimensionManager(worldObj);
  Map<Integer,DimensionDescriptor> dimensions=dimensionManager.getDimensions();
  for (  Map.Entry<Integer,DimensionDescriptor> me : dimensions.entrySet()) {
    Integer id=me.getKey();
    TeleportDestination c=new TeleportDestination(new Coordinate(0,70,0),id);
    if (!duplicateChecker.contains(c)) {
      duplicateChecker.add(c);
      TeleportDestinationClientInfo destinationClientInfo=new TeleportDestinationClientInfo(c);
      World w=DimensionManager.getWorld(id);
      String dimName=null;
      if (w != null) {
        dimName=DimensionManager.getProvider(id).getDimensionName();
      }
 else {
        DimensionInformation info=dimensionManager.getDimensionInformation(id);
        dimName=info.getName();
      }
      if (dimName == null || dimName.trim().isEmpty()) {
        dimName="String_Node_Str" + id;
      }
      destinationClientInfo.setDimensionName(dimName);
      list.add(destinationClientInfo);
    }
  }
  return list;
}