nus-yam/ex-repair huggingface dataset:
Program: 11666
Project: 11666
Buggy source:
/** 
 * Generates the chunk.
 */
public void generate(){
  if (this.ready.getCount() == 0) {
    return;
  }
  Region region=Region.getFile(this,false);
  if (region == null) {
    this.runGenerator();
  }
 else {
    int rX=this.x & 31;
    int rZ=this.z & 31;
    if (region.hasChunk(rX,rZ)) {
      try (DataInputStream in=region.getChunkDataInputStream(rX,rZ)){
        Tag.Compound compound=Tag.decode(in).getCompound("String_Node_Str");
        CompletableFuture.runAsync(() -> this.read(compound),ARBITRARY_POOL).whenCompleteAsync((v,t) -> {
          if (this.ready.getCount() == 1) {
            this.runGenerator();
          }
        }
,ARBITRARY_POOL);
        this.waitReady();
      }
 catch (      IOException e) {
        throw new RuntimeException(e);
      }
    }
 else {
      this.runGenerator();
    }
  }
}

Fixed version (ground truth):
/** 
 * Generates the chunk.
 */
public void generate(){
  if (!this.generationInProgress.compareAndSet(false,true)) {
    return;
  }
  Region region=Region.getFile(this,false);
  if (region == null) {
    this.runGenerator();
  }
 else {
    int rX=this.x & 31;
    int rZ=this.z & 31;
    if (region.hasChunk(rX,rZ)) {
      try (DataInputStream in=region.getChunkDataInputStream(rX,rZ)){
        Tag.Compound compound=Tag.decode(in).getCompound("String_Node_Str");
        CompletableFuture.runAsync(() -> this.read(compound),ARBITRARY_POOL).whenCompleteAsync((v,t) -> {
          if (this.ready.getCount() == 1) {
            this.runGenerator();
          }
        }
,ARBITRARY_POOL);
        this.waitReady();
      }
 catch (      IOException e) {
        throw new RuntimeException(e);
      }
    }
 else {
      this.runGenerator();
    }
  }
}
Program: 11667
Project: 11667
Buggy source:
private void doTick(){
  int curTime;
  int newTime;
  do {
    curTime=this.time.get();
    newTime=curTime++;
    if (newTime == 24000) {
      newTime=0;
    }
  }
 while (!this.time.compareAndSet(curTime,newTime));
  this.chunks.forEach(TridentChunk::tick);
}

Fixed version (ground truth):
private void doTick(){
  int curTime;
  int newTime;
  do {
    curTime=this.time.get();
    newTime=curTime + 1;
    if (newTime == 24000) {
      newTime=0;
    }
  }
 while (!this.time.compareAndSet(curTime,newTime));
  this.chunks.forEach(TridentChunk::tick);
}
Program: 11668
Project: 11668
Buggy source:
@Override public void write(ByteBuf buf){
  buf.writeInt(this.player.getId());
  buf.writeByte(this.opts.getGameMode().asByte());
  buf.writeInt(this.opts.getDimension().asByte());
  buf.writeByte(this.opts.getDifficulty().asByte());
  buf.writeByte(0);
  wstr(buf,this.type.toString());
  buf.writeBoolean(false);
}

Fixed version (ground truth):
@Override public void write(ByteBuf buf){
  buf.writeInt(this.player.getId());
  buf.writeByte(this.opts.getGameMode().asByte());
  buf.writeInt(this.opts.getDimension().asByte());
  buf.writeByte(this.opts.getDifficulty().asByte());
  buf.writeByte(0);
  wstr(buf,this.type.toString());
  buf.writeBoolean(this.opts.getGameRules().get(GameRule.REDUCE_DEBUG));
}
Program: 11669
Project: 11669
Buggy source:
/** 
 * Resumes the joining process after the player has confirmed the client spawn position.
 */
public void resumeLogin(){
  if (!this.finishedLogin.compareAndSet(false,true)) {
    return;
  }
  this.client.sendPacket(new PlayOutJoinGame(this,this.getWorld()));
  this.client.sendPacket(PlayOutPluginMsg.BRAND);
  TridentPluginChannel.autoAdd(this);
  this.client.sendPacket(new PlayOutDifficulty(this.getWorld()));
  this.client.sendPacket(new PlayOutSpawnPos());
  this.client.sendPacket(new PlayOutPosLook(this));
  this.client.sendPacket(new PlayOutPlayerAbilities(this));
  this.setTabList(TridentGlobalTabList.getInstance());
  TridentGlobalTabList.getInstance().update();
  Collections.addAll(this.permissions,"String_Node_Str");
  if (TridentServer.getInstance().getOpsList().getOps().contains(this.uuid)) {
    this.op=true;
  }
  PlayOutSpawnPlayer spawnThis=new PlayOutSpawnPlayer(this);
  ChatComponent chat=ChatComponent.create().setColor(ChatColor.YELLOW).setTranslate("String_Node_Str").addWith(this.name);
  TridentPlayer.players.values().stream().filter(p -> !p.equals(this)).forEach(p -> {
    p.sendMessage(chat,ChatType.CHAT);
    p.net().sendPacket(spawnThis);
    PlayOutSpawnPlayer oldPlayerPacket=new PlayOutSpawnPlayer(p);
    this.client.sendPacket(oldPlayerPacket);
  }
);
  TridentServer.getInstance().getLogger().log("String_Node_Str" + this.name + "String_Node_Str"+ this.uuid+ "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Resumes the joining process after the player has confirmed the client spawn position.
 */
public void resumeLogin(){
  if (!this.finishedLogin.compareAndSet(false,true)) {
    return;
  }
  this.client.sendPacket(new PlayOutJoinGame(this,this.getWorld()));
  this.client.sendPacket(PlayOutPluginMsg.BRAND);
  TridentPluginChannel.autoAdd(this);
  this.client.sendPacket(new PlayOutDifficulty(this.getWorld()));
  this.client.sendPacket(new PlayOutSpawnPos());
  this.client.sendPacket(new PlayOutPosLook(this));
  this.client.sendPacket(new PlayOutPlayerAbilities(this));
  this.setTabList(TridentGlobalTabList.getInstance());
  TridentGlobalTabList.getInstance().update();
  Collections.addAll(this.permissions,"String_Node_Str");
  if (TridentServer.getInstance().getOpsList().getOps().contains(this.uuid)) {
    this.op=true;
  }
  PlayOutSpawnPlayer spawnThis=new PlayOutSpawnPlayer(this);
  ChatComponent chat=ChatComponent.create().setColor(ChatColor.YELLOW).setTranslate("String_Node_Str").addWith(this.name);
  TridentPlayer.players.values().stream().filter(p -> !p.equals(this)).forEach(p -> {
    p.sendMessage(chat,ChatType.CHAT);
    p.net().sendPacket(spawnThis);
    PlayOutSpawnPlayer oldPlayerPacket=new PlayOutSpawnPlayer(p);
    this.client.sendPacket(oldPlayerPacket);
  }
);
  ServerThreadPool.forSpec(PoolSpec.PLUGINS).execute(() -> TridentServer.getInstance().getEventController().dispatch(new PlayerJoinEvent(this)));
  TridentServer.getInstance().getLogger().log("String_Node_Str" + this.name + "String_Node_Str"+ this.uuid+ "String_Node_Str");
}
Program: 11670
Project: 11670
Buggy source:
/** 
 * Spawns a new player.
 * @param client the client representing the player
 * @param name the player name
 * @param uuid the player UUID
 * @param skinTextures the player textures
 */
public static TridentPlayer spawn(NetClient client,String name,UUID uuid,TabListElement.PlayerProperty skinTextures){
  TridentWorld world=TridentServer.getInstance().getWorldLoader().getDefaultWorld();
  TridentPlayer player=new TridentPlayer(client,world,name,uuid,skinTextures);
  client.setPlayer(player);
  TridentPlayer.players.put(uuid,player);
  Login.finish();
  TridentPlayer.playerNames.put(name,player);
  ServerThreadPool.forSpec(PoolSpec.PLUGINS).execute(() -> TridentServer.getInstance().getEventController().dispatch(new PlayerJoinEvent(player)));
  player.setPosition(world.getWorldOptions().getSpawn().toPosition(world));
  player.updateChunks();
  player.resumeLogin();
  return player;
}

Fixed version (ground truth):
/** 
 * Spawns a new player.
 * @param client the client representing the player
 * @param name the player name
 * @param uuid the player UUID
 * @param skinTextures the player textures
 */
public static TridentPlayer spawn(NetClient client,String name,UUID uuid,TabListElement.PlayerProperty skinTextures){
  TridentWorld world=TridentServer.getInstance().getWorldLoader().getDefaultWorld();
  TridentPlayer player=new TridentPlayer(client,world,name,uuid,skinTextures);
  client.setPlayer(player);
  TridentPlayer.players.put(uuid,player);
  Login.finish();
  TridentPlayer.playerNames.put(name,player);
  player.position=world.getWorldOptions().getSpawn().toPosition(world);
  player.updateChunks();
  player.resumeLogin();
  return player;
}
Program: 11672
Project: 11672
Buggy source:
/** 
 * Loads a new world with the given name and folder.
 * @param name the name of the world
 * @param enclosing the enclosing folder
 */
public TridentWorld(String name,Path enclosing){
  this.name=name;
  this.directory=enclosing;
  try (GZIPInputStream stream=new GZIPInputStream(new FileInputStream(this.directory.resolve("String_Node_Str").toFile()))){
    Tag.Compound root=Tag.decode(new DataInputStream(stream));
    Tag.Compound compound=root.getCompound("String_Node_Str");
    this.worldOptions=new WorldOptImpl(this,compound);
    this.generatorOptions=new GenOptImpl(compound);
    this.weather.read(compound);
    this.border.read(compound);
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
/** 
 * Loads a new world with the given name and folder.
 * @param name the name of the world
 * @param enclosing the enclosing folder
 */
public TridentWorld(String name,Path enclosing){
  this.name=name;
  this.directory=enclosing;
  try (GZIPInputStream stream=new GZIPInputStream(new FileInputStream(this.directory.resolve("String_Node_Str").toFile()))){
    Tag.Compound root=Tag.decode(new DataInputStream(stream));
    Tag.Compound compound=root.getCompound("String_Node_Str");
    this.worldOptions=new WorldOptImpl(this,compound);
    this.generatorOptions=new GenOptImpl(compound);
    this.weather.read(compound);
    this.border.read(compound);
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
  int centerX=this.worldOptions.getSpawn().getIntX() >> 4;
  int centerZ=this.worldOptions.getSpawn().getIntZ() >> 4;
  int radius=3;
  for (int x=centerX - radius; x < centerX + radius; x++) {
    for (int z=centerZ - radius; z < centerZ + radius; z++) {
      this.getChunkAt(x,z);
    }
  }
}
Program: 11673
Project: 11673
Buggy source:
/** 
 * Creates a new set of world options which implements those found in the compound file for this world.
 * @param world the world to create options for
 * @param compound the compound to read data from
 */
public WorldOptImpl(TridentWorld world,Tag.Compound compound){
  this.world=world;
  this.dimension=Dimension.OVERWORLD;
}

Fixed version (ground truth):
/** 
 * Creates a new set of world options which implements those found in the compound file for this world.
 * @param world the world to create options for
 * @param compound the compound to read data from
 */
@Debug("String_Node_Str") public WorldOptImpl(TridentWorld world,Tag.Compound compound){
  this.world=world;
  this.dimension=Dimension.OVERWORLD;
  this.gameMode=GameMode.CREATIVE;
  this.difficulty.set(Difficulty.from(compound.getByte("String_Node_Str")),compound.getByte("String_Node_Str") == 1);
  this.spawn=new Vector(compound.getInt("String_Node_Str"),compound.getInt("String_Node_Str"),compound.getInt("String_Node_Str"));
  Tag.Compound rulesCmp=compound.getCompound("String_Node_Str");
  for (  String s : rulesCmp.getEntries().keySet()) {
    GameRule<Object> rule=GameRule.from(s);
    this.gameRules.set(rule,rule.parseValue(rulesCmp.getString(s)));
  }
}
Program: 11674
Project: 11674
Buggy source:
@Override public void updateMetadata(){
  PlayOutEntityMetadata packet=new PlayOutEntityMetadata(this);
  RecipientSelector.whoCanSee(this,packet,false);
}

Fixed version (ground truth):
@Override public void updateMetadata(){
  PlayOutEntityMetadata packet=new PlayOutEntityMetadata(this);
  RecipientSelector.whoCanSee(this,false,packet);
}
Program: 11675
Project: 11675
Buggy source:
/** 
 * Entity superconstructor.
 * @param world the world which the entity is located
 */
public TridentEntity(World world,PoolSpec spec){
  this.id=EID_COUNTER.incrementAndGet();
  this.position=world.getWorldOptions().getSpawn().toPosition(world);
  this.pool=ServerThreadPool.forSpec(spec);
  EntityMetaType metaType=this.getClass().getAnnotation(EntityMetaType.class);
  if (metaType == null) {
    throw new RuntimeException(this.getClass() + "String_Node_Str");
  }
  try {
    this.metadata=metaType.value().getConstructor(EntityMetadata.class).newInstance(new EntityMetadata());
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
/** 
 * Entity superconstructor.
 * @param world the world which the entity is located
 */
public TridentEntity(TridentWorld world,PoolSpec spec){
  this.id=EID_COUNTER.incrementAndGet();
  this.pool=ServerThreadPool.forSpec(spec);
  Position pos=world.getWorldOptions().getSpawn().toPosition(world);
  this.position=pos;
  if (this instanceof Player) {
    TridentPlayer player=(TridentPlayer)this;
    world.getOccupants().add(player);
    world.getChunkAt(pos.getChunkX(),pos.getChunkZ()).getOccupants().add(player);
  }
 else {
    world.getEntitySet().add(this);
    world.getEntitySet().add(this);
  }
  EntityMetaType metaType=this.getClass().getAnnotation(EntityMetaType.class);
  if (metaType == null) {
    throw new RuntimeException(this.getClass() + "String_Node_Str");
  }
  try {
    this.metadata=metaType.value().getConstructor(EntityMetadata.class).newInstance(new EntityMetadata());
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}
Program: 11677
Project: 11677
Buggy source:
@Override public final void remove(){
  TridentWorld world=(TridentWorld)this.position.getWorld();
  TridentChunk chunk=world.getChunkAt(this.position.getChunkX(),this.position.getChunkZ(),false);
  if (chunk != null) {
    if (this instanceof Player) {
      chunk.getOccupants().remove(this);
    }
 else {
      chunk.getEntitySet().remove(this);
    }
  }
  if (this instanceof Player) {
    world.getOccupants().remove(this);
  }
 else {
    world.getEntitySet().remove(this);
  }
  this.doRemove();
  PlayOutDestroyEntities destroyEntities=new PlayOutDestroyEntities(Collections.singletonList(this));
  TridentPlayer.getPlayers().values().stream().filter(player -> !player.equals(this)).forEach(p -> p.net().sendPacket(destroyEntities));
}

Fixed version (ground truth):
@Override public final void remove(){
  TridentWorld world=(TridentWorld)this.position.getWorld();
  world.getEntitySet().remove(this);
  world.getOccupants().remove(this);
  TridentChunk chunk=world.getChunkAt(this.position.getChunkX(),this.position.getChunkZ(),false);
  if (chunk != null) {
    if (this instanceof Player) {
      chunk.getOccupants().remove(this);
    }
 else {
      chunk.getEntitySet().remove(this);
    }
  }
  if (this instanceof Player) {
    world.getOccupants().remove(this);
  }
 else {
    world.getEntitySet().remove(this);
  }
  this.doRemove();
  PlayOutDestroyEntities destroyEntities=new PlayOutDestroyEntities(Collections.singletonList(this));
  TridentPlayer.getPlayers().values().stream().filter(player -> !player.equals(this)).forEach(p -> p.net().sendPacket(destroyEntities));
}
Program: 11678
Project: 11678
Buggy source:
@Override public Item get(int slot){
  if (slot < 0 || slot >= this.size) {
    throw new IllegalArgumentException("String_Node_Str" + slot);
  }
  Item item=this.contents.get(slot);
  return item == null ? TridentItem.EMPTY : item;
}

Fixed version (ground truth):
@Nonnull @Override public Item get(int slot){
  if (slot < 0 || slot >= this.size) {
    throw new IllegalArgumentException("String_Node_Str" + slot);
  }
  Item item=this.contents.get(slot);
  return item == null ? TridentItem.EMPTY : item;
}
Program: 11679
Project: 11679
Buggy source:
@Nullable @Override public Item remove(int slot,int quantity){
  if (quantity < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (slot < 0 || slot >= this.size) {
    throw new IllegalArgumentException("String_Node_Str" + slot);
  }
  Item computed=this.contents.compute(slot,(k,v) -> {
    if (v == null) {
      return null;
    }
 else {
      int left=Math.max(0,v.getCount() - quantity);
      if (left == 0) {
        this.sendViewers(new PlayOutSlot(this.id,slot,Slot.EMPTY));
        return null;
      }
 else {
        TridentItem item=new TridentItem(v.getSubstance(),left,v.getDamage(),v.getMeta());
        PacketOut packetOut=new PlayOutSlot(this.id,slot,Slot.newSlot(item));
        this.sendViewers(packetOut);
        return item;
      }
    }
  }
);
  return computed == null ? TridentItem.EMPTY : computed;
}

Fixed version (ground truth):
@Nonnull @Override public Item remove(int slot,int quantity){
  if (quantity < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (slot < 0 || slot >= this.size) {
    throw new IllegalArgumentException("String_Node_Str" + slot);
  }
  Item computed=this.contents.compute(slot,(k,v) -> {
    if (v == null) {
      return null;
    }
 else {
      int left=Math.max(0,v.getCount() - quantity);
      if (left == 0) {
        this.sendViewers(new PlayOutSlot(this.id,slot,Slot.EMPTY));
        return null;
      }
 else {
        TridentItem item=new TridentItem(v.getSubstance(),left,v.getDamage(),v.getMeta());
        PacketOut packetOut=new PlayOutSlot(this.id,slot,Slot.newSlot(item));
        this.sendViewers(packetOut);
        return item;
      }
    }
  }
);
  return computed == null ? TridentItem.EMPTY : computed;
}
Program: 11680
Project: 11680
Buggy source:
/** 
 * Creates a new slot using the given byte buffer to read encoded values of the slot.
 * @param buf the buffer which to read
 */
public static Slot read(ByteBuf buf){
  short id=buf.readShort();
  if (id != -1) {
    byte count=buf.readByte();
    short dmg=buf.readShort();
    Tag.Compound nbt=Tag.decode(new DataInputStream(new ByteBufInputStream(buf)));
    buf.readBytes(buf.readableBytes());
    if (id == Substance.AIR.getId()) {
      return EMPTY;
    }
 else {
      return new Slot(id,count,dmg,new ItemMeta(nbt));
    }
  }
 else {
    return EMPTY;
  }
}

Fixed version (ground truth):
/** 
 * Creates a new slot using the given byte buffer to read encoded values of the slot.
 * @param buf the buffer which to read
 */
public static Slot read(ByteBuf buf){
  short id=buf.readShort();
  if (id != -1) {
    byte count=buf.readByte();
    short dmg=buf.readShort();
    Tag.Compound nbt=Tag.decode(new DataInputStream(new ByteBufInputStream(buf)));
    buf.readBytes(buf.readableBytes());
    if (id == Substance.AIR.getId()) {
      return EMPTY;
    }
 else {
      return new Slot(id,count,dmg,nbt == null ? new ItemMeta() : new ItemMeta(nbt));
    }
  }
 else {
    return EMPTY;
  }
}
Program: 11681
Project: 11681
Buggy source:
/** 
 * Creates a new slot using the information wrapped by the given item. <p>This method automatically checks whether the item is   {@code null} and in which case, it returns{@link #EMPTY}.</p>
 * @param item the item which to send in slot format
 * @return the new slot
 */
public static Slot newSlot(Item item){
  if (item.getSubstance() == Substance.AIR) {
    return EMPTY;
  }
  return new Slot((short)item.getSubstance().getId(),(byte)item.getCount(),item.getDamage(),item.getMeta());
}

Fixed version (ground truth):
/** 
 * Creates a new slot using the information wrapped by the given item. <p>This method automatically checks whether the item is   {@code null} and in which case, it returns{@link #EMPTY}.</p>
 * @param item the item which to send in slot format
 * @return the new slot
 */
public static Slot newSlot(Item item){
  if (item.isEmpty()) {
    return EMPTY;
  }
  return new Slot((short)item.getSubstance().getId(),(byte)item.getCount(),item.getDamage(),item.getMeta());
}
Program: 11682
Project: 11682
Buggy source:
/** 
 * Init code for server startup
 */
public static TridentServer init(ServerConfig config,Logger console,NetServer net) throws IllegalStateException {
  TridentServer server=new TridentServer(config,console,net);
  if (TridentServer.instance == null) {
    TridentServer.instance=server;
    return server;
  }
  throw new IllegalStateException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Init code for server startup
 */
public static TridentServer init(ServerConfig config,Logger console,NetServer net) throws IllegalStateException {
  TridentServer server=new TridentServer(config,console,net);
  if (TridentServer.instance == null) {
    TridentServer.instance=server;
    server.tick.start();
    return server;
  }
  throw new IllegalStateException("String_Node_Str");
}
Program: 11683
Project: 11683
Buggy source:
/** 
 * Creates a new server instance
 * @param config the config to initialize the server
 * @param console the logger to which the server logs
 */
private TridentServer(ServerConfig config,Logger console,NetServer server){
  this.config=config;
  this.logger=console;
  this.server=server;
  this.tick=new TridentTick(console);
  this.tick.start();
}

Fixed version (ground truth):
/** 
 * Creates a new server instance
 * @param config the config to initialize the server
 * @param console the logger to which the server logs
 */
private TridentServer(ServerConfig config,Logger console,NetServer server){
  this.config=config;
  this.logger=console;
  this.server=server;
  this.tick=new TridentTick(console);
}
Program: 11684
Project: 11684
Buggy source:
@Override public LogMessageImpl handle(LogMessageImpl msg){
  Writer out=this.check();
  try {
    out.write(msg.format(0));
    out.write(LINE_SEP);
    out.flush();
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
  return msg;
}

Fixed version (ground truth):
@Override public LogMessageImpl handle(LogMessageImpl msg){
  try (Writer out=this.check()){
    out.write(msg.format(0));
    out.write(LINE_SEP);
    out.flush();
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
  return msg;
}
Program: 11685
Project: 11685
Buggy source:
/** 
 * Writes the memory configuration object to the config located at the given path.
 * @param path the config to write
 * @param object the memory representation of theconfig
 */
public static void writeConfig(Path path,JsonObject object) throws IOException {
  String json=GSON.toJson(object);
  try {
    if (!Files.exists(path)) {
      Files.createFile(path);
    }
    FileOutputStream stream=new FileOutputStream(path.toFile());
    stream.write(json.getBytes());
    stream.close();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Writes the memory configuration object to the config located at the given path.
 * @param path the config to write
 * @param object the memory representation of theconfig
 */
public static void writeConfig(Path path,JsonObject object) throws IOException {
  String json=GSON.toJson(object);
  try (FileOutputStream stream=new FileOutputStream(path.toFile())){
    stream.write(json.getBytes());
  }
 }
Program: 11686
Project: 11686
Buggy source:
/** 
 * Iterates over the elements in this config section, performing the given operations in order to append the elements to the given collection.
 * @param base the base string key
 * @param col the collection to append entries
 * @param function extracts the entry value
 * @param deep {@code true} to get children elements
 * @param < T > the type appended to the collection
 */
private <T>void iterate(String base,Collection<T> col,BiFunction<String,Map.Entry<String,Object>,T> function,boolean deep){
  this.elements.entrySet().stream().forEach(e -> {
    Object val=e.getValue();
    if (deep) {
      if (val instanceof ConfigSection) {
        TridentConfigSection section=(TridentConfigSection)val;
        section.iterate(this.handlePath(base,section.name),col,function,true);
        return;
      }
    }
    col.add(function.apply(base,e));
  }
);
}

Fixed version (ground truth):
/** 
 * Iterates over the elements in this config section, performing the given operations in order to append the elements to the given collection.
 * @param base the base string key
 * @param col the collection to append entries
 * @param function extracts the entry value
 * @param deep {@code true} to get children elements
 * @param < T > the type appended to the collection
 */
private <T>void iterate(String base,Collection<T> col,BiFunction<String,Map.Entry<String,Object>,T> function,boolean deep){
  this.elements.entrySet().forEach(e -> {
    Object val=e.getValue();
    if (deep) {
      if (val instanceof ConfigSection) {
        TridentConfigSection section=(TridentConfigSection)val;
        section.iterate(this.handlePath(base,section.name),col,function,true);
        return;
      }
    }
    col.add(function.apply(base,e));
  }
);
}
Program: 11687
Project: 11687
Buggy source:
/** 
 * Loads the json from file into memory
 * @param object the file json
 */
public void read(JsonObject object){
  object.entrySet().stream().forEach(e -> {
    String key=e.getKey();
    JsonElement value=e.getValue();
    if (value.isJsonObject()) {
      TridentConfigSection section=this.createChild0(key,object);
      section.read(value.getAsJsonObject());
    }
 else {
      this.elements.put(key,ConfigIo.asObj(value,TridentAdapter.class));
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Loads the json from file into memory
 * @param object the file json
 */
public void read(JsonObject object){
  object.entrySet().forEach(e -> {
    String key=e.getKey();
    JsonElement value=e.getValue();
    if (value.isJsonObject()) {
      TridentConfigSection section=this.createChild0(key,object);
      section.read(value.getAsJsonObject());
    }
 else {
      this.elements.put(key,ConfigIo.asObj(value,TridentAdapter.class));
    }
  }
);
}
Program: 11688
Project: 11688
Buggy source:
/** 
 * Initializer code for server startup.
 * @param ip the IP address of the interface to bind
 * @param port the port which to bind the interface
 * @return the new server net handler
 * @throws InterruptedException if something wenthorribly wrong
 */
public static NetServer init(String ip,int port,boolean useNative) throws InterruptedException {
  boolean nativeCompat=System.getProperty("String_Node_Str").toLowerCase().contains("String_Node_Str");
  return nativeCompat && useNative ? new NetEpollServer(ip,port) : new NetNioServer(ip,port);
}

Fixed version (ground truth):
/** 
 * Initializer code for server startup.
 * @param ip the IP address of the interface to bind
 * @param port the port which to bind the interface
 * @return the new server net handler
 */
public static NetServer init(String ip,int port,boolean useNative){
  boolean nativeCompat=System.getProperty("String_Node_Str").toLowerCase().contains("String_Node_Str");
  return nativeCompat && useNative ? new NetEpollServer(ip,port) : new NetNioServer(ip,port);
}
Program: 11689
Project: 11689
Buggy source:
/** 
 * Sets up the server.
 * @throws InterruptedException no
 */
public abstract void setup() throws InterruptedException ;

Fixed version (ground truth):
/** 
 * Sets up the server.
 */
public abstract void setup();
Program: 11690
Project: 11690
Buggy source:
/** 
 * Writes a compressed packet that is deflated using zlib.
 * @param payload the payload to write
 * @param out the output buffer
 * @param len the length
 * @throws IOException if something goes wrong
 */
private void writeDeflated(ByteBuf payload,ByteBuf out,int len) throws IOException {
  payload.markReaderIndex();
  byte[] input=arr(payload,len);
  Deflater deflater=DEFLATER.get();
  deflater.setInput(input);
  deflater.finish();
  byte[] buffer=new byte[NetClient.BUFFER_SIZE];
  ByteBuf result=payload.alloc().buffer();
  while (!deflater.finished()) {
    int deflated=deflater.deflate(buffer);
    result.writeBytes(buffer,0,deflated);
  }
  deflater.reset();
  int resultLen=result.readableBytes();
  if (resultLen >= len) {
    payload.resetReaderIndex();
    this.writeCompressed(payload,out);
  }
 else {
    wvint(out,resultLen + BigInteger.valueOf(len).toByteArray().length);
    wvint(out,len);
    out.writeBytes(result);
  }
  result.release();
}

Fixed version (ground truth):
/** 
 * Writes a compressed packet that is deflated using zlib.
 * @param payload the payload to write
 * @param out the output buffer
 * @param len the length
 */
private void writeDeflated(ByteBuf payload,ByteBuf out,int len){
  payload.markReaderIndex();
  byte[] input=arr(payload,len);
  Deflater deflater=DEFLATER.get();
  deflater.setInput(input);
  deflater.finish();
  byte[] buffer=new byte[NetClient.BUFFER_SIZE];
  ByteBuf result=payload.alloc().buffer();
  while (!deflater.finished()) {
    int deflated=deflater.deflate(buffer);
    result.writeBytes(buffer,0,deflated);
  }
  deflater.reset();
  int resultLen=result.readableBytes();
  if (resultLen >= len) {
    payload.resetReaderIndex();
    this.writeCompressed(payload,out);
  }
 else {
    wvint(out,resultLen + BigInteger.valueOf(len).toByteArray().length);
    wvint(out,len);
    out.writeBytes(result);
  }
  result.release();
}
Program: 11691
Project: 11691
Buggy source:
/** 
 * Performs an HTTP(s) POST to the mojang server.
 * @param element the JSON object to POST
 */
public Future<T> post(JsonElement element){
  Callable<T> post=() -> {
    try {
      this.c.setRequestMethod("String_Node_Str");
      this.c.setRequestProperty("String_Node_Str","String_Node_Str");
      this.c.setRequestProperty("String_Node_Str","String_Node_Str");
      this.c.setDoOutput(true);
      this.c.setDoInput(true);
      this.c.getOutputStream().write(ConfigIo.GSON.toJson(element).getBytes(NetData.NET_CHARSET));
      this.c.getOutputStream().close();
      int code=this.c.getResponseCode();
      if (code != 200) {
        return this.exception.apply(String.valueOf(code));
      }
      BufferedReader reader=new BufferedReader(new InputStreamReader(this.c.getInputStream()));
      return this.callback.apply(ConfigIo.PARSER.parse(reader));
    }
 catch (    IOException e) {
      return this.exception.apply(e.getMessage());
    }
  }
;
  return SCHEDULER.submit(post);
}

Fixed version (ground truth):
/** 
 * Performs an HTTP(s) POST to the mojang server.
 * @param element the JSON object to POST
 */
public Future<T> post(JsonElement element){
  Callable<T> post=() -> {
    try {
      this.c.setRequestMethod("String_Node_Str");
      this.c.setRequestProperty("String_Node_Str","String_Node_Str");
      this.c.setRequestProperty("String_Node_Str","String_Node_Str");
      this.c.setDoOutput(true);
      this.c.setDoInput(true);
      try (OutputStream out=this.c.getOutputStream()){
        out.write(ConfigIo.GSON.toJson(element).getBytes(NetData.NET_CHARSET));
      }
       int code=this.c.getResponseCode();
      if (code != 200) {
        return this.exception.apply(String.valueOf(code));
      }
      try (BufferedReader reader=new BufferedReader(new InputStreamReader(this.c.getInputStream()))){
        return this.callback.apply(ConfigIo.PARSER.parse(reader));
      }
     }
 catch (    IOException e) {
      return this.exception.apply(e.getMessage());
    }
  }
;
  return SCHEDULER.submit(post);
}
Program: 11692
Project: 11692
Buggy source:
/** 
 * Performs an HTTP(s) GET to the server.
 */
public Future<T> get(){
  Callable<T> get=() -> {
    try {
      this.c.setRequestMethod("String_Node_Str");
      this.c.setRequestProperty("String_Node_Str","String_Node_Str");
      this.c.setRequestProperty("String_Node_Str","String_Node_Str");
      this.c.setDoOutput(true);
      this.c.setDoInput(true);
      int code=this.c.getResponseCode();
      if (code != 200) {
        return this.exception.apply(String.valueOf(code));
      }
      BufferedReader reader=new BufferedReader(new InputStreamReader(this.c.getInputStream()));
      return this.callback.apply(ConfigIo.PARSER.parse(reader));
    }
 catch (    IOException e) {
      return this.exception.apply(e.getMessage());
    }
  }
;
  return SCHEDULER.submit(get);
}

Fixed version (ground truth):
/** 
 * Performs an HTTP(s) GET to the server.
 */
public Future<T> get(){
  Callable<T> get=() -> {
    try {
      this.c.setRequestMethod("String_Node_Str");
      this.c.setRequestProperty("String_Node_Str","String_Node_Str");
      this.c.setRequestProperty("String_Node_Str","String_Node_Str");
      this.c.setDoOutput(true);
      this.c.setDoInput(true);
      int code=this.c.getResponseCode();
      if (code != 200) {
        return this.exception.apply(String.valueOf(code));
      }
      try (BufferedReader reader=new BufferedReader(new InputStreamReader(this.c.getInputStream()))){
        return this.callback.apply(ConfigIo.PARSER.parse(reader));
      }
     }
 catch (    IOException e) {
      return this.exception.apply(e.getMessage());
    }
  }
;
  return SCHEDULER.submit(get);
}
Program: 11693
Project: 11693
Buggy source:
@Override public void sendTitle(Title title){
  if (!title.isDefaultFadeTimes()) {
    this.net().sendPacket(new PlayOutTitle.SetTiming(title));
  }
  ChatComponent mainTitle=title.getHeader();
  ChatComponent subtitle=title.getSubtitle();
  this.net().sendPacket(new PlayOutTitle.SetTitle(mainTitle));
  this.net().sendPacket(new PlayOutTitle.SetSubtitle(subtitle));
}

Fixed version (ground truth):
@Override public void sendTitle(Title title){
  if (!title.isDefaultFadeTimes()) {
    this.net().sendPacket(new PlayOutTitle.SetTiming(title));
  }
  ChatComponent mainTitle=title.getHeader();
  ChatComponent subtitle=title.getSubtitle();
  this.net().sendPacket(new PlayOutTitle.SetSubtitle(subtitle));
  this.net().sendPacket(new PlayOutTitle.SetTitle(mainTitle));
}
Program: 11694
Project: 11694
Buggy source:
@Override public void resetTitle(){
  this.net().sendPacket(new PlayOutTitle.Hide());
}

Fixed version (ground truth):
@Override public void resetTitle(){
  this.net().sendPacket(new PlayOutTitle.Reset());
}
Program: 11695
Project: 11695
Buggy source:
@Override public void run(){
  while (true) {
    try {
      long start=System.currentTimeMillis();
      for (      TridentWorld world : TridentWorldLoader.getInstance().worlds()) {
        world.tick();
      }
      for (      TridentPlayer player : TridentPlayer.getPlayers().values()) {
        player.tick();
      }
      long end=System.currentTimeMillis();
      long elapsed=end - start;
      long waitTime=TICK_MILLIS - elapsed;
      if (waitTime <= 0) {
        this.logger.debug("String_Node_Str" + -waitTime + "String_Node_Str"+ (-waitTime / TICK_MILLIS)+ "String_Node_Str");
      }
 else {
        Thread.sleep(waitTime);
      }
    }
 catch (    InterruptedException e) {
      break;
    }
catch (    Exception e) {
      JiraExceptionCatcher.serverException(e);
      break;
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (true) {
    try {
      long start=System.currentTimeMillis();
      for (      TridentWorld world : TridentWorldLoader.getInstance().worlds()) {
        world.tick();
      }
      for (      TridentPlayer player : TridentPlayer.getPlayers().values()) {
        player.tick();
      }
      TridentScheduler.getInstance().tick();
      long end=System.currentTimeMillis();
      long elapsed=end - start;
      long waitTime=TICK_MILLIS - elapsed;
      if (waitTime < 0) {
        this.logger.debug("String_Node_Str" + -waitTime + "String_Node_Str"+ (-waitTime / TICK_MILLIS)+ "String_Node_Str");
      }
 else {
        Thread.sleep(waitTime);
      }
    }
 catch (    InterruptedException e) {
      break;
    }
catch (    Exception e) {
      JiraExceptionCatcher.serverException(e);
      break;
    }
  }
}
Program: 11696
Project: 11696
Buggy source:
@Override public void read(ByteBuf buf,NetClient client){
  int id=rvint(buf);
  Integer localId=TELEPORT_ID.getIfPresent(client);
  if (localId != null && localId == id) {
  }
 else {
    Logger.get(PlayInTeleportConfirm.class).error("String_Node_Str" + localId + "String_Node_Str"+ id);
  }
}

Fixed version (ground truth):
@Override public void read(ByteBuf buf,NetClient client){
  int id=rvint(buf);
  Integer localId=TELEPORT_ID.get(client);
  if (localId != null && localId == id) {
  }
 else {
    Logger.get(PlayInTeleportConfirm.class).error("String_Node_Str" + localId + "String_Node_Str"+ id);
  }
}
Program: 11697
Project: 11697
Buggy source:
/** 
 * Performs an HTTP(s) POST to the mojang server.
 * @param element the JSON object to POST
 */
public Future<T> post(JsonElement element){
  Callable<T> post=() -> {
    try {
      this.c.setRequestMethod("String_Node_Str");
      this.c.setRequestProperty("String_Node_Str","String_Node_Str");
      this.c.setRequestProperty("String_Node_Str","String_Node_Str");
      this.c.setDoOutput(true);
      this.c.setDoInput(true);
      this.c.getOutputStream().write(ConfigIo.GSON.toJson(element).getBytes(NetData.NET_CHARSET));
      this.c.getOutputStream().close();
      int code=this.c.getResponseCode();
      if (code != 200) {
        return this.exception.apply(String.valueOf(code));
      }
      BufferedReader reader=new BufferedReader(new InputStreamReader(this.c.getInputStream()));
      return this.callback.apply(ConfigIo.PARSER.parse(reader));
    }
 catch (    IOException e) {
      return this.exception.apply(e.getMessage());
    }
  }
;
  return ServerThreadPool.forSpec(PoolSpec.SCHEDULER).submit(post);
}

Fixed version (ground truth):
/** 
 * Performs an HTTP(s) POST to the mojang server.
 * @param element the JSON object to POST
 */
public Future<T> post(JsonElement element){
  Callable<T> post=() -> {
    try {
      this.c.setRequestMethod("String_Node_Str");
      this.c.setRequestProperty("String_Node_Str","String_Node_Str");
      this.c.setRequestProperty("String_Node_Str","String_Node_Str");
      this.c.setDoOutput(true);
      this.c.setDoInput(true);
      this.c.getOutputStream().write(ConfigIo.GSON.toJson(element).getBytes(NetData.NET_CHARSET));
      this.c.getOutputStream().close();
      int code=this.c.getResponseCode();
      if (code != 200) {
        return this.exception.apply(String.valueOf(code));
      }
      BufferedReader reader=new BufferedReader(new InputStreamReader(this.c.getInputStream()));
      return this.callback.apply(ConfigIo.PARSER.parse(reader));
    }
 catch (    IOException e) {
      return this.exception.apply(e.getMessage());
    }
  }
;
  return SCHEDULER.submit(post);
}
Program: 11698
Project: 11698
Buggy source:
/** 
 * Performs an HTTP(s) GET to the server.
 */
public Future<T> get(){
  Callable<T> get=() -> {
    try {
      this.c.setRequestMethod("String_Node_Str");
      this.c.setRequestProperty("String_Node_Str","String_Node_Str");
      this.c.setRequestProperty("String_Node_Str","String_Node_Str");
      this.c.setDoOutput(true);
      this.c.setDoInput(true);
      int code=this.c.getResponseCode();
      if (code != 200) {
        return this.exception.apply(String.valueOf(code));
      }
      BufferedReader reader=new BufferedReader(new InputStreamReader(this.c.getInputStream()));
      return this.callback.apply(ConfigIo.PARSER.parse(reader));
    }
 catch (    IOException e) {
      return this.exception.apply(e.getMessage());
    }
  }
;
  return ServerThreadPool.forSpec(PoolSpec.SCHEDULER).submit(get);
}

Fixed version (ground truth):
/** 
 * Performs an HTTP(s) GET to the server.
 */
public Future<T> get(){
  Callable<T> get=() -> {
    try {
      this.c.setRequestMethod("String_Node_Str");
      this.c.setRequestProperty("String_Node_Str","String_Node_Str");
      this.c.setRequestProperty("String_Node_Str","String_Node_Str");
      this.c.setDoOutput(true);
      this.c.setDoInput(true);
      int code=this.c.getResponseCode();
      if (code != 200) {
        return this.exception.apply(String.valueOf(code));
      }
      BufferedReader reader=new BufferedReader(new InputStreamReader(this.c.getInputStream()));
      return this.callback.apply(ConfigIo.PARSER.parse(reader));
    }
 catch (    IOException e) {
      return this.exception.apply(e.getMessage());
    }
  }
;
  return SCHEDULER.submit(get);
}
Program: 11699
Project: 11699
Buggy source:
@Override public Object read(JsonReader in) throws IOException {
  JsonToken token=in.peek();
switch (token) {
case BEGIN_ARRAY:
    List<Object> list=new ArrayList<>();
  in.beginArray();
while (in.hasNext()) {
  list.add(this.read(in));
}
in.endArray();
return list;
case BEGIN_OBJECT:
Map<String,Object> map=new LinkedTreeMap<>();
in.beginObject();
while (in.hasNext()) {
String key=in.nextName();
Object value=this.read(in);
if (key.equals("String_Node_Str")) {
try {
return this.gson.getAdapter(Class.forName((String)value)).read(in);
}
 catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
map.put(key,value);
}
in.endObject();
return map;
case STRING:
return in.nextString();
case NUMBER:
double d=in.nextDouble();
if (DoubleMath.isMathematicalInteger(d)) {
return (int)d;
}
return d;
case BOOLEAN:
return in.nextBoolean();
case NULL:
in.nextNull();
return null;
default :
throw new IllegalStateException();
}
}

Fixed version (ground truth):
@Override public Object read(JsonReader in) throws IOException {
  JsonToken token=in.peek();
switch (token) {
case BEGIN_ARRAY:
    List<Object> list=new ArrayList<>();
  in.beginArray();
while (in.hasNext()) {
  list.add(this.read(in));
}
in.endArray();
return list;
case BEGIN_OBJECT:
Map<String,Object> map=new LinkedTreeMap<>();
in.beginObject();
while (in.hasNext()) {
String key=in.nextName();
Object value=this.read(in);
if (key.equals("String_Node_Str")) {
try {
return this.gson.getAdapter(Class.forName((String)value)).read(in);
}
 catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
map.put(key,value);
}
in.endObject();
return map;
case STRING:
return in.nextString();
case NUMBER:
return in.nextDouble();
case BOOLEAN:
return in.nextBoolean();
case NULL:
in.nextNull();
return null;
default :
throw new IllegalStateException();
}
}
Program: 11700
Project: 11700
Buggy source:
/** 
 * Constructs a new player.
 */
private TridentPlayer(NetClient client,World world,String name,UUID uuid,String textures){
  super(world);
  this.client=client;
  this.name=name;
  this.uuid=uuid;
  this.gameMode=world.opts().gameMode();
  this.textures=textures;
  this.renderDistance=7;
}

Fixed version (ground truth):
/** 
 * Constructs a new player.
 */
private TridentPlayer(NetClient client,World world,String name,UUID uuid,String textures){
  super(world,PoolSpec.PLAYERS);
  this.client=client;
  this.name=name;
  this.uuid=uuid;
  this.gameMode=world.opts().gameMode();
  this.textures=textures;
  this.renderDistance=7;
}
Program: 11701
Project: 11701
Buggy source:
public void read(ByteBuf buf){
  List<EntityMetadataItem> items=new LinkedList<>();
  short id;
  while ((id=buf.readUnsignedByte()) != 0xFF) {
    EntityMetadataType type=EntityMetadataType.values()[id];
    Object value=null;
switch (type) {
case BYTE:
      value=buf.readByte();
    break;
case VARINT:
  value=NetData.rvint(buf);
break;
case FLOAT:
value=buf.readFloat();
break;
case STRING:
value=NetData.rstr(buf);
break;
case CHAT:
value=ChatComponent.fromJson(new Gson().fromJson(NetData.rstr(buf),JsonObject.class));
break;
case SLOT:
break;
case BOOLEAN:
value=buf.readBoolean();
break;
case ROTATION:
float[] rd=new float[3];
for (int i=0; i < 3; i++) rd[i]=buf.readFloat();
value=new Vector(rd[0],rd[1],rd[2]);
break;
case POSITION:
{
long val=buf.readLong();
int x=(int)(val >> 38);
int y=(int)((val >> 26) & 0xFFF);
int z=(int)(val << 38 >> 38);
value=new Vector(x,y,z);
break;
}
case OPTPOSITION:
{
if (buf.readBoolean()) {
long val=buf.readLong();
int x=(int)(val >> 38);
int y=(int)((val >> 26) & 0xFFF);
int z=(int)(val << 38 >> 38);
value=new Vector(x,y,z);
}
 else {
value=null;
}
break;
}
case DIRECTION:
value=Direction.values()[NetData.rvint(buf)];
break;
case OPTUUID:
if (buf.readBoolean()) {
value=new UUID(buf.readLong(),buf.readLong());
}
 else {
value=null;
}
break;
case BLOCKID:
int bid=NetData.rvint(buf);
value=new int[]{(bid >> 4) & 0xF,bid & 0xF};
break;
}
if (value != null) {
items.add(new EntityMetadataItem(id,type,value));
}
}
this.items.clear();
this.items.addAll(items);
}

Fixed version (ground truth):
public void read(ByteBuf buf){
  List<EntityMetadataItem> items=new LinkedList<>();
  short id;
  while ((id=buf.readUnsignedByte()) != 0xFF) {
    EntityMetadataType type=EntityMetadataType.values()[id];
    Object value=null;
switch (type) {
case BYTE:
      value=buf.readByte();
    break;
case VARINT:
  value=NetData.rvint(buf);
break;
case FLOAT:
value=buf.readFloat();
break;
case STRING:
value=NetData.rstr(buf);
break;
case CHAT:
value=ChatComponent.fromJson(new Gson().fromJson(NetData.rstr(buf),JsonObject.class));
break;
case SLOT:
break;
case BOOLEAN:
value=buf.readBoolean();
break;
case ROTATION:
float[] rd=new float[3];
for (int i=0; i < 3; i++) {
rd[i]=buf.readFloat();
}
value=new Vector(rd[0],rd[1],rd[2]);
break;
case POSITION:
{
long val=buf.readLong();
int x=(int)(val >> 38);
int y=(int)((val >> 26) & 0xFFF);
int z=(int)(val << 38 >> 38);
value=new Vector(x,y,z);
break;
}
case OPTPOSITION:
{
if (buf.readBoolean()) {
long val=buf.readLong();
int x=(int)(val >> 38);
int y=(int)((val >> 26) & 0xFFF);
int z=(int)(val << 38 >> 38);
value=new Vector(x,y,z);
}
 else {
value=null;
}
break;
}
case DIRECTION:
value=Direction.values()[NetData.rvint(buf)];
break;
case OPTUUID:
if (buf.readBoolean()) {
value=new UUID(buf.readLong(),buf.readLong());
}
 else {
value=null;
}
break;
case BLOCKID:
int bid=NetData.rvint(buf);
value=new int[]{(bid >> 4) & 0xF,bid & 0xF};
break;
}
if (value != null) {
items.add(new EntityMetadataItem(id,type,value));
}
}
this.items.clear();
this.items.addAll(items);
}
Program: 11702
Project: 11702
Buggy source:
/** 
 * Obtains the net state which the packet is registered to be present in.
 * @param cls the packet class
 * @return the state of the packet
 */
public static int packetInfo(Class<? extends Packet> cls){
  int identifier=PACKETS.get(cls);
  if (identifier != -1) {
    return identifier;
  }
  throw new IllegalArgumentException(cls.getSimpleName() + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Obtains the net state which the packet is registered to be present in.
 * @param cls the packet class
 * @return the state of the packet
 */
public static int packetInfo(Class<? extends Packet> cls){
  int identifier=PACKET_IDS.getInt(cls);
  if (identifier != -1) {
    return identifier;
  }
  throw new IllegalArgumentException(cls.getSimpleName() + "String_Node_Str");
}
Program: 11703
Project: 11703
Buggy source:
/** 
 * Obtains the class of the packet containing the given ID, bound, and the given state.
 * @param state the packet's network state
 * @param bound the packet bound
 * @param id the packet ID
 * @return the packet class
 */
public static Class<? extends Packet> byId(NetState state,Bound bound,int id){
  int identifier=shift(state,bound,id);
  Class<? extends Packet> packet=PACKET_IDS.get(identifier);
  if (packet != null) {
    return packet;
  }
  String paddedHex=String.format("String_Node_Str",Integer.toHexString(id).toUpperCase()).replace(' ','0');
  throw new IllegalArgumentException(state + "String_Node_Str" + bound+ "String_Node_Str"+ id+ "String_Node_Str"+ paddedHex+ "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Obtains the class of the packet containing the given ID, bound, and the given state.
 * @param state the packet's network state
 * @param bound the packet bound
 * @param id the packet ID
 * @return the packet class
 */
public static Class<? extends Packet> byId(NetState state,Bound bound,int id){
  int identifier=shift(state,bound,id);
  Class<? extends Packet> packet=PACKETS.get(identifier);
  if (packet != null) {
    return packet;
  }
  String paddedHex=String.format("String_Node_Str",Integer.toHexString(id).toUpperCase()).replace(' ','0');
  throw new IllegalArgumentException(state + "String_Node_Str" + bound+ "String_Node_Str"+ id+ "String_Node_Str"+ paddedHex+ "String_Node_Str");
}
Program: 11704
Project: 11704
Buggy source:
/** 
 * Puts the given packet class into the map with the given ID, and also inserts the constructor into the CTOR cache.
 * @param cls the class
 * @param id the ID
 */
private static void put(Class<? extends Packet> cls,NetState state,Bound bound,int id){
  int identifier=shift(state,bound,id);
  PACKETS.put(cls,identifier);
  PACKET_IDS.put(identifier,cls);
  if (bound == Bound.SERVER) {
    CTORS.put(cls,ConstructorAccess.get(cls));
  }
}

Fixed version (ground truth):
/** 
 * Puts the given packet class into the map with the given ID, and also inserts the constructor into the CTOR cache.
 * @param cls the class
 * @param id the ID
 */
private static void put(Class<? extends Packet> cls,NetState state,Bound bound,int id){
  int identifier=shift(state,bound,id);
  PACKET_IDS.put(cls,identifier);
  if (bound == Bound.SERVER) {
    PACKETS.put(identifier,cls);
    CTORS.put(cls,ConstructorAccess.get(cls));
  }
}