nus-yam/ex-repair huggingface dataset:
Program: 177557
Project: 177557
Buggy source:
/** 
 * Returns a Vector2 object using the X and Z values of the given Vector3. The x of the Vector3 becomes the x of the Vector2, and the z of this Vector3 becomes the y of the Vector2m.
 * @param o Vector3 object to use
 * @return
 */
public static Vector2 toVector2(Vector3 o){
  return new Vector2(o.getX(),o.getZ());
}

Fixed version (ground truth):
/** 
 * Returns a Vector2 object using the X and Z values of the given Vector3. The x of the Vector3 becomes the x of the Vector2, and the z of this Vector3 becomes the y of the Vector2m.
 * @param o Vector3 object to use
 * @return
 */
public static Vector2 toVector2(Vector3 o){
  return new Vector2(o.x,o.z);
}
Program: 177558
Project: 177558
Buggy source:
/** 
 * Rounds the X, Y, and Z values of the given Vector3 up to the nearest integer value.
 * @param o Vector3 to use
 * @return
 */
public static Vector3 ceil(Vector3 o){
  return new Vector3(Math.ceil(o.getX()),Math.ceil(o.getY()),Math.ceil(o.getZ()));
}

Fixed version (ground truth):
/** 
 * Rounds the X, Y, and Z values of the given Vector3 up to the nearest integer value.
 * @param o Vector3 to use
 * @return
 */
public static Vector3 ceil(Vector3 o){
  return new Vector3(Math.ceil(o.x),Math.ceil(o.y),Math.ceil(o.z));
}
Program: 177559
Project: 177559
Buggy source:
/** 
 * Returns a Vector2m object using the X and Z values of the given Vector3. The x of the Vector3 becomes the x of the Vector2m, and the z of this Vector3 becomes the y of the Vector2m.
 * @param o Vector3 object to use
 * @return
 */
public static Vector2m toVector2m(Vector3 o){
  return new Vector2m(o.getX(),o.getZ());
}

Fixed version (ground truth):
/** 
 * Returns a Vector2m object using the X and Z values of the given Vector3. The x of the Vector3 becomes the x of the Vector2m, and the z of this Vector3 becomes the y of the Vector2m.
 * @param o Vector3 object to use
 * @return
 */
public static Vector2m toVector2m(Vector3 o){
  return new Vector2m(o.x,o.z);
}
Program: 177560
Project: 177560
Buggy source:
/** 
 * Sets the X, Y, and Z values of the given Vector3 to their absolute value.
 * @param o Vector3 to use
 * @return
 */
public static Vector3 abs(Vector3 o){
  return new Vector3(Math.abs(o.getX()),Math.abs(o.getY()),Math.abs(o.getZ()));
}

Fixed version (ground truth):
/** 
 * Sets the X, Y, and Z values of the given Vector3 to their absolute value.
 * @param o Vector3 to use
 * @return
 */
public static Vector3 abs(Vector3 o){
  return new Vector3(Math.abs(o.x),Math.abs(o.y),Math.abs(o.z));
}
Program: 177561
Project: 177561
Buggy source:
/** 
 * Rounds the X, Y, and Z values of the given Vector3 to the nearest integer value.
 * @param o Vector3 to use
 * @return
 */
public static Vector3 round(Vector3 o){
  return new Vector3(Math.round(o.getX()),Math.round(o.getY()),Math.round(o.getZ()));
}

Fixed version (ground truth):
/** 
 * Rounds the X, Y, and Z values of the given Vector3 to the nearest integer value.
 * @param o Vector3 to use
 * @return
 */
public static Vector3 round(Vector3 o){
  return new Vector3(Math.round(o.x),Math.round(o.y),Math.round(o.z));
}
Program: 177562
Project: 177562
Buggy source:
/** 
 * Sets this point equal to another pointm
 */
public void set(Pointm point){
  world=point.world;
  x=point.x;
  y=point.y;
  z=point.y;
}

Fixed version (ground truth):
/** 
 * Sets this point equal to another pointm
 */
protected void set(AtomicPoint point){
  this.world=point.world;
  this.x=point.x;
  this.y=point.y;
  this.z=point.y;
}
Program: 177564
Project: 177564
Buggy source:
@Override public void setTransform(Transform transform){
  int seq=lock.writeLock();
  try {
    while (true) {
      int seqRead=transform.readLock();
      Point newPosition=transform.getPosition();
      chunkLive=newPosition.getWorld().getChunk(newPosition);
      Region newRegion=chunkLive.getRegion();
      if (newRegion == null && this.getController() instanceof PlayerController) {
        newRegion=newPosition.getWorld().getRegion(newPosition,true);
      }
      EntityManager newEntityManager=((SpoutRegion)newRegion).getEntityManager();
      transformLive.set(transform);
      entityManagerLive=newEntityManager;
      if (transform.readUnlock(seqRead)) {
        return;
      }
    }
  }
  finally {
    lock.writeUnlock(seq);
  }
}

Fixed version (ground truth):
@Override public void setTransform(Transform transform){
  int seq=lock.writeLock();
  try {
    while (true) {
      int seqRead=transform.readLock();
      Point newPosition=transform.getPosition();
      World world=newPosition.getWorld();
      if (world == null) {
        chunkLive=null;
        transformLive.set(DEAD);
        entityManagerLive=null;
        return;
      }
      chunkLive=newPosition.getWorld().getChunk(newPosition);
      Region newRegion=chunkLive.getRegion();
      if (newRegion == null && this.getController() instanceof PlayerController) {
        newRegion=newPosition.getWorld().getRegion(newPosition,true);
      }
      EntityManager newEntityManager=((SpoutRegion)newRegion).getEntityManager();
      transformLive.set(transform);
      entityManagerLive=newEntityManager;
      if (transform.readUnlock(seqRead)) {
        return;
      }
    }
  }
  finally {
    lock.writeUnlock(seq);
  }
}
Program: 177565
Project: 177565
Buggy source:
@Override public Chunk getChunkLive(){
  Point position=transformLive.getPosition();
  return position.getWorld().getChunk(position,true);
}

Fixed version (ground truth):
@Override public Chunk getChunkLive(){
  while (true) {
    int seq=lock.readLock();
    Point position=transformLive.getPosition();
    World w=position.getWorld();
    if (w == null) {
      if (lock.readUnlock(seq)) {
        return null;
      }
    }
 else {
      Chunk c=w.getChunk(position,true);
      if (lock.readUnlock(seq)) {
        return c;
      }
    }
  }
}
Program: 177566
Project: 177566
Buggy source:
public boolean kill(){
  int seq=lock.writeLock();
  try {
    while (true) {
      int seqRead=transformLive.readLock();
      AtomicPoint p=transformLive.getPosition();
      boolean alive=p.getWorld() != null;
      if (transformLive.readUnlock(seqRead)) {
        p.set(null,0F,0F,0F);
        entityManagerLive=null;
        return alive;
      }
    }
  }
  finally {
    lock.writeUnlock(seq);
  }
}

Fixed version (ground truth):
public boolean kill(){
  int seq=lock.writeLock();
  boolean alive=true;
  try {
    AtomicPoint p=transformLive.getPosition();
    alive=p.getWorld() != null;
    transformLive.set(DEAD);
  }
  finally {
    lock.writeUnlock(seq);
  }
  setTransform(DEAD);
  return alive;
}
Program: 177567
Project: 177567
Buggy source:
@Override public Chunk getChunk(){
  Point position=transform.getPosition();
  return position.getWorld().getChunk(position,true);
}

Fixed version (ground truth):
@Override public Chunk getChunk(){
  while (true) {
    int seq=lock.readLock();
    Point position=transform.getPosition();
    World w=position.getWorld();
    if (w == null) {
      if (lock.readUnlock(seq)) {
        return null;
      }
    }
 else {
      Chunk c=w.getChunk(position,true);
      if (lock.readUnlock(seq)) {
        return c;
      }
    }
  }
}
Program: 177568
Project: 177568
Buggy source:
/** 
 * Sets the block id, data and auxData for the block at (x, y, z), if the current data matches the expected data.<br> <br>
 * @param x the x coordinate
 * @param y the y coordinate
 * @param z the z coordinate
 * @param expect the expected block value
 * @param newValue the new block value
 * @return true if the block was set
 */
public final boolean compareAndSetBlock(int x,int y,int z,BlockFullState<T> expect,BlockFullState<T> newValue){
  return compareAndSetBlock(x,y,z,expect.id,expect.data,expect.auxData,newValue.id,newValue.data,newValue.auxData);
}

Fixed version (ground truth):
/** 
 * Sets the block id, data and auxData for the block at (x, y, z), if the current data matches the expected data.<br> <br>
 * @param x the x coordinate
 * @param y the y coordinate
 * @param z the z coordinate
 * @param expect the expected block value
 * @param newValue the new block value
 * @return true if the block was set
 */
public final boolean compareAndSetBlock(int x,int y,int z,BlockFullState<T> expect,BlockFullState<T> newValue){
  return compareAndSetBlock(x,y,z,expect.getId(),expect.getData(),expect.getAuxData(),newValue.getId(),newValue.getData(),newValue.getAuxData());
}
Program: 177569
Project: 177569
Buggy source:
/** 
 * Atomically gets the full set of data associated with the block.<br> <br>
 * @param x the x coordinate
 * @param y the y coordinate
 * @param z the z coordinate
 * @param fullState a BlockFullState object to store the return value, or null to generate a new one
 * @return the full state of the block
 */
public final BlockFullState<T> getFullData(int x,int y,int z,BlockFullState<T> fullData){
  if (fullData == null) {
    fullData=new BlockFullState<T>();
  }
  int index=getIndex(x,y,z);
  while (true) {
    int seq=getSequence(x,y,z);
    short blockId=blockIds.get(index);
    if (auxStore.isReserved(blockId)) {
      fullData.id=auxStore.getId(blockId);
      fullData.data=auxStore.getData(blockId);
      fullData.auxData=auxStore.getAuxData(blockId);
      int seq2=getSequence(x,y,z);
      if (seq == seq2) {
        return fullData;
      }
    }
 else {
      fullData.id=blockId;
      fullData.data=0;
      fullData.auxData=null;
      return null;
    }
  }
}

Fixed version (ground truth):
/** 
 * Atomically gets the full set of data associated with the block.<br> <br>
 * @param x the x coordinate
 * @param y the y coordinate
 * @param z the z coordinate
 * @param fullState a BlockFullState object to store the return value, or null to generate a new one
 * @return the full state of the block
 */
public final BlockFullState<T> getFullData(int x,int y,int z,BlockFullState<T> fullData){
  if (fullData == null) {
    fullData=new BlockFullState<T>();
  }
  int index=getIndex(x,y,z);
  while (true) {
    int seq=getSequence(x,y,z);
    short blockId=blockIds.get(index);
    if (auxStore.isReserved(blockId)) {
      fullData.setId(auxStore.getId(blockId));
      fullData.setData(auxStore.getData(blockId));
      fullData.setAuxData(auxStore.getAuxData(blockId));
      int seq2=getSequence(x,y,z);
      if (seq == seq2) {
        return fullData;
      }
    }
 else {
      fullData.setId(blockId);
      fullData.setData((short)0);
      fullData.setAuxData(null);
      return fullData;
    }
  }
}
Program: 177570
Project: 177570
Buggy source:
/** 
 * Adds an entry to the store.  The auxData parameter should be set to null to indicate no auxiliary data.<br> <br> The index that is returned is guaranteed to be one of the reserved indexes.<br> <br>
 * @param id the id
 * @param data the data
 * @param auxData the auxiliary data
 * @return the index that the entry was stored in the array
 */
public final int add(short id,short data,T auxData){
  if (auxData == EMPTY) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  entries.incrementAndGet();
  while (true) {
    if (needsResize()) {
      resizeArrays();
    }
    int testIndex=scan.getAndIncrement() & (length.get() - 1);
    int prevSeq=seqArray.get().getAndSet(testIndex,DatatableSequenceNumber.UNSTABLE);
    if (prevSeq == DatatableSequenceNumber.UNSTABLE) {
      continue;
    }
    try {
      int idAndData=(((int)id) << 16) | (data & 0xFFFF);
      intArray.get()[testIndex]=idAndData;
      auxArray.get()[testIndex]=auxData;
      return toExternal(testIndex);
    }
  finally {
      seqArray.get().set(testIndex,DatatableSequenceNumber.get());
    }
  }
}

Fixed version (ground truth):
/** 
 * Adds an entry to the store.  The auxData parameter should be set to null to indicate no auxiliary data.<br> <br> The index that is returned is guaranteed to be one of the reserved indexes.<br> <br>
 * @param id the id
 * @param data the data
 * @param auxData the auxiliary data
 * @return the index that the entry was stored in the array
 */
public final int add(short id,short data,T auxData){
  if (auxData == EMPTY) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  entries.incrementAndGet();
  while (true) {
    if (needsResize()) {
      resizeArrays();
    }
    int testIndex=scan.getAndIncrement() & (length.get() - 1);
    int prevSeq=seqArray.get().getAndSet(testIndex,DatatableSequenceNumber.UNSTABLE);
    if (prevSeq == DatatableSequenceNumber.UNSTABLE) {
      continue;
    }
    try {
      if (auxArray.get()[testIndex] != EMPTY) {
        continue;
      }
      int idAndData=(((int)id) << 16) | (data & 0xFFFF);
      intArray.get()[testIndex]=idAndData;
      auxArray.get()[testIndex]=auxData;
      return toExternal(testIndex);
    }
  finally {
      seqArray.get().set(testIndex,DatatableSequenceNumber.get());
    }
  }
}
Program: 177571
Project: 177571
Buggy source:
/** 
 * Indicates if the given short should be reserved.<br> <br> Only ids where isReverved(id) returns true will be returned by the add(...) method.<br> <br> Ids from (65536 - length) to 65535 are reserved. <br> The top 2 bytes of the id are ignored.<br>
 * @param id
 * @return true if the id is reserved
 */
public final boolean isReserved(int id){
  id=id & 0x0000FFFF;
  return (id & reservedMask) == id;
}

Fixed version (ground truth):
/** 
 * Indicates if the given short should be reserved.<br> <br> Only ids where isReverved(id) returns true will be returned by the add(...) method.<br> <br> Ids from (65536 - length) to 65535 are reserved. <br> The top 2 bytes of the id are ignored.<br>
 * @param id
 * @return true if the id is reserved
 */
public final boolean isReserved(int id){
  id=id & 0x0000FFFF;
  return (id & reservedMask) == reservedMask;
}
Program: 177572
Project: 177572
Buggy source:
/** 
 * Removes the array elements at the given index.  The array should not be empty at the index in question.<br> <br>
 * @param index the index
 */
public boolean remove(int index){
  index=toInternal(index);
  while (true) {
    int prevSeq=seqArray.get().getAndSet(index,DatatableSequenceNumber.UNSTABLE);
    if (prevSeq == DatatableSequenceNumber.UNSTABLE) {
      return false;
    }
    try {
      T current=auxArray.get()[index];
      if (current == EMPTY) {
        return false;
      }
      auxArray.get()[index]=EMPTY;
      entries.decrementAndGet();
      return true;
    }
  finally {
      seqArray.get().set(index,DatatableSequenceNumber.get());
    }
  }
}

Fixed version (ground truth):
/** 
 * Removes the array elements at the given index.  The array should not be empty at the index in question.<br> <br>
 * @param index the index
 */
public boolean remove(int index){
  index=toInternal(index);
  while (true) {
    int prevSeq=seqArray.get().getAndSet(index,DatatableSequenceNumber.UNSTABLE);
    if (prevSeq == DatatableSequenceNumber.UNSTABLE) {
      continue;
    }
    try {
      T current=auxArray.get()[index];
      if (current == EMPTY) {
        return false;
      }
      auxArray.get()[index]=EMPTY;
      entries.decrementAndGet();
      return true;
    }
  finally {
      seqArray.get().set(index,DatatableSequenceNumber.get());
    }
  }
}
Program: 177573
Project: 177573
Buggy source:
/** 
 * Indicates if the array needs resizing.  An array is considered to need resizing if it is more than 50% full. Once an array has a length of the maximum length, it is never considered in need to resizing.
 * @return true if the array needs to be resized
 */
private final boolean needsResize(){
  return length.get() < maxLength && entries.get() >= (length.get() >> 1);
}

Fixed version (ground truth):
/** 
 * Indicates if the array needs resizing.  An array is considered to need resizing if it is more than 50% full. Once an array has a length of the maximum length, it is never considered in need to resizing.
 * @return true if the array needs to be resized
 */
private final boolean needsResize(){
  int lengthThreshold=length.get();
  lengthThreshold-=lengthThreshold >> 2;
  return length.get() < maxLength && entries.get() >= lengthThreshold;
}
Program: 177574
Project: 177574
Buggy source:
private void set(int x,int y,int z,int id,int data,Integer auxData){
  int index=getIndex(x,y,z);
  this.ids[index]=(short)id;
  this.data[index]=(short)data;
  this.auxData[index]=auxData;
  store.setBlock(x,y,z,(short)id,(short)data,auxData);
}

Fixed version (ground truth):
private void set(int x,int y,int z,int id,int data,Integer auxData){
  int index=getIndex(x,y,z);
  this.ids[index]=(short)id;
  this.data[index]=(short)data;
  this.auxData[index]=auxData;
  store.setBlock(x,y,z,(short)id,(short)data,auxData);
  checkForResize();
}
Program: 177576
Project: 177576
Buggy source:
public CuboidShortBuffer getBlockCuboidBufferLive(){
  checkChunkLoaded();
  int x=getX() << Chunk.CHUNK_SIZE_BITS;
  int y=getY() << Chunk.CHUNK_SIZE_BITS;
  int z=getZ() << Chunk.CHUNK_SIZE_BITS;
  CuboidShortBuffer snapshot=new CuboidShortBuffer(getWorld(),x,y,z,Chunk.CHUNK_SIZE,Chunk.CHUNK_SIZE,Chunk.CHUNK_SIZE,this.blockIds.getLive());
  if (y < 32) {
    snapshot.flood((short)1);
  }
  return snapshot;
}

Fixed version (ground truth):
public CuboidShortBuffer getBlockCuboidBufferLive(){
  checkChunkLoaded();
  int x=getX() << Chunk.CHUNK_SIZE_BITS;
  int y=getY() << Chunk.CHUNK_SIZE_BITS;
  int z=getZ() << Chunk.CHUNK_SIZE_BITS;
  CuboidShortBuffer snapshot=new CuboidShortBuffer(getWorld(),x,y,z,Chunk.CHUNK_SIZE,Chunk.CHUNK_SIZE,Chunk.CHUNK_SIZE,this.blockIds.getLive());
  return snapshot;
}
Program: 177577
Project: 177577
Buggy source:
/** 
 * @param dt milliseonds since the last tick
 */
public void onTick(float dt){
  if (controller != null)   controller.onTick(dt);
}

Fixed version (ground truth):
/** 
 * @param dt milliseconds since the last tick
 */
public void onTick(float dt){
  if (controller != null)   controller.onTick(dt);
}
Program: 177578
Project: 177578
Buggy source:
public void setController(Controller controller){
  controller.attachToEntity(this);
  this.controller=controller;
  controller.onAttached();
}

Fixed version (ground truth):
public void setController(Controller controller){
  controller.attachToEntity(this);
  Region region=getRegion();
  if (region != null) {
    ((SpoutRegion)region).deallocate(this);
  }
  this.controller=controller;
  if (region != null) {
    ((SpoutRegion)region).allocate(this);
  }
  controller.onAttached();
}
Program: 177579
Project: 177579
Buggy source:
@Override public String getUsage(String[] input,int baseIndex){
  return ChatColor.RED + "String_Node_Str" + (input.length > baseIndex ? input[baseIndex] : getPreferredName())+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String getUsage(String[] input,int baseIndex){
  return ChatColor.RED + "String_Node_Str" + (input.length > baseIndex ? input[baseIndex + 1] : getPreferredName())+ "String_Node_Str";
}
Program: 177580
Project: 177580
Buggy source:
public void execute(CommandSource source,String[] args,int baseIndex,boolean fuzzyLookup) throws CommandException {
  if (rawExecutor != null && rawExecutor != this) {
    rawExecutor.execute(source,args,baseIndex,fuzzyLookup);
    return;
  }
  if (args.length > baseIndex && children.size() > 0) {
    Command sub=getChild(args[0],fuzzyLookup);
    if (sub == null) {
      throw new MissingCommandException("String_Node_Str",getUsage(args,baseIndex));
    }
    sub.execute(source,args,++baseIndex,fuzzyLookup);
    return;
  }
  if (executor == null || baseIndex >= args.length) {
    throw new MissingCommandException("String_Node_Str",getUsage(args,baseIndex));
  }
  args=MiscCompatibilityUtils.arrayCopyOfRange(args,baseIndex,args.length);
  CommandContext context=new CommandContext(args,valueFlags);
  for (  char flag : context.getFlags().toArray()) {
    if (!flags.contains(flag)) {
      throw new CommandUsageException("String_Node_Str" + flag,this);
    }
  }
  try {
    executor.processCommand(source,this,context);
  }
 catch (  CommandException e) {
    throw e;
  }
catch (  Throwable t) {
    throw new WrappedCommandException(t);
  }
}

Fixed version (ground truth):
public void execute(CommandSource source,String[] args,int baseIndex,boolean fuzzyLookup) throws CommandException {
  if (rawExecutor != null && rawExecutor != this) {
    rawExecutor.execute(source,args,baseIndex,fuzzyLookup);
    return;
  }
  if (args.length > baseIndex && children.size() > 0) {
    Command sub=getChild(args[baseIndex + 1],fuzzyLookup);
    if (sub == null) {
      throw new MissingCommandException("String_Node_Str",getUsage(args,baseIndex));
    }
    sub.execute(source,args,++baseIndex,fuzzyLookup);
    return;
  }
  if (executor == null || baseIndex >= args.length) {
    throw new MissingCommandException("String_Node_Str",getUsage(args,baseIndex));
  }
  args=MiscCompatibilityUtils.arrayCopyOfRange(args,baseIndex,args.length);
  CommandContext context=new CommandContext(args,valueFlags);
  for (  char flag : context.getFlags().toArray()) {
    if (!flags.contains(flag)) {
      throw new CommandUsageException("String_Node_Str" + flag,this);
    }
  }
  try {
    executor.processCommand(source,this,context);
  }
 catch (  CommandException e) {
    throw e;
  }
catch (  Throwable t) {
    throw new WrappedCommandException(t);
  }
}
Program: 177581
Project: 177581
Buggy source:
ConfigurationNode(Map<String,Object> root){
  this.root=root;
}

Fixed version (ground truth):
protected ConfigurationNode(Map<String,Object> root){
  this.root=root;
}
Program: 177582
Project: 177582
Buggy source:
/** 
 * Creates and returns a 4x4 rotation matrix given by the provided Quaternion
 * @param rot
 * @return
 */
public static Matrix rotate(Quaternion rot){
  Matrix res=createIdentity();
  Quaternion r=rot.normalize();
  res.set(0,0,1 - (2 * r.getY() * r.getY()) - (2 * r.getZ() * r.getZ()));
  res.set(0,1,(2 * r.getX() * r.getY()) - (2 * r.getW() * r.getZ()));
  res.set(0,2,(2 * r.getX() * r.getZ()) + (2 * r.getW() * r.getY()));
  res.set(0,3,0);
  res.set(1,0,(2 * r.getX() * r.getY()) + (2 * r.getW() * r.getZ()));
  res.set(1,1,1 - (2 * r.getX() * r.getX()) - (2 * r.getZ() * r.getZ()));
  res.set(1,2,(2 * r.getY() * r.getZ()) - (2 * r.getW() * r.getX()));
  res.set(1,3,0);
  res.set(2,0,(2 * r.getX() * r.getZ()) - (2 * r.getW() * r.getY()));
  res.set(2,1,(2 * r.getY() * r.getZ()) + (2 * r.getW() * r.getZ()));
  res.set(2,2,1 - (2 * r.getX() * r.getX()) - (2 * r.getY() * r.getY()));
  res.set(2,3,0);
  return res;
}

Fixed version (ground truth):
/** 
 * Creates and returns a 4x4 rotation matrix given by the provided Quaternion
 * @param rot
 * @return
 */
public static Matrix rotate(Quaternion rot){
  Matrix res=createIdentity();
  Quaternion r=rot.normalize();
  res.set(0,0,1 - (2 * r.getY() * r.getY()) - (2 * r.getZ() * r.getZ()));
  res.set(0,1,(2 * r.getX() * r.getY()) - (2 * r.getW() * r.getZ()));
  res.set(0,2,(2 * r.getX() * r.getZ()) + (2 * r.getW() * r.getY()));
  res.set(0,3,0);
  res.set(1,0,(2 * r.getX() * r.getY()) + (2 * r.getW() * r.getZ()));
  res.set(1,1,1 - (2 * r.getX() * r.getX()) - (2 * r.getZ() * r.getZ()));
  res.set(1,2,(2 * r.getY() * r.getZ()) - (2 * r.getW() * r.getX()));
  res.set(1,3,0);
  res.set(2,0,(2 * r.getX() * r.getZ()) - (2 * r.getW() * r.getY()));
  res.set(2,1,(2.f * r.getY() * r.getZ()) + (2.f * r.getX() * r.getW()));
  res.set(2,2,1 - (2 * r.getX() * r.getX()) - (2 * r.getY() * r.getY()));
  res.set(2,3,0);
  return res;
}
Program: 177583
Project: 177583
Buggy source:
/** 
 * Returns the length of the given Quaternion Note: Uses sqrt, so is slowish.
 * @param a
 * @return
 */
public static float length(Quaternion a){
  return (float)MathHelper.sqrt(lengthSquared(a));
}

Fixed version (ground truth):
/** 
 * Returns the length of the given Quaternion Note: Uses sqrt, so is slowish.
 * @param a
 * @return
 */
public static float length(Quaternion a){
  return (float)Math.sqrt(lengthSquared(a));
}
Program: 177584
Project: 177584
Buggy source:
@Test public void testRotate(){
  Matrix m;
  Quaternion rot;
  rot=Quaternion.identity;
  m=Matrix.rotate(rot);
  double[][] id={{1,0,0,0},{0,1,0,0},{0,0,1,0},{0,0,0,1}};
  compareMatrixToArray(m,id);
  rot=new Quaternion(4,3,2,0);
  m=Matrix.rotate(rot);
  id=new double[][]{{0.103448,0.827586,0.551724,0},{0.827586,-0.37931,0.413793,0},{0.551724,0.413793,-0.724138,0},{0,0,0,1}};
  compareMatrixToArray(m,id);
  rot=new Quaternion(90,new Vector3(0,1,0));
  id=new double[][]{{0,0,1,0},{0,1,0,0},{-1,0,0,0},{0,0,0,1}};
  compareMatrixToArray(m,id);
}

Fixed version (ground truth):
@Test public void testRotate(){
  Matrix m;
  Quaternion rot;
  rot=Quaternion.identity;
  m=Matrix.rotate(rot);
  double[][] id={{1,0,0,0},{0,1,0,0},{0,0,1,0},{0,0,0,1}};
  compareMatrixToArray(m,id);
  rot=new Quaternion(4,3,2,0);
  m=Matrix.rotate(rot);
  id=new double[][]{{0.103448,0.827586,0.551724,0},{0.827586,-0.37931,0.413793,0},{0.551724,0.413793,-0.724138,0},{0,0,0,1}};
  compareMatrixToArray(m,id);
  rot=new Quaternion(90,new Vector3(0,1,0));
  m=Matrix.rotate(rot);
  id=new double[][]{{0,0,1,0},{0,1,0,0},{-1,0,0,0},{0,0,0,1}};
  compareMatrixToArray(m,id);
}
Program: 177585
Project: 177585
Buggy source:
/** 
 * Constructs and returns a new Quaternion that is A * B
 * @param a
 * @param b
 * @return
 */
public static Quaternion multiply(Quaternion a,Quaternion b){
  float x=a.w * b.x + a.x * b.w + a.y * b.z + a.z * b.y;
  float y=a.w * b.y - a.x * b.z + a.y * b.w + a.z * b.x;
  float z=a.w * b.z + a.x * b.y - a.y * b.x + a.z * b.w;
  float w=a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;
  return new Quaternion(x,y,z,w);
}

Fixed version (ground truth):
/** 
 * Constructs and returns a new Quaternion that is A * B
 * @param a
 * @param b
 * @return
 */
public static Quaternion multiply(Quaternion a,Quaternion b){
  float x=a.w * b.x + a.x * b.w + a.y * b.z - a.z * b.y;
  float y=a.w * b.y + a.y * b.w + a.z * b.x - a.x * b.z;
  float z=a.w * b.z + a.z * b.w + a.x * b.y - a.y * b.x;
  float w=a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;
  return new Quaternion(x,y,z,w);
}
Program: 177586
Project: 177586
Buggy source:
/** 
 * Returns the angles about each axis of this quaternion stored in a Vector3 vect.X = Rotation about the X axis (Roll) vect.Y = Rotation about the Y axis (Yaw) vect.Z = Rotation about the Z axis (Pitch)
 * @param a
 * @return
 */
public static Vector3 getAxisAngles(Quaternion a){
  float roll=(float)Math.atan2(2 * (a.getX() * a.getY() + a.getZ() * a.getW()),1 - 2 * (a.getY() * a.getY() + a.getZ() * a.getZ()));
  float pitch=(float)Math.asin(2 * (a.getX() * a.getZ() - a.getW() * a.getY()));
  float yaw=(float)Math.atan2(2 * (a.getX() * a.getW() + a.getY() * a.getZ()),1 - 2 * (a.getZ() * a.getZ() + a.getW() * a.getW()));
  return new Vector3(roll,pitch,yaw);
}

Fixed version (ground truth):
/** 
 * Returns the angles about each axis of this quaternion stored in a Vector3 vect.X = Rotation about the X axis (Roll) vect.Y = Rotation about the Y axis (Yaw) vect.Z = Rotation about the Z axis (Pitch)
 * @param a
 * @return
 */
public static Vector3 getAxisAngles(Quaternion a){
  float yaw=(float)Math.toDegrees(Math.atan2(2 * (a.getX() * a.getY() + a.getZ() * a.getW()),1 - 2 * (a.getY() * a.getY() + a.getZ() * a.getZ())));
  float pitch=-1 * (float)Math.toDegrees(Math.asin(2 * (a.getX() * a.getZ() - a.getW() * a.getY())));
  float roll=180 - (float)Math.toDegrees(Math.atan2(2 * (a.getX() * a.getW() + a.getY() * a.getZ()),1 - 2 * (a.getZ() * a.getZ() + a.getW() * a.getW())));
  return new Vector3(roll,pitch,yaw);
}
Program: 177587
Project: 177587
Buggy source:
@Test public void testLengthQuaternion(){
  fail("String_Node_Str");
}

Fixed version (ground truth):
@Test public void testLengthQuaternion(){
  Quaternion rot=new Quaternion(1,0,0,0);
  float ls=rot.length();
  if (Math.abs(ls - 1.0f) >= eps)   fail("String_Node_Str" + rot + "String_Node_Str"+ ls);
  rot=new Quaternion(6,4,3,2);
  ls=rot.length();
  if (Math.abs(ls - MathHelper.sqrt(65.0f)) >= eps)   fail("String_Node_Str" + rot + "String_Node_Str"+ ls);
  rot=new Quaternion(6,-1,0,2);
  ls=rot.length();
  if (Math.abs(ls - MathHelper.sqrt(41.0f)) >= eps)   fail("String_Node_Str" + rot + "String_Node_Str"+ ls);
}
Program: 177588
Project: 177588
Buggy source:
@Test public void testQuaternionDoubleDoubleDoubleDouble(){
  fail("String_Node_Str");
}

Fixed version (ground truth):
@Test public void testQuaternionDoubleDoubleDoubleDouble(){
  Quaternion q=new Quaternion(1,0,0,0);
  testValues(q,1,0,0,0);
  q=new Quaternion(4,2,6,8);
  testValues(q,4,2,6,8);
}
Program: 177589
Project: 177589
Buggy source:
@Test public void testMultiplyQuaternionQuaternion(){
  fail("String_Node_Str");
}

Fixed version (ground truth):
@Test public void testMultiplyQuaternionQuaternion(){
  Quaternion a=new Quaternion(1,0,0,0);
  Quaternion b=new Quaternion(1,0,0,0);
  Quaternion res=a.multiply(b);
  testValues(res,0,0,0,-1);
  a=new Quaternion(0,0,0,1);
  b=new Quaternion(0,0,0,1);
  res=a.multiply(b);
  testValues(res,0,0,0,1);
  a=new Quaternion(5,3,1,1);
  b=new Quaternion(0,0,0,1);
  res=a.multiply(b);
  testValues(res,5,3,1,1);
  a=new Quaternion(5,3,1,1);
  b=new Quaternion(-5,2,1,0);
  res=a.multiply(b);
  testValues(res,-4,-8,26,18);
}
Program: 177590
Project: 177590
Buggy source:
@Test public void testNormalizeQuaternion(){
  fail("String_Node_Str");
}

Fixed version (ground truth):
@Test public void testNormalizeQuaternion(){
  Quaternion rot=new Quaternion(1,0,0,0);
  Quaternion norm=rot.normalize();
  if (Math.abs(norm.length() - 1.f) >= eps)   fail("String_Node_Str" + rot + "String_Node_Str"+ norm.length());
  rot=new Quaternion(6,4,3,2);
  norm=rot.normalize();
  if (Math.abs(norm.length() - 1.f) >= eps)   fail("String_Node_Str" + rot + "String_Node_Str"+ norm.length());
  rot=new Quaternion(6,-1,0,2);
  norm=rot.normalize();
  if (Math.abs(norm.length() - 1.f) >= eps)   fail("String_Node_Str" + rot + "String_Node_Str"+ norm.length());
}
Program: 177591
Project: 177591
Buggy source:
@Test public void testQuaternionDoubleVector3(){
  fail("String_Node_Str");
}

Fixed version (ground truth):
@Test public void testQuaternionDoubleVector3(){
  Quaternion rot=new Quaternion(0,new Vector3(1,0,0));
  float qx=1.f * (float)MathHelper.sin(0);
  float qy=0.f * (float)MathHelper.sin(0);
  float qz=0.f * (float)MathHelper.sin(0);
  float qw=(float)MathHelper.cos(0);
  testValues(rot,qx,qy,qz,qw);
  rot=new Quaternion(40,new Vector3(3,2,1));
  qx=3.f * (float)MathHelper.sin((Math.toRadians(40) / 2));
  qy=2.f * (float)MathHelper.sin((Math.toRadians(40) / 2));
  qz=1.f * (float)MathHelper.sin((Math.toRadians(40) / 2));
  qw=(float)MathHelper.cos((Math.toRadians(40) / 2));
  testValues(rot,qx,qy,qz,qw);
  rot=new Quaternion(120,new Vector3(6,-3,2));
  qx=6.f * (float)MathHelper.sin((Math.toRadians(120) / 2));
  qy=-3.f * (float)MathHelper.sin((Math.toRadians(120) / 2));
  qz=2.f * (float)MathHelper.sin((Math.toRadians(120) / 2));
  qw=(float)MathHelper.cos((Math.toRadians(120) / 2));
  testValues(rot,qx,qy,qz,qw);
}
Program: 177592
Project: 177592
Buggy source:
@Test public void testRotateQuaternionDoubleVector3(){
  fail("String_Node_Str");
}

Fixed version (ground truth):
@Test public void testRotateQuaternionDoubleVector3(){
  float qx, qy, qz, qw;
  float x=1;
  float y=0;
  float z=0;
  float ang=0;
  Quaternion a=new Quaternion(0,0,0,1);
  Quaternion res=a.rotate(ang,new Vector3(x,y,z));
  testValues(res,0,0,0,1);
  x=1;
  ang=45;
  a=new Quaternion(0,0,0,1);
  res=a.rotate(ang,new Vector3(x,y,z));
  qx=x * (float)MathHelper.sin((Math.toRadians(ang) / 2));
  qy=y * (float)MathHelper.sin((Math.toRadians(ang) / 2));
  qz=z * (float)MathHelper.sin((Math.toRadians(ang) / 2));
  qw=(float)MathHelper.cos((Math.toRadians(ang) / 2));
  testValues(res,qx,qy,qz,qw);
  x=1.f;
  y=4.f;
  z=-3.f;
  ang=120;
  a=new Quaternion(0,0,0,1);
  res=a.rotate(ang,new Vector3(x,y,z));
  qx=x * (float)MathHelper.sin((Math.toRadians(ang) / 2));
  qy=y * (float)MathHelper.sin((Math.toRadians(ang) / 2));
  qz=z * (float)MathHelper.sin((Math.toRadians(ang) / 2));
  qw=(float)MathHelper.cos((Math.toRadians(ang) / 2));
  testValues(res,qx,qy,qz,qw);
}
Program: 177593
Project: 177593
Buggy source:
@Test public void testLengthSquaredQuaternion(){
  fail("String_Node_Str");
}

Fixed version (ground truth):
@Test public void testLengthSquaredQuaternion(){
  Quaternion rot=new Quaternion(1,0,0,0);
  float ls=rot.lengthSquared();
  if (Math.abs(ls - 1.0f) >= eps)   fail("String_Node_Str" + rot + "String_Node_Str"+ ls);
  rot=new Quaternion(6,4,3,2);
  ls=rot.lengthSquared();
  if (Math.abs(ls - 65.0f) >= eps)   fail("String_Node_Str" + rot + "String_Node_Str"+ ls);
  rot=new Quaternion(6,-1,0,2);
  ls=rot.lengthSquared();
  if (Math.abs(ls - 41.0f) >= eps)   fail("String_Node_Str" + rot + "String_Node_Str"+ ls);
}
Program: 177594
Project: 177594
Buggy source:
@Test public void testTransformVector3Quaternion(){
  Vector3 x=new Vector3(1,0,0);
  Vector3 u=x.transform(new Quaternion(90,new Vector3(0,1,0)));
  if (!u.equals(new Vector3(0,0,-1)))   fail("String_Node_Str");
  Vector3 y=new Vector3(2,4,5);
  Vector3 v=y.transform(new Quaternion(30,new Vector3(1,0,0)));
  Vector3 res=new Vector3(2,.964f,6.33f);
  if (!v.equals(res))   fail("String_Node_Str" + res + "String_Node_Str"+ v);
}

Fixed version (ground truth):
@Test public void testTransformVector3Quaternion(){
  Vector3 x=new Vector3(1,0,0);
  Vector3 u=x.transform(new Quaternion(90,new Vector3(0,1,0)));
  if (!u.equals(new Vector3(0,0,-1)))   fail("String_Node_Str" + u);
  Vector3 y=new Vector3(2,4,5);
  Vector3 v=y.transform(new Quaternion(30,new Vector3(1,0,0)));
  Vector3 res=new Vector3(2,.964f,6.33f);
  if (!v.equals(res))   fail("String_Node_Str" + res + "String_Node_Str"+ v);
}
Program: 177595
Project: 177595
Buggy source:
/** 
 * Sets the id for the block at (x, y, z) to the given id and returns the snapshot value For ids greater than 255, the id must represent a value custom id
 * @param x the x coordinate
 * @param y the x coordinate
 * @param z the x coordinate
 * @param id
 * @return the block's id from the snapshot
 */
@SnapshotRead @DelayedWrite public short setBlockId(int x,int y,int z,short id);

Fixed version (ground truth):
/** 
 * Sets the id for the block at (x, y, z) to the given id and returns the snapshot value For ids greater than 255, the id must represent a value custom id
 * @param x the x coordinate
 * @param y the y coordinate
 * @param z the z coordinate
 * @param id
 * @return the block's id from the snapshot
 */
@SnapshotRead @DelayedWrite public short setBlockId(int x,int y,int z,short id);
Program: 177596
Project: 177596
Buggy source:
/** 
 * Gets the id for the block at (x, y, z)<br/> Note: using live id may have a negative performance impact, relative to reading the snapshot value
 * @param x the x coordinate
 * @param y the x coordinate
 * @param z the x coordinate
 * @param live whether to use the live id, or snapshot value
 * @return the block's material
 */
@SnapshotRead @LiveRead public short getBlockId(int x,int y,int z,boolean live);

Fixed version (ground truth):
/** 
 * Gets the id for the block at (x, y, z)<br/> Note: using live id may have a negative performance impact, relative to reading the snapshot value
 * @param x the x coordinate
 * @param y the y coordinate
 * @param z the z coordinate
 * @param live whether to use the live id, or snapshot value
 * @return the block's material
 */
@SnapshotRead @LiveRead public short getBlockId(int x,int y,int z,boolean live);
Program: 177597
Project: 177597
Buggy source:
/** 
 * Gets the data for the block at (x, y, z)<br/> Note: using live data may have a negative performance impact, relative to reading the snapshot value
 * @param x the x coordinate
 * @param y the x coordinate
 * @param z the x coordinate
 * @param live whether to use the live data, or snapshot value
 * @return the block's data
 */
@SnapshotRead @LiveRead public byte getBlockData(int x,int y,int z,boolean live);

Fixed version (ground truth):
/** 
 * Gets the data for the block at (x, y, z)<br/> Note: using live data may have a negative performance impact, relative to reading the snapshot value
 * @param x the x coordinate
 * @param y the y coordinate
 * @param z the z coordinate
 * @param live whether to use the live data, or snapshot value
 * @return the block's data
 */
@SnapshotRead @LiveRead public byte getBlockData(int x,int y,int z,boolean live);
Program: 177598
Project: 177598
Buggy source:
/** 
 * Sets the block at (x, y, z) to the given material type and returns the snapshot value
 * @param x the x coordinate
 * @param y the x coordinate
 * @param z the x coordinate
 * @param material
 * @return the block's material from the snapshot
 */
@SnapshotRead @DelayedWrite public BlockMaterial setBlockMaterial(int x,int y,int z,BlockMaterial material);

Fixed version (ground truth):
/** 
 * Sets the block at (x, y, z) to the given material type and returns the snapshot value
 * @param x the x coordinate
 * @param y the y coordinate
 * @param z the z coordinate
 * @param material
 * @return the block's material from the snapshot
 */
@SnapshotRead @DelayedWrite public BlockMaterial setBlockMaterial(int x,int y,int z,BlockMaterial material);
Program: 177599
Project: 177599
Buggy source:
/** 
 * Gets the material for the block at (x, y, z)<br/> Note: using live material may have a negative performance impact, relative to reading the snapshot value
 * @param x the x coordinate
 * @param y the x coordinate
 * @param z the x coordinate
 * @param live whether to use the live id, or snapshot value
 * @return the block's material
 */
@SnapshotRead @LiveRead public BlockMaterial getBlockMaterial(int x,int y,int z,boolean live);

Fixed version (ground truth):
/** 
 * Gets the material for the block at (x, y, z)<br/> Note: using live material may have a negative performance impact, relative to reading the snapshot value
 * @param x the x coordinate
 * @param y the y coordinate
 * @param z the z coordinate
 * @param live whether to use the live id, or snapshot value
 * @return the block's material
 */
@SnapshotRead @LiveRead public BlockMaterial getBlockMaterial(int x,int y,int z,boolean live);
Program: 177600
Project: 177600
Buggy source:
/** 
 * Sets the snapshot data for the block at (x, y, z) to the given data and returns the snapshot value.
 * @param x the x coordinate
 * @param y the x coordinate
 * @param z the x coordinate
 * @param data to set at the block
 * @return the block's data from the snapshot
 */
@SnapshotRead @DelayedWrite public byte setBlockData(int x,int y,int z,byte data);

Fixed version (ground truth):
/** 
 * Sets the snapshot data for the block at (x, y, z) to the given data and returns the snapshot value.
 * @param x the x coordinate
 * @param y the y coordinate
 * @param z the z coordinate
 * @param data to set at the block
 * @return the block's data from the snapshot
 */
@SnapshotRead @DelayedWrite public byte setBlockData(int x,int y,int z,byte data);
Program: 177601
Project: 177601
Buggy source:
@UnsafeMethod public void enablePlugin(Plugin paramPlugin){
  if (!CommonPlugin.class.isAssignableFrom(paramPlugin.getClass()))   throw new IllegalArgumentException("String_Node_Str");
  if (!paramPlugin.isEnabled()) {
    CommonPlugin cp=(CommonPlugin)paramPlugin;
    String name=cp.getDescription().getName();
    if (!loaders.containsKey(name)) {
      loaders.put(name,(CommonClassLoader)cp.getClassLoader());
    }
    try {
      cp.setEnabled(true);
    }
 catch (    Exception e) {
      game.getLogger().log(Level.SEVERE,new StringBuilder().append("String_Node_Str").append(paramPlugin.getDescription().getFullName()).append("String_Node_Str").append(e.getMessage()).toString(),e);
    }
  }
}

Fixed version (ground truth):
@UnsafeMethod public void enablePlugin(Plugin paramPlugin){
  if (!CommonPlugin.class.isAssignableFrom(paramPlugin.getClass()))   throw new IllegalArgumentException("String_Node_Str");
  if (!paramPlugin.isEnabled()) {
    CommonPlugin cp=(CommonPlugin)paramPlugin;
    String name=cp.getDescription().getName();
    if (!loaders.containsKey(name)) {
      loaders.put(name,(CommonClassLoader)cp.getClassLoader());
    }
    try {
      cp.setEnabled(true);
      cp.onEnable();
    }
 catch (    Exception e) {
      game.getLogger().log(Level.SEVERE,new StringBuilder().append("String_Node_Str").append(paramPlugin.getDescription().getFullName()).append("String_Node_Str").append(e.getMessage()).toString(),e);
    }
  }
}
Program: 177602
Project: 177602
Buggy source:
@UnsafeMethod public void disablePlugin(Plugin paramPlugin){
  if (!CommonPlugin.class.isAssignableFrom(paramPlugin.getClass()))   throw new IllegalArgumentException("String_Node_Str");
  if (paramPlugin.isEnabled()) {
    CommonPlugin cp=(CommonPlugin)paramPlugin;
    String name=cp.getDescription().getName();
    if (!loaders.containsKey(name)) {
      loaders.put(name,(CommonClassLoader)cp.getClassLoader());
    }
    try {
      cp.setEnabled(false);
    }
 catch (    Exception e) {
      game.getLogger().log(Level.SEVERE,new StringBuilder().append("String_Node_Str").append(paramPlugin.getDescription().getFullName()).append("String_Node_Str").append(e.getMessage()).toString(),e);
    }
  }
}

Fixed version (ground truth):
@UnsafeMethod public void disablePlugin(Plugin paramPlugin){
  if (!CommonPlugin.class.isAssignableFrom(paramPlugin.getClass()))   throw new IllegalArgumentException("String_Node_Str");
  if (paramPlugin.isEnabled()) {
    CommonPlugin cp=(CommonPlugin)paramPlugin;
    String name=cp.getDescription().getName();
    if (!loaders.containsKey(name)) {
      loaders.put(name,(CommonClassLoader)cp.getClassLoader());
    }
    try {
      cp.setEnabled(false);
      cp.onDisable();
    }
 catch (    Exception e) {
      game.getLogger().log(Level.SEVERE,new StringBuilder().append("String_Node_Str").append(paramPlugin.getDescription().getFullName()).append("String_Node_Str").append(e.getMessage()).toString(),e);
    }
  }
}
Program: 177603
Project: 177603
Buggy source:
public void disablePlugin(Plugin plugin){
  if (!plugin.isEnabled()) {
    boolean locked=manager.lock(key);
    try {
      plugin.getPluginLoader().enablePlugin(plugin);
    }
 catch (    Exception e) {
      safelyLog(Level.SEVERE,new StringBuilder().append("String_Node_Str").append(plugin.getDescription().getFullName()).append("String_Node_Str").append(e.getMessage()).toString(),e);
    }
    if (!locked)     manager.unlock(key);
  }
}

Fixed version (ground truth):
public void disablePlugin(Plugin plugin){
  if (!plugin.isEnabled()) {
    boolean locked=manager.lock(key);
    try {
      plugin.getPluginLoader().disablePlugin(plugin);
    }
 catch (    Exception e) {
      safelyLog(Level.SEVERE,new StringBuilder().append("String_Node_Str").append(plugin.getDescription().getFullName()).append("String_Node_Str").append(e.getMessage()).toString(),e);
    }
    if (!locked)     manager.unlock(key);
  }
}
Program: 177604
Project: 177604
Buggy source:
public void loadPlugins(){
  pluginManager.registerPluginLoader(CommonPluginLoader.class);
  pluginManager.clearPlugins();
  if (!pluginDirectory.exists())   pluginDirectory.mkdirs();
  plugins=pluginManager.loadPlugins(pluginDirectory);
  for (  Plugin plugin : plugins) {
    try {
      plugin.onLoad();
    }
 catch (    Exception ex) {
      logger.log(Level.SEVERE,"String_Node_Str",new Object[]{plugin.getDescription().getName(),ex.getMessage()});
      ex.printStackTrace();
    }
  }
}

Fixed version (ground truth):
public void loadPlugins(){
  pluginManager.registerPluginLoader(CommonPluginLoader.class);
  pluginManager.clearPlugins();
  if (!pluginDirectory.exists())   pluginDirectory.mkdirs();
  Plugin[] plugins=pluginManager.loadPlugins(pluginDirectory);
  for (  Plugin plugin : plugins) {
    try {
      plugin.onLoad();
    }
 catch (    Exception ex) {
      logger.log(Level.SEVERE,"String_Node_Str",new Object[]{plugin.getDescription().getName(),ex.getMessage()});
      ex.printStackTrace();
    }
  }
}
Program: 177605
Project: 177605
Buggy source:
public void start(){
  CommandRegistrationsFactory<Class<?>> commandRegFactory=new AnnotatedCommandRegistrationFactory(new SimpleInjector(this),new SimpleAnnotatedCommandExecutorFactory());
  getRootCommand().addSubCommands(this,AdministrationCommands.class,commandRegFactory);
  consoleManager.setupConsole();
  loadPlugins();
  enablePlugins();
  scheduler.startMainThread();
}

Fixed version (ground truth):
public void start(){
  Spout.setGame(this);
  CommandRegistrationsFactory<Class<?>> commandRegFactory=new AnnotatedCommandRegistrationFactory(new SimpleInjector(this),new SimpleAnnotatedCommandExecutorFactory());
  getRootCommand().addSubCommands(this,AdministrationCommands.class,commandRegFactory);
  consoleManager.setupConsole();
  loadPlugins();
  enablePlugins();
  scheduler.startMainThread();
}
Program: 177606
Project: 177606
Buggy source:
private void enablePlugins(){
  for (  Plugin plugin : plugins) {
    pluginManager.enablePlugin(plugin);
  }
}

Fixed version (ground truth):
private void enablePlugins(){
  for (  Plugin plugin : pluginManager.getPlugins()) {
    pluginManager.enablePlugin(plugin);
  }
}
Program: 177607
Project: 177607
Buggy source:
private void markDirty(K key){
  boolean success=dirtyMap.putIfAbsent(key,Boolean.TRUE);
  if (success) {
    dirtyQueue.add(key);
  }
}

Fixed version (ground truth):
private void markDirty(K key){
  Boolean old=dirtyMap.putIfAbsent(key,Boolean.TRUE);
  if (old == null) {
    dirtyQueue.add(key);
  }
}
Program: 177608
Project: 177608
Buggy source:
private void markDirty(K key){
  boolean success=dirtyMap.putIfAbsent(key,Boolean.TRUE);
  if (success) {
    dirtyQueue.add(key);
  }
}

Fixed version (ground truth):
private void markDirty(K key){
  Boolean old=dirtyMap.putIfAbsent(key,Boolean.TRUE);
  if (old == null) {
    dirtyQueue.add(key);
  }
}
Program: 177609
Project: 177609
Buggy source:
/** 
 * Returns the dot product of A and B
 * @param a
 * @param b
 * @return
 */
public static double dot(Vector3 a,Vector3 b){
  return a.getX() * b.getX() + a.getY() * b.getY() + a.getZ() + b.getZ();
}

Fixed version (ground truth):
/** 
 * Returns the dot product of A and B
 * @param a
 * @param b
 * @return
 */
public static double dot(Vector3 a,Vector3 b){
  return a.getX() * b.getX() + a.getY() * b.getY() + a.getZ() * b.getZ();
}
Program: 177610
Project: 177610
Buggy source:
/** 
 * Returns the length of the given vector Note: Makes use of Math.sqrt and is not cached, so can be slow
 * @param a
 * @return
 */
public static double length(Vector3 a){
  return MathHelper.sqrt(lengthSquared(a));
}

Fixed version (ground truth):
/** 
 * Returns the length of the given vector Note: Makes use of Math.sqrt and is not cached, so can be slow
 * @param a
 * @return
 */
public static double length(Vector3 a){
  return Math.sqrt(lengthSquared(a));
}
Program: 177611
Project: 177611
Buggy source:
@Override public boolean processCommand(CommandSource source,Command command,Enum<?> commandEnum,String[] args,int baseIndex){
  boolean success=false;
  if (!this.owningAddon.isEnabled()) {
    return false;
  }
  try {
    success=this.executor.processCommand(source,command,commandEnum,args,baseIndex);
  }
 catch (  Throwable ex) {
    throw new CommandException("String_Node_Str" + command.getPreferredName() + "String_Node_Str"+ this.owningAddon.getDescription().getFullName(),ex);
  }
  if ((!success) && (command.getUsageMessage() != null)) {
    source.sendMessage(command.getUsageMessage());
  }
  return success;
}

Fixed version (ground truth):
public boolean processCommand(CommandSource source,Command command,Enum<?> commandEnum,String[] args,int baseIndex){
  boolean success=false;
  if (!this.owningAddon.isEnabled()) {
    return false;
  }
  try {
    success=this.executor.processCommand(source,command,commandEnum,args,baseIndex);
  }
 catch (  Throwable ex) {
    throw new CommandException("String_Node_Str" + command.getPreferredName() + "String_Node_Str"+ this.owningAddon.getDescription().getFullName(),ex);
  }
  if ((!success) && (command.getUsageMessage() != null)) {
    source.sendMessage(command.getUsageMessage());
  }
  return success;
}
Program: 177612
Project: 177612
Buggy source:
@Override public String getPreferredName(){
  return null;
}

Fixed version (ground truth):
public String getPreferredName(){
  return null;
}
Program: 177613
Project: 177613
Buggy source:
@Override public Command c(){
  return null;
}

Fixed version (ground truth):
public Command c(){
  return null;
}
Program: 177614
Project: 177614
Buggy source:
@Override public Command e(String name){
  return null;
}

Fixed version (ground truth):
public Command e(String name){
  return null;
}