nus-yam/ex-repair huggingface dataset:
Program: 145717
Project: 145717
Buggy source:
@Override public void setWorldObj(World world){
  super.setWorldObj(world);
  fakePlayer=new EntityFakePlayer(worldObj,this,xCoord,yCoord,zCoord,worldObj.getBlockMetadata(xCoord,yCoord,zCoord));
}

Fixed version (ground truth):
@Override public void setWorldObj(World world){
  super.setWorldObj(world);
}
Program: 145718
Project: 145718
Buggy source:
private void initPosition(int x,int y,int z,int meta){
  double var3=(double)x + 0.5D;
  double var5=(double)y - 1.1D;
  double var7=(double)z + 0.5D;
  float var1;
  float var2;
  System.out.println("String_Node_Str" + (meta - 8));
switch (meta - 8) {
case 0:
    var1=-90.0F;
  var2=0.0F;
var5+=0.51D;
break;
case 1:
var1=90.0F;
var2=0.0F;
var5-=0.51D;
break;
case 2:
var1=0.0F;
var2=0.0F;
var7+=0.51D;
break;
case 3:
var1=0.0F;
var2=180.0F;
var7-=0.51D;
break;
case 4:
var1=0.0F;
var2=90.0F;
var3-=0.51D;
break;
default :
var1=0.0F;
var2=270.0F;
var3+=0.51D;
}
this.setLocationAndAngles(var3,var5,var7,var2,var1);
}

Fixed version (ground truth):
private void initPosition(int x,int y,int z,int meta){
  double var3=(double)x + 0.5D;
  double var5=(double)y - 1.1D;
  double var7=(double)z + 0.5D;
  float var1;
  float var2;
switch (meta - 8) {
case 0:
    var1=90.0F;
  var2=0.0F;
var5-=0.51D;
break;
case 1:
var1=-90.0F;
var2=0.0F;
var5+=0.51D;
break;
case 2:
var1=0.0F;
var2=180.0F;
var7-=0.51D;
break;
case 3:
var1=0.0F;
var2=0.0F;
var7+=0.51D;
break;
case 4:
var1=0.0F;
var2=90.0F;
var3-=0.51D;
break;
default :
var1=0.0F;
var2=270.0F;
var3+=0.51D;
}
this.setLocationAndAngles(var3,var5,var7,var2,var1);
}
Program: 145719
Project: 145719
Buggy source:
public BlockUser(int tickRate,boolean enableFakePlayer){
  super(Material.wood);
  this.tickRate=tickRate;
  this.setCreativeTab(AdvancedDispensersMod.advancedDispensersTab);
  this.setHardness(2f);
  this.setBlockName("String_Node_Str");
  this.setStepSound(soundTypeWood);
  this.textureHelper=new UserTextureHelper();
  this.enableFakePlayer=enableFakePlayer;
  this.fakePlayer=null;
}

Fixed version (ground truth):
public BlockUser(int tickRate,boolean enableFakePlayer){
  super(Material.wood);
  this.tickRate=tickRate;
  this.setCreativeTab(AdvancedDispensersMod.advancedDispensersTab);
  this.setHardness(2f);
  this.setBlockName("String_Node_Str");
  this.setStepSound(soundTypeWood);
  this.textureHelper=new UserTextureHelper();
  this.enableFakePlayer=enableFakePlayer;
}
Program: 145720
Project: 145720
Buggy source:
@Override public void updateTick(World world,int x,int y,int z,Random random){
  if (!world.isRemote) {
    TileEntityUser tileEntity=(TileEntityUser)world.getTileEntity(x,y,z);
    int slot=getFirstSlot(tileEntity);
    if (slot < 0)     return;
    Item item=tileEntity.getStackInSlot(slot).getItem();
    int meta=world.getBlockMetadata(x,y,z);
    int i=getI(meta,x);
    int j=getJ(meta,y);
    int k=getK(meta,z);
    if (!Block.getBlockFromItem(item).equals(Blocks.air)) {
      System.out.println("String_Node_Str" + Block.getBlockFromItem(item).getUnlocalizedName());
      this.placeBlockInFront(world,tileEntity,x,y,z,i,j,k,meta,slot);
    }
 else     if (enableFakePlayer) {
      if (fakePlayer == null)       fakePlayer=new EntityFakePlayer(world,(TileEntityAdvancedDispensers)world.getTileEntity(x,y,z),x,y,z,meta);
      if (item.onItemUse(tileEntity.getStackInSlot(slot),fakePlayer,world,i,j,k,0,0.5f,1.0f,0.5f)) {
        System.out.println("String_Node_Str");
        return;
      }
 else {
        tileEntity.setInventorySlotContents(slot,item.onItemRightClick(tileEntity.getStackInSlot(slot),world,fakePlayer));
        if (tileEntity.getStackInSlot(slot).stackSize == 0)         tileEntity.setInventorySlotContents(slot,null);
        System.out.println("String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
@Override public void updateTick(World world,int x,int y,int z,Random random){
  if (!world.isRemote) {
    TileEntityUser tileEntity=(TileEntityUser)world.getTileEntity(x,y,z);
    int slot=getFirstSlot(tileEntity);
    if (slot < 0)     return;
    Item item=tileEntity.getStackInSlot(slot).getItem();
    int meta=world.getBlockMetadata(x,y,z);
    int i=getI(meta,x);
    int j=getJ(meta,y);
    int k=getK(meta,z);
    if (!Block.getBlockFromItem(item).equals(Blocks.air)) {
      System.out.println("String_Node_Str" + Block.getBlockFromItem(item).getUnlocalizedName());
      this.placeBlockInFront(world,tileEntity,x,y,z,i,j,k,meta,slot);
    }
 else     if (enableFakePlayer) {
      tileEntity.useItem(world,x,y,z,meta,slot,i,j,k);
    }
  }
}
Program: 145721
Project: 145721
Buggy source:
public TileEntityUser(){
  super("String_Node_Str",9);
}

Fixed version (ground truth):
public TileEntityUser(){
  super("String_Node_Str",9);
  this.fakePlayer=null;
}
Program: 145722
Project: 145722
Buggy source:
private void breakBlockInFront(World world,int x,int y,int z){
  int meta=world.getBlockMetadata(x,y,z);
  int i=AdvancedDispensersLib.INSTANCE.getI(meta,x);
  int j=AdvancedDispensersLib.INSTANCE.getJ(meta,y);
  int k=AdvancedDispensersLib.INSTANCE.getK(meta,z);
  Block block=world.getBlock(i,j,k);
  int blockmeta=world.getBlockMetadata(i,j,k);
  if (!block.equals(Blocks.air) && block.getHarvestLevel(blockmeta) <= this.tier) {
    ArrayList<ItemStack> drops=null;
    if (!silkTouch)     drops=block.getDrops(world,i,j,k,blockmeta,fortune);
 else {
      drops=new ArrayList<ItemStack>();
      drops.add(new ItemStack(block,1));
    }
    TileEntityBreaker tileEntityBreaker=(TileEntityBreaker)world.getTileEntity(x,y,z);
    for (    ItemStack stack : drops) {
      if (getSlotsForItemStack(stack,tileEntityBreaker)) {
        world.setBlock(i,j,k,Blocks.air);
        lastActivation=System.currentTimeMillis();
      }
    }
  }
}

Fixed version (ground truth):
private void breakBlockInFront(World world,int x,int y,int z){
  int meta=world.getBlockMetadata(x,y,z);
  int i=AdvancedDispensersLib.INSTANCE.getI(meta,x);
  int j=AdvancedDispensersLib.INSTANCE.getJ(meta,y);
  int k=AdvancedDispensersLib.INSTANCE.getK(meta,z);
  Block block=world.getBlock(i,j,k);
  int blockmeta=world.getBlockMetadata(i,j,k);
  if (!block.equals(Blocks.air) && block.getHarvestLevel(blockmeta) <= this.tier) {
    ArrayList<ItemStack> drops=null;
    if (!silkTouch)     drops=block.getDrops(world,i,j,k,blockmeta,fortune);
 else {
      drops=new ArrayList<ItemStack>();
      drops.add(new ItemStack(block,1,blockmeta));
    }
    TileEntityBreaker tileEntityBreaker=(TileEntityBreaker)world.getTileEntity(x,y,z);
    for (    ItemStack stack : drops) {
      if (getSlotsForItemStack(stack,tileEntityBreaker)) {
        world.setBlock(i,j,k,Blocks.air);
        lastActivation=System.currentTimeMillis();
      }
    }
  }
}
Program: 145723
Project: 145723
Buggy source:
private void breakBlockInFront(World world,int x,int y,int z){
  int meta=world.getBlockMetadata(x,y,z);
  int i=AdvancedDispensersLib.INSTANCE.getI(meta,x);
  int j=AdvancedDispensersLib.INSTANCE.getJ(meta,y);
  int k=AdvancedDispensersLib.INSTANCE.getK(meta,z);
  Block block=world.getBlock(i,j,k);
  int blockmeta=world.getBlockMetadata(i,j,k);
  if (!block.equals(Blocks.air) && block.getHarvestLevel(blockmeta) <= this.tier) {
    ArrayList<ItemStack> drops=null;
    if (!silkTouch)     drops=block.getDrops(world,i,j,k,blockmeta,fortune);
 else {
      drops=new ArrayList<ItemStack>();
      drops.add(new ItemStack(block,1,blockmeta));
    }
    TileEntityBreaker tileEntityBreaker=(TileEntityBreaker)world.getTileEntity(x,y,z);
    for (    ItemStack stack : drops) {
      if (getSlotsForItemStack(stack,tileEntityBreaker)) {
        world.setBlock(i,j,k,Blocks.air);
        lastActivation=System.currentTimeMillis();
      }
    }
  }
}

Fixed version (ground truth):
private void breakBlockInFront(World world,int x,int y,int z){
  int meta=world.getBlockMetadata(x,y,z);
  int i=AdvancedDispensersLib.INSTANCE.getI(meta,x);
  int j=AdvancedDispensersLib.INSTANCE.getJ(meta,y);
  int k=AdvancedDispensersLib.INSTANCE.getK(meta,z);
  Block block=world.getBlock(i,j,k);
  int blockmeta=world.getBlockMetadata(i,j,k);
  if (!block.equals(Blocks.air) && block.getHarvestLevel(blockmeta) <= this.tier) {
    ArrayList<ItemStack> drops=null;
    TileEntityBreaker tileEntity=(TileEntityBreaker)world.getTileEntity(x,y,z);
    if (silkTouch && tileEntity.canSilkHarvest(block,world,i,j,k,blockmeta)) {
      drops=new ArrayList<ItemStack>();
      drops.add(new ItemStack(block,1,blockmeta));
    }
 else {
      drops=block.getDrops(world,i,j,k,blockmeta,fortune);
    }
    TileEntityBreaker tileEntityBreaker=(TileEntityBreaker)world.getTileEntity(x,y,z);
    for (    ItemStack stack : drops) {
      if (getSlotsForItemStack(stack,tileEntityBreaker)) {
        world.setBlock(i,j,k,Blocks.air);
        lastActivation=System.currentTimeMillis();
      }
    }
  }
}
Program: 145724
Project: 145724
Buggy source:
private boolean spaceInOutput(){
  ItemStack stack=inventory[9].copy();
  for (int i=25; i < 34; i++) {
    if (inventory[i] == null || (inventory[i].getItem().equals(inventory[9].getItem().equals(inventory[i].getItem()) && inventory[i].stackSize <= inventory[i].getItem().getItemStackLimit(inventory[i]) - inventory[9].stackSize))) {
      return true;
    }
 else     if (inventory[i].getItem().equals(stack.getItem())) {
      stack.stackSize-=inventory[i].getItem().getItemStackLimit(inventory[i]) - inventory[i].stackSize;
    }
    if (stack == null || stack.stackSize <= 0) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean spaceInOutput(){
  ItemStack stack=inventory[9].copy();
  for (int i=25; i < 34; i++) {
    if (inventory[i] == null || (inventory[i].getItem().equals(stack.getItem()) && inventory[i].getItemDamage() == stack.getItemDamage() && inventory[i].stackSize <= inventory[i].getMaxStackSize() - stack.stackSize)) {
      return true;
    }
 else     if (inventory[i].getItem().equals(stack.getItem())) {
      stack.stackSize-=inventory[i].getMaxStackSize() - inventory[i].stackSize;
    }
    if (stack == null || stack.stackSize <= 0) {
      return true;
    }
  }
  return false;
}
Program: 145725
Project: 145725
Buggy source:
private void putResultInOutput(){
  ItemStack stack=inventory[9].copy();
  for (int i=25; i < 34; i++) {
    if (inventory[i] == null) {
      inventory[i]=stack;
      return;
    }
 else     if (inventory[i].getItem().equals(inventory[9].getItem().equals(inventory[i].getItem()) && inventory[i].stackSize <= inventory[i].getItem().getItemStackLimit(inventory[i]) - inventory[9].stackSize)) {
      inventory[i].stackSize+=stack.stackSize;
      return;
    }
 else     if (inventory[i].getItem().equals(stack.getItem())) {
      for (int j=0; j < stack.stackSize; j++) {
        if (inventory[i].stackSize == inventory[i].getItem().getItemStackLimit(inventory[i]))         break;
        if (stack.stackSize == 0)         return;
        stack.stackSize--;
        inventory[i].stackSize++;
      }
    }
    if (stack == null || stack.stackSize == 0) {
      return;
    }
  }
}

Fixed version (ground truth):
private void putResultInOutput(){
  ItemStack stack=inventory[9].copy();
  if (containsItem(stack)) {
    putStack(stack);
  }
 else {
    putInEmptySlot(stack);
  }
}
Program: 145726
Project: 145726
Buggy source:
private IIcon behind(int side){
switch (side) {
case 4:
    return textureBottom;
case 5:
  return textureTop;
default :
return textureSide_right;
}
}

Fixed version (ground truth):
private IIcon behind(int side){
switch (side) {
case 4:
    return textureBottom;
case 5:
  return textureTop;
case 2:
return textureSide_left;
default :
return textureSide_right;
}
}
Program: 145727
Project: 145727
Buggy source:
private IIcon left(int side){
switch (side) {
case 3:
    return textureBottom;
case 2:
  return textureTop;
case 0:
return textureSide_up;
case 1:
return textureSide_up;
default :
return textureSide_left;
}
}

Fixed version (ground truth):
private IIcon left(int side){
switch (side) {
case 3:
    return textureBottom;
case 2:
  return textureTop;
case 0:
return textureSide_up;
case 1:
return textureSide_up;
case 5:
return textureSide_right;
default :
return textureSide_left;
}
}
Program: 145728
Project: 145728
Buggy source:
private IIcon front(int side){
switch (side) {
case 5:
    return textureBottom;
case 4:
  return textureTop;
default :
return textureSide_left;
}
}

Fixed version (ground truth):
private IIcon front(int side){
switch (side) {
case 5:
    return textureBottom;
case 4:
  return textureTop;
case 2:
return textureSide_right;
default :
return textureSide_left;
}
}
Program: 145729
Project: 145729
Buggy source:
private IIcon right(int side){
switch (side) {
case 2:
    return textureBottom;
case 3:
  return textureTop;
case 0:
return textureSide_down;
case 1:
return textureSide_down;
default :
return textureSide_right;
}
}

Fixed version (ground truth):
private IIcon right(int side){
switch (side) {
case 2:
    return textureBottom;
case 3:
  return textureTop;
case 0:
return textureSide_down;
case 1:
return textureSide_down;
case 5:
return textureSide_left;
default :
return textureSide_right;
}
}
Program: 145730
Project: 145730
Buggy source:
@Override public void updateTick(World world,int x,int y,int z,Random random){
  if (!world.isRemote) {
    this.breakBlockInFront(world,x,y,z);
  }
}

Fixed version (ground truth):
@Override public void updateTick(World world,int x,int y,int z,Random random){
  if (!world.isRemote && lastActivation + tickRate * 1000 / 20 <= System.currentTimeMillis()) {
    this.breakBlockInFront(world,x,y,z);
  }
}
Program: 145731
Project: 145731
Buggy source:
public BlockBreaker(int tier,int fortune,boolean silkTouch,int tickRate){
  super(Material.rock);
  this.setCreativeTab(AdvancedDispensersMod.advancedDispensersTab);
  this.setHardness(2f);
  this.setStepSound(soundTypeStone);
  this.setBlockName("String_Node_Str");
  this.fortune=fortune;
  this.silkTouch=silkTouch;
  this.tier=tier;
  this.tickRate=tickRate;
  this.textureHelper=new BreakerTextureHelper(tier);
}

Fixed version (ground truth):
public BlockBreaker(int tier,int fortune,boolean silkTouch,int tickRate){
  super(Material.rock);
  this.setCreativeTab(AdvancedDispensersMod.advancedDispensersTab);
  this.setHardness(2f);
  this.setStepSound(soundTypeStone);
  this.setBlockName("String_Node_Str");
  this.fortune=fortune;
  this.silkTouch=silkTouch;
  this.tier=tier;
  this.tickRate=tickRate;
  this.textureHelper=new BreakerTextureHelper(tier);
  this.lastActivation=System.currentTimeMillis();
}
Program: 145732
Project: 145732
Buggy source:
private void breakBlockInFront(World world,int x,int y,int z){
  int meta=world.getBlockMetadata(x,y,z);
  int i=getI(x,y,z,meta);
  int j=getJ(x,y,z,meta);
  int k=getK(x,y,z,meta);
  Block block=world.getBlock(i,j,k);
  int blockmeta=world.getBlockMetadata(i,j,k);
  if (!block.equals(Blocks.air) && block.getHarvestLevel(blockmeta) <= this.tier) {
    ArrayList<ItemStack> drops=null;
    if (!silkTouch)     drops=block.getDrops(world,i,j,k,blockmeta,fortune);
 else {
      drops=new ArrayList<ItemStack>();
      drops.add(new ItemStack(block,1));
    }
    TileEntityBreaker tileEntityBreaker=(TileEntityBreaker)world.getTileEntity(x,y,z);
    for (    ItemStack stack : drops) {
      if (getSlotsForItemStack(stack,tileEntityBreaker)) {
        world.setBlock(i,j,k,Blocks.air);
      }
    }
  }
}

Fixed version (ground truth):
private void breakBlockInFront(World world,int x,int y,int z){
  int meta=world.getBlockMetadata(x,y,z);
  int i=getI(x,y,z,meta);
  int j=getJ(x,y,z,meta);
  int k=getK(x,y,z,meta);
  Block block=world.getBlock(i,j,k);
  int blockmeta=world.getBlockMetadata(i,j,k);
  if (!block.equals(Blocks.air) && block.getHarvestLevel(blockmeta) <= this.tier) {
    ArrayList<ItemStack> drops=null;
    if (!silkTouch)     drops=block.getDrops(world,i,j,k,blockmeta,fortune);
 else {
      drops=new ArrayList<ItemStack>();
      drops.add(new ItemStack(block,1));
    }
    TileEntityBreaker tileEntityBreaker=(TileEntityBreaker)world.getTileEntity(x,y,z);
    for (    ItemStack stack : drops) {
      if (getSlotsForItemStack(stack,tileEntityBreaker)) {
        world.setBlock(i,j,k,Blocks.air);
        lastActivation=System.currentTimeMillis();
      }
    }
  }
}
Program: 145733
Project: 145733
Buggy source:
@Override public int tickRate(World world){
  return tickRate;
}

Fixed version (ground truth):
@Override public int tickRate(World world){
  return 0;
}
Program: 145734
Project: 145734
Buggy source:
private int getI(int x,int y,int z,int meta){
switch (meta) {
case 12:
    return x - 1;
case 13:
  return x + 1;
default :
return x;
}
}

Fixed version (ground truth):
private int getI(int x,int y,int z,int meta){
switch (meta) {
case 4:
    return x - 1;
case 5:
  return x + 1;
case 12:
return x - 1;
case 13:
return x + 1;
default :
return x;
}
}
Program: 145735
Project: 145735
Buggy source:
private int getJ(int x,int y,int z,int meta){
switch (meta) {
case 8:
    return y - 1;
case 9:
  return y + 1;
default :
return y;
}
}

Fixed version (ground truth):
private int getJ(int x,int y,int z,int meta){
switch (meta) {
case 0:
    return y - 1;
case 1:
  return y + 1;
case 8:
return y - 1;
case 9:
return y + 1;
default :
return y;
}
}
Program: 145736
Project: 145736
Buggy source:
private int getK(int x,int y,int z,int meta){
switch (meta) {
case 10:
    return z - 1;
case 11:
  return z + 1;
default :
return z;
}
}

Fixed version (ground truth):
private int getK(int x,int y,int z,int meta){
switch (meta) {
case 2:
    return z - 1;
case 3:
  return z + 1;
case 10:
return z - 1;
case 11:
return z + 1;
default :
return z;
}
}
Program: 145737
Project: 145737
Buggy source:
@Override public void updateTick(World world,int x,int y,int z,Random random){
  if (!world.isRemote) {
    this.breakBlockInFront(world,x,y,z);
  }
}

Fixed version (ground truth):
@Override public void updateTick(World world,int x,int y,int z,Random random){
  if (!world.isRemote && !isBreaking) {
    this.breakBlockInFront(world,x,y,z);
  }
}
Program: 145738
Project: 145738
Buggy source:
public BlockBreaker(int tier,int fortune,boolean silkTouch,int tickRate){
  super(Material.rock);
  this.setCreativeTab(AdvancedDispensersMod.advancedDispensersTab);
  this.setHardness(2f);
  this.setStepSound(soundTypeStone);
  this.setBlockName("String_Node_Str");
  this.fortune=fortune;
  this.silkTouch=silkTouch;
  this.tier=tier;
  this.tickRate=tickRate;
  this.textureHelper=new BreakerTextureHelper(tier);
}

Fixed version (ground truth):
public BlockBreaker(int tier,int fortune,boolean silkTouch,int tickRate){
  super(Material.rock);
  this.setCreativeTab(AdvancedDispensersMod.advancedDispensersTab);
  this.setHardness(2f);
  this.setStepSound(soundTypeStone);
  this.setBlockName("String_Node_Str");
  this.fortune=fortune;
  this.silkTouch=silkTouch;
  this.tier=tier;
  this.tickRate=tickRate;
  this.textureHelper=new BreakerTextureHelper(tier);
  this.isBreaking=false;
}
Program: 145739
Project: 145739
Buggy source:
private void breakBlockInFront(World world,int x,int y,int z){
  int meta=world.getBlockMetadata(x,y,z);
  int i=getI(x,y,z,meta);
  int j=getJ(x,y,z,meta);
  int k=getK(x,y,z,meta);
  Block block=world.getBlock(i,j,k);
  int blockmeta=world.getBlockMetadata(i,j,k);
  if (!block.equals(Blocks.air) && block.getHarvestLevel(blockmeta) <= this.tier) {
    ArrayList<ItemStack> drops=null;
    if (!silkTouch)     drops=block.getDrops(world,i,j,k,blockmeta,fortune);
 else {
      drops=new ArrayList<ItemStack>();
      drops.add(new ItemStack(block,1));
    }
    TileEntityBreaker tileEntityBreaker=(TileEntityBreaker)world.getTileEntity(x,y,z);
    for (    ItemStack stack : drops) {
      if (getSlotsForItemStack(stack,tileEntityBreaker)) {
        world.setBlock(i,j,k,Blocks.air);
      }
    }
  }
}

Fixed version (ground truth):
private void breakBlockInFront(World world,int x,int y,int z){
  this.isBreaking=true;
  int meta=world.getBlockMetadata(x,y,z);
  int i=getI(x,y,z,meta);
  int j=getJ(x,y,z,meta);
  int k=getK(x,y,z,meta);
  Block block=world.getBlock(i,j,k);
  int blockmeta=world.getBlockMetadata(i,j,k);
  if (!block.equals(Blocks.air) && block.getHarvestLevel(blockmeta) <= this.tier) {
    ArrayList<ItemStack> drops=null;
    if (!silkTouch)     drops=block.getDrops(world,i,j,k,blockmeta,fortune);
 else {
      drops=new ArrayList<ItemStack>();
      drops.add(new ItemStack(block,1));
    }
    TileEntityBreaker tileEntityBreaker=(TileEntityBreaker)world.getTileEntity(x,y,z);
    for (    ItemStack stack : drops) {
      if (getSlotsForItemStack(stack,tileEntityBreaker)) {
        world.setBlock(i,j,k,Blocks.air);
      }
    }
  }
  this.isBreaking=false;
}
Program: 145743
Project: 145743
Buggy source:
public void execute(Writer writer,SnipMacroParameter params) throws IllegalArgumentException, IOException {
  Snip snip=params.getSnipRenderContext().getSnip();
  String name=snip.getName();
  String handler=params.get("String_Node_Str",0);
  writer.write("String_Node_Str");
  writer.write(name);
  writer.write("String_Node_Str");
  writer.write(handler);
  int start=snip.getContent().indexOf('}',params.getStart() + getName().length()) + 1;
  int end=params.getEnd() - getName().length() - 2;
  writer.write("String_Node_Str" + start);
  writer.write("String_Node_Str" + end);
  writer.write("String_Node_Str");
}

Fixed version (ground truth):
public void execute(Writer writer,SnipMacroParameter params) throws IllegalArgumentException, IOException {
  Snip snip=params.getSnipRenderContext().getSnip();
  String name=snip.getName();
  String handler=params.get("String_Node_Str",0);
  writer.write("String_Node_Str");
  writer.write(SnipLink.encode(name));
  writer.write("String_Node_Str");
  writer.write(handler);
  int start=snip.getContent().indexOf('}',params.getStart() + getName().length()) + 1;
  int end=params.getEnd() - getName().length() - 2;
  writer.write("String_Node_Str" + start);
  writer.write("String_Node_Str" + end);
  writer.write("String_Node_Str");
}
Program: 145744
Project: 145744
Buggy source:
public Hits search(String queryString){
  Searcher searcher=null;
  try {
    searcher=new IndexSearcher(indexFile().getAbsolutePath());
  }
 catch (  IOException e) {
    Logger.warn("String_Node_Str" + indexFile(),e);
  }
  Query query=null;
  try {
    query=MultiFieldQueryParser.parse(queryString,searchFields,new SnipAnalyzer());
  }
 catch (  org.apache.lucene.queryParser.ParseException e1) {
    close(searcher);
    Logger.warn("String_Node_Str" + queryString + "String_Node_Str");
  }
  Hits hits=null;
  try {
    hits=searcher.search(query);
  }
 catch (  IOException e) {
    close(searcher);
    Logger.warn("String_Node_Str",e);
  }
  return hits;
}

Fixed version (ground truth):
public Hits search(String queryString){
  Searcher searcher=null;
  try {
    searcher=new IndexSearcher(indexFile().getAbsolutePath());
  }
 catch (  IOException e) {
    Logger.warn("String_Node_Str" + indexFile(),e);
  }
  Query query=null;
  try {
    query=MultiFieldQueryParser.parse(queryString,searchFields,new StandardAnalyzer());
  }
 catch (  org.apache.lucene.queryParser.ParseException e1) {
    close(searcher);
    Logger.warn("String_Node_Str" + queryString + "String_Node_Str");
  }
  Hits hits=null;
  try {
    hits=searcher.search(query);
  }
 catch (  IOException e) {
    close(searcher);
    Logger.warn("String_Node_Str",e);
  }
  return hits;
}
Program: 145745
Project: 145745
Buggy source:
private synchronized void index(Snip snip,boolean exists){
  IndexWriter writer=null;
  try {
    File f;
    boolean create=true;
    if ((f=indexFile()).exists() && f.isDirectory()) {
      create=false;
    }
 else {
      create=true;
    }
    if (exists && f.exists()) {
      removeIndex(snip);
    }
    writer=new IndexWriter(f,new SnipAnalyzer(),create);
    writer.mergeFactor=20;
    writer.addDocument(SnipDocument.Document(snip));
    writer.optimize();
  }
 catch (  IOException e) {
    Logger.warn("String_Node_Str",e);
  }
 finally {
    close(writer);
  }
}

Fixed version (ground truth):
private synchronized void index(Snip snip,boolean exists){
  IndexWriter writer=null;
  try {
    File f;
    boolean create=true;
    if ((f=indexFile()).exists() && f.isDirectory()) {
      create=false;
    }
 else {
      create=true;
    }
    if (exists && f.exists()) {
      removeIndex(snip);
    }
    writer=new IndexWriter(f,new StandardAnalyzer(),create);
    writer.mergeFactor=20;
    writer.addDocument(SnipDocument.Document(snip));
    writer.optimize();
  }
 catch (  IOException e) {
    Logger.warn("String_Node_Str",e);
  }
 finally {
    close(writer);
  }
}
Program: 145746
Project: 145746
Buggy source:
public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException {
  Configuration config=Application.get().getConfiguration();
  String snipName=request.getParameter("String_Node_Str");
  if (null == snipName) {
    response.sendRedirect(config.getUrl("String_Node_Str" + config.getStartSnip()));
    return;
  }
  if (null != request.getParameter("String_Node_Str")) {
    response.sendRedirect(config.getUrl("String_Node_Str" + SnipLink.encode(snipName)));
    return;
  }
  Snip snip=SnipSpaceFactory.getInstance().load(snipName);
  String labelName=request.getParameter("String_Node_Str");
  snip.getLabels().removeLabel(labelName);
  RequestDispatcher dispatcher=request.getRequestDispatcher("String_Node_Str" + SnipLink.encode(snipName));
  dispatcher.forward(request,response);
}

Fixed version (ground truth):
public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException {
  Configuration config=Application.get().getConfiguration();
  String type=request.getHeader("String_Node_Str");
  if (type != null && type.startsWith("String_Node_Str")) {
    try {
      request=new MultipartWrapper(request,config.getEncoding() != null ? config.getEncoding() : "String_Node_Str");
    }
 catch (    IllegalArgumentException e) {
      Logger.warn("String_Node_Str" + e.getMessage());
    }
  }
  String snipName=request.getParameter("String_Node_Str");
  if (null == snipName) {
    response.sendRedirect(config.getUrl("String_Node_Str" + config.getStartSnip()));
    return;
  }
  if (null != request.getParameter("String_Node_Str")) {
    response.sendRedirect(config.getUrl("String_Node_Str" + SnipLink.encode(snipName)));
    return;
  }
  Snip snip=SnipSpaceFactory.getInstance().load(snipName);
  String labelName=request.getParameter("String_Node_Str");
  snip.getLabels().removeLabel(labelName);
  RequestDispatcher dispatcher=request.getRequestDispatcher("String_Node_Str" + SnipLink.encode(snipName));
  dispatcher.forward(request,response);
}
Program: 145747
Project: 145747
Buggy source:
public void remove(Snip snip){
synchronized (delayed) {
    if (!delayed.contains(snip)) {
      delayed.remove(snip);
    }
  }
  changed.getQueue().remove(snip);
  storage.storageRemove(snip);
  indexer.removeIndex(snip);
  return;
}

Fixed version (ground truth):
public void remove(Snip snip){
synchronized (delayed) {
    delayed.remove(snip);
  }
  changed.getQueue().remove(snip);
  storage.storageRemove(snip);
  indexer.removeIndex(snip);
  return;
}
Program: 145748
Project: 145748
Buggy source:
public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException {
  String parent=request.getParameter("String_Node_Str");
  String parentBefore=request.getParameter("String_Node_Str");
  if (null == parentBefore) {
    parentBefore=parent;
  }
  String content=request.getParameter("String_Node_Str");
  String name=request.getParameter("String_Node_Str");
  String template=request.getParameter("String_Node_Str");
  if (template != null) {
    SnipSpace space=(SnipSpace)Components.getComponent(SnipSpace.class);
    Snip snip=space.load(template);
    content=snip.getContent();
  }
  request.setAttribute("String_Node_Str",parent);
  request.setAttribute("String_Node_Str",parentBefore);
  request.setAttribute("String_Node_Str",content);
  request.setAttribute("String_Node_Str",name);
  request.setAttribute("String_Node_Str",getTemplates());
  RequestDispatcher dispatcher=request.getRequestDispatcher("String_Node_Str");
  dispatcher.forward(request,response);
}

Fixed version (ground truth):
public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException {
  String parent=request.getParameter("String_Node_Str");
  String parentBefore=request.getParameter("String_Node_Str");
  if (null == parentBefore) {
    parentBefore=parent;
  }
  String content=request.getParameter("String_Node_Str");
  String name=request.getParameter("String_Node_Str");
  String template=request.getParameter("String_Node_Str");
  String copy=request.getParameter("String_Node_Str");
  if ((copy != null) && (template != null)) {
    SnipSpace space=(SnipSpace)Components.getComponent(SnipSpace.class);
    Snip snip=space.load(template);
    content=snip.getContent();
  }
  request.setAttribute("String_Node_Str",parent);
  request.setAttribute("String_Node_Str",parentBefore);
  request.setAttribute("String_Node_Str",content);
  request.setAttribute("String_Node_Str",name);
  request.setAttribute("String_Node_Str",getTemplates());
  RequestDispatcher dispatcher=request.getRequestDispatcher("String_Node_Str");
  dispatcher.forward(request,response);
}
Program: 145750
Project: 145750
Buggy source:
public Map setup(HttpServletRequest request,HttpServletResponse response,Configuration config,Map errors){
  String autodetect=request.getParameter(Configuration.APP_REAL_AUTODETECT) != null ? "String_Node_Str" : "String_Node_Str";
  config.setRealAutodetect(autodetect);
  if ("String_Node_Str".equals(autodetect)) {
    config.setRealHost(request.getParameter(Configuration.APP_REAL_HOST));
    String portStr=request.getParameter(Configuration.APP_REAL_PORT);
    config.setRealPort(request.getParameter(Configuration.APP_REAL_PORT));
    if (portStr != null && !"String_Node_Str".equals(portStr)) {
      try {
        Integer.parseInt(portStr);
      }
 catch (      NumberFormatException e) {
        errors.put(Configuration.APP_REAL_PORT,Configuration.APP_REAL_PORT);
      }
    }
  }
  String realProtocol=request.getParameter(Configuration.APP_REAL_PROTOCOL);
  if (null != realProtocol && !"String_Node_Str".equals(realProtocol)) {
    config.setRealPath(realProtocol.trim());
  }
  String realPath=request.getParameter(Configuration.APP_REAL_PATH);
  if (null != realPath && !"String_Node_Str".equals(realPath)) {
    realPath=realPath.trim();
    config.setRealPath(realPath.startsWith("String_Node_Str") ? realPath : "String_Node_Str" + realPath);
  }
  return errors;
}

Fixed version (ground truth):
public Map setup(HttpServletRequest request,HttpServletResponse response,Configuration config,Map errors){
  String autodetect=request.getParameter(Configuration.APP_REAL_AUTODETECT) != null ? "String_Node_Str" : "String_Node_Str";
  config.setRealAutodetect(autodetect);
  if ("String_Node_Str".equals(autodetect)) {
    config.setRealHost(request.getParameter(Configuration.APP_REAL_HOST));
    String portStr=request.getParameter(Configuration.APP_REAL_PORT);
    config.setRealPort(request.getParameter(Configuration.APP_REAL_PORT));
    if (portStr != null && !"String_Node_Str".equals(portStr)) {
      try {
        Integer.parseInt(portStr);
      }
 catch (      NumberFormatException e) {
        errors.put(Configuration.APP_REAL_PORT,Configuration.APP_REAL_PORT);
      }
    }
  }
  String realProtocol=request.getParameter(Configuration.APP_REAL_PROTOCOL);
  if (null != realProtocol && !"String_Node_Str".equals(realProtocol)) {
    config.setRealProtocol(realProtocol.trim());
  }
  String realPath=request.getParameter(Configuration.APP_REAL_PATH);
  if (null != realPath && !"String_Node_Str".equals(realPath)) {
    realPath=realPath.trim();
    config.setRealPath(realPath.startsWith("String_Node_Str") ? realPath : "String_Node_Str" + realPath);
  }
  return errors;
}
Program: 145751
Project: 145751
Buggy source:
public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException {
  User user=Application.get().getUser();
  AuthenticationService service=(AuthenticationService)Components.getComponent(AuthenticationService.class);
  if (service.isAuthenticated(user)) {
    user.lastAccess();
  }
  String name=request.getPathInfo();
  if (null == name || "String_Node_Str".equals(name)) {
    name=Application.get().getConfiguration().getStartSnip();
  }
 else {
    name=name.substring(1);
  }
  Configuration config=Application.get().getConfiguration();
  String encodedSpace=config.getEncodedSpace();
  if (encodedSpace != null && encodedSpace.length() > 0) {
    name=name.replace(encodedSpace.charAt(0),' ');
  }
  Snip snip=SnipSpaceFactory.getInstance().load(name);
  ServletOutputStream out=response.getOutputStream();
  response.setContentType("String_Node_Str" + Application.get().getConfiguration().getEncoding());
  if (null != snip) {
    snip.handle(request);
    out.println(snip.getContent());
  }
 else {
    out.println("String_Node_Str");
  }
}

Fixed version (ground truth):
public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException {
  User user=Application.get().getUser();
  AuthenticationService service=(AuthenticationService)Components.getComponent(AuthenticationService.class);
  if (service.isAuthenticated(user)) {
    user.lastAccess();
  }
  String name=request.getPathInfo();
  if (null == name || "String_Node_Str".equals(name)) {
    name=Application.get().getConfiguration().getStartSnip();
  }
 else {
    name=name.substring(1);
  }
  Configuration config=Application.get().getConfiguration();
  String encodedSpace=config.getEncodedSpace();
  if (encodedSpace != null && encodedSpace.length() > 0) {
    name=name.replace(encodedSpace.charAt(0),' ');
  }
  Snip snip=SnipSpaceFactory.getInstance().load(name);
  response.setContentType("String_Node_Str" + Application.get().getConfiguration().getEncoding());
  PrintWriter out=response.getWriter();
  if (null != snip) {
    snip.handle(request);
    out.println(snip.getContent());
  }
 else {
    out.println("String_Node_Str");
  }
}
Program: 145752
Project: 145752
Buggy source:
public boolean restoreXml(byte[] xmlData,int flags) throws IOException {
  ByteArrayInputStream importStream=new ByteArrayInputStream(xmlData);
  try {
    XMLSnipImport.load(importStream,flags);
  }
 catch (  Exception e) {
    System.err.println("String_Node_Str" + e);
    e.printStackTrace();
  }
  return true;
}

Fixed version (ground truth):
public boolean restoreXml(byte[] xmlData,int flags) throws IOException {
  ByteArrayInputStream importStream=new ByteArrayInputStream(xmlData);
  try {
    XMLSnipImport.load(importStream,flags);
  }
 catch (  Exception e) {
    System.err.println("String_Node_Str" + e);
    throw new IOException(e.getMessage());
  }
  return true;
}
Program: 145753
Project: 145753
Buggy source:
public void sendMail(String sender,Collection recipientList,String subject,String content){
  try {
    Message mesg=new MimeMessage(session);
    mesg.setFrom(new InternetAddress(sender));
    Iterator iterator=recipientList.iterator();
    while (iterator.hasNext()) {
      String recpt=(String)iterator.next();
      mesg.addRecipient(Message.RecipientType.TO,new InternetAddress(recpt));
    }
    mesg.setSubject(subject);
    Multipart mp=new MimeMultipart();
    BodyPart htmlPart=new MimeBodyPart();
    htmlPart.setContent(content,"String_Node_Str");
    mp.addBodyPart(htmlPart);
    mesg.setContent(mp);
    Transport.send(mesg);
  }
 catch (  MessagingException ex) {
    Exception e;
    while ((e=ex.getNextException()) != null) {
      Logger.warn(ex.getMessage(),e);
    }
  }
  return;
}

Fixed version (ground truth):
public void sendMail(String sender,Collection recipientList,String subject,String content){
  try {
    Message mesg=new MimeMessage(session);
    mesg.setFrom(new InternetAddress(sender));
    Iterator iterator=recipientList.iterator();
    while (iterator.hasNext()) {
      String recpt=(String)iterator.next();
      mesg.addRecipient(Message.RecipientType.TO,new InternetAddress(recpt));
    }
    mesg.setSubject(subject);
    Multipart mp=new MimeMultipart();
    BodyPart htmlPart=new MimeBodyPart();
    htmlPart.setContent(content,"String_Node_Str");
    mp.addBodyPart(htmlPart);
    mesg.setContent(mp);
    Transport.send(mesg);
  }
 catch (  MessagingException ex) {
    Exception e;
    if ((e=ex.getNextException()) != null) {
      Logger.warn(ex.getMessage(),e);
    }
  }
  return;
}
Program: 145755
Project: 145755
Buggy source:
private void update(Configuration config){
  if (null == dataSource) {
    try {
      System.err.println("String_Node_Str" + config.getJdbcDriver());
      Class.forName(config.getJdbcDriver());
    }
 catch (    Exception e) {
      Logger.fatal("String_Node_Str" + config.getJdbcDriver(),e);
    }
    String jdbcUrl=config.getJdbcUrl();
    if (jdbcUrl.indexOf("String_Node_Str") != -1) {
      jdbcUrl=jdbcUrl.concat("String_Node_Str");
    }
 else {
      jdbcUrl=jdbcUrl.concat("String_Node_Str");
    }
    jdbcUrl=jdbcUrl.concat("String_Node_Str" + config.getJdbcUser()).concat("String_Node_Str" + config.getJdbcPassword());
    ObjectPool connectionPool=new GenericObjectPool(null);
    ConnectionFactory connectionFactory=new DriverManagerConnectionFactory(jdbcUrl,config.getJdbcUser(),config.getJdbcPassword());
    PoolableConnectionFactory poolableConnectionFactory=new PoolableConnectionFactory(connectionFactory,connectionPool,null,null,false,true);
    dataSource=new PoolingDataSource(connectionPool);
  }
}

Fixed version (ground truth):
private void update(Configuration config){
  if (null == dataSource) {
    try {
      System.err.println("String_Node_Str" + config.getJdbcDriver());
      Class.forName(config.getJdbcDriver());
    }
 catch (    Exception e) {
      Logger.fatal("String_Node_Str" + config.getJdbcDriver(),e);
    }
    String jdbcUrl=config.getJdbcUrl();
    if (jdbcUrl.indexOf("String_Node_Str") != -1) {
      jdbcUrl=jdbcUrl.concat("String_Node_Str");
    }
 else {
      jdbcUrl=jdbcUrl.concat("String_Node_Str");
    }
    String jdbcPassword=config.getJdbcPassword();
    if (null != jdbcPassword) {
      jdbcPassword="String_Node_Str";
    }
    jdbcUrl=jdbcUrl.concat("String_Node_Str" + config.getJdbcUser()).concat("String_Node_Str" + jdbcPassword);
    ObjectPool connectionPool=new GenericObjectPool(null);
    ConnectionFactory connectionFactory=new DriverManagerConnectionFactory(jdbcUrl,config.getJdbcUser(),jdbcPassword);
    PoolableConnectionFactory poolableConnectionFactory=new PoolableConnectionFactory(connectionFactory,connectionPool,null,null,false,true);
    dataSource=new PoolingDataSource(connectionPool);
  }
}
Program: 145757
Project: 145757
Buggy source:
public void remove(Snip snip){
  changed.getQueue().remove(snip);
  storage.storageRemove(snip);
  indexer.removeIndex(snip);
  return;
}

Fixed version (ground truth):
public void remove(Snip snip){
synchronized (delayed) {
    if (!delayed.contains(snip)) {
      delayed.remove(snip);
    }
  }
  changed.getQueue().remove(snip);
  storage.storageRemove(snip);
  indexer.removeIndex(snip);
  return;
}
Program: 145759
Project: 145759
Buggy source:
public String getName(){
  return "String_Node_Str";
}

Fixed version (ground truth):
public String getName(){
  return name;
}
Program: 145760
Project: 145760
Buggy source:
public void execute(Writer writer,MacroParameter params) throws IllegalArgumentException, IOException {
  if (params.getLength() == 1) {
    Snip[] snips=space.match(params.get("String_Node_Str"));
    int depth=-1;
    int startDepth=-1;
    int currentDepth=-1;
    for (int i=0; i < snips.length; i++) {
      Snip snip=snips[i];
      String elements[]=snip.getName().split("String_Node_Str");
      currentDepth=elements.length - 1;
      if (startDepth == -1) {
        startDepth=currentDepth;
      }
      if (currentDepth > depth) {
        depth=currentDepth;
        writer.write("String_Node_Str");
      }
 else       if (currentDepth < depth) {
        depth=currentDepth;
        writer.write("String_Node_Str");
      }
      writer.write("String_Node_Str");
      SnipLink.appendLink(writer,snip.getName(),elements[elements.length - 1]);
      writer.write("String_Node_Str");
    }
    if (-1 != startDepth) {
      for (int i=0; i < currentDepth; i++) {
        writer.write("String_Node_Str");
      }
    }
  }
 else   if (params.getLength() == 2) {
    writer.write("String_Node_Str" + params.get(0) + "String_Node_Str");
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
}

Fixed version (ground truth):
public void execute(Writer writer,MacroParameter params) throws IllegalArgumentException, IOException {
  if (params.getLength() == 1) {
    Snip[] snips=space.match(params.get("String_Node_Str"));
    Node root=new Node("String_Node_Str",false);
    for (int i=0; i < snips.length; i++) {
      Snip snip=snips[i];
      String elements[]=snip.getName().split("String_Node_Str");
      Node lastNode=root;
      for (int j=0; j < elements.length; j++) {
        String name=elements[j];
        if (!lastNode.hasChild(name)) {
          boolean isSnip=(j == elements.length - 1);
          Node node=new Node(name,isSnip);
          if (isSnip) {
            node.setSnipName(snip.getName());
          }
          lastNode.addChild(node);
          lastNode=node;
        }
 else {
          lastNode=lastNode.getChild(name);
        }
      }
    }
    writeTree(writer,root);
  }
 else   if (params.getLength() == 2) {
    writer.write("String_Node_Str" + params.get(0) + "String_Node_Str");
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
}
Program: 145761
Project: 145761
Buggy source:
private Macro compileMacro(String macroSource){
  Macro macro=null;
  try {
    GroovyClassLoader gcl=new GroovyClassLoader();
    InputStream is=new ByteArrayInputStream(macroSource.getBytes());
    Class clazz=gcl.parseClass(is,"String_Node_Str");
    Object aScript=clazz.newInstance();
    macro=(Macro)aScript;
    System.out.println("String_Node_Str" + macroSource);
  }
 catch (  Exception e) {
    System.err.println("String_Node_Str" + e.getMessage());
    e.printStackTrace();
  }
  return macro;
}

Fixed version (ground truth):
private Macro compileMacro(String macroSource){
  Macro macro=null;
  try {
    GroovyClassLoader gcl=new GroovyClassLoader();
    InputStream is=new ByteArrayInputStream(macroSource.getBytes());
    Class clazz=gcl.parseClass(is,"String_Node_Str");
    Object aScript=clazz.newInstance();
    macro=(Macro)aScript;
  }
 catch (  Exception e) {
    System.err.println("String_Node_Str" + e.getMessage());
    e.printStackTrace();
  }
  return macro;
}
Program: 145762
Project: 145762
Buggy source:
public int doStartTag() throws JspException {
  if (null != snip) {
    Map dublinCore=DublinCore.generate(snip);
    try {
      JspWriter out=pageContext.getOut();
      if ("String_Node_Str".equals(format)) {
        Iterator iterator=dublinCore.keySet().iterator();
        while (iterator.hasNext()) {
          String name=(String)iterator.next();
          String value=(String)dublinCore.get(name);
          out.print("String_Node_Str");
          out.print(name.toLowerCase());
          out.print("String_Node_Str");
          out.print(value);
          out.print("String_Node_Str");
          out.print(name);
          out.println("String_Node_Str");
        }
      }
 else {
        out.println("String_Node_Str");
        Iterator iterator=dublinCore.keySet().iterator();
        while (iterator.hasNext()) {
          String name=(String)iterator.next();
          String value=(String)dublinCore.get(name);
          out.print("String_Node_Str");
          out.print(capitalize(name));
          out.print("String_Node_Str");
          out.print(value);
          out.println("String_Node_Str");
        }
      }
    }
 catch (    IOException e) {
      Logger.warn("String_Node_Str",e);
    }
  }
  return super.doStartTag();
}

Fixed version (ground truth):
public int doStartTag() throws JspException {
  if (null != snip) {
    Map dublinCore=DublinCore.generate(snip);
    try {
      JspWriter out=pageContext.getOut();
      if ("String_Node_Str".equals(format)) {
        Iterator iterator=dublinCore.keySet().iterator();
        while (iterator.hasNext()) {
          String name=(String)iterator.next();
          String value=(String)dublinCore.get(name);
          out.print("String_Node_Str");
          out.print(name.toLowerCase());
          out.print("String_Node_Str");
          out.print(Encoder.escape(value));
          out.print("String_Node_Str");
          out.print(name);
          out.println("String_Node_Str");
        }
      }
 else {
        out.println("String_Node_Str");
        Iterator iterator=dublinCore.keySet().iterator();
        while (iterator.hasNext()) {
          String name=(String)iterator.next();
          String value=(String)dublinCore.get(name);
          out.print("String_Node_Str");
          out.print(capitalize(name));
          out.print("String_Node_Str");
          out.print(Encoder.escape(value));
          out.println("String_Node_Str");
        }
      }
    }
 catch (    IOException e) {
      Logger.warn("String_Node_Str",e);
    }
  }
  return super.doStartTag();
}
Program: 145763
Project: 145763
Buggy source:
/** 
 * Store a snip in an XML node.
 * @param user the user to store
 * @return the serialized user as XML
 */
public Element serialize(User user){
  Element userElement=DocumentHelper.createElement(USER);
  userElement.addElement(USER_NAME).addText(user.getLogin());
  userElement.addElement(USER_PASSWORD).addText(notNull(user.getPasswd()));
  userElement.addElement(USER_EMAIL).addText(notNull(user.getEmail()));
  userElement.addElement(USER_ROLES).addText(user.getRoles().toString());
  userElement.addElement(USER_STATUS).addText(notNull(user.getStatus()));
  userElement.addElement(USER_CTIME,getStringTimestamp(user.getCTime()));
  userElement.addElement(USER_MTIME,getStringTimestamp(user.getMTime()));
  userElement.addElement(USER_LAST_ACCESS,getStringTimestamp(user.getLastAccess()));
  userElement.addElement(USER_LAST_LOGIN,getStringTimestamp(user.getLastLogin()));
  userElement.addElement(USER_LAST_LOGOUT,getStringTimestamp(user.getLastLogout()));
  userElement.addElement(USER_APPLICATION,notNull(user.getApplication()));
  return userElement;
}

Fixed version (ground truth):
/** 
 * Store a snip in an XML node.
 * @param user the user to store
 * @return the serialized user as XML
 */
public Element serialize(User user){
  Element userElement=DocumentHelper.createElement(USER);
  userElement.addElement(USER_NAME).addText(user.getLogin());
  userElement.addElement(USER_PASSWORD).addText(notNull(user.getPasswd()));
  userElement.addElement(USER_EMAIL).addText(notNull(user.getEmail()));
  userElement.addElement(USER_ROLES).addText(user.getRoles().toString());
  userElement.addElement(USER_STATUS).addText(notNull(user.getStatus()));
  userElement.addElement(USER_CTIME).addText(getStringTimestamp(user.getCTime()));
  userElement.addElement(USER_MTIME).addText(getStringTimestamp(user.getMTime()));
  userElement.addElement(USER_LAST_ACCESS).addText(getStringTimestamp(user.getLastAccess()));
  userElement.addElement(USER_LAST_LOGIN).addText(getStringTimestamp(user.getLastLogin()));
  userElement.addElement(USER_LAST_LOGOUT).addText(getStringTimestamp(user.getLastLogout()));
  userElement.addElement(USER_APPLICATION).addText(notNull(user.getApplication()));
  return userElement;
}