nus-yam/ex-repair huggingface dataset:
Program: 177342
Project: 177342
Buggy source:
protected void updateObserver(){
  final int viewDistance=getViewDistance() >> Chunk.BLOCKS.BITS;
  World w=getWorld();
  int cx=chunk.getLive().getX();
  int cy=chunk.getLive().getY();
  int cz=chunk.getLive().getZ();
  HashSet<SpoutChunk> observing=new HashSet<SpoutChunk>((viewDistance * viewDistance * viewDistance* 3) / 2);
  OutwardIterator oi=new OutwardIterator(cx,cy,cz,viewDistance);
  while (oi.hasNext()) {
    IntVector3 v=oi.next();
    Chunk chunk=w.getChunk(v.getX(),v.getY(),v.getZ(),LoadOption.LOAD_GEN);
    chunk.refreshObserver(this);
    observing.add((SpoutChunk)chunk);
  }
  observingChunks.removeAll(observing);
  for (  SpoutChunk chunk : observingChunks) {
    if (chunk.isLoaded()) {
      chunk.removeObserver(this);
    }
  }
  observingChunks.clear();
  observingChunks.addAll(observing);
}

Fixed version (ground truth):
protected void updateObserver(){
  final int viewDistance=getViewDistance() >> Chunk.BLOCKS.BITS;
  World w=getWorld();
  int cx=getChunkLive().getX();
  int cy=getChunkLive().getY();
  int cz=getChunkLive().getZ();
  HashSet<SpoutChunk> observing=new HashSet<SpoutChunk>((viewDistance * viewDistance * viewDistance* 3) / 2);
  OutwardIterator oi=new OutwardIterator(cx,cy,cz,viewDistance);
  while (oi.hasNext()) {
    IntVector3 v=oi.next();
    Chunk chunk=w.getChunk(v.getX(),v.getY(),v.getZ(),LoadOption.LOAD_GEN);
    chunk.refreshObserver(this);
    observing.add((SpoutChunk)chunk);
  }
  observingChunks.removeAll(observing);
  for (  SpoutChunk chunk : observingChunks) {
    if (chunk.isLoaded()) {
      chunk.removeObserver(this);
    }
  }
  observingChunks.clear();
  observingChunks.addAll(observing);
}
Program: 177343
Project: 177343
Buggy source:
public void finalizeRun(){
  if (entityManager.isDirty()) {
    entityManager.get().removeEntity(this);
    if (!isRemoved()) {
      entityManager.getLive().addEntity(this);
    }
  }
  if (isRemoved()) {
    removeObserver();
    for (    Component component : values()) {
      detach(component.getClass());
    }
  }
 else   if ((chunk.isDirty() && observer.getLive()) || observer.isDirty()) {
    updateObserver();
  }
}

Fixed version (ground truth):
public void finalizeRun(){
  if (isRemoved()) {
    removeObserver();
    for (    Component component : values()) {
      detach(component.getClass());
    }
    return;
  }
  Chunk chunk=getChunk();
  SpoutChunk chunkLive=(SpoutChunk)getChunkLive();
  if (chunk.getRegion() != chunkLive.getRegion()) {
    entityManager.get().removeEntity(this);
    if (!isRemoved()) {
      entityManager.set(chunkLive.getRegion().getEntityManager());
      entityManager.getLive().addEntity(this);
    }
  }
  if ((chunk != chunkLive && observer.getLive()) || observer.isDirty()) {
    updateObserver();
  }
}
Program: 177344
Project: 177344
Buggy source:
/** 
 * Prevents stack overflow when creating an entity during chunk loading due to circle of calls
 */
public void setupInitialChunk(Transform transform){
  Chunk getChunk=transform.getPosition().getWorld().getChunkFromBlock(transform.getPosition());
  chunk.set(getChunk);
  SpoutRegion region=(SpoutRegion)getChunk.getRegion();
  entityManager.set(region.getEntityManager());
}

Fixed version (ground truth):
/** 
 * Prevents stack overflow when creating an entity during chunk loading due to circle of calls
 */
public void setupInitialChunk(Transform transform){
  SpoutRegion region=(SpoutRegion)getChunkLive().getRegion();
  entityManager.set(region.getEntityManager());
}
Program: 177345
Project: 177345
Buggy source:
@Override public Chunk getChunk(){
  return chunk.get();
}

Fixed version (ground truth):
@Override public Chunk getChunk(){
  return getTransform().getPosition().getChunk(LoadOption.NO_LOAD);
}
Program: 177346
Project: 177346
Buggy source:
@DelayedWrite public boolean connect(SpoutSession<?> session,Transform newTransform){
  if (!onlineLive.compareAndSet(false,true)) {
    return false;
  }
  if (newTransform == null || newTransform.getPosition().getWorld() == null) {
    return false;
  }
  setupInitialChunk(newTransform);
  getTransform().setTransform(newTransform);
  sessionLive.set(session);
  copySnapshot();
  return true;
}

Fixed version (ground truth):
@DelayedWrite public boolean connect(SpoutSession<?> session,Transform newTransform){
  if (!onlineLive.compareAndSet(false,true)) {
    return false;
  }
  if (newTransform == null || newTransform.getPosition().getWorld() == null) {
    return false;
  }
  getTransform().setTransform(newTransform);
  setupInitialChunk(newTransform);
  sessionLive.set(session);
  copySnapshot();
  return true;
}
Program: 177347
Project: 177347
Buggy source:
private Iterator<Point> attemptSendChunk(Iterator<Point> i,Iterable<Point> queue,Chunk c){
  if (c.canSend()) {
    Collection<Chunk> sent=sendChunk(c);
    activeChunks.add(c.getBase());
    i.remove();
    if (sent != null) {
      boolean updated=false;
      for (      Chunk s : sent) {
        Point base=s.getBase();
        if (priorityChunkSendQueue.remove(base) || chunkSendQueue.remove(base)) {
          updated=true;
          activeChunks.add(base);
          chunksSent++;
        }
      }
      if (updated) {
        i=queue.iterator();
      }
    }
    chunksSent++;
  }
  return i;
}

Fixed version (ground truth):
private Iterator<Point> attemptSendChunk(Iterator<Point> i,Iterable<Point> queue,Chunk c){
  if (c.canSend()) {
    Collection<Chunk> sent=sendChunk(c);
    activeChunks.add(c.getBase());
    i.remove();
    if (sent != null) {
      boolean updated=false;
      for (      Chunk s : sent) {
        Point base=s.getBase();
        if (priorityChunkSendQueue.remove(base) || chunkSendQueue.remove(base)) {
          updated=true;
          if (initializedChunks.contains(base)) {
            activeChunks.add(base);
          }
          chunksSent++;
        }
      }
      if (updated) {
        i=queue.iterator();
      }
    }
    chunksSent++;
  }
  return i;
}
Program: 177348
Project: 177348
Buggy source:
@Override public World getWorld(){
  return getTransform().getPosition().getWorld();
}

Fixed version (ground truth):
@Override public World getWorld(){
  return entityManager.getRegion().getWorld();
}
Program: 177349
Project: 177349
Buggy source:
public SpoutPlayer(String name,Transform transform,int viewDistance){
  super(transform,viewDistance);
  this.name=name;
  displayName.set(name);
  hashcode=name.hashCode();
}

Fixed version (ground truth):
public SpoutPlayer(String name,Transform transform,int viewDistance){
  super(transform,viewDistance);
  this.name=name;
  displayName.set(name);
  hashcode=name.hashCode();
  this.setObserver(true);
}
Program: 177350
Project: 177350
Buggy source:
public Player addPlayer(String playerName,SpoutSession<?> session,int viewDistance){
  SpoutPlayer player=new SpoutPlayer(playerName,null,viewDistance);
  players.putIfAbsent(playerName,player);
  return player;
}

Fixed version (ground truth):
public Player addPlayer(String playerName,SpoutSession<?> session,int viewDistance){
  SpoutPlayer player=new SpoutPlayer(playerName,null,viewDistance);
  players.put(playerName,player);
  player.connect(session,getDefaultWorld().getSpawnPoint());
  getDefaultWorld().spawnEntity(player);
  session.setPlayer(player);
  session.getProtocol().initializeSession(session);
  return player;
}
Program: 177351
Project: 177351
Buggy source:
/** 
 * Finalizes the manager at the FINALIZERUN tick stage
 */
public void finalizeRun(){
  for (  SpoutEntity e : entities.get().values()) {
    e.finalizeRun();
    if (e instanceof Player) {
      Player p=(Player)e;
      if (p.isOnline()) {
        p.getNetworkSynchronizer().finalizeTick();
      }
    }
    if (e.isRemoved()) {
      removeEntity(e);
    }
  }
}

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);
      return;
    }
    e.finalizeRun();
    if (e instanceof Player) {
      Player p=(Player)e;
      if (p.isOnline()) {
        p.getNetworkSynchronizer().finalizeTick();
      }
    }
  }
}
Program: 177352
Project: 177352
Buggy source:
/** 
 * Syncs all entities/observers in this region
 */
public void syncEntities(){
  Map<Player,ArrayList<SpoutEntity>> toSync=players.get();
  Collection<SpoutEntity> allEntities=getAll();
  for (  Player player : toSync.keySet()) {
    if (!player.isOnline()) {
      continue;
    }
    Integer playerViewDistance=player.getViewDistance();
    NetworkSynchronizer net=player.getNetworkSynchronizer();
    ArrayList<SpoutEntity> entitiesPerPlayer=toSync.get(player);
    boolean spawn, destroy, update;
    for (    SpoutEntity entity : allEntities) {
      if (entity.equals(player)) {
        continue;
      }
      boolean contains=entitiesPerPlayer.contains(entity);
      spawn=destroy=update=false;
      if (MathHelper.distance(player.getTransform().getPosition(),entity.getTransform().getPosition()) <= playerViewDistance) {
        if (!contains) {
          entitiesPerPlayer.add(entity);
          spawn=true;
        }
 else         if (entity.isRemoved()) {
          destroy=entitiesPerPlayer.remove(entity);
        }
 else {
          update=true;
        }
      }
 else {
        destroy=entitiesPerPlayer.remove(entity);
      }
      net.syncEntity(entity,spawn,destroy,update);
    }
  }
}

Fixed version (ground truth):
/** 
 * Syncs all entities/observers in this region
 */
public void syncEntities(){
  Map<Player,ArrayList<SpoutEntity>> toSync=players.get();
  for (  Player player : toSync.keySet()) {
    if (!player.isOnline()) {
      continue;
    }
    Integer playerViewDistance=player.getViewDistance();
    NetworkSynchronizer net=player.getNetworkSynchronizer();
    ArrayList<SpoutEntity> entitiesPerPlayer=toSync.get(player);
    boolean spawn, destroy, update;
    for (    SpoutEntity entity : getAllLive()) {
      if (entity.equals(player)) {
        continue;
      }
      boolean contains=entitiesPerPlayer.contains(entity);
      spawn=destroy=update=false;
      if (MathHelper.distance(player.getTransform().getPosition(),entity.getTransform().getPosition()) <= playerViewDistance) {
        if (!contains) {
          entitiesPerPlayer.add(entity);
          spawn=true;
        }
 else         if (entity.isRemoved()) {
          destroy=entitiesPerPlayer.remove(entity);
        }
 else {
          update=true;
        }
      }
 else {
        destroy=entitiesPerPlayer.remove(entity);
      }
      net.syncEntity(entity,spawn,destroy,update);
    }
  }
}
Program: 177353
Project: 177353
Buggy source:
/** 
 * Deallocates the id for an entity.
 * @param entity The entity.
 */
public void deallocate(SpoutEntity entity){
  entities.remove(entity.getId());
  if (entity instanceof Player) {
    entity.setId(SpoutEntity.NOTSPAWNEDID);
  }
}

Fixed version (ground truth):
/** 
 * Deallocates the id for an entity.
 * @param entity The entity.
 */
public void deallocate(SpoutEntity entity){
  entities.remove(entity.getId());
}
Program: 177354
Project: 177354
Buggy source:
/** 
 * Adds an entity to the manager.
 * @param entity The entity
 */
public void addEntity(SpoutEntity entity){
  allocate(entity);
  if (entity instanceof Player) {
    players.putIfAbsent((Player)entity,new ArrayList<SpoutEntity>());
  }
}

Fixed version (ground truth):
/** 
 * Adds an entity to the manager.
 * @param entity The entity
 */
public void addEntity(SpoutEntity entity){
  allocate(entity);
  if (entity instanceof Player) {
    players.put((Player)entity,new ArrayList<SpoutEntity>());
  }
}
Program: 177355
Project: 177355
Buggy source:
@Override @DelayedWrite public void remove(){
  removeLive.getAndSet(true);
}

Fixed version (ground truth):
@Override @DelayedWrite public void remove(){
  removeLive.set(true);
}
Program: 177356
Project: 177356
Buggy source:
@Override @DelayedWrite public void setSavable(boolean savable){
  saveLive.getAndSet(savable);
}

Fixed version (ground truth):
@Override @DelayedWrite public void setSavable(boolean savable){
  saveLive.set(savable);
}
Program: 177357
Project: 177357
Buggy source:
/** 
 * Prevents stack overflow when creating an entity during chunk loading due to circle of calls
 */
public void setupInitialChunk(Transform transform){
  chunkLive.set(transform.getPosition().getWorld().getChunkFromBlock(transform.getPosition()));
  entityManagerLive.set(((SpoutRegion)chunkLive.get().getRegion()).getEntityManager());
}

Fixed version (ground truth):
/** 
 * Prevents stack overflow when creating an entity during chunk loading due to circle of calls
 */
public void setupInitialChunk(Transform transform){
  Chunk chunk=transform.getPosition().getWorld().getChunkFromBlock(transform.getPosition());
  this.chunk=chunk;
  chunkLive.set(chunk);
  SpoutRegion region=(SpoutRegion)chunkLive.get().getRegion();
  this.entityManager=region.getEntityManager();
  entityManagerLive.set(region.getEntityManager());
}
Program: 177358
Project: 177358
Buggy source:
@DelayedWrite public boolean disconnect(){
  if (!onlineLive.compareAndSet(true,false)) {
    return false;
  }
  sessionLive.set(null);
  this.remove();
  return true;
}

Fixed version (ground truth):
@DelayedWrite public boolean disconnect(){
  sessionLive.set(null);
  this.remove();
  return true;
}
Program: 177359
Project: 177359
Buggy source:
@EventHandler(order=Order.MONITOR) public void onPlayerConnect(PlayerConnectEvent event){
  if (event.isCancelled()) {
    return;
  }
  final SpoutPlayer player=(SpoutPlayer)server.addPlayer(event.getPlayerName(),(SpoutSession<?>)event.getSession(),event.getViewDistance());
  if (player != null) {
    server.getEventManager().callEvent(new PlayerLoadEvent(player));
    World defaultWorld=Spout.getEngine().getDefaultWorld();
    player.connect((SpoutSession<?>)event.getSession(),defaultWorld.getSpawnPoint());
    defaultWorld.spawnEntity(player);
    ((SpoutSession<?>)event.getSession()).setPlayer(player);
    event.getSession().getProtocol().initializeSession(event.getSession());
    PlayerLoginEvent loginEvent=server.getEventManager().callEvent(new PlayerLoginEvent(player));
    if (!loginEvent.isAllowed()) {
      if (loginEvent.getMessage() != null) {
        player.kick(loginEvent.getMessage());
      }
 else {
        player.kick();
      }
    }
 else {
      server.getEventManager().callEvent(new PlayerJoinEvent(player,ChatStyle.CYAN,player.getDisplayName(),ChatStyle.CYAN,"String_Node_Str"));
    }
  }
 else {
    event.getSession().disconnect("String_Node_Str");
  }
}

Fixed version (ground truth):
@EventHandler(order=Order.MONITOR) public void onPlayerConnect(PlayerConnectEvent event){
  if (event.isCancelled()) {
    return;
  }
  final SpoutPlayer player=(SpoutPlayer)server.addPlayer(event.getPlayerName(),(SpoutSession<?>)event.getSession(),event.getViewDistance());
  if (player != null) {
    server.getEventManager().callEvent(new PlayerLoadEvent(player));
    PlayerLoginEvent loginEvent=server.getEventManager().callEvent(new PlayerLoginEvent(player));
    if (!loginEvent.isAllowed()) {
      if (loginEvent.getMessage() != null) {
        player.kick(loginEvent.getMessage());
      }
 else {
        player.kick();
      }
    }
 else {
      server.getEventManager().callEvent(new PlayerJoinEvent(player,ChatStyle.CYAN,player.getDisplayName(),ChatStyle.CYAN,"String_Node_Str"));
    }
  }
 else {
    event.getSession().disconnect("String_Node_Str");
  }
}
Program: 177360
Project: 177360
Buggy source:
public void dispose(PlayerLeaveEvent leaveEvent){
  SpoutPlayer player;
  if ((player=this.player.getAndSet(null)) != null) {
    if (!leaveEvent.hasBeenCalled()) {
      getEngine().getEventManager().callEvent(leaveEvent);
    }
    ChatArguments text=leaveEvent.getMessage();
    if (text != null && text.getArguments().size() > 0) {
      getEngine().broadcastMessage(text);
    }
    player.save();
    try {
      player.remove();
      player.disconnect();
    }
 catch (    Exception e) {
      Spout.getLogger().log(Level.WARNING,"String_Node_Str" + player.getName() + "String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
public void dispose(PlayerLeaveEvent leaveEvent){
  SpoutPlayer player;
  if ((player=this.player.getAndSet(null)) != null) {
    if (!leaveEvent.hasBeenCalled()) {
      getEngine().getEventManager().callEvent(leaveEvent);
    }
    ChatArguments text=leaveEvent.getMessage();
    if (text != null && text.getArguments().size() > 0) {
      getEngine().broadcastMessage(text);
    }
    player.save();
    try {
      player.disconnect();
    }
 catch (    Exception e) {
      Spout.getLogger().log(Level.WARNING,"String_Node_Str" + player.getName() + "String_Node_Str",e);
    }
  }
}
Program: 177362
Project: 177362
Buggy source:
/** 
 * Spawns an entity into the world. Fires off a cancellable EntitySpawnEvent
 */
@Override public void spawnEntity(Entity e){
  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)) {
    EntitySpawnEvent event=Spout.getEventManager().callEvent(new EntitySpawnEvent(e,e.getTransform().getPosition()));
    if (event.isCancelled()) {
      return;
    }
    region.addEntity(e);
  }
 else {
    throw new IllegalStateException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Spawns an entity into the world. Fires off a cancellable EntitySpawnEvent
 */
@Override public void spawnEntity(Entity e){
  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)) {
    EntitySpawnEvent event=Spout.getEventManager().callEvent(new EntitySpawnEvent(e,e.getTransform().getPosition()));
    if (event.isCancelled()) {
      return;
    }
    region.getEntityManager().addEntity((SpoutEntity)e);
  }
 else {
    throw new IllegalStateException("String_Node_Str");
  }
}
Program: 177363
Project: 177363
Buggy source:
@Override public <T extends Component>T add(Class<T> type){
  if (type == null) {
    return null;
  }
  @SuppressWarnings("String_Node_Str") T component=(T)components.get(type);
  if (component == null) {
    try {
      component=type.newInstance();
    }
 catch (    InstantiationException e) {
      e.printStackTrace();
    }
catch (    IllegalAccessException e) {
      e.printStackTrace();
    }
  }
  return component;
}

Fixed version (ground truth):
@Override public <T extends Component>T add(Class<T> type){
  if (type == null) {
    return null;
  }
  @SuppressWarnings("String_Node_Str") T component=(T)components.get(type);
  if (component == null) {
    try {
      component=type.newInstance();
    }
 catch (    InstantiationException e) {
      e.printStackTrace();
    }
catch (    IllegalAccessException e) {
      e.printStackTrace();
    }
  }
  if (component != null) {
    if (component.attachTo(this)) {
      components.put(type,component);
    }
  }
  return component;
}
Program: 177365
Project: 177365
Buggy source:
public JLineConsole(SpoutEngine engine){
  this.engine=engine;
  setDateFormat(new SimpleDateFormat("String_Node_Str"));
  try {
    reader=new ConsoleReader();
    writer=new OutputStreamWriter(AnsiConsole.out);
  }
 catch (  IOException e) {
    throw new ExceptionInInitializerError(e);
  }
  @SuppressWarnings("String_Node_Str") final Collection<Completor> completors=reader.getCompletors();
  for (  Completor c : new ArrayList<Completor>(completors)) {
    reader.removeCompletor(c);
  }
  Completor[] list=new Completor[]{new SpoutCommandCompletor(engine),new NullCompletor()};
  reader.addCompletor(new ArgumentCompletor(list));
}

Fixed version (ground truth):
public JLineConsole(SpoutEngine engine){
  JansiStyleHandler.INSTANCE.getFormatters();
  this.engine=engine;
  setDateFormat(new SimpleDateFormat("String_Node_Str"));
  try {
    reader=new ConsoleReader();
    writer=new OutputStreamWriter(AnsiConsole.out);
  }
 catch (  IOException e) {
    throw new ExceptionInInitializerError(e);
  }
  @SuppressWarnings("String_Node_Str") final Collection<Completor> completors=reader.getCompletors();
  for (  Completor c : new ArrayList<Completor>(completors)) {
    reader.removeCompletor(c);
  }
  Completor[] list=new Completor[]{new SpoutCommandCompletor(engine),new NullCompletor()};
  reader.addCompletor(new ArgumentCompletor(list));
}
Program: 177366
Project: 177366
Buggy source:
@Override protected void initImpl(){
  ConsoleCommandThread commandThread=new ConsoleCommandThread();
  commandThread.setDaemon(true);
  commandThread.start();
}

Fixed version (ground truth):
@Override protected void initImpl(){
  ConsoleCommandThread commandThread=new ConsoleCommandThread();
  commandThread.start();
}
Program: 177367
Project: 177367
Buggy source:
public ConsoleCommandThread(){
  super("String_Node_Str");
}

Fixed version (ground truth):
public ConsoleCommandThread(){
  super("String_Node_Str");
  setDaemon(true);
}
Program: 177368
Project: 177368
Buggy source:
@Override public WorldComponent addComponent(Component component){
  Class<? extends Component> clazz=component.getClass();
  if (hasComponent(clazz)) {
    return (WorldComponent)getComponent(clazz);
  }
  components.put(clazz,component);
  component.attachTo(this);
  component.onAttached();
  return (WorldComponent)component;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public <T extends Component>T addComponent(Component component){
  if (component.attachTo(this)) {
    Class<? extends Component> clazz=component.getClass();
    if (hasComponent(clazz)) {
      return (T)getComponent(clazz);
    }
    components.put(clazz,component);
    component.onAttached();
    return (T)component;
  }
 else {
    return null;
  }
}
Program: 177369
Project: 177369
Buggy source:
@Override public WorldComponent getComponent(Class<? extends Component> aClass){
  for (  Class<? extends Component> c : components.keySet()) {
    if (aClass.isAssignableFrom(c))     return (WorldComponent)components.get(c);
  }
  return null;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public <T extends Component>T getComponent(Class<? extends Component> aClass){
  for (  Class<? extends Component> c : components.keySet()) {
    if (aClass.isAssignableFrom(c))     return (T)components.get(c);
  }
  return null;
}
Program: 177370
Project: 177370
Buggy source:
@Override public boolean attachTo(ComponentHolder holder){
  if (holder instanceof Entity) {
    super.attachTo(holder);
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean attachTo(ComponentHolder holder){
  if (holder instanceof Entity) {
    return super.attachTo(holder);
  }
 else {
    return false;
  }
}
Program: 177371
Project: 177371
Buggy source:
@Override public void attachTo(ComponentHolder<?> holder){
  this.holder=holder;
}

Fixed version (ground truth):
@Override public boolean attachTo(ComponentHolder holder){
  this.holder=holder;
  return true;
}
Program: 177372
Project: 177372
Buggy source:
@Override public ComponentHolder<?> getHolder(){
  return holder;
}

Fixed version (ground truth):
@Override public ComponentHolder getHolder(){
  return holder;
}
Program: 177373
Project: 177373
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public T addComponent(Component component){
  Class<? extends Component> clazz=component.getClass();
  if (hasComponent(clazz)) {
    return (T)getComponent(clazz);
  }
  components.put(clazz,component);
  component.attachTo(this);
  component.onAttached();
  return (T)component;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public <T extends Component>T addComponent(Component component){
  if (component.attachTo(this)) {
    Class<? extends Component> clazz=component.getClass();
    if (hasComponent(clazz)) {
      return (T)getComponent(clazz);
    }
    components.put(clazz,component);
    component.onAttached();
    return (T)component;
  }
 else {
    return null;
  }
}
Program: 177374
Project: 177374
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public T getComponent(Class<? extends Component> aClass){
  for (  Class<? extends Component> c : components.keySet()) {
    if (aClass.isAssignableFrom(c))     return (T)components.get(c);
  }
  return null;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public <T extends Component>T getComponent(Class<? extends Component> aClass){
  for (  Class<? extends Component> c : components.keySet()) {
    if (aClass.isAssignableFrom(c))     return (T)components.get(c);
  }
  return null;
}
Program: 177375
Project: 177375
Buggy source:
/** 
 * Attaches to a component holder.
 * @param holder The component holder to attach to
 */
public void attachTo(ComponentHolder<?> holder);

Fixed version (ground truth):
/** 
 * Attaches to a component holder.
 * @param holder The component holder to attach to
 */
public boolean attachTo(ComponentHolder holder);
Program: 177376
Project: 177376
Buggy source:
/** 
 * Gets the component holder holding this component.
 * @return the component holder
 */
public ComponentHolder<?> getHolder();

Fixed version (ground truth):
/** 
 * Gets the component holder holding this component.
 * @return the component holder
 */
public ComponentHolder getHolder();
Program: 177377
Project: 177377
Buggy source:
/** 
 * Adds a new component to the holder.  If the holder already contains a component of that type, then a new component is not constructed, and the one already attached is returned
 * @param component the component to be added
 * @return The component created, or the one already attached
 */
public T addComponent(Component component);

Fixed version (ground truth):
/** 
 * Adds a new component to the holder.  If the holder already contains a component of that type, then a new component is not constructed, and the one already attached is returned
 * @param component the component to be added
 * @return The component created, or the one already attached
 */
public <T extends Component>T addComponent(Component component);
Program: 177378
Project: 177378
Buggy source:
/** 
 * Returns the first component that is assignable from the given class, or null if it doesn't exist
 * @param component the type of component to get
 * @return The component instance, or null if it doesn't exist
 */
public T getComponent(Class<? extends Component> component);

Fixed version (ground truth):
/** 
 * Returns the first component that is assignable from the given class, or null if it doesn't exist
 * @param component the type of component to get
 * @return The component instance, or null if it doesn't exist
 */
public <T extends Component>T getComponent(Class<? extends Component> component);
Program: 177379
Project: 177379
Buggy source:
public void render(float dt){
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  Vector3 currentPlayerPos=new Vector3(activePlayer.getTransform().getPosition().getBlockX(),activePlayer.getTransform().getPosition().getBlockY(),activePlayer.getTransform().getPosition().getBlockZ());
  activeCamera=new CameraComponent(MathHelper.createPerspective(75,aspectRatio,0.001f,1000),MathHelper.createLookAt(currentPlayerPos,currentPlayerPos.add(activePlayer.getTransform().copy().forwardVector().normalize().add(5,5,5)),Vector3.UP));
  activeCamera.getFrustum().update(activeCamera.getProjection(),activeCamera.getView());
  Transform loc=new Transform(new Point(null,0f,0f,0f),Quaternion.IDENTITY,Vector3.ONE);
  mat.getShader().setUniform("String_Node_Str",activeCamera.getView());
  mat.getShader().setUniform("String_Node_Str",activeCamera.getProjection());
  mat.getShader().setUniform("String_Node_Str",loc.toMatrix());
  renderer.draw(mat);
}

Fixed version (ground truth):
public void render(float dt){
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  Vector3 currentPlayerPos=new Vector3(activePlayer.getTransform().getPosition().getBlockX(),activePlayer.getTransform().getPosition().getBlockY(),activePlayer.getTransform().getPosition().getBlockZ());
  activeCamera=new CameraComponent(MathHelper.createPerspective(75,aspectRatio,0.001f,1000),MathHelper.createLookAt(currentPlayerPos,currentPlayerPos.add(activePlayer.getTransform().getTransform().forwardVector().normalize().add(5,5,5)),Vector3.UP));
  activeCamera.getFrustum().update(activeCamera.getProjection(),activeCamera.getView());
  Transform loc=new Transform(new Point(null,0f,0f,0f),Quaternion.IDENTITY,Vector3.ONE);
  mat.getShader().setUniform("String_Node_Str",activeCamera.getView());
  mat.getShader().setUniform("String_Node_Str",activeCamera.getProjection());
  mat.getShader().setUniform("String_Node_Str",loc.toMatrix());
  renderer.draw(mat);
}
Program: 177380
Project: 177380
Buggy source:
@Override protected void removeObserver(){
  getNetworkSynchronizer().onDeath();
}

Fixed version (ground truth):
@Override protected void removeObserver(){
  getNetworkSynchronizer().onRemoved();
}
Program: 177381
Project: 177381
Buggy source:
@DelayedWrite public boolean connect(SpoutSession<?> session,Transform newPosition){
  if (!onlineLive.compareAndSet(false,true)) {
    return false;
  }
  if (newPosition != null) {
    setTransform(newPosition);
  }
  final Transform transform=getTransform();
  if (newPosition != null && transform != null && !this.isSpawned()) {
    setupInitialChunk(transform);
  }
  sessionLive.set(session);
  copySnapshot();
  justSpawned=true;
  return true;
}

Fixed version (ground truth):
@DelayedWrite public boolean connect(SpoutSession<?> session,Transform newPosition){
  if (!onlineLive.compareAndSet(false,true)) {
    return false;
  }
  if (newPosition != null) {
    getTransform().setTransform(newPosition);
  }
  final Transform transform=getTransform().copy();
  if (newPosition != null && transform != null && !this.isSpawned()) {
    setupInitialChunk(transform);
  }
  sessionLive.set(session);
  copySnapshot();
  justSpawned=true;
  return true;
}
Program: 177382
Project: 177382
Buggy source:
@Override public void sendMessage(SendMode sendMode,Protocol protocol,Message... messages){
  if (sendMode.canSendToSelf() && this.getSession().getProtocol().equals(protocol)) {
    getSession().sendAll(false,messages);
  }
}

Fixed version (ground truth):
@Override public boolean sendMessage(ChatArguments message){
  return sendRawMessage(message);
}
Program: 177383
Project: 177383
Buggy source:
public void dispose(PlayerLeaveEvent leaveEvent){
  SpoutPlayer player;
  if ((player=this.player.getAndSet(null)) != null) {
    if (!leaveEvent.hasBeenCalled()) {
      getEngine().getEventManager().callEvent(leaveEvent);
    }
    ChatArguments text=leaveEvent.getMessage();
    if (text != null && text.getArguments().size() > 0) {
      getEngine().broadcastMessage(text);
    }
    PlayerSaveEvent saveEvent=getEngine().getEventManager().callEvent(new PlayerSaveEvent(player));
    if (!saveEvent.isSaved()) {
    }
    try {
      player.kill();
      player.disconnect();
    }
 catch (    Exception ignore) {
    }
  }
}

Fixed version (ground truth):
public void dispose(PlayerLeaveEvent leaveEvent){
  SpoutPlayer player;
  if ((player=this.player.getAndSet(null)) != null) {
    if (!leaveEvent.hasBeenCalled()) {
      getEngine().getEventManager().callEvent(leaveEvent);
    }
    ChatArguments text=leaveEvent.getMessage();
    if (text != null && text.getArguments().size() > 0) {
      getEngine().broadcastMessage(text);
    }
    PlayerSaveEvent saveEvent=getEngine().getEventManager().callEvent(new PlayerSaveEvent(player));
    if (!saveEvent.isSaved()) {
    }
    try {
      player.remove();
      player.disconnect();
    }
 catch (    Exception ignore) {
    }
  }
}
Program: 177384
Project: 177384
Buggy source:
@Override public void handleClient(Session session,AddEntityMessage message){
  if (!session.hasPlayer()) {
    return;
  }
  System.out.println("String_Node_Str" + message.getEntityId() + "String_Node_Str"+ message.getType().getName());
  Player player=session.getPlayer();
  Entity newEntity;
  if (message.getEntityId() == session.getDataMap().get(SpoutProtocol.PLAYER_ENTITY_ID)) {
    newEntity=player;
  }
 else {
    newEntity=session.getEngine().getDefaultWorld().createEntity(message.getTransform().getPosition(),null);
  }
  Controller controller=message.getType().createController();
  if (controller == null) {
    throw new IllegalArgumentException("String_Node_Str" + message.getType().getName() + "String_Node_Str");
  }
  newEntity.setController(controller);
  newEntity.setTransform(message.getTransform());
  ((Client)session.getEngine()).getDefaultWorld().spawnEntity(newEntity);
}

Fixed version (ground truth):
@Override public void handleClient(Session session,AddEntityMessage message){
  if (!session.hasPlayer()) {
    return;
  }
  System.out.println("String_Node_Str" + message.getEntityId() + "String_Node_Str"+ message.getType().getName());
  Player player=session.getPlayer();
  Entity newEntity;
  if (message.getEntityId() == session.getDataMap().get(SpoutProtocol.PLAYER_ENTITY_ID)) {
    newEntity=player;
  }
 else {
    newEntity=session.getEngine().getDefaultWorld().createEntity(message.getTransform().getPosition());
  }
  newEntity.getTransform().setTransform(message.getTransform());
  ((Client)session.getEngine()).getDefaultWorld().spawnEntity(newEntity);
}
Program: 177385
Project: 177385
Buggy source:
@Override public void handleClient(Session session,RemoveEntityMessage message){
  if (!session.hasPlayer()) {
    return;
  }
  Entity entity=session.getPlayer().getWorld().getEntity(message.getEntityId());
  if (entity != null) {
    entity.kill();
  }
}

Fixed version (ground truth):
@Override public void handleClient(Session session,RemoveEntityMessage message){
  if (!session.hasPlayer()) {
    return;
  }
  Entity entity=session.getPlayer().getWorld().getEntity(message.getEntityId());
  if (entity != null) {
    entity.remove();
  }
}
Program: 177386
Project: 177386
Buggy source:
/** 
 * Removes a chunk from the region and indicates if the region is empty
 * @param c the chunk to remove
 * @return true if the region is now empty
 */
public boolean removeChunk(Chunk c){
  TickStage.checkStage(TickStage.SNAPSHOT,executionThread);
  if (c.getRegion() != this) {
    return false;
  }
  AtomicReference<SpoutChunk> current=chunks[c.getX() & CHUNKS.MASK][c.getY() & CHUNKS.MASK][c.getZ() & CHUNKS.MASK];
  SpoutChunk currentChunk=current.get();
  if (currentChunk != c) {
    return false;
  }
  boolean success=current.compareAndSet(currentChunk,null);
  if (success) {
    int num=numberActiveChunks.decrementAndGet();
    for (    Entity e : currentChunk.getLiveEntities()) {
      e.kill();
    }
    currentChunk.setUnloaded();
    occupiedChunksQueue.remove(currentChunk);
    occupiedChunks.remove(currentChunk);
    populationQueue.remove(currentChunk);
    dirtyChunks.remove(currentChunk);
    removeDynamicBlockUpdates(currentChunk);
    if (num == 0) {
      return true;
    }
 else     if (num < 0) {
      throw new IllegalStateException("String_Node_Str");
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Removes a chunk from the region and indicates if the region is empty
 * @param c the chunk to remove
 * @return true if the region is now empty
 */
public boolean removeChunk(Chunk c){
  TickStage.checkStage(TickStage.SNAPSHOT,executionThread);
  if (c.getRegion() != this) {
    return false;
  }
  AtomicReference<SpoutChunk> current=chunks[c.getX() & CHUNKS.MASK][c.getY() & CHUNKS.MASK][c.getZ() & CHUNKS.MASK];
  SpoutChunk currentChunk=current.get();
  if (currentChunk != c) {
    return false;
  }
  boolean success=current.compareAndSet(currentChunk,null);
  if (success) {
    int num=numberActiveChunks.decrementAndGet();
    for (    Entity e : currentChunk.getLiveEntities()) {
      e.remove();
    }
    currentChunk.setUnloaded();
    occupiedChunksQueue.remove(currentChunk);
    occupiedChunks.remove(currentChunk);
    populationQueue.remove(currentChunk);
    dirtyChunks.remove(currentChunk);
    removeDynamicBlockUpdates(currentChunk);
    if (num == 0) {
      return true;
    }
 else     if (num < 0) {
      throw new IllegalStateException("String_Node_Str");
    }
  }
  return false;
}
Program: 177387
Project: 177387
Buggy source:
@Override public void setBlockController(int x,int y,int z,BlockController controller){
  Vector3 pos=new Vector3(x,y,z);
  Entity entity=this.entityManager.getBlockEntities().get(pos);
  if (entity != null) {
    if (controller != null) {
      entity.setController(controller);
    }
 else {
      entity.kill();
    }
  }
 else   if (controller != null) {
    this.getWorld().createAndSpawnEntity(new Point(pos,getWorld()),controller);
  }
}

Fixed version (ground truth):
@Override public void setBlockController(int x,int y,int z,BlockController controller){
  Vector3 pos=new Vector3(x,y,z);
  Entity entity=this.entityManager.getBlockEntities().get(pos);
  if (entity != null) {
    if (controller != null) {
      entity.setController(controller);
    }
 else {
      entity.remove();
    }
  }
 else   if (controller != null) {
    this.getWorld().createAndSpawnEntity(new Point(pos,getWorld()),controller);
  }
}
Program: 177389
Project: 177389
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 (      Entity entity : getPlayers()) {
        syncChunkToPlayers(spoutChunk,entity);
      }
      processChunkUpdatedEvent(spoutChunk);
      spoutChunk.resetDirtyArrays();
      spoutChunk.setLightDirty(false);
    }
  }
  SpoutChunkSnapshotFuture snapshotFuture;
  while ((snapshotFuture=snapshotQueue.poll()) != null) {
    snapshotFuture.run();
  }
  Iterator<SpoutChunk> itr=occupiedChunks.iterator();
  int cx, cy, cz;
  entityManager.syncEntities();
  while (itr.hasNext()) {
    SpoutChunk c=itr.next();
    cx=c.getX() & CHUNKS.MASK;
    cy=c.getY() & CHUNKS.MASK;
    cz=c.getZ() & CHUNKS.MASK;
    if (c != getChunk(cx,cy,cz,LoadOption.NO_LOAD)) {
      itr.remove();
    }
  }
}

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 : getPlayers()) {
        syncChunkToPlayers(spoutChunk,entity);
      }
      processChunkUpdatedEvent(spoutChunk);
      spoutChunk.resetDirtyArrays();
      spoutChunk.setLightDirty(false);
    }
  }
  SpoutChunkSnapshotFuture snapshotFuture;
  while ((snapshotFuture=snapshotQueue.poll()) != null) {
    snapshotFuture.run();
  }
  Iterator<SpoutChunk> itr=occupiedChunks.iterator();
  int cx, cy, cz;
  entityManager.syncEntities();
  while (itr.hasNext()) {
    SpoutChunk c=itr.next();
    cx=c.getX() & CHUNKS.MASK;
    cy=c.getY() & CHUNKS.MASK;
    cz=c.getZ() & CHUNKS.MASK;
    if (c != getChunk(cx,cy,cz,LoadOption.NO_LOAD)) {
      itr.remove();
    }
  }
}
Program: 177390
Project: 177390
Buggy source:
private void syncChunkToPlayers(SpoutChunk chunk,Entity entity){
  SpoutPlayer player=(SpoutPlayer)entity.getController().getParent();
  if (player.isOnline()) {
    NetworkSynchronizer synchronizer=player.getNetworkSynchronizer();
    if (!chunk.isDirtyOverflow() && !chunk.isLightDirty()) {
      for (int i=0; true; i++) {
        Vector3 block=chunk.getDirtyBlock(i);
        if (block == null) {
          break;
        }
        try {
          synchronizer.updateBlock(chunk,(int)block.getX(),(int)block.getY(),(int)block.getZ());
        }
 catch (        Exception e) {
          Spout.getEngine().getLogger().log(Level.SEVERE,"String_Node_Str" + player.getName());
        }
      }
    }
 else {
      synchronizer.sendChunk(chunk);
    }
  }
}

Fixed version (ground truth):
private void syncChunkToPlayers(SpoutChunk chunk,Player player){
  if (player.isOnline()) {
    NetworkSynchronizer synchronizer=player.getNetworkSynchronizer();
    if (!chunk.isDirtyOverflow() && !chunk.isLightDirty()) {
      for (int i=0; true; i++) {
        Vector3 block=chunk.getDirtyBlock(i);
        if (block == null) {
          break;
        }
        try {
          synchronizer.updateBlock(chunk,(int)block.getX(),(int)block.getY(),(int)block.getZ());
        }
 catch (        Exception e) {
          Spout.getEngine().getLogger().log(Level.SEVERE,"String_Node_Str" + player.getName());
        }
      }
    }
 else {
      synchronizer.sendChunk(chunk);
    }
  }
}
Program: 177392
Project: 177392
Buggy source:
private void doPhysics(List<AsyncExecutor> executors) throws InterruptedException {
  int passStartUpdates=updates.get() - 1;
  int startUpdates=updates.get();
  while (passStartUpdates < updates.get() && updates.get() < startUpdates + UPDATE_THRESHOLD) {
    passStartUpdates=updates.get();
    for (int sequence=-1; sequence < 8 && updates.get() < startUpdates + UPDATE_THRESHOLD; sequence++) {
      if (sequence == -1) {
        TickStage.setStage(TickStage.PHYSICS);
      }
 else {
        TickStage.setStage(TickStage.GLOBAL_PHYSICS);
      }
      for (      AsyncExecutor e : executors) {
        if (!e.doPhysics(sequence)) {
          throw new IllegalStateException("String_Node_Str");
        }
      }
      boolean joined=false;
      while (!joined) {
        try {
          AsyncExecutorUtils.pulseJoinAll(executors,(PULSE_EVERY << 4));
          joined=true;
        }
 catch (        TimeoutException e) {
          if (((SpoutEngine)Spout.getEngine()).isSetupComplete()) {
            logLongDurationTick("String_Node_Str",executors);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private void doPhysics(List<AsyncExecutor> executors) throws InterruptedException {
  int passStartUpdates=updates.get() - 1;
  int startUpdates=updates.get();
  while (passStartUpdates < updates.get() && updates.get() < startUpdates + UPDATE_THRESHOLD) {
    passStartUpdates=updates.get();
    for (int sequence=-1; sequence < 27 && updates.get() < startUpdates + UPDATE_THRESHOLD; sequence++) {
      if (sequence == -1) {
        TickStage.setStage(TickStage.PHYSICS);
      }
 else {
        TickStage.setStage(TickStage.GLOBAL_PHYSICS);
      }
      for (      AsyncExecutor e : executors) {
        if (!e.doPhysics(sequence)) {
          throw new IllegalStateException("String_Node_Str");
        }
      }
      boolean joined=false;
      while (!joined) {
        try {
          AsyncExecutorUtils.pulseJoinAll(executors,(PULSE_EVERY << 4));
          joined=true;
        }
 catch (        TimeoutException e) {
          if (((SpoutEngine)Spout.getEngine()).isSetupComplete()) {
            logLongDurationTick("String_Node_Str",executors);
          }
        }
      }
    }
  }
}
Program: 177393
Project: 177393
Buggy source:
private void updateObserver(){
  if (this instanceof Player) {
    return;
  }
  final int viewDistance=getViewDistance() >> Chunk.BLOCKS.BITS;
  World w=getWorld();
  int cx=chunkLive.get().getX();
  int cy=chunkLive.get().getY();
  int cz=chunkLive.get().getZ();
  HashSet<SpoutChunk> observing=new HashSet<SpoutChunk>((viewDistance * viewDistance * viewDistance* 3) / 2);
  OutwardIterator oi=new OutwardIterator(cx,cy,cz,viewDistance);
  while (oi.hasNext()) {
    IntVector3 v=oi.next();
    Chunk chunk=w.getChunk(v.getX(),v.getY(),v.getZ(),LoadOption.LOAD_GEN);
    chunk.refreshObserver(this);
    observing.add((SpoutChunk)chunk);
  }
  observingChunks.removeAll(observing);
  for (  SpoutChunk chunk : observingChunks) {
    if (chunk.isLoaded()) {
      chunk.removeObserver(this);
    }
  }
  observingChunks.clear();
  observingChunks.addAll(observing);
}

Fixed version (ground truth):
protected void updateObserver(){
  final int viewDistance=getViewDistance() >> Chunk.BLOCKS.BITS;
  World w=getWorld();
  int cx=chunkLive.get().getX();
  int cy=chunkLive.get().getY();
  int cz=chunkLive.get().getZ();
  HashSet<SpoutChunk> observing=new HashSet<SpoutChunk>((viewDistance * viewDistance * viewDistance* 3) / 2);
  OutwardIterator oi=new OutwardIterator(cx,cy,cz,viewDistance);
  while (oi.hasNext()) {
    IntVector3 v=oi.next();
    Chunk chunk=w.getChunk(v.getX(),v.getY(),v.getZ(),LoadOption.LOAD_GEN);
    chunk.refreshObserver(this);
    observing.add((SpoutChunk)chunk);
  }
  observingChunks.removeAll(observing);
  for (  SpoutChunk chunk : observingChunks) {
    if (chunk.isLoaded()) {
      chunk.removeObserver(this);
    }
  }
  observingChunks.clear();
  observingChunks.addAll(observing);
}
Program: 177395
Project: 177395
Buggy source:
private void removeObserver(){
  if (controllerLive.get() instanceof PlayerController) {
    Player p=((PlayerController)controllerLive.get()).getParent();
    p.getNetworkSynchronizer().onDeath();
    return;
  }
  for (  SpoutChunk chunk : observingChunks) {
    if (chunk.isLoaded()) {
      chunk.removeObserver(this);
    }
  }
  observingChunks.clear();
}

Fixed version (ground truth):
protected void removeObserver(){
  for (  SpoutChunk chunk : observingChunks) {
    if (chunk.isLoaded()) {
      chunk.removeObserver(this);
    }
  }
  observingChunks.clear();
}
Program: 177396
Project: 177396
Buggy source:
public synchronized boolean clear(){
  map.clear();
  return true;
}

Fixed version (ground truth):
public synchronized boolean clear(){
  map.clear();
  reverseMap.clear();
  return true;
}
Program: 177397
Project: 177397
Buggy source:
@Override public void channelConnected(ChannelHandlerContext ctx,ChannelStateEvent e){
  Channel c=e.getChannel();
  if (!upstream) {
    try {
      engine.getChannelGroup().add(c);
      Session session=engine.newSession(c);
      engine.getSessionRegistry().add(session);
      setSession(session);
      ctx.setAttachment(session);
      engine.getLogger().info("String_Node_Str" + c + "String_Node_Str");
    }
 catch (    Exception ex) {
      ex.printStackTrace();
      throw new RuntimeException("String_Node_Str",ex);
    }
  }
 else {
    if (engine instanceof Client) {
      engine.getChannelGroup().add(c);
      Session session=engine.newSession(c);
      engine.getSessionRegistry().add(session);
      setSession(session);
      ctx.setAttachment(session);
    }
    engine.getLogger().info("String_Node_Str" + c + "String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void channelConnected(ChannelHandlerContext ctx,ChannelStateEvent e){
  Channel c=e.getChannel();
  if (!upstream) {
    try {
      engine.getChannelGroup().add(c);
      Session session=engine.newSession(c);
      engine.getSessionRegistry().add(session);
      setSession(session);
      ctx.setAttachment(session);
      engine.getLogger().info("String_Node_Str" + c + "String_Node_Str");
    }
 catch (    Exception ex) {
      ex.printStackTrace();
      throw new RuntimeException("String_Node_Str",ex);
    }
  }
 else {
    engine.getLogger().info("String_Node_Str" + c + "String_Node_Str");
  }
}
Program: 177398
Project: 177398
Buggy source:
protected void worldChanged(World world){
}

Fixed version (ground truth):
protected void worldChanged(World world){
  session.send(false,new WorldChangeMessage(world,((DataMap)world.getDataMap()).getRawMap()));
}
Program: 177399
Project: 177399
Buggy source:
public void initializeSession(Session session){
  session.setNetworkSynchronizer(new SpoutNetworkSynchronizer(session));
  for (  StringMap map : StringMap.getAll()) {
    session.send(false,new StringMapMessage(map.getId(),StringMapMessage.Action.SET,map.getItems()));
  }
}

Fixed version (ground truth):
public void initializeSession(Session session){
  session.setNetworkSynchronizer(new SpoutNetworkSynchronizer(session));
  session.send(false,new StringMapMessage(StringMapMessage.STRINGMAP_REGISTRATION_MAP,StringMapMessage.Action.SET,StringMap.get(StringMapMessage.STRINGMAP_REGISTRATION_MAP).getItems()));
  for (  StringMap map : StringMap.getAll()) {
    session.send(false,new StringMapMessage(map.getId(),StringMapMessage.Action.SET,map.getItems()));
  }
}