nus-yam/ex-repair huggingface dataset:
Program: 177244
Project: 177244
Buggy source:
@Override public void initializeServerSession(final ServerSession session){
  SyncedMapRegistry.getRegistrationMap().registerListener(new EventableListener<SyncedMapEvent>(){
    @Override public void onEvent(    SyncedMapEvent event){
      session.send(true,new SyncedMapMessage(event.getAssociatedObject().getId(),SyncedMapEvent.Action.ADD,event.getModifiedElements()));
    }
  }
);
  session.send(true,new SyncedMapMessage(SyncedMapRegistry.REGISTRATION_MAP,SyncedMapEvent.Action.SET,SyncedMapRegistry.getRegistrationMap().getItems()));
  for (  SyncedStringMap map : SyncedMapRegistry.getAll()) {
    session.send(true,new SyncedMapMessage(map.getId(),SyncedMapEvent.Action.SET,map.getItems()));
  }
}

Fixed version (ground truth):
@Override public void initializeServerSession(final ServerSession session){
  final UUID playerUUID=session.getPlayer().getUID();
  SyncedMapRegistry.getRegistrationMap().registerListener(new EventableListener<SyncedMapEvent>(){
    @Override public void onEvent(    SyncedMapEvent event){
      Entity e=Spout.getEngine().getEntity(playerUUID);
      if (e == null || !(e instanceof Player)) {
        SyncedMapRegistry.getRegistrationMap().unregisterListener(this);
      }
      session.send(true,new SyncedMapMessage(event.getAssociatedObject().getId(),SyncedMapEvent.Action.ADD,event.getModifiedElements()));
    }
  }
);
  session.send(true,new SyncedMapMessage(SyncedMapRegistry.REGISTRATION_MAP,SyncedMapEvent.Action.SET,SyncedMapRegistry.getRegistrationMap().getItems()));
  for (  SyncedStringMap map : SyncedMapRegistry.getAll()) {
    session.send(true,new SyncedMapMessage(map.getId(),SyncedMapEvent.Action.SET,map.getItems()));
  }
}
Program: 177245
Project: 177245
Buggy source:
/** 
 * Gets the Z-coordinate of the chunk the base of this CuboidBuffer is in
 * @return base chunk Z-coordinate
 */
public int getBaseChunkZ(){
  return baseZ << Chunk.BLOCKS.BITS;
}

Fixed version (ground truth):
/** 
 * Gets the Z-coordinate of the chunk the base of this CuboidBuffer is in
 * @return base chunk Z-coordinate
 */
public int getBaseChunkZ(){
  return baseZ >> Chunk.BLOCKS.BITS;
}
Program: 177246
Project: 177246
Buggy source:
/** 
 * Gets the Y-coordinate of the chunk the base of this CuboidBuffer is in
 * @return base chunk Y-coordinate
 */
public int getBaseChunkY(){
  return baseY << Chunk.BLOCKS.BITS;
}

Fixed version (ground truth):
/** 
 * Gets the Y-coordinate of the chunk the base of this CuboidBuffer is in
 * @return base chunk Y-coordinate
 */
public int getBaseChunkY(){
  return baseY >> Chunk.BLOCKS.BITS;
}
Program: 177247
Project: 177247
Buggy source:
/** 
 * Gets the X-coordinate of the chunk the base of this CuboidBuffer is in
 * @return base chunk X-coordinate
 */
public int getBaseChunkX(){
  return baseX << Chunk.BLOCKS.BITS;
}

Fixed version (ground truth):
/** 
 * Gets the X-coordinate of the chunk the base of this CuboidBuffer is in
 * @return base chunk X-coordinate
 */
public int getBaseChunkX(){
  return baseX >> Chunk.BLOCKS.BITS;
}
Program: 177248
Project: 177248
Buggy source:
/** 
 * Spout can display more than one line
 * @param id, arg
 */
public void spoutUpdate(int id,String arg){
  if (spoutMessages.containsKey(id)) {
    LabelComponent lbl=spoutMessages.get(id).get(LabelComponent.class);
    if (!arg.equals(lbl.getText())) {
      lbl.setText(arg);
    }
  }
 else {
    Widget w=new SpoutWidget();
    w.getTransform().setPosition(-0.975f,0.9f - (id * 0.075f));
    LabelComponent lbl=w.add(LabelComponent.class);
    lbl.setFont(SpoutRenderMaterials.DEFAULT_FONT);
    lbl.setText(arg);
    spoutMessages.put(id,w);
    attachWidget(plugin,w);
  }
}

Fixed version (ground truth):
/** 
 * Spout can display more than one line
 * @param id
 * @param arg
 */
public void spoutUpdate(int id,String arg){
  if (spoutMessages.containsKey(id)) {
    LabelComponent lbl=spoutMessages.get(id).get(LabelComponent.class);
    if (!arg.equals(lbl.getText())) {
      lbl.setText(arg);
    }
  }
 else {
    Widget w=new SpoutWidget();
    w.getTransform().setPosition(-0.975f,0.9f - (id * 0.075f));
    LabelComponent lbl=w.add(LabelComponent.class);
    lbl.setFont(SpoutRenderMaterials.DEFAULT_FONT);
    lbl.setText(arg);
    spoutMessages.put(id,w);
    attachWidget(plugin,w);
  }
}
Program: 177249
Project: 177249
Buggy source:
/** 
 * Creates a new task with the specified number of ticks between consecutive calls to   {@link #execute()}.
 * @param ticks The number of ticks.
 */
public SpoutTask(TaskManager manager,Scheduler scheduler,Object owner,Runnable task,boolean sync,long delay,long period,TaskPriority priority,boolean longLife){
  this.taskId=nextTaskId.getAndIncrement();
  this.nextCallTime=new AtomicLong(manager.getUpTime() + delay);
  this.executing=new AtomicBoolean(false);
  this.owner=owner;
  this.task=task;
  this.delay=delay;
  this.period=period;
  this.sync=sync;
  this.priority=priority;
  this.manager=manager;
  this.scheduler=scheduler;
  this.longLife=longLife;
}

Fixed version (ground truth):
/** 
 * Creates a new task with the specified period between consecutive calls to   {@link #pulse()}.
 */
public SpoutTask(TaskManager manager,Scheduler scheduler,Object owner,Runnable task,boolean sync,long delay,long period,TaskPriority priority,boolean longLife){
  this.taskId=nextTaskId.getAndIncrement();
  this.nextCallTime=new AtomicLong(manager.getUpTime() + delay);
  this.executing=new AtomicBoolean(false);
  this.owner=owner;
  this.task=task;
  this.delay=delay;
  this.period=period;
  this.sync=sync;
  this.priority=priority;
  this.manager=manager;
  this.scheduler=scheduler;
  this.longLife=longLife;
}
Program: 177251
Project: 177251
Buggy source:
@Override public void start(){
  if (!connnect()) {
    return;
  }
  SpoutClientSession get=session.get();
  get.send(true,get.getProtocol().getIntroductionMessage(getPlayer().getName(),(InetSocketAddress)get.getChannel().getRemoteAddress()));
  worldChanged("String_Node_Str",UUID.randomUUID(),new DatatableComponent().serialize());
  super.start();
  getEventManager().registerEvents(new SpoutClientListener(this),this);
  AnnotatedCommandExecutorFactory.create(new InputCommands(this));
  AnnotatedCommandExecutorFactory.create(new RendererCommands(this));
  Dimension dim=Toolkit.getDefaultToolkit().getScreenSize();
  this.renderer=getScheduler().startRenderThread(new Vector2(dim.getWidth() * 0.75f,dim.getHeight() * 0.75f),ccoverride,null);
  getScheduler().startGuiThread();
  if (EngineStartEvent.getHandlerList().getRegisteredListeners().length != 0) {
    getEventManager().callEvent(new EngineStartEvent());
  }
  inputManager.onClientStart();
  filesystem.postStartup();
}

Fixed version (ground truth):
@Override public void start(){
  worldChanged("String_Node_Str",UUID.randomUUID(),new DatatableComponent().serialize());
  if (!connnect()) {
    return;
  }
  SpoutClientSession get=session.get();
  getPlayer().getName();
  get.send(true,get.getProtocol().getIntroductionMessage(getPlayer().getName(),(InetSocketAddress)get.getChannel().getRemoteAddress()));
  super.start();
  getEventManager().registerEvents(new SpoutClientListener(this),this);
  AnnotatedCommandExecutorFactory.create(new InputCommands(this));
  AnnotatedCommandExecutorFactory.create(new RendererCommands(this));
  Dimension dim=Toolkit.getDefaultToolkit().getScreenSize();
  this.renderer=getScheduler().startRenderThread(new Vector2(dim.getWidth() * 0.75f,dim.getHeight() * 0.75f),ccoverride,null);
  getScheduler().startGuiThread();
  if (EngineStartEvent.getHandlerList().getRegisteredListeners().length != 0) {
    getEventManager().callEvent(new EngineStartEvent());
  }
  inputManager.onClientStart();
  filesystem.postStartup();
}
Program: 177252
Project: 177252
Buggy source:
@Override public List<String> getAllPlayers(){
  return Arrays.asList(player.get().getName());
}

Fixed version (ground truth):
@Override public List<String> getAllPlayers(){
  return Arrays.asList(getPlayer().getName());
}
Program: 177253
Project: 177253
Buggy source:
public SpoutClientPlayer(Engine engine,String name,Transform transform,int viewDistance){
  super(engine,name,transform,viewDistance);
  add(CameraComponent.class);
}

Fixed version (ground truth):
public SpoutClientPlayer(Engine engine,String name,Transform transform,int viewDistance){
  super(engine,name,transform,viewDistance,null,false,(byte[])null,(Class<? extends Component>[])null);
  add(CameraComponent.class);
}
Program: 177254
Project: 177254
Buggy source:
/** 
 * Prevents stack overflow when creating an entity during chunk loading due to circle of calls
 */
public void setupInitialChunk(Transform transform,LoadOption loadopt){
  SpoutRegion region=(SpoutRegion)scene.getTransformLive().getPosition().getChunk(loadopt).getRegion();
  if (region == null) {
    return;
  }
  entityManager.set(region.getEntityManager());
  snapshotManager.copyAllSnapshots();
  if (initialComponents != null) {
    this.add(initialComponents);
    initialComponents=null;
  }
}

Fixed version (ground truth):
/** 
 * Prevents stack overflow when creating an entity during chunk loading due to circle of calls
 */
public void setupInitialChunk(Transform transform,LoadOption loadopt){
  SpoutChunk chunk=(SpoutChunk)scene.getTransformLive().getPosition().getChunk(loadopt);
  if (chunk == null) {
    return;
  }
  entityManager.set(chunk.getRegion().getEntityManager());
  snapshotManager.copyAllSnapshots();
  if (initialComponents != null) {
    this.add(initialComponents);
    initialComponents=null;
  }
}
Program: 177255
Project: 177255
Buggy source:
@Override public void finalizeRun(){
  if (getEngine().getPlatform() != Platform.CLIENT && !this.isOnlineLive()) {
    remove();
  }
  super.finalizeRun();
  if (this.isOnline()) {
    this.getNetworkSynchronizer().finalizeTick();
  }
  if (isRemoved()) {
    if (getEngine().getPlatform() == Platform.SERVER) {
      ((ServerNetworkSynchronizer)getNetworkSynchronizer()).onRemoved();
      ((SpoutServer)getEngine()).removePlayer(this);
    }
    sessionLive.set(null);
  }
}

Fixed version (ground truth):
@Override public void finalizeRun(){
  if (getEngine().getPlatform() != Platform.CLIENT && !this.isOnlineLive()) {
    remove();
  }
  super.finalizeRun();
  if (isRemoved()) {
    if (getEngine().getPlatform() == Platform.SERVER) {
      ((ServerNetworkSynchronizer)getNetworkSynchronizer()).onRemoved();
      ((SpoutServer)getEngine()).removePlayer(this);
    }
    sessionLive.set(null);
  }
 else   if (this.isOnline()) {
    this.getNetworkSynchronizer().finalizeTick();
  }
}
Program: 177257
Project: 177257
Buggy source:
@Override public void start(boolean checkWorlds){
  if (!connnect()) {
    return;
  }
  SpoutClientSession get=session.get();
  get.send(true,true,get.getProtocol().getIntroductionMessage(getPlayer().getName(),(InetSocketAddress)get.getChannel().getRemoteAddress()));
  worldChanged("String_Node_Str",UUID.randomUUID(),new DatatableComponent().serialize());
  super.start(checkWorlds);
  getEventManager().registerEvents(new SpoutClientListener(this),this);
  AnnotatedCommandExecutorFactory.create(new InputCommands(this));
  AnnotatedCommandExecutorFactory.create(new RendererCommands(this));
  Dimension dim=Toolkit.getDefaultToolkit().getScreenSize();
  this.renderer=getScheduler().startRenderThread(new Vector2(dim.getWidth() * 0.75f,dim.getHeight() * 0.75f),ccoverride,null);
  getScheduler().startGuiThread();
  if (EngineStartEvent.getHandlerList().getRegisteredListeners().length != 0) {
    getEventManager().callEvent(new EngineStartEvent());
  }
  filesystem.postStartup();
}

Fixed version (ground truth):
@Override public void start(){
  if (!connnect()) {
    return;
  }
  SpoutClientSession get=session.get();
  get.send(true,true,get.getProtocol().getIntroductionMessage(getPlayer().getName(),(InetSocketAddress)get.getChannel().getRemoteAddress()));
  worldChanged("String_Node_Str",UUID.randomUUID(),new DatatableComponent().serialize());
  super.start();
  getEventManager().registerEvents(new SpoutClientListener(this),this);
  AnnotatedCommandExecutorFactory.create(new InputCommands(this));
  AnnotatedCommandExecutorFactory.create(new RendererCommands(this));
  Dimension dim=Toolkit.getDefaultToolkit().getScreenSize();
  this.renderer=getScheduler().startRenderThread(new Vector2(dim.getWidth() * 0.75f,dim.getHeight() * 0.75f),ccoverride,null);
  getScheduler().startGuiThread();
  if (EngineStartEvent.getHandlerList().getRegisteredListeners().length != 0) {
    getEventManager().callEvent(new EngineStartEvent());
  }
  filesystem.postStartup();
}
Program: 177258
Project: 177258
Buggy source:
public void start(boolean checkWorlds){
  log("String_Node_Str",getPlatform().name().toLowerCase());
  log("String_Node_Str",getVersion(),getAPIVersion());
  log("String_Node_Str");
  log("String_Node_Str");
  log("String_Node_Str");
  if (debugMode()) {
    log("String_Node_Str",Level.WARNING);
  }
  Object exe;
switch (getPlatform()) {
case CLIENT:
    exe=new ClientCommands(this);
  break;
case SERVER:
exe=new ServerCommands(this);
break;
default :
exe=new CommonCommands(this);
break;
}
AnnotatedCommandExecutorFactory.create(exe);
AnnotatedCommandExecutorFactory.create(new MessagingCommands(this));
InputCommands.setupInputCommands(this);
if (debugMode()) {
AnnotatedCommandExecutorFactory.create(new TestCommands(this));
AnnotatedCommandExecutorFactory.create(new AnnotatedCommandExecutorTest.RootExecutor());
AnnotatedCommandExecutorFactory.create(new AnnotatedCommandExecutorTest.ChildExecutor(),cmdManager.getCommand("String_Node_Str"));
}
setupBindings(config);
enablePlugins();
if (SpoutConfiguration.RECLAIM_MEMORY.getBoolean()) {
reclamation=new MemoryReclamationThread();
reclamation.start();
}
scheduler.startMainThread();
setupComplete.set(true);
}

Fixed version (ground truth):
public void start(){
  log("String_Node_Str",getPlatform().name().toLowerCase());
  log("String_Node_Str",getVersion(),getAPIVersion());
  log("String_Node_Str");
  log("String_Node_Str");
  log("String_Node_Str");
  if (debugMode()) {
    log("String_Node_Str",Level.WARNING);
  }
  scheduler.scheduleSyncRepeatingTask(this,getSessionTask(),50,50,TaskPriority.CRITICAL);
  Object exe;
switch (getPlatform()) {
case CLIENT:
    exe=new ClientCommands(this);
  break;
case SERVER:
exe=new ServerCommands(this);
break;
default :
exe=new CommonCommands(this);
break;
}
AnnotatedCommandExecutorFactory.create(exe);
AnnotatedCommandExecutorFactory.create(new MessagingCommands(this));
InputCommands.setupInputCommands(this);
if (debugMode()) {
AnnotatedCommandExecutorFactory.create(new TestCommands(this));
AnnotatedCommandExecutorFactory.create(new AnnotatedCommandExecutorTest.RootExecutor());
AnnotatedCommandExecutorFactory.create(new AnnotatedCommandExecutorTest.ChildExecutor(),cmdManager.getCommand("String_Node_Str"));
}
setupBindings(config);
enablePlugins();
if (SpoutConfiguration.RECLAIM_MEMORY.getBoolean()) {
reclamation=new MemoryReclamationThread();
reclamation.start();
}
scheduler.startMainThread();
setupComplete.set(true);
}
Program: 177259
Project: 177259
Buggy source:
public void start(boolean checkWorlds,Listener listener){
  engineItemMap=MaterialRegistry.setupRegistry();
  engineBiomeMap=BiomeRegistry.setupRegistry();
  engineLightingMap=LightingRegistry.setupRegistry();
  scheduler.scheduleSyncRepeatingTask(this,new SessionTask(sessions),50,50,TaskPriority.CRITICAL);
  super.start(checkWorlds);
  if (checkWorlds) {
    if (loadedWorlds.getLive().isEmpty()) {
      throw new IllegalStateException("String_Node_Str");
    }
    World world=this.getWorld(SpoutConfiguration.DEFAULT_WORLD.getString());
    if (world != null) {
      this.setDefaultWorld(world);
    }
    getDefaultWorld();
  }
  getEventManager().registerEvents(listener,this);
  getEventManager().callEvent(new EngineStartEvent());
  filesystem.postStartup();
  WorldSavingThread.startThread();
  log("String_Node_Str");
}

Fixed version (ground truth):
protected void start(boolean checkWorlds,Listener listener){
  engineItemMap=MaterialRegistry.setupRegistry();
  engineBiomeMap=BiomeRegistry.setupRegistry();
  engineLightingMap=LightingRegistry.setupRegistry();
  super.start();
  if (checkWorlds) {
    if (loadedWorlds.getLive().isEmpty()) {
      throw new IllegalStateException("String_Node_Str");
    }
    World world=this.getWorld(SpoutConfiguration.DEFAULT_WORLD.getString());
    if (world != null) {
      this.setDefaultWorld(world);
    }
    getDefaultWorld();
  }
  getEventManager().registerEvents(listener,this);
  getEventManager().callEvent(new EngineStartEvent());
  filesystem.postStartup();
  WorldSavingThread.startThread();
  log("String_Node_Str");
}
Program: 177261
Project: 177261
Buggy source:
@Override public World getWorld(){
  return entityManager.get().getRegion().getWorld();
}

Fixed version (ground truth):
@Override public World getWorld(){
  if (Spout.getPlatform() == Platform.SERVER) {
    return entityManager.get().getRegion().getWorld();
  }
 else {
    return ((Client)Spout.getEngine()).getWorld();
  }
}
Program: 177262
Project: 177262
Buggy source:
public SpoutEntity(Engine engine,Transform transform,int viewDistance,UUID uid,boolean load,byte[] dataMap,Class<? extends Component>... components){
  id.set(NOTSPAWNEDID);
  this.engine=engine;
  observer=new SnapshotableReference<Iterator<IntVector3>>(snapshotManager,INITIAL_TICK);
  observer.set(NOT_OBSERVING);
  scene=(SpoutSceneComponent)add(SceneComponent.class);
  network=add(NetworkComponent.class);
  if (uid != null) {
    this.uid=uid;
  }
 else {
    this.uid=UUID.randomUUID();
  }
  if (transform != null) {
    scene.setTransform(transform);
    scene.copySnapshot();
  }
  if (components != null && components.length > 0) {
    initialComponents=components;
  }
  int maxViewDistance=SpoutConfiguration.VIEW_DISTANCE.getInt() * Chunk.BLOCKS.SIZE;
  if (viewDistance < 0) {
    viewDistance=maxViewDistance;
  }
 else   if (viewDistance > maxViewDistance) {
    viewDistance=maxViewDistance;
  }
  setViewDistance(viewDistance);
  if (dataMap != null) {
    try {
      this.getDatatable().deserialize(dataMap);
    }
 catch (    IOException e) {
      engine.getLogger().log(Level.SEVERE,"String_Node_Str",e);
    }
  }
  snapshotManager.copyAllSnapshots();
  if (transform != null) {
    if (load) {
      setupInitialChunk(transform,LoadOption.LOAD_GEN);
    }
 else {
      setupInitialChunk(transform,LoadOption.NO_LOAD);
    }
  }
}

Fixed version (ground truth):
public SpoutEntity(Engine engine,Transform transform,int viewDistance,UUID uid,boolean load,byte[] dataMap,Class<? extends Component>... components){
  id.set(NOTSPAWNEDID);
  this.engine=engine;
  observer.set(NOT_OBSERVING);
  scene=(SpoutSceneComponent)add(SceneComponent.class);
  network=add(NetworkComponent.class);
  if (uid != null) {
    this.uid=uid;
  }
 else {
    this.uid=UUID.randomUUID();
  }
  if (transform != null) {
    scene.setTransform(transform);
    scene.copySnapshot();
  }
  if (components != null && components.length > 0) {
    initialComponents=components;
  }
  int maxViewDistance=SpoutConfiguration.VIEW_DISTANCE.getInt() * Chunk.BLOCKS.SIZE;
  if (viewDistance < 0) {
    viewDistance=maxViewDistance;
  }
 else   if (viewDistance > maxViewDistance) {
    viewDistance=maxViewDistance;
  }
  setViewDistance(viewDistance);
  if (dataMap != null) {
    try {
      this.getDatatable().deserialize(dataMap);
    }
 catch (    IOException e) {
      engine.getLogger().log(Level.SEVERE,"String_Node_Str",e);
    }
  }
  snapshotManager.copyAllSnapshots();
  if (transform != null) {
    if (load) {
      setupInitialChunk(transform,LoadOption.LOAD_GEN);
    }
 else {
      setupInitialChunk(transform,LoadOption.NO_LOAD);
    }
  }
}
Program: 177263
Project: 177263
Buggy source:
@Override public void initializeSession(final Session session){
  session.setNetworkSynchronizer(new SpoutNetworkSynchronizer(session));
  for (  StringMap map : StringMap.getAll()) {
    session.send(false,new StringMapMessage(map.getId(),StringMapEvent.Action.SET,map.getItems()));
  }
  session.send(false,new WorldChangeMessage(session.getPlayer().getWorld(),session.getPlayer().getWorld().getDatatable()));
}

Fixed version (ground truth):
@Override public void initializeSession(final Session session){
  session.setNetworkSynchronizer(new SpoutNetworkSynchronizer(session));
  for (  StringMap map : StringMap.getAll()) {
    session.send(false,new StringMapMessage(map.getId(),StringMapEvent.Action.SET,map.getItems()));
  }
}
Program: 177264
Project: 177264
Buggy source:
@Override public ChannelBuffer encode(LoginMessage message){
  ChannelBuffer buffer=ChannelBuffers.dynamicBuffer();
  ChannelBufferUtils.writeString(buffer,message.getPlayerName());
  buffer.writeInt(message.getProtocolVersion());
  return buffer;
}

Fixed version (ground truth):
@Override public ChannelBuffer encode(LoginMessage message){
  ChannelBuffer buffer=ChannelBuffers.dynamicBuffer();
  ChannelBufferUtils.writeString(buffer,message.getPlayerName());
  buffer.writeInt(message.getExtraInt());
  return buffer;
}
Program: 177265
Project: 177265
Buggy source:
@Override public void handleClient(Session session,LoginMessage message){
  session.getDataMap().put(SpoutProtocol.PLAYER_ENTITY_ID,message.getProtocolVersion());
  session.setState(Session.State.GAME);
  session.getEngine().getEventManager().callEvent(new ClientPlayerConnectedEvent(session,message.getProtocolVersion()));
}

Fixed version (ground truth):
@Override public void handleClient(Session session,LoginMessage message){
  session.getDataMap().put(SpoutProtocol.PLAYER_ENTITY_ID,message.getExtraInt());
  session.setState(Session.State.GAME);
  session.getEngine().getEventManager().callEvent(new ClientPlayerConnectedEvent(session,message.getExtraInt()));
}
Program: 177266
Project: 177266
Buggy source:
@Override public int hashCode(){
  return new HashCodeBuilder(95,45).append(playerName).append(protoVersion).toHashCode();
}

Fixed version (ground truth):
@Override public int hashCode(){
  return new HashCodeBuilder(95,45).append(playerName).append(extraInt).toHashCode();
}
Program: 177267
Project: 177267
Buggy source:
public LoginMessage(String playerName,int protoVersion){
  this.playerName=playerName;
  this.protoVersion=protoVersion;
}

Fixed version (ground truth):
public LoginMessage(String playerName,int extraInt){
  this.playerName=playerName;
  this.extraInt=extraInt;
}
Program: 177268
Project: 177268
Buggy source:
@Override public boolean equals(Object obj){
  if (obj instanceof LoginMessage) {
    final LoginMessage other=(LoginMessage)obj;
    return new EqualsBuilder().append(playerName,other.playerName).append(protoVersion,other.protoVersion).isEquals();
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (obj instanceof LoginMessage) {
    final LoginMessage other=(LoginMessage)obj;
    return new EqualsBuilder().append(playerName,other.playerName).append(extraInt,other.extraInt).isEquals();
  }
 else {
    return false;
  }
}
Program: 177269
Project: 177269
Buggy source:
@Override public String toString(){
  return new ToStringBuilder(this,SpoutToStringStyle.INSTANCE).append("String_Node_Str",playerName).append("String_Node_Str",protoVersion).toString();
}

Fixed version (ground truth):
@Override public String toString(){
  return new ToStringBuilder(this,SpoutToStringStyle.INSTANCE).append("String_Node_Str",playerName).append("String_Node_Str",extraInt).toString();
}
Program: 177270
Project: 177270
Buggy source:
/** 
 * Spawns an entity into the world. Fires off a cancellable EntitySpawnEvent
 */
public void spawnEntity(Entity e,int entityID){
  if (e.isSpawned()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  SpoutRegion region=(SpoutRegion)e.getRegion();
  if (region == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (region.getEntityManager().isSpawnable((SpoutEntity)e)) {
    if (entityID > -1) {
      if (getEngine().getPlatform() == Platform.CLIENT) {
        ((SpoutEntity)e).setId(entityID);
      }
 else {
        throw new IllegalArgumentException("String_Node_Str");
      }
    }
    EntitySpawnEvent event=getEngine().getEventManager().callEvent(new EntitySpawnEvent(e,e.getScene().getPosition()));
    if (event.isCancelled()) {
      return;
    }
    region.getEntityManager().addEntity((SpoutEntity)e);
    for (    Component component : values()) {
      if (component instanceof WorldComponent) {
        ((WorldComponent)component).onSpawn(event);
      }
    }
    for (    Component component : e.values()) {
      if (component instanceof EntityComponent) {
        ((EntityComponent)component).onSpawned(event);
      }
    }
  }
 else {
    throw new IllegalStateException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Spawns an entity into the world. Fires off a cancellable EntitySpawnEvent
 */
public void spawnEntity(Entity e,int entityID){
  if (e.isSpawned()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  SpoutRegion region=(SpoutRegion)e.getRegion();
  if (region == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (region.getEntityManager().isSpawnable((SpoutEntity)e)) {
    if (entityID != SpoutEntity.NOTSPAWNEDID) {
      if (getEngine().getPlatform() == Platform.CLIENT) {
        ((SpoutEntity)e).setId(entityID);
      }
 else {
        throw new IllegalArgumentException("String_Node_Str");
      }
    }
    EntitySpawnEvent event=getEngine().getEventManager().callEvent(new EntitySpawnEvent(e,e.getScene().getPosition()));
    if (event.isCancelled()) {
      return;
    }
    region.getEntityManager().addEntity((SpoutEntity)e);
    for (    Component component : values()) {
      if (component instanceof WorldComponent) {
        ((WorldComponent)component).onSpawn(event);
      }
    }
    for (    Component component : e.values()) {
      if (component instanceof EntityComponent) {
        ((EntityComponent)component).onSpawned(event);
      }
    }
  }
 else {
    throw new IllegalStateException("String_Node_Str");
  }
}
Program: 177271
Project: 177271
Buggy source:
/** 
 * Get the debug screen
 */
public abstract Derp getDebugHud();

Fixed version (ground truth):
/** 
 * Get the debug screen
 */
public abstract DebugHud getDebugHud();
Program: 177272
Project: 177272
Buggy source:
/** 
 * Get the debug screen
 */
public abstract DebugHud getDebugHud();

Fixed version (ground truth):
/** 
 * Get the debug screen
 */
public abstract Derp getDebugHud();
Program: 177274
Project: 177274
Buggy source:
public ImmutableHeightMapBuffer getHeightMapBuffer(){
  return new ImmutableHeightMapBuffer(getX(),getZ(),SpoutColumn.BLOCKS.SIZE,SpoutColumn.BLOCKS.SIZE,heightMap);
}

Fixed version (ground truth):
public ImmutableHeightMapBuffer getHeightMapBuffer(){
  return new ImmutableHeightMapBuffer(getX() << BLOCKS.BITS,getZ() << BLOCKS.BITS,SpoutColumn.BLOCKS.SIZE,SpoutColumn.BLOCKS.SIZE,heightMap);
}
Program: 177275
Project: 177275
Buggy source:
@Override public ImmutableHeightMapBuffer getLocalHeightMap(int x,int z,LoadOption loadopt){
  SpoutColumn col=getWorld().getColumn(x << Chunk.BLOCKS.BITS,z << Chunk.BLOCKS.BITS,true);
  if (col == null) {
    return null;
  }
  return col.getHeightMapBuffer();
}

Fixed version (ground truth):
@Override public ImmutableHeightMapBuffer getLocalHeightMap(int x,int z,LoadOption loadopt){
  SpoutColumn col=getWorld().getColumn((getChunkX() + x) << Chunk.BLOCKS.BITS,(getChunkZ() + z) << Chunk.BLOCKS.BITS,true);
  if (col == null) {
    return null;
  }
  return col.getHeightMapBuffer();
}
Program: 177276
Project: 177276
Buggy source:
/** 
 * Gets the size of the CuboidBuffer
 */
public Vector3 getSize(){
  return new Vector3(sizeX,sizeY,sizeZ);
}

Fixed version (ground truth):
/** 
 * Gets the size of the CuboidBuffer
 */
public Vector3 getSize(){
  return size;
}
Program: 177277
Project: 177277
Buggy source:
/** 
 * Gets a Point representing the base of this CuboidBuffer
 */
public Vector3 getBase(){
  return new Vector3(baseX,baseY,baseZ);
}

Fixed version (ground truth):
/** 
 * Gets a Point representing the base of this CuboidBuffer
 */
public Vector3 getBase(){
  return base;
}
Program: 177278
Project: 177278
Buggy source:
protected T getLightBufferRaw(int x,int y,int z){
  int cx=(x - baseX) >> Chunk.BLOCKS.BITS;
  int cy=(y - baseY) >> Chunk.BLOCKS.BITS;
  int cz=(z - baseZ) >> Chunk.BLOCKS.BITS;
  Chunk c=r.getLocalChunk(cx,cy,cz,loadOpt);
  if (c == null) {
    return null;
  }
  @SuppressWarnings("String_Node_Str") T buf=(T)c.getLightBuffer(id);
  if (buf == null) {
    return null;
  }
  return buf;
}

Fixed version (ground truth):
protected T getLightBufferRaw(int x,int y,int z){
  int cx=(x - baseX - Region.BLOCKS.SIZE) >> Chunk.BLOCKS.BITS;
  int cy=(y - baseY - Region.BLOCKS.SIZE) >> Chunk.BLOCKS.BITS;
  int cz=(z - baseZ - Region.BLOCKS.SIZE) >> Chunk.BLOCKS.BITS;
  Chunk c=r.getLocalChunk(cx,cy,cz,loadOpt);
  if (c == null) {
    Spout.getLogger().info("String_Node_Str" + cx + "String_Node_Str"+ cy+ "String_Node_Str"+ cz);
    return null;
  }
  @SuppressWarnings("String_Node_Str") T buf=(T)c.getLightBuffer(id);
  if (buf == null) {
    Spout.getLogger().info("String_Node_Str");
    return null;
  }
  return buf;
}
Program: 177279
Project: 177279
Buggy source:
public CuboidLightBuffer setIfAbsentLightBuffer(short id,CuboidLightBuffer buffer){
  if (id < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
 else   if (buffer != null && buffer.getManagerId() != id) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  TickStage.checkStage(TickStage.LIGHTING);
  CuboidLightBuffer[] array=lightBuffers.get();
  CuboidLightBuffer buf;
  if (id < array.length) {
    buf=array[id];
    if (buf != null) {
      return buf;
    }
  }
  CuboidLightBuffer newBuf;
  if (buffer == null) {
    LightingManager<?> manager=LightingRegistry.get(id);
    if (manager == null) {
      return null;
    }
    newBuf=manager.newLightBuffer(this,getBlockX(),getBlockY(),getBlockZ(),BLOCKS.SIZE,BLOCKS.SIZE,BLOCKS.SIZE);
  }
 else {
    newBuf=buffer;
  }
  boolean success=false;
  while (!success) {
    array=lightBuffers.get();
    if (id < array.length) {
      buf=array[id];
      if (buf != null) {
        return buf;
      }
    }
    CuboidLightBuffer[] newArray=new CuboidLightBuffer[Math.max(id + 1,array.length)];
    for (int i=0; i < array.length; i++) {
      newArray[i]=array[i];
    }
    newArray[id]=newBuf;
    success=lightBuffers.compareAndSet(array,newArray);
  }
  return newBuf;
}

Fixed version (ground truth):
private CuboidLightBuffer setIfAbsentLightBuffer(short id,CuboidLightBuffer buffer){
  if (id < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
 else   if (buffer != null && buffer.getManagerId() != id) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  CuboidLightBuffer[] array=lightBuffers.get();
  CuboidLightBuffer buf;
  if (id < array.length) {
    buf=array[id];
    if (buf != null) {
      return buf;
    }
  }
  CuboidLightBuffer newBuf;
  if (buffer == null) {
    LightingManager<?> manager=LightingRegistry.get(id);
    if (manager == null) {
      return null;
    }
    newBuf=manager.newLightBuffer(this,getBlockX(),getBlockY(),getBlockZ(),BLOCKS.SIZE,BLOCKS.SIZE,BLOCKS.SIZE);
  }
 else {
    newBuf=buffer;
  }
  boolean success=false;
  while (!success) {
    array=lightBuffers.get();
    if (id < array.length) {
      buf=array[id];
      if (buf != null) {
        return buf;
      }
    }
    CuboidLightBuffer[] newArray=new CuboidLightBuffer[Math.max(id + 1,array.length)];
    for (int i=0; i < array.length; i++) {
      newArray[i]=array[i];
    }
    newArray[id]=newBuf;
    success=lightBuffers.compareAndSet(array,newArray);
  }
  return newBuf;
}
Program: 177280
Project: 177280
Buggy source:
@Override public CuboidLightBuffer getLightBuffer(short id){
  return setIfAbsentLightBuffer(id,null);
}

Fixed version (ground truth):
@Override public CuboidLightBuffer getLightBuffer(short id){
  TickStage.checkStage(TickStage.LIGHTING);
  return setIfAbsentLightBuffer(id,null);
}
Program: 177281
Project: 177281
Buggy source:
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
  short matId=in.readShort();
  short matData=in.readShort();
  material=MaterialRegistry.get(matId);
  if (matData != 0 && material != null) {
    material=material.getSubMaterial(matData);
  }
  amount=in.readInt();
  data=in.readShort();
  int auxDataSize=in.readInt();
  if (auxDataSize > 0) {
    byte[] auxData=new byte[auxDataSize];
    ManagedHashMap map=new ManagedHashMap();
    map.deserialize(auxData);
    this.auxData=map;
  }
  boolean hasNBTData=in.readBoolean();
  if (hasNBTData) {
    NBTInputStream is=new NBTInputStream(in,false);
    CompoundTag tag=(CompoundTag)is.readTag();
    nbtData=tag.getValue();
    is.close();
  }
  if (material == null) {
    throw new ClassNotFoundException("String_Node_Str" + matId + "String_Node_Str"+ matData+ "String_Node_Str");
  }
}

Fixed version (ground truth):
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
  short matId=in.readShort();
  short matData=in.readShort();
  material=MaterialRegistry.get(matId);
  if (matData != 0 && material != null) {
    material=material.getSubMaterial(matData);
  }
  amount=in.readInt();
  data=in.readShort();
  int auxDataSize=in.readInt();
  if (auxDataSize > 0) {
    byte[] auxData=new byte[auxDataSize];
    in.read(auxData);
    ManagedHashMap map=new ManagedHashMap();
    map.deserialize(auxData);
    this.auxData=map;
  }
  boolean hasNBTData=in.readBoolean();
  if (hasNBTData) {
    NBTInputStream is=new NBTInputStream(in,false);
    CompoundTag tag=(CompoundTag)is.readTag();
    nbtData=tag.getValue();
    is.close();
  }
  if (material == null) {
    throw new ClassNotFoundException("String_Node_Str" + matId + "String_Node_Str"+ matData+ "String_Node_Str");
  }
}
Program: 177282
Project: 177282
Buggy source:
private ChannelQueueThread getChannelQueue(int queueId){
  queueId=queueId & QUEUE_ID_MASK;
  ChannelQueueThread[] queues=channelQueues.get();
  if (queues == null) {
    return null;
  }
  while (queueId >= queues.length || queues[queueId] == null) {
    ChannelQueueThread[] newQueues=new ChannelQueueThread[queueId + 1];
    for (int i=0; i < queues.length; i++) {
      newQueues[i]=queues[i];
    }
    ChannelQueueThread newQueue=new ChannelQueueThread(poolIndex,queueId);
    newQueues[queueId]=newQueue;
    if (channelQueues.compareAndSet(queues,newQueues)) {
      newQueue.start();
      queues=newQueues;
    }
  }
  return queues[queueId];
}

Fixed version (ground truth):
private ChannelQueueThread getChannelQueue(int queueId){
  queueId=queueId & QUEUE_ID_MASK;
  ChannelQueueThread[] queues=channelQueues.get();
  if (queues == null) {
    return null;
  }
  while (queueId >= queues.length || queues[queueId] == null) {
    ChannelQueueThread[] newQueues=new ChannelQueueThread[queueId + 1];
    System.arraycopy(queues,0,newQueues,0,queues.length);
    ChannelQueueThread newQueue=new ChannelQueueThread(poolIndex,queueId);
    newQueues[queueId]=newQueue;
    if (channelQueues.compareAndSet(queues,newQueues)) {
      newQueue.start();
      queues=newQueues;
    }
  }
  return queues[queueId];
}
Program: 177283
Project: 177283
Buggy source:
public NetworkSendThread(int poolIndex){
  this.poolIndex=poolIndex;
  channelQueues.set(new ChannelQueueThread[16]);
}

Fixed version (ground truth):
public NetworkSendThread(int poolIndex){
  this.poolIndex=poolIndex;
  channelQueues.set(new ChannelQueueThread[0]);
}
Program: 177284
Project: 177284
Buggy source:
@Override public void send(boolean upstream,boolean force,Message message){
  if (message == null) {
    return;
  }
  try {
    if (force || this.state == State.GAME) {
      if (channel.isOpen()) {
        NetworkSendThread sendThread=networkSendThread.get();
        if (sendThread == null) {
          channel.write(message);
        }
 else {
          sendThread.send(this,channel,message);
        }
      }
    }
 else {
      sendQueue.add(message);
    }
  }
 catch (  Exception e) {
    disconnect(false,new Object[]{"String_Node_Str"});
  }
}

Fixed version (ground truth):
@Override public void send(boolean upstream,boolean force,Message message){
  if (message == null) {
    return;
  }
  try {
    if (force || this.state == State.GAME) {
      if (channel.isOpen()) {
        NetworkSendThread sendThread=networkSendThread.get();
        if (sendThread == null) {
          channel.write(message);
        }
 else {
          sendThread.send(this,channel,message);
        }
      }
    }
 else {
      sendQueue.add(message);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    disconnect(false,new Object[]{"String_Node_Str"});
  }
}
Program: 177285
Project: 177285
Buggy source:
/** 
 * Adds a prioritized element to the queue
 * @param o
 */
public boolean add(T o){
  Long key=getKey(o.getPriority());
  RedirectableConcurrentLinkedQueue<T> queue=queueMap.get(key);
  if (queue == null) {
    queue=new RedirectableConcurrentLinkedQueue<T>(key);
    RedirectableConcurrentLinkedQueue<T> previous=queueMap.putIfAbsent(key,queue);
    if (previous != null) {
      queue=previous;
    }
  }
  return queue.add(o);
}

Fixed version (ground truth):
/** 
 * Adds a prioritized element to the queue
 * @param o
 */
public boolean add(T o){
  return addRaw(o);
}
Program: 177286
Project: 177286
Buggy source:
/** 
 * This method is used to add elements to the queue when redirecting.  It should not be used for other purposed.
 * @param e
 * @return
 */
public boolean redirect(T o){
  return add(o);
}

Fixed version (ground truth):
/** 
 * This method is used to add elements to the queue when redirecting.  It should not be used for other purposes.
 * @param e
 * @return
 */
public boolean redirect(T o){
  return addRaw(o);
}
Program: 177287
Project: 177287
Buggy source:
private ByteArrayArray getByteArrayArray(){
  int count=0;
  boolean interrupted=false;
  try {
    while (true) {
      ByteArrayArray baa=baaRef.get();
      if (baa != null) {
        if (!baa.isClosed()) {
          return baa;
        }
        baaRef.compareAndSet(baa,null);
        continue;
      }
      if (baaRef.compareAndSet(null,openInProgress)) {
        baa=null;
        try {
          try {
            baa=new SimpleRegionFile(file,segmentSize,entries,timeout);
          }
 catch (          ClosedByInterruptException e1) {
            interrupted|=Thread.interrupted();
            baa=null;
            continue;
          }
catch (          IOException e) {
            System.out.println("String_Node_Str" + file);
            baa=null;
          }
          return baa;
        }
  finally {
          if (!baaRef.compareAndSet(openInProgress,baa)) {
            throw new IllegalStateException("String_Node_Str");
          }
        }
      }
      count++;
      if (count > 10) {
        try {
          Thread.sleep(1);
        }
 catch (        InterruptedException e) {
        }
      }
 else       if (count > 0) {
        Thread.yield();
      }
    }
  }
  finally {
    if (interrupted) {
      Thread.currentThread().interrupt();
    }
  }
}

Fixed version (ground truth):
private ByteArrayArray getByteArrayArray(){
  int count=0;
  while (true) {
    ByteArrayArray baa=baaRef.get();
    if (baa != null) {
      if (!baa.isClosed()) {
        return baa;
      }
      baaRef.compareAndSet(baa,null);
      continue;
    }
    if (baaRef.compareAndSet(null,openInProgress)) {
      baa=null;
      try {
        try {
          baa=new SimpleRegionFile(file,segmentSize,entries,timeout);
        }
 catch (        IOException e) {
          e.printStackTrace();
          baa=null;
        }
        return baa;
      }
  finally {
        if (!baaRef.compareAndSet(openInProgress,baa)) {
          throw new IllegalStateException("String_Node_Str");
        }
      }
    }
    count++;
    if (count > 10) {
      try {
        Thread.sleep(1);
      }
 catch (      InterruptedException e) {
      }
    }
 else     if (count > 0) {
      Thread.yield();
    }
  }
}
Program: 177288
Project: 177288
Buggy source:
public MappedRandomAccessFile(File filePath,String permissions,int pageShift) throws FileNotFoundException {
  this.file=new RandomAccessFile(filePath,permissions);
  this.PAGE_SHIFT=pageShift;
  PAGE_SIZE=(1 << PAGE_SHIFT);
  PAGE_MASK=PAGE_SIZE - 1;
}

Fixed version (ground truth):
public MappedRandomAccessFile(File filePath,String permissions,int pageShift) throws FileNotFoundException {
  this.file=new RandomAccessFile(filePath,permissions);
  this.PAGE_SHIFT=pageShift;
  PAGE_SIZE=(1 << PAGE_SHIFT);
  PAGE_MASK=PAGE_SIZE - 1;
  this.filePath=filePath;
  this.permissions=permissions;
}
Program: 177289
Project: 177289
Buggy source:
private MappedByteBuffer getPage(int pageIndex) throws IOException {
  while (pageIndex >= pages.size()) {
    pages.add(null);
  }
  MappedByteBuffer page=pages.get(pageIndex);
  if (page == null) {
    long pagePosition=pageIndex << PAGE_SHIFT;
    page=file.getChannel().map(FileChannel.MapMode.READ_WRITE,pagePosition,PAGE_SIZE);
    pages.set(pageIndex,page);
  }
  return page;
}

Fixed version (ground truth):
private MappedByteBuffer getPage(int pageIndex) throws IOException {
  while (pageIndex >= pages.size()) {
    pages.add(null);
  }
  MappedByteBuffer page=pages.get(pageIndex);
  if (page == null) {
    long pagePosition=pageIndex << PAGE_SHIFT;
    boolean interrupted=false;
    boolean success=false;
    try {
      while (!success) {
        try {
          interrupted|=Thread.interrupted();
          page=file.getChannel().map(FileChannel.MapMode.READ_WRITE,pagePosition,PAGE_SIZE);
          success=true;
        }
 catch (        ClosedByInterruptException e) {
          file=new RandomAccessFile(filePath,permissions);
        }
catch (        IOException e) {
          throw new IOException("String_Node_Str" + filePath,e);
        }
      }
    }
  finally {
      if (interrupted) {
        Thread.currentThread().interrupt();
      }
    }
    pages.set(pageIndex,page);
  }
  return page;
}
Program: 177290
Project: 177290
Buggy source:
public void write(byte[] b,int off,int len) throws IOException {
  int pageIndex=(int)(pos >> PAGE_SHIFT);
  int offset=(int)(pos & PAGE_MASK);
  int endPageOne=Math.min(len + offset,PAGE_SIZE);
  MappedByteBuffer page=getPage(pageIndex);
  int j=0;
  int length=endPageOne - offset;
  page.position(offset);
  page.put(b,off + j,length);
  j+=length;
  while (len > j) {
    pageIndex++;
    page=getPage(pageIndex);
    page.position(0);
    if (len - j > PAGE_SIZE) {
      length=PAGE_SIZE;
    }
 else {
      length=len - j;
    }
    page.put(b,off + j,length);
    j+=length;
  }
  pos+=b.length;
}

Fixed version (ground truth):
public void write(byte[] b,int off,int len) throws IOException {
  int pageIndex=(int)(pos >> PAGE_SHIFT);
  int offset=(int)(pos & PAGE_MASK);
  int endPageOne=Math.min(len + offset,PAGE_SIZE);
  MappedByteBuffer page=getPage(pageIndex);
  int j=0;
  int length=endPageOne - offset;
  page.position(offset);
  page.put(b,off + j,length);
  j+=length;
  while (len > j) {
    pageIndex++;
    page=getPage(pageIndex);
    page.position(0);
    if (len - j > PAGE_SIZE) {
      length=PAGE_SIZE;
    }
 else {
      length=len - j;
    }
    page.put(b,off + j,length);
    j+=length;
  }
  pos+=len;
}
Program: 177291
Project: 177291
Buggy source:
/** 
 * Increments the lock counter.<br>
 * @return the number of blocks locked or FILE_CLOSED
 */
private int decrementLockCounter(){
  while (true) {
    int oldValue=this.lockCounter.get();
    if (oldValue == SimpleRegionFile.FILE_CLOSED) {
      return SimpleRegionFile.FILE_CLOSED;
    }
 else     if (oldValue <= 0) {
      throw new RuntimeException("String_Node_Str");
    }
    int newValue=oldValue - 1;
    if (this.lockCounter.compareAndSet(oldValue,newValue)) {
      return newValue;
    }
  }
}

Fixed version (ground truth):
/** 
 * Increments the lock counter.<br>
 * @return the number of blocks locked or FILE_CLOSED
 */
private int decrementLockCounter(){
  while (true) {
    int oldValue=this.lockCounter.get();
    int newValue=oldValue - 1;
    if (oldValue == SimpleRegionFile.FILE_CLOSED) {
      newValue=SimpleRegionFile.FILE_CLOSED;
    }
 else     if (oldValue <= 0) {
      throw new RuntimeException("String_Node_Str");
    }
    if (this.lockCounter.compareAndSet(oldValue,newValue)) {
      return newValue;
    }
  }
}
Program: 177292
Project: 177292
Buggy source:
public void updateBlockPhysics(int x,int y,int z,BlockMaterial oldMaterial){
  checkChunkLoaded();
  int rx=x & BLOCKS.MASK;
  int ry=y & BLOCKS.MASK;
  int rz=z & BLOCKS.MASK;
  rx+=(getX() & Region.CHUNKS.MASK) << BLOCKS.BITS;
  ry+=(getY() & Region.CHUNKS.MASK) << BLOCKS.BITS;
  rz+=(getZ() & Region.CHUNKS.MASK) << BLOCKS.BITS;
  physicsQueue.queueForUpdate(rx,ry,rz,null);
}

Fixed version (ground truth):
public void updateBlockPhysics(int x,int y,int z,BlockMaterial oldMaterial){
  checkChunkLoaded();
  int rx=x & BLOCKS.MASK;
  int ry=y & BLOCKS.MASK;
  int rz=z & BLOCKS.MASK;
  rx+=(getX() & Region.CHUNKS.MASK) << BLOCKS.BITS;
  ry+=(getY() & Region.CHUNKS.MASK) << BLOCKS.BITS;
  rz+=(getZ() & Region.CHUNKS.MASK) << BLOCKS.BITS;
  physicsQueue.queueForUpdate(rx,ry,rz,oldMaterial);
}
Program: 177293
Project: 177293
Buggy source:
private ByteArrayArray getByteArrayArray(){
  int count=0;
  boolean interrupted=false;
  try {
    while (true) {
      ByteArrayArray baa=baaRef.get();
      if (baa != null) {
        if (!baa.isClosed()) {
          return baa;
        }
        baaRef.compareAndSet(baa,null);
        continue;
      }
      if (baaRef.compareAndSet(null,openInProgress)) {
        try {
          try {
            baa=new SimpleRegionFile(file,segmentSize,entries,timeout);
          }
 catch (          ClosedByInterruptException e1) {
            interrupted|=Thread.interrupted();
            baaRef.compareAndSet(openInProgress,null);
            continue;
          }
catch (          IOException e) {
            System.out.println("String_Node_Str" + file);
            baaRef.compareAndSet(openInProgress,null);
          }
          return baa;
        }
  finally {
          if (!baaRef.compareAndSet(openInProgress,baa)) {
            throw new IllegalStateException("String_Node_Str");
          }
        }
      }
      count++;
      if (count > 10) {
        try {
          Thread.sleep(1);
        }
 catch (        InterruptedException e) {
        }
      }
 else       if (count > 0) {
        Thread.yield();
      }
    }
  }
  finally {
    if (interrupted) {
      Thread.currentThread().interrupt();
    }
  }
}

Fixed version (ground truth):
private ByteArrayArray getByteArrayArray(){
  int count=0;
  boolean interrupted=false;
  try {
    while (true) {
      ByteArrayArray baa=baaRef.get();
      if (baa != null) {
        if (!baa.isClosed()) {
          return baa;
        }
        baaRef.compareAndSet(baa,null);
        continue;
      }
      if (baaRef.compareAndSet(null,openInProgress)) {
        baa=null;
        try {
          try {
            baa=new SimpleRegionFile(file,segmentSize,entries,timeout);
          }
 catch (          ClosedByInterruptException e1) {
            interrupted|=Thread.interrupted();
            baa=null;
            continue;
          }
catch (          IOException e) {
            System.out.println("String_Node_Str" + file);
            baa=null;
          }
          return baa;
        }
  finally {
          if (!baaRef.compareAndSet(openInProgress,baa)) {
            throw new IllegalStateException("String_Node_Str");
          }
        }
      }
      count++;
      if (count > 10) {
        try {
          Thread.sleep(1);
        }
 catch (        InterruptedException e) {
        }
      }
 else       if (count > 0) {
        Thread.yield();
      }
    }
  }
  finally {
    if (interrupted) {
      Thread.currentThread().interrupt();
    }
  }
}