nus-yam/ex-repair huggingface dataset:
Program: 177294
Project: 177294
Buggy source:
@Override public void assign(){
  if (getShader().getMaterialAssigned() != this) {
    Set<Map.Entry<String,Object>> s=materialParameters.entrySet();
    for (    Map.Entry<String,Object> entry : s) {
      if (entry.getValue() instanceof Integer) {
        shader.setUniform(entry.getKey(),((Integer)entry.getValue()).intValue());
      }
 else       if (entry.getValue() instanceof Float) {
        shader.setUniform(entry.getKey(),((Float)entry.getValue()).floatValue());
      }
 else       if (entry.getValue() instanceof Double) {
        shader.setUniform(entry.getKey(),((Double)entry.getValue()).floatValue());
      }
 else       if (entry.getValue() instanceof ClientTexture) {
        shader.setUniform(entry.getKey(),(ClientTexture)entry.getValue());
      }
 else       if (entry.getValue() instanceof Vector2) {
        shader.setUniform(entry.getKey(),(Vector2)entry.getValue());
      }
 else       if (entry.getValue() instanceof Vector3) {
        shader.setUniform(entry.getKey(),(Vector3)entry.getValue());
      }
 else       if (entry.getValue() instanceof Vector4) {
        shader.setUniform(entry.getKey(),(Vector4)entry.getValue());
      }
 else       if (entry.getValue() instanceof Color) {
        shader.setUniform(entry.getKey(),(Color)entry.getValue());
      }
 else       if (entry.getValue() instanceof Matrix) {
        shader.setUniform(entry.getKey(),(Matrix)entry.getValue());
      }
    }
    getShader().setMaterialAssigned(this);
  }
  shader.assign();
}

Fixed version (ground truth):
@Override public void assign(){
  if (materialParameters != null && getShader().getMaterialAssigned() != this) {
    Set<Map.Entry<String,Object>> s=materialParameters.entrySet();
    for (    Map.Entry<String,Object> entry : s) {
      if (entry.getValue() instanceof Integer) {
        shader.setUniform(entry.getKey(),((Integer)entry.getValue()).intValue());
      }
 else       if (entry.getValue() instanceof Float) {
        shader.setUniform(entry.getKey(),((Float)entry.getValue()).floatValue());
      }
 else       if (entry.getValue() instanceof Double) {
        shader.setUniform(entry.getKey(),((Double)entry.getValue()).floatValue());
      }
 else       if (entry.getValue() instanceof ClientTexture) {
        shader.setUniform(entry.getKey(),(ClientTexture)entry.getValue());
      }
 else       if (entry.getValue() instanceof Vector2) {
        shader.setUniform(entry.getKey(),(Vector2)entry.getValue());
      }
 else       if (entry.getValue() instanceof Vector3) {
        shader.setUniform(entry.getKey(),(Vector3)entry.getValue());
      }
 else       if (entry.getValue() instanceof Vector4) {
        shader.setUniform(entry.getKey(),(Vector4)entry.getValue());
      }
 else       if (entry.getValue() instanceof Color) {
        shader.setUniform(entry.getKey(),(Color)entry.getValue());
      }
 else       if (entry.getValue() instanceof Matrix) {
        shader.setUniform(entry.getKey(),(Matrix)entry.getValue());
      }
    }
    getShader().setMaterialAssigned(this);
  }
  shader.assign();
}
Program: 177296
Project: 177296
Buggy source:
public void startTickRun(int stage,long delta){
  final float dt=delta;
switch (stage) {
case 0:
{
      taskManager.heartbeat(delta);
      updateAutosave();
      updateBlockComponents(dt);
      updateEntities(dt);
      updateLighting();
      updatePopulation();
      unloadChunks();
      break;
    }
case 1:
{
    updateDynamics(dt);
    break;
  }
default :
{
  throw new IllegalStateException("String_Node_Str");
}
}
}

Fixed version (ground truth):
public void startTickRun(int stage,long delta){
  final float dt=delta / 1000;
switch (stage) {
case 0:
{
      taskManager.heartbeat(delta);
      updateAutosave();
      updateBlockComponents(dt);
      updateEntities(dt);
      updateLighting();
      updatePopulation();
      unloadChunks();
      break;
    }
case 1:
{
    updateDynamics(dt);
    break;
  }
default :
{
  throw new IllegalStateException("String_Node_Str");
}
}
}
Program: 177297
Project: 177297
Buggy source:
public ClientClassLoader(CommonPluginLoader loader,ClassLoader parent){
  super(loader,parent);
}

Fixed version (ground truth):
public ClientClassLoader(CommonPluginLoader loader,ClassLoader parent,List<String> depends,List<String> softDepends){
  super(loader,parent,depends,softDepends);
}
Program: 177298
Project: 177298
Buggy source:
public CommonClassLoader(final CommonPluginLoader loader,final ClassLoader parent){
  super(new URL[0],parent);
  this.loader=loader;
  loaders.add(this);
}

Fixed version (ground truth):
public CommonClassLoader(final CommonPluginLoader loader,final ClassLoader parent,List<String> depends,List<String> softDepends){
  super(new URL[0],parent);
  this.loader=loader;
  loaders.add(this);
  this.depends=depends == null ? Collections.<String>emptyList() : Collections.unmodifiableList(depends);
  this.softDepends=softDepends == null ? Collections.<String>emptyList() : Collections.unmodifiableList(softDepends);
}
Program: 177299
Project: 177299
Buggy source:
protected Class<?> findClass(String name,boolean checkGlobal) throws ClassNotFoundException {
  Class<?> result=classes.get(name);
  if (result == null) {
    try {
      result=super.findClass(name);
    }
 catch (    Exception ignored) {
    }
    if (result == null && checkGlobal) {
      result=loader.getClassByName(name,this);
    }
    if (result != null) {
      classes.put(name,result);
      pluginsForClassNames.put(name,plugin);
    }
 else {
      throw new ClassNotFoundException(name);
    }
  }
  return result;
}

Fixed version (ground truth):
protected Class<?> findClass(String name,boolean checkGlobal) throws ClassNotFoundException {
  Class<?> result=classes.get(name);
  if (result == null) {
    try {
      result=super.findClass(name);
    }
 catch (    ClassNotFoundException ignored) {
    }
    if (result == null && checkGlobal) {
      result=loader.getClassByName(name,this);
    }
    if (result != null) {
      classes.put(name,result);
      pluginsForClassNames.put(name,plugin);
    }
 else {
      throw new ClassNotFoundException(name);
    }
  }
  return result;
}
Program: 177300
Project: 177300
Buggy source:
protected Class<?> getClassByName(final String name,final CommonClassLoader commonLoader){
  CommonPlugin plugin=commonLoader.getPlugin();
  Set<String> ignore=new HashSet<String>();
  try {
    ignore.add(plugin.getName());
  }
 catch (  NullPointerException nfe) {
    Spout.getLogger().severe("String_Node_Str" + name + "String_Node_Str");
    return null;
  }
  if (plugin.getDescription().getDepends() != null) {
    for (    String dependency : plugin.getDescription().getDepends()) {
      try {
        Class<?> clazz=loaders.get(dependency).findClass(name,false);
        if (clazz != null) {
          return clazz;
        }
      }
 catch (      ClassNotFoundException ignored) {
      }
      ignore.add(dependency);
    }
  }
  if (plugin.getDescription().getSoftDepends() != null) {
    for (    String softDependency : plugin.getDescription().getSoftDepends()) {
      try {
        Class<?> clazz=loaders.get(softDependency).findClass(name,false);
        if (clazz != null) {
          return clazz;
        }
      }
 catch (      ClassNotFoundException ignored) {
      }
      ignore.add(softDependency);
    }
  }
  for (  String current : loaders.keySet()) {
    if (ignore.contains(current)) {
      continue;
    }
    CommonClassLoader loader=loaders.get(current);
    try {
      Class<?> clazz=loader.findClass(name,false);
      if (clazz != null) {
        return clazz;
      }
    }
 catch (    ClassNotFoundException ignored) {
    }
  }
  return null;
}

Fixed version (ground truth):
protected Class<?> getClassByName(final String name,final CommonClassLoader commonLoader){
  Set<String> ignore=new HashSet<String>();
  for (  String dependency : commonLoader.getDepends()) {
    try {
      Class<?> clazz=loaders.get(dependency).findClass(name,false);
      if (clazz != null) {
        return clazz;
      }
    }
 catch (    ClassNotFoundException ignored) {
    }
    ignore.add(dependency);
  }
  for (  String softDependency : commonLoader.getSoftDepends()) {
    try {
      Class<?> clazz=loaders.get(softDependency).findClass(name,false);
      if (clazz != null) {
        return clazz;
      }
    }
 catch (    ClassNotFoundException ignored) {
    }
    ignore.add(softDependency);
  }
  for (  String current : loaders.keySet()) {
    if (ignore.contains(current)) {
      continue;
    }
    CommonClassLoader loader=loaders.get(current);
    if (loader == commonLoader) {
      continue;
    }
    try {
      Class<?> clazz=loader.findClass(name,false);
      if (clazz != null) {
        return clazz;
      }
    }
 catch (    ClassNotFoundException ignored) {
    }
  }
  return null;
}
Program: 177302
Project: 177302
Buggy source:
@Override @SuppressWarnings("String_Node_Str") public V[] values(V[] dest){
  for (int m=0; m < mapCount; m++) {
    lockArray[m].readLock().lock();
  }
  try {
    int localSize=totalKeys.get();
    V[] values;
    if (dest == null || dest.length < localSize) {
      values=(V[])new Object[size()];
    }
 else {
      values=dest;
    }
    int position=0;
    for (int m=0; m < mapCount; m++) {
      V[] mapValues=(V[])mapArray[m].values();
      for (      V mapValue : mapValues) {
        values[position++]=mapValue;
      }
    }
    if (position != localSize) {
      throw new IllegalStateException("String_Node_Str");
    }
    return values;
  }
  finally {
    for (int m=0; m < mapCount; m++) {
      lockArray[m].readLock().unlock();
    }
  }
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") public V[] values(V[] dest){
  if (dest == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  for (int m=0; m < mapCount; m++) {
    lockArray[m].readLock().lock();
  }
  try {
    int localSize=totalKeys.get();
    V[] values;
    if (dest.length < localSize) {
      values=(V[])Array.newInstance(dest.getClass().getComponentType(),size());
    }
 else {
      values=dest;
    }
    int position=0;
    for (int m=0; m < mapCount; m++) {
      V[] mapValues=(V[])mapArray[m].values();
      for (      V mapValue : mapValues) {
        values[position++]=mapValue;
      }
    }
    if (position != localSize) {
      throw new IllegalStateException("String_Node_Str");
    }
    for (int i=position; i < dest.length; i++) {
      values[i]=null;
    }
    return values;
  }
  finally {
    for (int m=0; m < mapCount; m++) {
      lockArray[m].readLock().unlock();
    }
  }
}
Program: 177303
Project: 177303
Buggy source:
public TransformTag(String name,Transform t){
  super(name,transformToMap(t));
}

Fixed version (ground truth):
public TransformTag(String name,Vector3 p,Quaternion q,Vector3 s){
  super(name,toMap(p,q,s));
}
Program: 177304
Project: 177304
Buggy source:
public static Vector3 getValue(List<FloatTag> list){
  if (list == null || list.size() != 4) {
    return null;
  }
  Float x=NBTMapper.toTagValue(list.get(0),Float.class,null);
  Float y=NBTMapper.toTagValue(list.get(1),Float.class,null);
  Float z=NBTMapper.toTagValue(list.get(2),Float.class,null);
  if (x == null || y == null || z == null) {
    return null;
  }
  return new Vector3(x,y,z);
}

Fixed version (ground truth):
public static Vector3 getValue(List<FloatTag> list){
  if (list == null || list.size() != 3) {
    return null;
  }
  Float x=NBTMapper.toTagValue(list.get(0),Float.class,null);
  Float y=NBTMapper.toTagValue(list.get(1),Float.class,null);
  Float z=NBTMapper.toTagValue(list.get(2),Float.class,null);
  if (x == null || y == null || z == null) {
    return null;
  }
  return new Vector3(x,y,z);
}
Program: 177305
Project: 177305
Buggy source:
@Override public void copySnapshot(){
  super.copySnapshot();
  Transform t=getTransform();
  float ratio=80f / 20f;
  speed=t.getPosition().subtract(transformRender.getPosition()).multiply(ratio);
  rotate=new Vector3(t.getRotation().getPitch() - transformRender.getRotation().getPitch(),t.getRotation().getYaw() - transformRender.getRotation().getYaw(),t.getRotation().getRoll() - transformRender.getRotation().getRoll()).multiply(ratio);
  scale=t.getScale().subtract(transformRender.getScale()).multiply(ratio);
  System.out.println(speed);
  lastTime=System.currentTimeMillis();
}

Fixed version (ground truth):
@Override public void copySnapshot(){
  super.copySnapshot();
  Transform t=getTransform();
  float ratio=80f / 20f;
  speed=t.getPosition().subtract(transformRender.getPosition()).multiply(ratio);
  rotate=new Vector3(t.getRotation().getPitch() - transformRender.getRotation().getPitch(),t.getRotation().getYaw() - transformRender.getRotation().getYaw(),t.getRotation().getRoll() - transformRender.getRotation().getRoll()).multiply(ratio);
  scale=t.getScale().subtract(transformRender.getScale()).multiply(ratio);
  lastTime=System.currentTimeMillis();
}
Program: 177308
Project: 177308
Buggy source:
public int schedule(SpoutTask task){
synchronized (scheduleLock) {
    addTask(task);
    if (task.getDelay() == 0 && task.getPeriod() < 0) {
      SpoutWorker worker=new SpoutWorker(task,this);
      addWorker(worker,task);
      worker.start();
    }
 else {
      taskQueue.add(task);
    }
    return task.getTaskId();
  }
}

Fixed version (ground truth):
public int schedule(SpoutTask task){
synchronized (scheduleLock) {
    addTask(task);
    if (!task.isSync()) {
      SpoutWorker worker=new SpoutWorker(task,this);
      addWorker(worker,task);
      worker.start();
    }
 else {
      taskQueue.add(task);
    }
    return task.getTaskId();
  }
}
Program: 177310
Project: 177310
Buggy source:
private SpoutChunk setChunk(SpoutChunk newChunk,int x,int y,int z,ChunkDataForRegion dataForRegion,boolean generated,LoadOption loadopt){
  final AtomicReference<SpoutChunk> chunkReference=chunks[x][y][z];
  while (true) {
    if (chunkReference.compareAndSet(null,newChunk)) {
      newChunk.notifyColumn();
      if (Spout.getEngine().getPlatform() == Platform.CLIENT) {
        newChunk.setNeighbourRenderDirty(true);
      }
      numberActiveChunks.incrementAndGet();
      if (dataForRegion != null) {
        for (        SpoutEntity entity : dataForRegion.loadedEntities) {
          entity.setupInitialChunk(entity.getTransform().getTransform());
          entityManager.addEntity(entity);
        }
        dynamicBlockTree.addDynamicBlockUpdates(dataForRegion.loadedUpdates);
      }
      Spout.getEventManager().callDelayedEvent(new ChunkLoadEvent(newChunk,generated));
      return newChunk;
    }
    newChunk.setUnloadedUnchecked();
    SpoutChunk oldChunk=chunkReference.get();
    if (oldChunk != null) {
      checkChunkLoaded(oldChunk,loadopt);
      return oldChunk;
    }
  }
}

Fixed version (ground truth):
private SpoutChunk setChunk(SpoutChunk newChunk,int x,int y,int z,ChunkDataForRegion dataForRegion,boolean generated,LoadOption loadopt){
  final AtomicReference<SpoutChunk> chunkReference=chunks[x][y][z];
  while (true) {
    if (chunkReference.compareAndSet(null,newChunk)) {
      newChunk.notifyColumn();
      if (Spout.getEngine().getPlatform() == Platform.CLIENT) {
        newChunk.setNeighbourRenderDirty(true);
      }
      numberActiveChunks.incrementAndGet();
      if (dataForRegion != null) {
        for (        SpoutEntity entity : dataForRegion.loadedEntities) {
          entity.setupInitialChunk(entity.getTransform().getTransform());
          entityManager.addEntity(entity);
        }
        dynamicBlockTree.addDynamicBlockUpdates(dataForRegion.loadedUpdates);
      }
      Spout.getEventManager().callDelayedEvent(new ChunkLoadEvent(newChunk,generated));
      return newChunk;
    }
    SpoutChunk oldChunk=chunkReference.get();
    if (oldChunk != null) {
      newChunk.setUnloadedUnchecked();
      checkChunkLoaded(oldChunk,loadopt);
      return oldChunk;
    }
  }
}
Program: 177311
Project: 177311
Buggy source:
public void setNeighbourRenderDirty(boolean dirty){
  SpoutRegion parent=getRegion();
  for (int x=-1; x < 2; x++) {
    for (int y=-1; y < 2; y++) {
      for (int z=-1; z < 2; z++) {
        SpoutChunk c=parent.getLocalChunk(this,x,y,z,LoadOption.NO_LOAD);
        if (c != null) {
          c.setRenderDirty(dirty);
        }
      }
    }
  }
}

Fixed version (ground truth):
public void setNeighbourRenderDirty(boolean dirty){
  SpoutRegion parent=getRegion();
  for (int x=-1; x < 2; x++) {
    for (int y=-1; y < 2; y++) {
      for (int z=-1; z < 2; z++) {
        if (x == 0 || y == 0 || z == 0) {
          SpoutChunk c=parent.getLocalChunk(this,x,y,z,LoadOption.NO_LOAD);
          if (c != null) {
            c.setRenderDirty(dirty);
          }
        }
      }
    }
  }
}
Program: 177312
Project: 177312
Buggy source:
public void setRenderDirty(boolean dirty){
  renderDirty.set(dirty);
}

Fixed version (ground truth):
public void setRenderDirty(boolean dirty){
  renderDirty.set(dirty);
  if (dirty) {
    queueDirty();
  }
}
Program: 177314
Project: 177314
Buggy source:
private void addUpdateToRenderQueue(SpoutChunk c){
  int bx=c.getX() - 1;
  int by=c.getY() - 1;
  int bz=c.getZ() - 1;
  if (c.isInViewDistance()) {
    ChunkSnapshot[][][] chunks=new ChunkSnapshot[3][3][3];
    for (int x=0; x < 3; x++) {
      for (int y=0; y < 3; y++) {
        for (int z=0; z < 3; z++) {
          if (x == 1 || y == 1 || z == 1) {
            ChunkSnapshot snapshot=getRenderSnapshot(bx + x,by + y,bz + z);
            if (snapshot == null) {
              return;
            }
            chunks[x][y][z]=snapshot;
          }
        }
      }
    }
    renderChunkQueue.add(new SpoutChunkSnapshotModel(bx + 1,by + 1,bz + 1,chunks));
  }
 else {
    if (c.leftViewDistance()) {
      renderChunkQueue.add(new SpoutChunkSnapshotModel(bx + 1,by + 1,bz + 1,true));
    }
  }
  c.viewDistanceCopy();
}

Fixed version (ground truth):
private void addUpdateToRenderQueue(SpoutChunk c){
  int bx=c.getX() - 1;
  int by=c.getY() - 1;
  int bz=c.getZ() - 1;
  if (c.isInViewDistance()) {
    ChunkSnapshot[][][] chunks=new ChunkSnapshot[3][3][3];
    for (int x=0; x < 3; x++) {
      for (int y=0; y < 3; y++) {
        for (int z=0; z < 3; z++) {
          if (x == 1 || y == 1 || z == 1) {
            ChunkSnapshot snapshot=getRenderSnapshot(bx + x,by + y,bz + z);
            if (snapshot == null) {
              return;
            }
            chunks[x][y][z]=snapshot;
          }
        }
      }
    }
    c.setRenderDirty(false);
    renderChunkQueue.add(new SpoutChunkSnapshotModel(bx + 1,by + 1,bz + 1,chunks));
  }
 else {
    if (c.leftViewDistance()) {
      c.setRenderDirty(false);
      renderChunkQueue.add(new SpoutChunkSnapshotModel(bx + 1,by + 1,bz + 1,true));
    }
  }
  c.viewDistanceCopy();
}
Program: 177315
Project: 177315
Buggy source:
private SpoutChunk setChunk(SpoutChunk newChunk,int x,int y,int z,ChunkDataForRegion dataForRegion,boolean generated,LoadOption loadopt){
  final AtomicReference<SpoutChunk> chunkReference=chunks[x][y][z];
  while (true) {
    if (chunkReference.compareAndSet(null,newChunk)) {
      newChunk.notifyColumn();
      newChunk.setNeighbourRenderDirty(true);
      numberActiveChunks.incrementAndGet();
      if (dataForRegion != null) {
        for (        SpoutEntity entity : dataForRegion.loadedEntities) {
          entity.setupInitialChunk(entity.getTransform().getTransform());
          entityManager.addEntity(entity);
        }
        dynamicBlockTree.addDynamicBlockUpdates(dataForRegion.loadedUpdates);
      }
      Spout.getEventManager().callDelayedEvent(new ChunkLoadEvent(newChunk,generated));
      return newChunk;
    }
    newChunk.setUnloadedUnchecked();
    SpoutChunk oldChunk=chunkReference.get();
    if (oldChunk != null) {
      checkChunkLoaded(oldChunk,loadopt);
      return oldChunk;
    }
  }
}

Fixed version (ground truth):
private SpoutChunk setChunk(SpoutChunk newChunk,int x,int y,int z,ChunkDataForRegion dataForRegion,boolean generated,LoadOption loadopt){
  final AtomicReference<SpoutChunk> chunkReference=chunks[x][y][z];
  while (true) {
    if (chunkReference.compareAndSet(null,newChunk)) {
      newChunk.notifyColumn();
      if (Spout.getEngine().getPlatform() == Platform.CLIENT) {
        newChunk.setNeighbourRenderDirty(true);
      }
      numberActiveChunks.incrementAndGet();
      if (dataForRegion != null) {
        for (        SpoutEntity entity : dataForRegion.loadedEntities) {
          entity.setupInitialChunk(entity.getTransform().getTransform());
          entityManager.addEntity(entity);
        }
        dynamicBlockTree.addDynamicBlockUpdates(dataForRegion.loadedUpdates);
      }
      Spout.getEventManager().callDelayedEvent(new ChunkLoadEvent(newChunk,generated));
      return newChunk;
    }
    newChunk.setUnloadedUnchecked();
    SpoutChunk oldChunk=chunkReference.get();
    if (oldChunk != null) {
      checkChunkLoaded(oldChunk,loadopt);
      return oldChunk;
    }
  }
}
Program: 177316
Project: 177316
Buggy source:
public static void saveChunk(SpoutChunk chunk){
  ChunkSaveTask task=new ChunkSaveTask(chunk);
  if (instance.isInterrupted()) {
    Spout.getLogger().warning("String_Node_Str");
    task.call();
  }
 else {
    instance.queue.add(task);
  }
}

Fixed version (ground truth):
public static void saveChunk(SpoutChunk chunk){
  ChunkSaveTask task=new ChunkSaveTask(chunk);
  if (instance.isInterrupted() || !instance.isAlive()) {
    Spout.getLogger().warning("String_Node_Str");
    task.call();
  }
 else {
    instance.queue.add(task);
  }
}
Program: 177317
Project: 177317
Buggy source:
@Override public void run(){
  while (!this.isInterrupted()) {
    Callable<SpoutWorld> task;
    try {
      task=queue.take();
      task.call();
    }
 catch (    InterruptedException ignore) {
      break;
    }
catch (    Exception e) {
      e.printStackTrace();
    }
  }
  processRemaining();
}

Fixed version (ground truth):
@Override public void run(){
  while (!Thread.interrupted()) {
    Callable<SpoutWorld> task;
    try {
      task=queue.take();
      task.call();
    }
 catch (    InterruptedException ignore) {
      break;
    }
catch (    Exception e) {
      e.printStackTrace();
    }
  }
  processRemaining();
}
Program: 177319
Project: 177319
Buggy source:
public AtomicPaletteBlockStore(int shift,int dirtySize,short[] blocks,short[] data){
  this.side=1 << shift;
  this.shift=shift;
  this.doubleShift=shift << 1;
  int size=side * side * side;
  store=new AtomicShortIntArray(size);
  this.length=size;
  dirtyX=new byte[dirtySize];
  dirtyY=new byte[dirtySize];
  dirtyZ=new byte[dirtySize];
  if (blocks != null && data != null) {
    int x=0;
    int z=0;
    int y=0;
    int max=(1 << shift) - 1;
    for (int i=0; i < Math.min(blocks.length,size); i++) {
      this.setBlock(x,y,z,blocks[i],data[i]);
      if (x < max) {
        x++;
      }
 else {
        x=0;
        if (z < max) {
          z++;
        }
 else {
          z=0;
          if (y < max) {
            y++;
          }
 else {
            y=0;
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
public AtomicPaletteBlockStore(int shift,int dirtySize,short[] blocks,short[] data){
  this.side=1 << shift;
  this.shift=shift;
  this.doubleShift=shift << 1;
  int size=side * side * side;
  store=new AtomicShortIntArray(size);
  this.length=size;
  dirtyX=new byte[dirtySize];
  dirtyY=new byte[dirtySize];
  dirtyZ=new byte[dirtySize];
  if (blocks != null) {
    int x=0;
    int z=0;
    int y=0;
    int max=(1 << shift) - 1;
    for (int i=0; i < Math.min(blocks.length,size); i++) {
      short d=data == null ? 0 : data[i];
      this.setBlock(x,y,z,blocks[i],d);
      if (x < max) {
        x++;
      }
 else {
        x=0;
        if (z < max) {
          z++;
        }
 else {
          z=0;
          if (y < max) {
            y++;
          }
 else {
            y=0;
          }
        }
      }
    }
  }
}
Program: 177321
Project: 177321
Buggy source:
public void init(SpoutApplication args){
  this.arguments=args;
  try {
    config.load();
  }
 catch (  ConfigurationException e) {
    log("String_Node_Str",Level.SEVERE,e.getMessage(),e);
  }
  console=new MultiConsole(new FileConsole(this),new JLineConsole(this));
  consoleManager.setupConsole(console);
  registerWithScheduler(scheduler);
  if (!getExecutor().startExecutor()) {
    throw new IllegalStateException("String_Node_Str");
  }
  DefaultPermissions.addDefaultPermission(STANDARD_BROADCAST_PERMISSION);
  if (debugMode()) {
    new TicklockMonitor().start();
    new DeadlockMonitor().start();
  }
}

Fixed version (ground truth):
public void init(SpoutApplication args){
  this.arguments=args;
  try {
    config.load();
    inputConfig.load();
  }
 catch (  ConfigurationException e) {
    log("String_Node_Str",Level.SEVERE,e.getMessage(),e);
  }
  console=new MultiConsole(new FileConsole(this),new JLineConsole(this));
  consoleManager.setupConsole(console);
  registerWithScheduler(scheduler);
  if (!getExecutor().startExecutor()) {
    throw new IllegalStateException("String_Node_Str");
  }
  DefaultPermissions.addDefaultPermission(STANDARD_BROADCAST_PERMISSION);
  if (debugMode()) {
    new TicklockMonitor().start();
    new DeadlockMonitor().start();
  }
}
Program: 177323
Project: 177323
Buggy source:
public void assign(boolean compatabilityMode){
  if (!variables.containsKey("String_Node_Str")) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (!variables.containsKey("String_Node_Str")) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (compatabilityMode) {
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    matrixBuffer.clear();
    matrixBuffer.put(getProjectionMatrix().toArray());
    matrixBuffer.flip();
    GL11.glLoadMatrix(matrixBuffer);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    matrixBuffer.clear();
    matrixBuffer.put(getViewMatrix().toArray());
    matrixBuffer.flip();
    GL11.glLoadMatrix(matrixBuffer);
  }
 else {
    super.assign();
  }
}

Fixed version (ground truth):
public void assign(boolean compatabilityMode){
  if (!variables.containsKey("String_Node_Str")) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (!variables.containsKey("String_Node_Str")) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (compatabilityMode) {
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    matrixBuffer.clear();
    matrixBuffer.put(getProjectionMatrix().toArray());
    matrixBuffer.flip();
    GL11.glLoadMatrix(matrixBuffer);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    SpoutClient client=((SpoutClient)Spout.getEngine());
    Quaternion r=client.getActivePlayer().getTransform().getRotation();
    Point p=client.getActivePlayer().getTransform().getPosition();
    GL11.glLoadIdentity();
    GL11.glRotatef(r.getPitch(),1,0,0);
    GL11.glRotatef(r.getYaw(),0,1,0);
    GL11.glRotatef(r.getRoll(),0,0,1);
    GL11.glTranslatef(-p.getX(),-p.getY(),-p.getZ());
  }
 else {
    super.assign();
  }
}
Program: 177325
Project: 177325
Buggy source:
public void addQuad(Vector3 a,Vector3 b,Vector3 c,Vector3 d,Color col){
  renderer.addTexCoord(0,0);
  renderer.addColor(col);
  renderer.addVertex(a);
  renderer.addTexCoord(1,0);
  renderer.addColor(col);
  renderer.addVertex(b);
  renderer.addTexCoord(1,1);
  renderer.addColor(col);
  renderer.addVertex(c);
  renderer.addTexCoord(1,1);
  renderer.addColor(col);
  renderer.addVertex(c);
  renderer.addTexCoord(0,1);
  renderer.addColor(col);
  renderer.addVertex(d);
  renderer.addTexCoord(0,0);
  renderer.addColor(col);
  renderer.addVertex(a);
}

Fixed version (ground truth):
public void addQuad(Vector3 a,Vector3 b,Vector3 c,Vector3 d,Color col){
  renderer.addTexCoord(0f,0f);
  renderer.addColor(col);
  renderer.addVertex(a);
  renderer.addTexCoord(1f,0f);
  renderer.addColor(col);
  renderer.addVertex(b);
  renderer.addTexCoord(1f,1f);
  renderer.addColor(col);
  renderer.addVertex(c);
  renderer.addTexCoord(1f,1f);
  renderer.addColor(col);
  renderer.addVertex(c);
  renderer.addTexCoord(0f,1f);
  renderer.addColor(col);
  renderer.addVertex(d);
  renderer.addTexCoord(0f,0f);
  renderer.addColor(col);
  renderer.addVertex(a);
}
Program: 177326
Project: 177326
Buggy source:
@Override protected void doFlush(){
  GL11.glNewList(displayList,GL11.GL_COMPILE);
  FloatBuffer vBuffer=BufferUtils.createFloatBuffer(vertexBuffer.size());
  vBuffer.clear();
  vBuffer.put(vertexBuffer.toArray());
  vBuffer.flip();
  GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
  GL11.glVertexPointer(4,0,vBuffer);
  if (useNormals) {
    vBuffer.clear();
    vBuffer.put(normalBuffer.toArray());
    vBuffer.flip();
    GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
    GL11.glNormalPointer(0,vBuffer);
  }
  if (useTextures) {
    vBuffer.clear();
    vBuffer.put(uvBuffer.toArray());
    vBuffer.flip();
    GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
    GL11.glTexCoordPointer(2,0,vBuffer);
  }
  GL11.glDrawArrays(renderMode,0,numVertices);
  GL11.glEndList();
}

Fixed version (ground truth):
@Override protected void doFlush(){
  GL11.glNewList(displayList,GL11.GL_COMPILE);
  FloatBuffer vBuffer=BufferUtils.createFloatBuffer(vertexBuffer.size());
  vBuffer.clear();
  vBuffer.put(vertexBuffer.toArray());
  vBuffer.flip();
  GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
  GL11.glVertexPointer(4,0,vBuffer);
  if (useNormals) {
    vBuffer.clear();
    vBuffer.put(normalBuffer.toArray());
    vBuffer.flip();
    GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
    GL11.glNormalPointer(0,vBuffer);
  }
  if (useTextures) {
    FloatBuffer temp=BufferUtils.createFloatBuffer(uvBuffer.size());
    temp.put(uvBuffer.toArray());
    temp.flip();
    GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
    GL11.glTexCoordPointer(2,0,temp);
  }
  GL11.glDrawArrays(renderMode,0,numVertices);
  GL11.glEndList();
}
Program: 177327
Project: 177327
Buggy source:
public int getKey(String source,String clazz){
  HashMap<String,Integer> idmap=classes.get(clazz);
  if (idmap == null) {
    return NO_ID;
  }
 else {
    Integer id=idmap.get(source);
    if (id != null) {
      return id;
    }
  }
  return NO_ID;
}

Fixed version (ground truth):
public int getKey(String source,String clazz){
synchronized (classes) {
    HashMap<String,Integer> idmap=classes.get(clazz);
    if (idmap == null) {
      return NO_ID;
    }
 else {
      Integer id=idmap.get(source);
      if (id != null) {
        return id;
      }
    }
    return NO_ID;
  }
}
Program: 177328
Project: 177328
Buggy source:
public List<Integer> getIdList(){
  return Collections.unmodifiableList(idList);
}

Fixed version (ground truth):
public List<Integer> getIdList(){
synchronized (idList) {
    return Collections.unmodifiableList(idList);
  }
}
Program: 177329
Project: 177329
Buggy source:
public void save(Writer writer){
  Yaml yaml=new Yaml();
  LinkedHashMap<String,Object> dump=new LinkedHashMap<String,Object>();
  dump.put("String_Node_Str",nextId);
  LinkedHashMap<Integer,LinkedHashMap<String,String>> ids=new LinkedHashMap<Integer,LinkedHashMap<String,String>>();
  for (  Entry<String,HashMap<String,Integer>> e1 : classes.entrySet()) {
    for (    Entry<String,Integer> e2 : e1.getValue().entrySet()) {
      String clazz=e1.getKey();
      String source=e2.getKey();
      int key=e2.getValue();
      LinkedHashMap<String,String> v=new LinkedHashMap<String,String>(2);
      v.put("String_Node_Str",clazz);
      v.put("String_Node_Str",source);
      ids.put(key,v);
    }
  }
  dump.put("String_Node_Str",ids);
  String toWrite=yaml.dumpAs(dump,Tag.MAP,FlowStyle.BLOCK);
  try {
    writer.write(toWrite);
    writer.close();
  }
 catch (  IOException e) {
  }
}

Fixed version (ground truth):
public void save(Writer writer){
  Yaml yaml=new Yaml();
  LinkedHashMap<String,Object> dump=new LinkedHashMap<String,Object>();
  dump.put("String_Node_Str",nextId);
  LinkedHashMap<Integer,LinkedHashMap<String,String>> ids=new LinkedHashMap<Integer,LinkedHashMap<String,String>>();
  for (  Entry<String,HashMap<String,Integer>> e1 : classes.entrySet()) {
    for (    Entry<String,Integer> e2 : e1.getValue().entrySet()) {
      String clazz=e1.getKey();
      String source=e2.getKey();
      int key=e2.getValue();
      LinkedHashMap<String,String> v=new LinkedHashMap<String,String>(2);
      v.put("String_Node_Str",clazz);
      v.put("String_Node_Str",source);
      ids.put(key,v);
    }
  }
  dump.put("String_Node_Str",ids);
  String toWrite=yaml.dumpAs(dump,Tag.MAP,FlowStyle.BLOCK);
  try {
    writer.write(toWrite);
  }
 catch (  IOException e) {
    Spout.getLogger().log(Level.SEVERE,"String_Node_Str",e);
  }
 finally {
    IOUtils.closeQuietly(writer);
  }
}
Program: 177330
Project: 177330
Buggy source:
@SuppressWarnings("String_Node_Str") protected void loadLanguage(InputStream in){
  Yaml yaml=new Yaml();
  Map<String,Object> dump=(Map<String,Object>)yaml.load(in);
  Locale locale=null;
  if (dump.containsKey("String_Node_Str")) {
    locale=Locale.getByCode((String)dump.get("String_Node_Str"));
  }
  if (locale == null) {
    return;
  }
  LanguageDictionary dict=new LanguageDictionary(locale);
  setDictionary(locale,dict);
  if (dump.containsKey("String_Node_Str")) {
    Map<Integer,Object> strings=(Map<Integer,Object>)dump.get("String_Node_Str");
    for (    Entry<Integer,Object> e : strings.entrySet()) {
      if (e.getValue() instanceof String) {
        dict.setTranslation(e.getKey(),e.getValue());
      }
 else {
        try {
          LocaleNumberHandler handler=locale.getNumberHandler().newInstance();
          handler.init(e.getValue());
          dict.setTranslation(e.getKey(),handler);
        }
 catch (        IllegalArgumentException e1) {
        }
catch (        SecurityException e1) {
        }
catch (        InstantiationException e1) {
        }
catch (        IllegalAccessException e1) {
        }
      }
    }
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") protected void loadLanguage(InputStream in,String fileName){
  Yaml yaml=new Yaml();
  Map<String,Object> dump=(Map<String,Object>)yaml.load(in);
  Locale locale=null;
  if (dump.containsKey("String_Node_Str")) {
    locale=Locale.getByCode((String)dump.get("String_Node_Str"));
  }
  if (locale == null) {
    throw new IllegalStateException("String_Node_Str" + fileName);
  }
  LanguageDictionary dict=new LanguageDictionary(locale);
  setDictionary(locale,dict);
  if (dump.containsKey("String_Node_Str")) {
    Map<Integer,Object> strings=(Map<Integer,Object>)dump.get("String_Node_Str");
    for (    Entry<Integer,Object> e : strings.entrySet()) {
      if (e.getValue() instanceof String) {
        dict.setTranslation(e.getKey(),e.getValue());
      }
 else {
        try {
          LocaleNumberHandler handler=locale.getNumberHandler().newInstance();
          handler.init(e.getValue());
          dict.setTranslation(e.getKey(),handler);
        }
 catch (        IllegalArgumentException e1) {
          throw new RuntimeException("String_Node_Str" + fileName + "String_Node_Str");
        }
catch (        SecurityException e1) {
          Spout.getLogger().log(Level.SEVERE,"String_Node_Str",e1);
        }
catch (        InstantiationException e1) {
          Spout.getLogger().log(Level.SEVERE,"String_Node_Str",e1);
        }
catch (        IllegalAccessException e1) {
          Spout.getLogger().log(Level.SEVERE,"String_Node_Str",e1);
        }
      }
    }
  }
}
Program: 177331
Project: 177331
Buggy source:
public String getCodedSource(int id){
  return codedLanguage.getTranslation(id);
}

Fixed version (ground truth):
public String getCodedSource(int id){
synchronized (codedLanguage) {
    return codedLanguage.getTranslation(id);
  }
}
Program: 177332
Project: 177332
Buggy source:
public void setKey(String source,String clazz,int id){
  HashMap<String,Integer> idmap=classes.get(clazz);
  if (idmap == null) {
    idmap=new HashMap<String,Integer>();
    classes.put(clazz,idmap);
  }
  idmap.put(source,id);
  idList.add(id);
  codedLanguage.setTranslation(id,source);
}

Fixed version (ground truth):
public void setKey(String source,String clazz,int id){
synchronized (classes) {
    HashMap<String,Integer> idmap=classes.get(clazz);
    if (idmap == null) {
      idmap=new HashMap<String,Integer>();
      classes.put(clazz,idmap);
    }
    idmap.put(source,id);
  }
synchronized (idList) {
    idList.add(id);
  }
synchronized (codedLanguage) {
    codedLanguage.setTranslation(id,source);
  }
}
Program: 177333
Project: 177333
Buggy source:
@SuppressWarnings("String_Node_Str") protected void loadLanguages(){
  try {
    Set<String> loaded=new HashSet<String>();
    File langDir=getLangDirectory();
    if (langDir.exists() && langDir.isDirectory()) {
      File[] files=langDir.listFiles();
      for (      File file : files) {
        if (LANG_FILE_FILTER.matcher(file.getName()).matches()) {
          loadLanguage(new FileInputStream(file));
          loaded.add(file.getName());
        }
      }
    }
    if (plugin != null) {
      JarFile jar=new JarFile(plugin.getFile());
      if (jar.getEntry(getJarBasePath()) == null) {
        return;
      }
      Enumeration<JarEntry> entries=jar.entries();
      while (entries.hasMoreElements()) {
        JarEntry entry=entries.nextElement();
        if (entry.getName().startsWith(getJarBasePath())) {
          String file=entry.getName().replaceFirst(getJarBasePath(),"String_Node_Str");
          if (LANG_FILE_FILTER.matcher(file).matches() && !loaded.contains(file)) {
            loadLanguage(jar.getInputStream(entry));
            loaded.add(file);
          }
        }
      }
    }
  }
 catch (  IOException e) {
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") protected void loadLanguages(){
  try {
    Set<String> loaded=new HashSet<String>();
    File langDir=getLangDirectory();
    if (langDir.exists() && langDir.isDirectory()) {
      File[] files=langDir.listFiles();
      for (      File file : files) {
        if (LANG_FILE_FILTER.matcher(file.getName()).matches()) {
          try {
            loadLanguage(new FileInputStream(file),file.getAbsolutePath());
            loaded.add(file.getName());
          }
 catch (          Exception e) {
            Spout.getLogger().log(Level.SEVERE,"String_Node_Str" + plugin.getName(),e);
          }
        }
      }
    }
    if (plugin != null) {
      JarFile jar=new JarFile(plugin.getFile());
      if (jar.getEntry(getJarBasePath()) == null) {
        return;
      }
      Enumeration<JarEntry> entries=jar.entries();
      while (entries.hasMoreElements()) {
        JarEntry entry=entries.nextElement();
        if (entry.getName().startsWith(getJarBasePath())) {
          String file=entry.getName().replaceFirst(getJarBasePath(),"String_Node_Str");
          if (LANG_FILE_FILTER.matcher(file).matches() && !loaded.contains(file)) {
            try {
              loadLanguage(jar.getInputStream(entry),plugin.getFile().getAbsolutePath() + "String_Node_Str" + entry.getName());
              loaded.add(file);
            }
 catch (            Exception e) {
              Spout.getLogger().log(Level.SEVERE,"String_Node_Str" + plugin.getName(),e);
            }
          }
        }
      }
    }
  }
 catch (  IOException e) {
    Spout.getLogger().log(Level.SEVERE,"String_Node_Str" + plugin.getName(),e);
  }
}
Program: 177334
Project: 177334
Buggy source:
/** 
 * Syncs all entities/observers in this region
 */
public void syncEntities(){
  for (  Entity ent : getAll()) {
    if (ent.getChunk() == null) {
      continue;
    }
    Set<? extends Entity> observers=ent.getChunk().getObservers();
    for (    Entity observer : observers) {
      if (ent == observer) {
        continue;
      }
      if (!(observer instanceof Player)) {
        continue;
      }
      Player player=(Player)observer;
      if (!player.isOnline()) {
        continue;
      }
      NetworkSynchronizer network=player.getNetworkSynchronizer();
      int view=player.getViewDistance();
      boolean spawn, sync, destroy;
      spawn=sync=destroy=false;
      if (MathHelper.distance(ent.getTransform().getPosition(),player.getTransform().getPosition()) > view) {
        destroy=true;
      }
 else {
        if (!network.hasSpawned(ent)) {
          spawn=true;
        }
 else {
          sync=true;
        }
      }
      network.syncEntity(ent,spawn,destroy,sync);
    }
  }
}

Fixed version (ground truth):
/** 
 * Syncs all entities/observers in this region
 */
public void syncEntities(){
  for (  Entity ent : getAll()) {
    if (ent.getChunk() == null) {
      continue;
    }
    if (ent.getId() == SpoutEntity.NOTSPAWNEDID) {
      continue;
    }
    Set<? extends Entity> observers=ent.getChunk().getObservers();
    syncEntity(ent,observers,false);
    Set<? extends Entity> expiredObservers=((SpoutChunk)ent.getChunk()).getExpiredObservers();
    syncEntity(ent,expiredObservers,true);
  }
}
Program: 177335
Project: 177335
Buggy source:
@Override public boolean removeObserver(Entity entity){
  checkChunkLoaded();
  parentRegion.markObserverDirty(this);
  TickStage.checkStage(TickStage.FINALIZE);
  Integer oldDistance=((SpoutEntity)entity).getPrevViewDistance();
  if (oldDistance == null) {
    return false;
  }
  observers.remove((SpoutEntity)entity);
  if (!isObserved()) {
    parentRegion.unloadQueue.add(this);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean removeObserver(Entity entity){
  checkChunkLoaded();
  parentRegion.markObserverDirty(this);
  TickStage.checkStage(TickStage.FINALIZE);
  Integer oldDistance=((SpoutEntity)entity).getPrevViewDistance();
  if (oldDistance == null) {
    return false;
  }
  observers.remove((SpoutEntity)entity);
  expiredObserversQueue.add((SpoutEntity)entity);
  if (!isObserved()) {
    parentRegion.unloadQueue.add(this);
  }
  return true;
}
Program: 177336
Project: 177336
Buggy source:
public void preSnapshotRun(){
  entityManager.preSnapshotRun();
  SpoutChunk spoutChunk;
  while ((spoutChunk=dirtyChunks.poll()) != null) {
    spoutChunk.setNotDirtyQueued();
    if (!spoutChunk.isLoaded()) {
      continue;
    }
    if (spoutChunk.isPopulated() && spoutChunk.isDirty()) {
      spoutChunk.setRenderDirty();
      for (      Player entity : spoutChunk.getObservingPlayers()) {
        syncChunkToPlayer(spoutChunk,entity);
      }
      processChunkUpdatedEvent(spoutChunk);
      spoutChunk.resetDirtyArrays();
      spoutChunk.setLightDirty(false);
    }
  }
  SpoutChunkSnapshotFuture snapshotFuture;
  while ((snapshotFuture=snapshotQueue.poll()) != null) {
    snapshotFuture.run();
  }
  entityManager.syncEntities();
}

Fixed version (ground truth):
public void preSnapshotRun(){
  entityManager.preSnapshotRun();
  SpoutChunk spoutChunk;
  while ((spoutChunk=dirtyChunks.poll()) != null) {
    spoutChunk.setNotDirtyQueued();
    if (!spoutChunk.isLoaded()) {
      continue;
    }
    if (spoutChunk.isPopulated() && spoutChunk.isDirty()) {
      spoutChunk.setRenderDirty();
      for (      Player entity : spoutChunk.getObservingPlayers()) {
        syncChunkToPlayer(spoutChunk,entity);
      }
      processChunkUpdatedEvent(spoutChunk);
      spoutChunk.resetDirtyArrays();
      spoutChunk.setLightDirty(false);
    }
  }
  SpoutChunkSnapshotFuture snapshotFuture;
  while ((snapshotFuture=snapshotQueue.poll()) != null) {
    snapshotFuture.run();
  }
  for (int dx=0; dx < CHUNKS.SIZE; dx++) {
    for (int dy=0; dy < CHUNKS.SIZE; dy++) {
      for (int dz=0; dz < CHUNKS.SIZE; dz++) {
        SpoutChunk chunk=chunks[dx][dy][dz].get();
        if (chunk != null) {
          chunk.updateExpiredObservers();
        }
      }
    }
  }
  entityManager.syncEntities();
}
Program: 177337
Project: 177337
Buggy source:
/** 
 * Syncs all entities/observers in this region
 */
public void syncEntities(){
  for (  Entity ent : getAll()) {
    if (ent.getChunk() == null) {
      continue;
    }
    if (ent.getId() == SpoutEntity.NOTSPAWNEDID) {
      continue;
    }
    Set<? extends Entity> observers=ent.getChunk().getObservers();
    syncEntity(ent,observers,false);
    Set<? extends Entity> expiredObservers=((SpoutChunk)ent.getChunk()).getExpiredObservers();
    syncEntity(ent,expiredObservers,true);
  }
}

Fixed version (ground truth):
/** 
 * Syncs all entities/observers in this region
 */
public void syncEntities(){
  for (  Entity ent : getAll()) {
    if (ent.getChunk() == null) {
      continue;
    }
    if (ent.getId() == SpoutEntity.NOTSPAWNEDID) {
      Spout.getLogger().info("String_Node_Str");
      continue;
    }
    Set<? extends Entity> observers=ent.getChunk().getObservers();
    syncEntity(ent,observers,false);
    Set<? extends Entity> expiredObservers=((SpoutChunk)ent.getChunk()).getExpiredObservers();
    syncEntity(ent,expiredObservers,true);
  }
}
Program: 177338
Project: 177338
Buggy source:
/** 
 * Adds an entity to the manager.
 * @param entity The entity
 */
public void addEntity(SpoutEntity entity){
  int currentId=entity.getId();
  if (currentId == SpoutEntity.NOTSPAWNEDID) {
    entity.setId(getNextId());
  }
  entities.put(currentId,entity);
  if (entity instanceof Player) {
    players.put((Player)entity,new ArrayList<SpoutEntity>());
  }
}

Fixed version (ground truth):
/** 
 * Adds an entity to the manager.
 * @param entity The entity
 */
public void addEntity(SpoutEntity entity){
  int currentId=entity.getId();
  if (currentId == SpoutEntity.NOTSPAWNEDID) {
    currentId=getNextId();
    entity.setId(currentId);
  }
  entities.put(currentId,entity);
  if (entity instanceof Player) {
    players.put((Player)entity,new ArrayList<SpoutEntity>());
  }
}
Program: 177339
Project: 177339
Buggy source:
/** 
 * Finalizes the manager at the FINALIZERUN tick stage
 */
public void finalizeRun(){
  for (  SpoutEntity e : entities.get().values()) {
    if (e.isRemoved()) {
      removeEntity(e);
      continue;
    }
    e.finalizeRun();
    if (e instanceof Player) {
      Player p=(Player)e;
      if (p.isOnline()) {
        p.getNetworkSynchronizer().finalizeTick();
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Finalizes the manager at the FINALIZERUN tick stage
 */
public void finalizeRun(){
  for (  SpoutEntity e : entities.get().values()) {
    if (e.isRemoved()) {
      removeEntity(e);
    }
    e.finalizeRun();
    if (e instanceof Player) {
      Player p=(Player)e;
      if (p.isOnline()) {
        p.getNetworkSynchronizer().finalizeTick();
      }
    }
  }
}
Program: 177340
Project: 177340
Buggy source:
@Override public void onTick(float dt){
  for (  Component component : values()) {
    component.tick(dt);
  }
  if (getTransform().isDirty()) {
    chunk.set(getWorld().getChunkFromBlock(getTransform().getPosition(),LoadOption.NO_LOAD));
    entityManager.set(((SpoutRegion)getRegion()).getEntityManager());
  }
}

Fixed version (ground truth):
@Override public void onTick(float dt){
  for (  Component component : values()) {
    component.tick(dt);
  }
}
Program: 177341
Project: 177341
Buggy source:
public Chunk getChunkLive(){
  return chunk.getLive();
}

Fixed version (ground truth):
public Chunk getChunkLive(){
  return getTransform().getTransformLive().getPosition().getChunk(LoadOption.NO_LOAD);
}