nus-yam/ex-repair huggingface dataset:
Program: 59840
Project: 59840
Buggy source:
@Test public void test() throws Exception {
  ConfigurationBuilderImpl t=(ConfigurationBuilderImpl)tang.newConfigurationBuilder();
  t.register(Tweeter.class);
  t.bindImplementation(TweetFactory.class,MockTweetFactory.class);
  t.bindImplementation(SMS.class,MockSMS.class);
  t.bindNamedParameter(Tweeter.PhoneNumber.class,new Long(867 - 5309).toString());
  Tweeter tw=(Tweeter)new InjectorImpl(t.build()).getInstance(Tweeter.class);
  tw.sendMessage();
}

Fixed version (ground truth):
@Test public void test() throws Exception {
  ConfigurationBuilder t=tang.newConfigurationBuilder();
  t.register(Tweeter.class);
  t.bindImplementation(TweetFactory.class,MockTweetFactory.class);
  t.bindImplementation(SMS.class,MockSMS.class);
  t.bindNamedParameter(Tweeter.PhoneNumber.class,new Long(867 - 5309).toString());
  Tweeter tw=(Tweeter)tang.newInjector(t.build()).getInstance(Tweeter.class);
  tw.sendMessage();
}
Program: 59841
Project: 59841
Buggy source:
@Override public Injector createChildInjector(Configuration... configurations) throws BindException {
  InjectorImpl ret;
  ret=copy(this);
  return ret;
}

Fixed version (ground truth):
@Override public Injector createChildInjector(Configuration... configurations) throws BindException {
  InjectorImpl ret;
  ret=copy(this,configurations);
  return ret;
}
Program: 59843
Project: 59843
Buggy source:
@Override public void addConfiguration(Configuration ti) throws BindException {
  ConfigurationImpl t=(ConfigurationImpl)ti;
  if (t.dirtyBit) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  try {
    for (    Class<?> c : t.namespace.getRegisteredClasses()) {
      register(c);
    }
    for (    ClassNode<?> cn : t.boundImpls.keySet()) {
      bind(cn.getClazz(),t.boundImpls.get(cn));
    }
    for (    ClassNode<?> cn : t.boundConstructors.keySet()) {
      bind(cn.getClazz(),t.boundConstructors.get(cn));
    }
    for (    ClassNode<?> cn : t.singletons) {
      try {
        bindSingleton(cn.getClazz());
      }
 catch (      BindException e) {
        throw new IllegalStateException("String_Node_Str",e);
      }
    }
    for (    NamedParameterNode<?> np : t.namedParameters.keySet()) {
      bind(np.getNameClass().getName(),t.namedParameters.get(np));
    }
  }
 catch (  ReflectiveOperationException e) {
    throw new IllegalStateException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public void addConfiguration(Configuration ti) throws BindException {
  ConfigurationImpl t=(ConfigurationImpl)ti;
  if (t.dirtyBit) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  for (  Class<?> c : t.namespace.getRegisteredClasses()) {
    register(c);
  }
  for (  ClassNode<?> cn : t.boundImpls.keySet()) {
    bind(cn.getClazz(),t.boundImpls.get(cn));
  }
  for (  ClassNode<?> cn : t.boundConstructors.keySet()) {
    bind(cn.getClazz(),t.boundConstructors.get(cn));
  }
  for (  ClassNode<?> cn : t.singletons) {
    try {
      bindSingleton(cn.getClazz());
    }
 catch (    BindException e) {
      throw new IllegalStateException("String_Node_Str",e);
    }
  }
  for (  NamedParameterNode<?> np : t.namedParameters.keySet()) {
    bind(np.getNameClass().getName(),t.namedParameters.get(np));
  }
}
Program: 59844
Project: 59844
Buggy source:
@Override @SuppressWarnings("String_Node_Str") public <T>InjectorImpl bindVolatileInstance(Class<T> c,T o) throws InjectionException {
  tc.dirtyBit=true;
  Node n;
  try {
    n=tc.namespace.getNode(c);
  }
 catch (  NameResolutionException e) {
    throw new InjectionException("String_Node_Str" + c,e);
  }
  if (n instanceof NamedParameterNode) {
    NamedParameterNode<T> np=(NamedParameterNode<T>)n;
    tc.namedParameterInstances.put(np,o);
    ClassNode<T> cn=(ClassNode<T>)n;
    cn.setIsSingleton();
    tc.singletonInstances.put(cn,o);
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + c + "String_Node_Str");
  }
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") public <T>InjectorImpl bindVolatileInstance(Class<T> c,T o) throws InjectionException {
  tc.dirtyBit=true;
  Node n;
  try {
    n=tc.namespace.getNode(c);
  }
 catch (  NameResolutionException e) {
    throw new InjectionException("String_Node_Str" + c,e);
  }
  if (n instanceof NamedParameterNode) {
    NamedParameterNode<T> np=(NamedParameterNode<T>)n;
    tc.namedParameterInstances.put(np,o);
  }
 else   if (n instanceof ClassNode) {
    ClassNode<T> cn=(ClassNode<T>)n;
    cn.setIsSingleton();
    tc.singletonInstances.put(cn,o);
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + c + "String_Node_Str");
  }
  System.err.println("String_Node_Str");
  return this;
}
Program: 59845
Project: 59845
Buggy source:
@SuppressWarnings("String_Node_Str") private <T>NamespaceNode<T> registerNamespace(Namespace conf,ClassNode<T> classNode) throws BindException {
  String[] path=conf.value().split(regexp);
  Node root=namespace;
  for (int i=0; i < path.length - 1; i++) {
    if (!root.contains(path[i])) {
      Node newRoot=new NamespaceNode<T>(root,path[i]);
      root=newRoot;
    }
 else {
      root=root.get(path[i]);
      if (!(root instanceof NamespaceNode)) {
        throw new BindException("String_Node_Str" + root + "String_Node_Str");
      }
    }
  }
  Node n=root.get(path[path.length - 1]);
  NamespaceNode<T> ret;
  if (n == null) {
    ret=new NamespaceNode<T>(root,path[path.length - 1],classNode);
  }
 else   if (n instanceof NamespaceNode) {
    ret=(NamespaceNode<T>)n;
    ret.setTarget(classNode);
    for (    Node child : ret.children.values()) {
      classNode.put(child);
    }
  }
 else {
    throw new BindException("String_Node_Str" + n + "String_Node_Str");
  }
  return ret;
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) private <T>NamespaceNode<T> registerNamespace(Namespace conf,ClassNode<T> classNode) throws BindException {
  String[] path=conf.value().split(regexp);
  Node root=namespace;
  for (int i=0; i < path.length - 1; i++) {
    if (!root.contains(path[i])) {
      Node newRoot=new NamespaceNode<T>(root,path[i]);
      root=newRoot;
    }
 else {
      root=root.get(path[i]);
      if (!(root instanceof NamespaceNode)) {
        throw new BindException("String_Node_Str" + root + "String_Node_Str");
      }
    }
  }
  if (root instanceof NamespaceNode) {
    Node target=((NamespaceNode<?>)root).getTarget();
    if (target != null) {
      throw new BindException("String_Node_Str");
    }
  }
  Node n=root.get(path[path.length - 1]);
  NamespaceNode<T> ret;
  if (n == null) {
    ret=new NamespaceNode<T>(root,path[path.length - 1],classNode);
  }
 else   if (n instanceof NamespaceNode) {
    ret=(NamespaceNode<T>)n;
    ret.setTarget(classNode);
    for (    Node child : ret.children.values()) {
      if (true) {
        throw new BindException("String_Node_Str");
      }
 else {
        try {
          classNode.put(child);
        }
 catch (        IllegalArgumentException e) {
          throw new BindException("String_Node_Str" + ret.getFullName() + "String_Node_Str"+ child.getFullName());
        }
      }
    }
  }
 else {
    throw new BindException("String_Node_Str" + n + "String_Node_Str");
  }
  return ret;
}
Program: 59846
Project: 59846
Buggy source:
@SuppressWarnings("String_Node_Str") <T>ClassNode<T>[] getKnownImpls(ClassNode<T> c){
  return knownImpls.getValuesForKey(c).toArray(new ClassNode[0]);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") <T>Set<ClassNode<T>> getKnownImpls(ClassNode<T> c){
  return (Set<ClassNode<T>>)(Set<?>)knownImpls.getValuesForKey(c);
}
Program: 59847
Project: 59847
Buggy source:
@SuppressWarnings("String_Node_Str") NamedParameterNode(Node parent,Class<? extends Name<T>> clazz) throws BindException {
  super(parent,clazz);
  this.clazz=clazz;
  for (  Constructor<?> c : clazz.getDeclaredConstructors()) {
    for (    Annotation a : c.getDeclaredAnnotations()) {
      if (a instanceof Inject) {
        throw new BindException("String_Node_Str" + clazz.getName() + "String_Node_Str");
      }
    }
  }
  Class<T> parameterClass;
  try {
    Type[] interfaces=clazz.getGenericInterfaces();
    if (interfaces.length != 1) {
      throw new IllegalArgumentException();
    }
    Type genericNameType=interfaces[0];
    if (genericNameType instanceof ParameterizedType) {
      ParameterizedType ptype=(ParameterizedType)genericNameType;
      if (ptype.getRawType() != Name.class) {
        throw new BindException("String_Node_Str" + clazz.getName() + "String_Node_Str");
      }
      try {
        Type t=ptype.getActualTypeArguments()[0];
        if (t instanceof ParameterizedType) {
          t=((ParameterizedType)t).getRawType();
        }
        parameterClass=(Class<T>)t;
      }
 catch (      ClassCastException e) {
        throw new IllegalArgumentException();
      }
    }
 else {
      throw new IllegalArgumentException();
    }
  }
 catch (  IllegalArgumentException e) {
    throw new IllegalArgumentException("String_Node_Str" + clazz + "String_Node_Str"+ "String_Node_Str");
  }
  this.namedParameter=clazz.getAnnotation(NamedParameter.class);
  this.argClass=parameterClass;
  this.defaultInstance=(this.namedParameter == null || namedParameter.default_value().length() == 0) ? null : ReflectionUtilities.parse(this.argClass,namedParameter.default_value());
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") NamedParameterNode(Node parent,Class<? extends Name<T>> clazz,Class<T> argClass) throws BindException {
  super(parent,clazz);
  this.clazz=clazz;
  this.namedParameter=clazz.getAnnotation(NamedParameter.class);
  this.argClass=argClass;
  if (this.namedParameter == null || namedParameter.default_value().length() == 0) {
    this.defaultInstance=null;
  }
 else {
    this.defaultInstance=ReflectionUtilities.parse(this.argClass,namedParameter.default_value());
  }
}
Program: 59848
Project: 59848
Buggy source:
private <T,U>Node buildPathToNode(Class<U> clazz,boolean isPrefixTarget) throws BindException {
  String[] path=clazz.getName().split(regexp);
  Node root=namespace;
  for (int i=0; i < path.length - 1; i++) {
    root=root.get(path[i]);
  }
  if (root == null) {
    throw new NullPointerException();
  }
  Node parent=root;
  if (clazz.getAnnotation(NamedParameter.class) == null) {
    return new ClassNode<U>(parent,clazz,isPrefixTarget,false);
  }
 else {
    if (isPrefixTarget) {
      throw new BindException(clazz + "String_Node_Str");
    }
    @SuppressWarnings("String_Node_Str") NamedParameterNode<T> np=new NamedParameterNode<T>(parent,(Class<? extends Name<T>>)clazz);
    String shortName=np.getShortName();
    if (shortName != null) {
      NamedParameterNode<?> oldNode=shortNames.get(shortName);
      if (oldNode != null) {
        if (oldNode.getNameClass() == np.getNameClass()) {
          throw new IllegalStateException("String_Node_Str" + oldNode.getNameClass() + "String_Node_Str"+ shortName);
        }
        throw new BindException("String_Node_Str" + oldNode.getNameClass() + "String_Node_Str"+ np.getNameClass()+ "String_Node_Str"+ shortName);
      }
      shortNames.put(shortName,np);
    }
    return np;
  }
}

Fixed version (ground truth):
private <T,U>Node buildPathToNode(Class<U> clazz,boolean isPrefixTarget) throws BindException {
  String[] path=clazz.getName().split(regexp);
  Node root=namespace;
  for (int i=0; i < path.length - 1; i++) {
    root=root.get(path[i]);
  }
  if (root == null) {
    throw new NullPointerException();
  }
  Node parent=root;
  Class<?> argType=getNamedParameterTargetOrNull(clazz);
  if (argType == null) {
    return new ClassNode<U>(parent,clazz,isPrefixTarget,false);
  }
 else {
    if (isPrefixTarget) {
      throw new BindException(clazz + "String_Node_Str");
    }
    @SuppressWarnings("String_Node_Str") NamedParameterNode<T> np=new NamedParameterNode<T>(parent,(Class<? extends Name<T>>)clazz,(Class<T>)argType);
    String shortName=np.getShortName();
    if (shortName != null) {
      NamedParameterNode<?> oldNode=shortNames.get(shortName);
      if (oldNode != null) {
        if (oldNode.getNameClass() == np.getNameClass()) {
          throw new IllegalStateException("String_Node_Str" + oldNode.getNameClass() + "String_Node_Str"+ shortName);
        }
        throw new BindException("String_Node_Str" + oldNode.getNameClass() + "String_Node_Str"+ np.getNameClass()+ "String_Node_Str"+ shortName);
      }
      shortNames.put(shortName,np);
    }
    return np;
  }
}
Program: 59849
Project: 59849
Buggy source:
/** 
 * @param args
 * @throws IOException 
 * @throws NumberFormatException
 * @throws ParseException
 */
public <T>void processCommandLine(String[] args) throws BindException, IOException ;

Fixed version (ground truth):
/** 
 * @param args
 * @throws IOException
 * @throws NumberFormatException
 * @throws ParseException
 */
public <T>void processCommandLine(String[] args) throws BindException, IOException ;
Program: 59850
Project: 59850
Buggy source:
/** 
 * Needed when you want to make a class available for injection, but don't want to bind a subclass to its implementation. Without this call, by the time injector.newInstance() is called, ConfigurationBuilderImpl has been locked down, and the class won't be found.
 * @param c
 */
public void register(Class<?> c){
  conf.namespace.register(c);
}

Fixed version (ground truth):
/** 
 * Needed when you want to make a class available for injection, but don't want to bind a subclass to its implementation. Without this call, by the time injector.newInstance() is called, ConfigurationBuilderImpl has been locked down, and the class won't be found.
 * @param c
 */
@Override public void register(Class<?> c) throws BindException {
  conf.namespace.register(c);
}
Program: 59853
Project: 59853
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public <T>void setClassVivifier(Class<T> c,Class<Vivifier<? extends T>> v){
  namespace.register(c);
  try {
    vivifier.put(namespace.getNode(c),(Class)v);
  }
 catch (  NameResolutionException e) {
    throw new IllegalStateException("String_Node_Str" + c + "String_Node_Str");
  }
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public <T>void setClassVivifier(Class<T> c,Class<? extends Vivifier<? extends T>> v){
  namespace.register(c);
  try {
    vivifier.put(namespace.getNode(c),(Class)v);
  }
 catch (  NameResolutionException e) {
    throw new IllegalStateException("String_Node_Str" + c + "String_Node_Str");
  }
}
Program: 59854
Project: 59854
Buggy source:
public boolean canInject(String name) throws NameResolutionException {
  Node n=namespace.getNode(name);
  if (n instanceof NamedParameterNode) {
    NamedParameterNode np=(NamedParameterNode)n;
    return boundValues.get(np) != null;
  }
 else   if (n instanceof ClassNode) {
    ClassNode c=(ClassNode)n;
    Class<?> clz=(Class<?>)boundValues.get(c);
    if (clz != null) {
      return canInject(clz.getName());
    }
    for (    ConstructorDef def : c.injectableConstructors) {
      boolean canInject=true;
      for (      ConstructorArg arg : def.args) {
        if (!canInject(arg.getFullyQualifiedName(c.clazz))) {
          canInject=false;
          break;
        }
      }
      if (canInject) {
        return true;
      }
    }
    return false;
  }
 else {
    throw new IllegalArgumentException();
  }
}

Fixed version (ground truth):
public boolean canInject(String name){
  Node n;
  try {
    n=namespace.getNode(name);
  }
 catch (  NameResolutionException e) {
    e.printStackTrace();
    return false;
  }
  if (n instanceof NamedParameterNode) {
    NamedParameterNode np=(NamedParameterNode)n;
    return boundValues.get(np) != null;
  }
 else   if (n instanceof ClassNode) {
    ClassNode c=(ClassNode)n;
    Class<?> clz=(Class<?>)boundValues.get(c);
    if (clz != null) {
      return canInject(clz.getName());
    }
    for (    ConstructorDef def : c.injectableConstructors) {
      boolean canInject=true;
      for (      ConstructorArg arg : def.args) {
        if (!canInject(arg.getFullyQualifiedName(c.clazz))) {
          canInject=false;
          break;
        }
      }
      if (canInject) {
        return true;
      }
    }
    throw new IllegalStateException("String_Node_Str" + name);
  }
 else {
    throw new IllegalArgumentException();
  }
}
Program: 59856
Project: 59856
Buggy source:
String getName(){
  return name == null ? type.getName() : name.value().getSimpleName();
}

Fixed version (ground truth):
String getName(){
  return name == null ? type.getName() : name.value().getName();
}
Program: 59857
Project: 59857
Buggy source:
String getFullyQualifiedName(Class<?> targetClass){
  String name=getName();
  if (!name.contains("String_Node_Str")) {
    name=targetClass.getName() + "String_Node_Str" + name;
  }
  return name;
}

Fixed version (ground truth):
String getFullyQualifiedName(Class<?> targetClass){
  String name=getName();
  if (!name.contains("String_Node_Str")) {
    name=targetClass.getName() + "String_Node_Str" + name;
    throw new IllegalStateException("String_Node_Str");
  }
  return name;
}
Program: 59859
Project: 59859
Buggy source:
ConstructorDef(ConstructorArg[] args,Constructor<?> constructor){
  this.args=args;
  this.constructor=constructor;
  for (int i=0; i < this.args.length; i++) {
    for (int j=i + 1; j < this.args.length; j++) {
      if (this.args[i].toString().equals(this.args[j].toString())) {
        throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
ConstructorDef(ConstructorArg[] args,Constructor<?> constructor){
  this.args=args;
  this.constructor=constructor;
  constructor.setAccessible(true);
  for (int i=0; i < this.args.length; i++) {
    for (int j=i + 1; j < this.args.length; j++) {
      if (this.args[i].toString().equals(this.args[j].toString())) {
        throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
      }
    }
  }
}
Program: 59860
Project: 59860
Buggy source:
public void resolveAllClasses(){
  for (Class<?>[] classes=findUnresolvedClasses(); classes.length > 0; classes=findUnresolvedClasses()) {
    for (    Class<?> c : classes) {
      registerClass(c);
    }
  }
}

Fixed version (ground truth):
public void resolveAllClasses(){
  for (Class<?>[] classes=findUnresolvedClasses(); classes.length > 0; classes=findUnresolvedClasses()) {
    registerClass(classes[0]);
  }
}
Program: 59862
Project: 59862
Buggy source:
@Override public boolean isItemValidForSlot(int slot,ItemStack itemStack){
  if (itemStack == null) {
    return false;
  }
switch (slot) {
case BASE:
case TARGET:
    return !Carving.chisel.getItemsForChiseling(itemStack).isEmpty();
case OUTPUT:
  return false;
case CHISEL:
return itemStack.getItem() instanceof IChiselItem;
default :
return itemStack.getItem() == ChiselItems.upgrade && Upgrade.values()[slot - MIN_UPGRADE].ordinal() == itemStack.getItemDamage();
}
}

Fixed version (ground truth):
@Override public boolean isItemValidForSlot(int slot,ItemStack itemStack){
  if (itemStack == null) {
    return false;
  }
switch (slot) {
case BASE:
    return true;
case TARGET:
  return false;
case OUTPUT:
return false;
case CHISEL:
return itemStack.getItem() instanceof IChiselItem;
default :
return itemStack.getItem() == ChiselItems.upgrade && Upgrade.values()[slot - MIN_UPGRADE].ordinal() == itemStack.getItemDamage();
}
}
Program: 59863
Project: 59863
Buggy source:
@SideOnly(Side.CLIENT) @SuppressWarnings("String_Node_Str") @Override public void registerIcons(String modName,Block block,IIconRegister register){
  IIcon base=register.registerIcon(modName + "String_Node_Str" + texturePath);
  int wh=(int)Math.sqrt(size);
  TextureSubmap[][] submaps=new TextureSubmap[wh][wh];
  TextureSubmap[][] submapsSmall=new TextureSubmap[wh][wh];
  for (int i=0; i < size; i++) {
    AbstractSubmapManager manager=(AbstractSubmapManager)TextureType.CTMX.createManagerFor(CarvingUtils.getDefaultVariationFor(block,meta,0),texturePath + "String_Node_Str" + i);
    manager.registerIcons(modName,block,register);
    Object cached=manager.getCachedObject();
    Triple<IIcon,TextureSubmap,TextureSubmap> triple=(Triple<IIcon,TextureSubmap,TextureSubmap>)cached;
    submaps[i % wh][i / wh]=triple.getMiddle();
    submapsSmall[i % wh][i / wh]=triple.getRight();
    if (i == 0) {
      defaultIcon=triple.getRight().getSubIcon(0,0);
    }
  }
}

Fixed version (ground truth):
@SideOnly(Side.CLIENT) @SuppressWarnings("String_Node_Str") @Override public void registerIcons(String modName,Block block,IIconRegister register){
  IIcon base=register.registerIcon(modName + "String_Node_Str" + texturePath);
  int wh=(int)Math.sqrt(size);
  TextureSubmap[][] submaps=new TextureSubmap[wh][wh];
  TextureSubmap[][] submapsSmall=new TextureSubmap[wh][wh];
  for (int i=0; i < size; i++) {
    AbstractSubmapManager manager=(AbstractSubmapManager)TextureType.CTMX.createManagerFor(CarvingUtils.getDefaultVariationFor(block,meta,0),texturePath + "String_Node_Str" + i);
    manager.registerIcons(modName,block,register);
    Object cached=manager.getCachedObject();
    Triple<IIcon,TextureSubmap,TextureSubmap> triple=(Triple<IIcon,TextureSubmap,TextureSubmap>)cached;
    submaps[i % wh][i / wh]=triple.getMiddle();
    submapsSmall[i % wh][i / wh]=triple.getRight();
    if (i == 0) {
      defaultIcon=triple.getRight().getSubIcon(0,0);
    }
  }
  submap=new Submap(base,wh,submaps);
  smallSubmap=new Submap(base,wh,submapsSmall);
}
Program: 59864
Project: 59864
Buggy source:
@Override public boolean hitEntity(ItemStack stack,EntityLivingBase target,EntityLivingBase attacker){
  if (target instanceof EntityPig) {
    double x=target.posX;
    double y=target.posY;
    double z=target.posZ;
    EntityPigZombie zambie=new EntityPigZombie(attacker.worldObj);
    zambie.setAttackTarget(attacker);
    zambie.forceSpawn=true;
    zambie.setLocationAndAngles(x,y,z,0.0F,0.0F);
    attacker.worldObj.spawnEntityInWorld(zambie);
    attacker.attackEntityAsMob(zambie);
    target.setDead();
  }
  stack.damageItem(1,attacker);
  return super.hitEntity(stack,attacker,target);
}

Fixed version (ground truth):
@Override public boolean hitEntity(ItemStack stack,EntityLivingBase target,EntityLivingBase attacker){
  stack.damageItem(1,attacker);
  return super.hitEntity(stack,attacker,target);
}
Program: 59865
Project: 59865
Buggy source:
@Override public void onBlockPlacedBy(World world,int x,int y,int z,EntityLivingBase player,ItemStack stack){
  super.onBlockPlacedBy(world,x,y,z,player,stack);
  int heading=MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
  TileEntityPresent te=(TileEntityPresent)world.getTileEntity(x,y,z);
  world.setBlockMetadataWithNotify(x,y,z,stack.getItemDamage(),3);
  te.setRotation(heading);
  te.findConnections();
  if (te.isConnected()) {
    TileEntityPresent other=te.getConnection();
    other.setRotation(heading);
  }
  world.markBlockForUpdate(x,y,z);
}

Fixed version (ground truth):
@Override public void onBlockPlacedBy(World world,int x,int y,int z,EntityLivingBase player,ItemStack stack){
  super.onBlockPlacedBy(world,x,y,z,player,stack);
  int heading=MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
  TileEntityPresent te=(TileEntityPresent)world.getTileEntity(x,y,z);
  world.setBlockMetadataWithNotify(x,y,z,stack.getItemDamage(),3);
  te.setRotation(heading);
  if (!world.isRemote) {
    te.findConnections();
    if (te.isConnected()) {
      TileEntityPresent other=te.getConnection();
      other.setRotation(heading);
    }
    world.markBlockForUpdate(x,y,z);
  }
}
Program: 59866
Project: 59866
Buggy source:
@Override public ItemStack decrStackSize(int slot,int amount){
  slot=getAdjustedSlot(slot);
  ItemStack[] inv=inventory;
  if (isConnected() && slot >= getTrueSizeInventory()) {
    inv=connection.inventory;
    slot%=getTrueSizeInventory();
  }
  if (inv[slot] != null) {
    ItemStack itemstack;
    if (inv[slot].stackSize <= amount) {
      itemstack=inv[slot];
      inv[slot]=null;
      this.markDirty();
      return itemstack;
    }
 else {
      itemstack=inv[slot].splitStack(amount);
      if (inv[slot].stackSize == 0) {
        inv[slot]=null;
      }
      this.markDirty();
      return itemstack;
    }
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public ItemStack decrStackSize(int slot,int amount){
  slot=getAdjustedSlot(slot);
  ItemStack[] inv=inventory;
  if (isConnected() && slot >= getTrueSizeInventory()) {
    inv=connection.inventory;
    slot%=getTrueSizeInventory();
    connection.markDirty();
  }
  if (inv[slot] != null) {
    ItemStack itemstack;
    if (inv[slot].stackSize <= amount) {
      itemstack=inv[slot];
      inv[slot]=null;
      this.markDirty();
      return itemstack;
    }
 else {
      itemstack=inv[slot].splitStack(amount);
      if (inv[slot].stackSize == 0) {
        inv[slot]=null;
      }
      this.markDirty();
      return itemstack;
    }
  }
 else {
    return null;
  }
}
Program: 59867
Project: 59867
Buggy source:
public void disconnect(){
  if (isConnected()) {
    this.connection.cachedDir=null;
    this.connection.connection=null;
    this.connection.markDirty();
    this.cachedDir=null;
    this.connection=null;
    this.markDirty();
    PacketHandler.INSTANCE.sendToDimension(new MessagePresentConnect(this,ForgeDirection.UNKNOWN,false),worldObj.provider.dimensionId);
  }
}

Fixed version (ground truth):
/** 
 * @param preserveDir If true, this is only a virtual disconnect, meaning the other chest still exists, but is still loaded, so maintain a cachedDir for reconnection upon chunk load.
 */
public void disconnect(boolean preserveDir){
  if (isConnected()) {
    if (!preserveDir) {
      this.connection.cachedDir=null;
      this.cachedDir=null;
    }
    this.connection.connection=null;
    this.connection.markDirty();
    this.connection=null;
    this.markDirty();
    PacketHandler.INSTANCE.sendToDimension(new MessagePresentConnect(this,ForgeDirection.UNKNOWN,false,preserveDir),worldObj.provider.dimensionId);
  }
}
Program: 59868
Project: 59868
Buggy source:
@Override public void setInventorySlotContents(int slot,ItemStack stack){
  slot=getAdjustedSlot(slot);
  if (slot < getTrueSizeInventory()) {
    inventory[slot]=stack;
  }
 else   if (isConnected()) {
    connection.inventory[slot % getTrueSizeInventory()]=stack;
  }
}

Fixed version (ground truth):
@Override public void setInventorySlotContents(int slot,ItemStack stack){
  slot=getAdjustedSlot(slot);
  if (slot < getTrueSizeInventory()) {
    inventory[slot]=stack;
  }
 else   if (isConnected()) {
    connection.inventory[slot % getTrueSizeInventory()]=stack;
    connection.markDirty();
  }
}
Program: 59869
Project: 59869
Buggy source:
public void findConnections(){
  if (!isConnected()) {
    for (    ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
      if (dir != ForgeDirection.UP && dir != ForgeDirection.DOWN) {
        if (connectTo(dir)) {
          break;
        }
      }
    }
  }
}

Fixed version (ground truth):
public void findConnections(){
  if (!isConnected()) {
    if (cachedDir != null) {
      if (connectTo(cachedDir)) {
        return;
      }
    }
    for (    ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
      if (dir != ForgeDirection.UP && dir != ForgeDirection.DOWN) {
        if (connectTo(dir)) {
          return;
        }
      }
    }
  }
}
Program: 59870
Project: 59870
Buggy source:
@Override public void updateEntity(){
  if (isConnected() && connection.isInvalid()) {
    disconnect();
  }
  if (autoSearch && worldObj != null) {
    if (cachedDir != null) {
      connectTo(cachedDir);
    }
 else {
      findConnections();
    }
    autoSearch=false;
  }
}

Fixed version (ground truth):
@Override public void updateEntity(){
  if (!isConnected() && autoSearch && worldObj != null) {
    if (cachedDir != null) {
      connectTo(cachedDir);
    }
 else     if (!worldObj.isRemote) {
      findConnections();
    }
    autoSearch=false;
  }
}
Program: 59871
Project: 59871
Buggy source:
public boolean connectTo(ForgeDirection dir){
  TileEntity te=worldObj.getTileEntity(xCoord + dir.offsetX,yCoord + dir.offsetY,zCoord + dir.offsetZ);
  if (te instanceof TileEntityPresent) {
    return connectTo((TileEntityPresent)te,dir);
  }
  return false;
}

Fixed version (ground truth):
public boolean connectTo(ForgeDirection dir){
  int x=xCoord + dir.offsetX, y=yCoord + dir.offsetY, z=zCoord + dir.offsetZ;
  TileEntity te=getTileSafe(x,y,z);
  if (te instanceof TileEntityPresent) {
    return connectTo((TileEntityPresent)te,dir);
  }
  return !exists(x,y,z);
}
Program: 59872
Project: 59872
Buggy source:
@Override public void toBytes(ByteBuf buf){
  super.toBytes(buf);
  buf.writeInt(dir.ordinal());
  buf.writeBoolean(connect);
}

Fixed version (ground truth):
@Override public void toBytes(ByteBuf buf){
  super.toBytes(buf);
  buf.writeInt(dir.ordinal());
  buf.writeBoolean(connect);
  buf.writeBoolean(preserveDir);
}
Program: 59873
Project: 59873
Buggy source:
@Override public void fromBytes(ByteBuf buf){
  super.fromBytes(buf);
  dir=ForgeDirection.values()[buf.readInt()];
  connect=buf.readBoolean();
}

Fixed version (ground truth):
@Override public void fromBytes(ByteBuf buf){
  super.fromBytes(buf);
  dir=ForgeDirection.values()[buf.readInt()];
  connect=buf.readBoolean();
  preserveDir=buf.readBoolean();
}
Program: 59874
Project: 59874
Buggy source:
@Override public IMessage onMessage(MessagePresentConnect message,MessageContext ctx){
  TileEntity te=message.getTileEntity(ctx);
  if (te instanceof TileEntityPresent) {
    if (message.connect) {
      ((TileEntityPresent)te).connectTo(message.dir);
    }
 else {
      ((TileEntityPresent)te).disconnect();
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public IMessage onMessage(MessagePresentConnect message,MessageContext ctx){
  TileEntity te=message.getTileEntity(ctx);
  if (te instanceof TileEntityPresent) {
    if (message.connect) {
      ((TileEntityPresent)te).connectTo(message.dir);
    }
 else {
      ((TileEntityPresent)te).disconnect(message.preserveDir);
    }
  }
  return null;
}
Program: 59875
Project: 59875
Buggy source:
public MessagePresentConnect(TileEntityPresent present,ForgeDirection dir,boolean connecting){
  super(present);
  this.dir=dir;
  this.connect=connecting;
}

Fixed version (ground truth):
public MessagePresentConnect(TileEntityPresent present,ForgeDirection dir,boolean connecting,boolean preserveDir){
  super(present);
  this.dir=dir;
  this.connect=connecting;
  this.preserveDir=preserveDir;
}
Program: 59876
Project: 59876
Buggy source:
@Override public void onBlockPlacedBy(World world,int x,int y,int z,EntityLivingBase player,ItemStack stack){
  super.onBlockPlacedBy(world,x,y,z,player,stack);
  int heading=MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
  TileEntityPresent te=(TileEntityPresent)world.getTileEntity(x,y,z);
  world.setBlockMetadataWithNotify(x,y,z,stack.getItemDamage(),3);
  te.setRotation(heading);
  if (!world.isRemote) {
    te.findConnections();
    if (te.isConnected()) {
      TileEntityPresent other=te.getConnection();
      other.setRotation(heading);
    }
    world.markBlockForUpdate(x,y,z);
  }
}

Fixed version (ground truth):
@Override public void onBlockPlacedBy(World world,int x,int y,int z,EntityLivingBase player,ItemStack stack){
  super.onBlockPlacedBy(world,x,y,z,player,stack);
  int heading=MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
  TileEntityPresent te=(TileEntityPresent)world.getTileEntity(x,y,z);
  world.setBlockMetadataWithNotify(x,y,z,stack.getItemDamage(),3);
  te.setRotation(heading);
  te.findConnections();
  if (te.isConnected()) {
    TileEntityPresent other=te.getConnection();
    other.setRotation(heading);
  }
  world.markBlockForUpdate(x,y,z);
}
Program: 59878
Project: 59878
Buggy source:
@Override public CarvableVariation getVariation(ItemStack stack){
  return carverHelper.getVariation(stack.getItemDamage());
}

Fixed version (ground truth):
@Override public CarvableVariation getVariation(ItemStack stack){
  return carverHelper.getVariation(blockMeta + (stack.getItemDamage() / 8));
}
Program: 59879
Project: 59879
Buggy source:
@Override public void onBlockPlacedBy(World par1World,int par2,int par3,int par4,EntityLivingBase par5EntityLiving,ItemStack par6ItemStack){
  int meta=MathHelper.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
  meta=meta == 0 ? 2 : meta == 2 ? 3 : meta == 3 ? 0 : 1;
  meta+=par1World.getBlockMetadata(par2,par3,par4) % 8;
  par1World.setBlockMetadataWithNotify(par2,par3,par4,meta,2);
}

Fixed version (ground truth):
@Override public void onBlockPlacedBy(World par1World,int par2,int par3,int par4,EntityLivingBase par5EntityLiving,ItemStack par6ItemStack){
  int meta=MathHelper.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
  meta=meta == 0 ? 2 : meta == 2 ? 3 : meta == 3 ? 0 : 1;
  meta+=par1World.getBlockMetadata(par2,par3,par4) % 8;
  if (par6ItemStack.getItemDamage() >= 8) {
    meta+=8;
  }
  par1World.setBlockMetadataWithNotify(par2,par3,par4,meta,2);
}
Program: 59880
Project: 59880
Buggy source:
public AxisAlignedBB getBoundingBox(TileEntityPresent me){
  if (me == null) {
    return AxisAlignedBB.getBoundingBox(minX,minY,minZ,maxX,maxY,maxZ);
  }
  int x=me.xCoord, y=me.yCoord, z=me.zCoord;
  if (me.isConnected()) {
    ForgeDirection dir=me.getConnectionDir();
    if (dir != ForgeDirection.NORTH && (!me.isParent() || dir == ForgeDirection.SOUTH)) {
      return AxisAlignedBB.getBoundingBox(x + minX,y + minY,z + minZ,x + maxX + dir.offsetX,y + maxY,z + maxZ + dir.offsetZ);
    }
 else {
      return AxisAlignedBB.getBoundingBox(x + dir.offsetX + minX,y + minY,z + dir.offsetZ + minZ,x + maxX,y + maxY,z + maxZ);
    }
  }
  return AxisAlignedBB.getBoundingBox(x + minX,y + minY,z + minZ,x + maxX,y + maxY,z + maxZ);
}

Fixed version (ground truth):
public AxisAlignedBB getBoundingBox(TileEntityPresent me){
  if (me == null) {
    System.out.println(-1);
    return AxisAlignedBB.getBoundingBox(minX,minY,minZ,maxX,maxY,maxZ);
  }
  int x=me.xCoord, y=me.yCoord, z=me.zCoord;
  if (me.isConnected()) {
    ForgeDirection dir=me.getConnectionDir();
    if (dir == ForgeDirection.EAST || (me.isParent() && dir == ForgeDirection.SOUTH) || (!me.isParent() && dir == ForgeDirection.SOUTH)) {
      return AxisAlignedBB.getBoundingBox(x + minX,y + minY,z + minZ,x + maxX + dir.offsetX,y + maxY,z + maxZ + dir.offsetZ);
    }
 else {
      return AxisAlignedBB.getBoundingBox(x + dir.offsetX + minX,y + minY,z + dir.offsetZ + minZ,x + maxX,y + maxY,z + maxZ);
    }
  }
  return AxisAlignedBB.getBoundingBox(x + minX,y + minY,z + minZ,x + maxX,y + maxY,z + maxZ);
}
Program: 59881
Project: 59881
Buggy source:
@Override public void onBlockPlacedBy(World world,int x,int y,int z,EntityLivingBase player,ItemStack stack){
  super.onBlockPlacedBy(world,x,y,z,player,stack);
  int heading=MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
  TileEntityPresent te=(TileEntityPresent)world.getTileEntity(x,y,z);
  world.setBlockMetadataWithNotify(x,y,z,heading,3);
  te.findConnections();
  if (te.isConnected()) {
    TileEntityPresent other=te.getConnection();
    world.setBlockMetadataWithNotify(other.xCoord,other.yCoord,other.zCoord,heading,3);
  }
  te.setType(stack.getItemDamage());
  world.markBlockForUpdate(x,y,z);
}

Fixed version (ground truth):
@Override public void onBlockPlacedBy(World world,int x,int y,int z,EntityLivingBase player,ItemStack stack){
  super.onBlockPlacedBy(world,x,y,z,player,stack);
  int heading=MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
  TileEntityPresent te=(TileEntityPresent)world.getTileEntity(x,y,z);
  world.setBlockMetadataWithNotify(x,y,z,stack.getItemDamage(),3);
  te.setRotation(heading);
  te.findConnections();
  if (te.isConnected()) {
    TileEntityPresent other=te.getConnection();
    other.setRotation(heading);
  }
  world.markBlockForUpdate(x,y,z);
}
Program: 59882
Project: 59882
Buggy source:
@Override public void breakBlock(World world,int x,int y,int z,Block present,int meta){
  TileEntityPresent tileEntityPresent=(TileEntityPresent)world.getTileEntity(x,y,z);
  if (tileEntityPresent != null) {
    for (int c=0; c < tileEntityPresent.getSizeInventory(); c++) {
      ItemStack itemStack=tileEntityPresent.getStackInSlot(c);
      if (itemStack != null) {
        dropBlockAsItem(world,x,y,z,itemStack);
      }
    }
    world.func_147453_f(x,y,z,this);
  }
  super.breakBlock(world,x,y,z,this,meta);
}

Fixed version (ground truth):
@Override public void breakBlock(World world,int x,int y,int z,Block present,int meta){
  TileEntityPresent tileEntityPresent=(TileEntityPresent)world.getTileEntity(x,y,z);
  if (tileEntityPresent != null) {
    for (int c=0; c < tileEntityPresent.getTrueSizeInventory(); c++) {
      ItemStack itemStack=tileEntityPresent.getTrueStackInSlot(c);
      if (itemStack != null) {
        dropBlockAsItem(world,x,y,z,itemStack);
      }
    }
    world.func_147453_f(x,y,z,this);
  }
  super.breakBlock(world,x,y,z,this,meta);
}
Program: 59883
Project: 59883
Buggy source:
@Override public void readFromNBT(NBTTagCompound tag){
  super.readFromNBT(tag);
  NBTTagList nbttaglist=tag.getTagList("String_Node_Str",10);
  inventory=new ItemStack[this.getSizeInventory()];
  for (int i=0; i < nbttaglist.tagCount(); ++i) {
    NBTTagCompound nbttagcompound1=nbttaglist.getCompoundTagAt(i);
    int j=nbttagcompound1.getByte("String_Node_Str") & 255;
    if (j >= 0 && j < inventory.length) {
      inventory[j]=ItemStack.loadItemStackFromNBT(nbttagcompound1);
    }
  }
  this.isParent=tag.getBoolean("String_Node_Str");
  this.type=tag.getInteger("String_Node_Str");
  if (tag.hasKey("String_Node_Str")) {
    cachedDir=ForgeDirection.values()[tag.getInteger("String_Node_Str")];
  }
  autoSearch=true;
}

Fixed version (ground truth):
@Override public void readFromNBT(NBTTagCompound tag){
  super.readFromNBT(tag);
  NBTTagList nbttaglist=tag.getTagList("String_Node_Str",10);
  for (int i=0; i < nbttaglist.tagCount(); ++i) {
    NBTTagCompound nbttagcompound1=nbttaglist.getCompoundTagAt(i);
    int j=nbttagcompound1.getByte("String_Node_Str") & 255;
    if (j >= 0 && j < getTrueSizeInventory()) {
      inventory[j]=ItemStack.loadItemStackFromNBT(nbttagcompound1);
    }
  }
  this.isParent=tag.getBoolean("String_Node_Str");
  this.rotation=tag.getInteger("String_Node_Str");
  if (tag.hasKey("String_Node_Str")) {
    cachedDir=ForgeDirection.values()[tag.getInteger("String_Node_Str")];
  }
  autoSearch=true;
}
Program: 59884
Project: 59884
Buggy source:
@Override public ItemStack decrStackSize(int slot,int amount){
  ItemStack[] inv=inventory;
  if (isConnected() && slot >= inventory.length) {
    inv=connection.inventory;
    slot%=inventory.length;
  }
  if (inv[slot] != null) {
    ItemStack itemstack;
    if (inv[slot].stackSize <= amount) {
      itemstack=inv[slot];
      inv[slot]=null;
      this.markDirty();
      return itemstack;
    }
 else {
      itemstack=inv[slot].splitStack(amount);
      if (inv[slot].stackSize == 0) {
        inv[slot]=null;
      }
      this.markDirty();
      return itemstack;
    }
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public ItemStack decrStackSize(int slot,int amount){
  slot=getAdjustedSlot(slot);
  ItemStack[] inv=inventory;
  if (isConnected() && slot >= getTrueSizeInventory()) {
    inv=connection.inventory;
    slot%=getTrueSizeInventory();
  }
  if (inv[slot] != null) {
    ItemStack itemstack;
    if (inv[slot].stackSize <= amount) {
      itemstack=inv[slot];
      inv[slot]=null;
      this.markDirty();
      return itemstack;
    }
 else {
      itemstack=inv[slot].splitStack(amount);
      if (inv[slot].stackSize == 0) {
        inv[slot]=null;
      }
      this.markDirty();
      return itemstack;
    }
  }
 else {
    return null;
  }
}
Program: 59885
Project: 59885
Buggy source:
public void disconnect(){
  if (isConnected()) {
    this.connection.cachedDir=null;
    this.connection.connection=null;
    this.cachedDir=null;
    this.connection=null;
    PacketHandler.INSTANCE.sendToDimension(new MessagePresentConnect(this,ForgeDirection.UNKNOWN,false),worldObj.provider.dimensionId);
  }
}

Fixed version (ground truth):
public void disconnect(){
  if (isConnected()) {
    this.connection.cachedDir=null;
    this.connection.connection=null;
    this.connection.markDirty();
    this.cachedDir=null;
    this.connection=null;
    this.markDirty();
    PacketHandler.INSTANCE.sendToDimension(new MessagePresentConnect(this,ForgeDirection.UNKNOWN,false),worldObj.provider.dimensionId);
  }
}
Program: 59886
Project: 59886
Buggy source:
@Override public void setInventorySlotContents(int slot,ItemStack stack){
  if (slot < inventory.length) {
    inventory[slot]=stack;
  }
 else   if (isConnected()) {
    connection.inventory[slot % inventory.length]=stack;
  }
}

Fixed version (ground truth):
@Override public void setInventorySlotContents(int slot,ItemStack stack){
  slot=getAdjustedSlot(slot);
  if (slot < getTrueSizeInventory()) {
    inventory[slot]=stack;
  }
 else   if (isConnected()) {
    connection.inventory[slot % getTrueSizeInventory()]=stack;
  }
}
Program: 59887
Project: 59887
Buggy source:
@Override public void writeToNBT(NBTTagCompound tag){
  super.writeToNBT(tag);
  NBTTagList nbttaglist=new NBTTagList();
  for (int i=0; i < inventory.length; ++i) {
    if (inventory[i] != null) {
      NBTTagCompound nbttagcompound1=new NBTTagCompound();
      nbttagcompound1.setByte("String_Node_Str",(byte)i);
      inventory[i].writeToNBT(nbttagcompound1);
      nbttaglist.appendTag(nbttagcompound1);
    }
  }
  tag.setTag("String_Node_Str",nbttaglist);
  tag.setBoolean("String_Node_Str",isParent);
  tag.setInteger("String_Node_Str",type);
  if (cachedDir != null) {
    tag.setInteger("String_Node_Str",cachedDir.ordinal());
  }
}

Fixed version (ground truth):
@Override public void writeToNBT(NBTTagCompound tag){
  super.writeToNBT(tag);
  NBTTagList nbttaglist=new NBTTagList();
  for (int i=0; i < getTrueSizeInventory(); ++i) {
    if (inventory[i] != null) {
      NBTTagCompound nbttagcompound1=new NBTTagCompound();
      nbttagcompound1.setByte("String_Node_Str",(byte)i);
      inventory[i].writeToNBT(nbttagcompound1);
      nbttaglist.appendTag(nbttagcompound1);
    }
  }
  tag.setTag("String_Node_Str",nbttaglist);
  tag.setBoolean("String_Node_Str",isParent);
  tag.setInteger("String_Node_Str",rotation);
  if (cachedDir != null) {
    tag.setInteger("String_Node_Str",cachedDir.ordinal());
  }
}
Program: 59888
Project: 59888
Buggy source:
@Override public ItemStack getStackInSlot(int slot){
  if (slot >= inventory.length) {
    return isConnected() ? connection.inventory[slot % inventory.length] : null;
  }
 else {
    return inventory[slot];
  }
}

Fixed version (ground truth):
@Override public ItemStack getStackInSlot(int slot){
  slot=getAdjustedSlot(slot);
  if (slot >= getTrueSizeInventory()) {
    return isConnected() ? connection.inventory[slot % getTrueSizeInventory()] : null;
  }
 else {
    return inventory[slot];
  }
}
Program: 59889
Project: 59889
Buggy source:
@Override public int getSizeInventory(){
  return isConnected() ? inventory.length + connection.inventory.length : inventory.length;
}

Fixed version (ground truth):
@Override public int getSizeInventory(){
  return isConnected() ? getTrueSizeInventory() + connection.getTrueSizeInventory() : getTrueSizeInventory();
}
Program: 59890
Project: 59890
Buggy source:
private void bindTexture(TileEntityPresent present){
  int idx=present.getType() + (present.isConnected() ? 0 : 16);
  ResourceLocation rl=textureCache.get(idx);
  if (rl == null) {
    String res=ChiselBlocks.present.getModelTexture(present.getType());
    res+=present.isConnected() ? "String_Node_Str" : "String_Node_Str";
    rl=new ResourceLocation("String_Node_Str",res);
    textureCache.put(idx,rl);
  }
  bindTexture(rl);
}

Fixed version (ground truth):
private void bindTexture(TileEntityPresent present){
  int idx=present.getWorldObj().getBlockMetadata(present.xCoord,present.yCoord,present.zCoord) + (present.isConnected() ? 0 : 16);
  ResourceLocation rl=textureCache.get(idx);
  if (rl == null) {
    String res=ChiselBlocks.present.getModelTexture(idx % 16);
    res+=present.isConnected() ? "String_Node_Str" : "String_Node_Str";
    rl=new ResourceLocation("String_Node_Str",res);
    textureCache.put(idx,rl);
  }
  bindTexture(rl);
}
Program: 59891
Project: 59891
Buggy source:
public BlockCarvableIcePillar(Material m){
  super(m);
  this.slipperiness=0.98F;
  this.setTickRandomly(true);
}

Fixed version (ground truth):
public BlockCarvableIcePillar(Material m){
  super(m);
  this.slipperiness=0.98F;
  this.setTickRandomly(true);
  setStained(true);
}
Program: 59892
Project: 59892
Buggy source:
/** 
 * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given coordinates.  Args: blockAccess, x, y, z, side
 */
@SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockAccess p_149646_1_,int p_149646_2_,int p_149646_3_,int p_149646_4_,int p_149646_5_){
  return super.shouldSideBeRendered(p_149646_1_,p_149646_2_,p_149646_3_,p_149646_4_,1 - p_149646_5_);
}

Fixed version (ground truth):
/** 
 * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given coordinates. Args: blockAccess, x, y, z, side
 */
@SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockAccess p_149646_1_,int p_149646_2_,int p_149646_3_,int p_149646_4_,int p_149646_5_){
  Block block=p_149646_1_.getBlock(p_149646_2_,p_149646_3_,p_149646_4_);
  return block == this ? false : super.shouldSideBeRendered(p_149646_1_,p_149646_2_,p_149646_3_,p_149646_4_,p_149646_5_);
}
Program: 59893
Project: 59893
Buggy source:
public void create(IStairsCreator creator,String name,Block[] blocks){
  for (int i=0; i < blocks.length; i++) {
    String n=name + "String_Node_Str" + i;
    blocks[i]=creator == null ? new BlockCarvableStairs(blockBase,i * 2,carverHelper) : creator.create(blockBase,i * 2,carverHelper);
    blocks[i].setBlockName(n);
    GameRegistry.registerBlock(blocks[i],ItemCarvable.class,n);
    for (int meta=0; meta < 2 && i * 2 + meta < carverHelper.variations.size(); meta++) {
      CarvableVariation variation=carverHelper.variations.get(i * 2 + meta);
      carverHelper.registerVariation(name,variation,blocks[i],meta * 8);
      GameRegistry.addRecipe(new ItemStack(blocks[i],4,meta * 8),"String_Node_Str","String_Node_Str","String_Node_Str",'*',new ItemStack(blockBase,1,i * 2 + meta));
    }
  }
}

Fixed version (ground truth):
public void create(IStairsCreator creator,String name,Block[] blocks){
  for (int i=0; i < blocks.length; i++) {
    String n=name + "String_Node_Str" + i;
    blocks[i]=creator == null ? new BlockCarvableStairs(blockBase,i * 2,carverHelper) : creator.create(blockBase,i * 2,carverHelper);
    blocks[i].setBlockName("String_Node_Str" + n);
    GameRegistry.registerBlock(blocks[i],ItemCarvable.class,n);
    for (int meta=0; meta < 2 && i * 2 + meta < carverHelper.variations.size(); meta++) {
      CarvableVariation variation=carverHelper.variations.get(i * 2 + meta);
      carverHelper.registerVariation(name,variation,blocks[i],meta * 8);
      GameRegistry.addRecipe(new ItemStack(blocks[i],4,meta * 8),"String_Node_Str","String_Node_Str","String_Node_Str",'*',new ItemStack(blockBase,1,i * 2 + meta));
    }
  }
}
Program: 59894
Project: 59894
Buggy source:
/** 
 * Removes a varaition with the passed   {@link Block} and metadata from this group.
 * @param block The  {@link Block} of the {@link ICarvingVariation variation}
 * @param metadata The metadata of the  {@link ICarvingVariation variation}
 * @return The ICarvingVariation that was removed. Null if nothing was removed.
 */
ICarvingVariation removeVariation(Block block,int metadata);

Fixed version (ground truth):
/** 
 * Removes a variation to this group. Do not call this from external code, as it will fail to remove the inverse lookup from the registry.
 * @param variation An  {@link ICarvingVariation} to add to this group
 */
boolean removeVariation(ICarvingVariation variation);