nus-yam/ex-repair huggingface dataset:
Program: 76696
Project: 76696
Buggy source:
@PostMapping(MODEL + "String_Node_Str") @Function("String_Node_Str") @ResponseBody public JsonResult importExcel(@RequestParam("String_Node_Str") MultipartFile file) throws Exception {
  if (file.isEmpty()) {
    return JsonResult.fail();
  }
  String fileName=file.getOriginalFilename();
  InputStream ins=file.getInputStream();
  InputStream inputXML=Thread.currentThread().getContextClassLoader().getResourceAsStream("String_Node_Str");
  XLSReader mainReader=ReaderBuilder.buildFromXML(inputXML);
  InputStream inputXLS=ins;
  List<CoreDict> dicts=new ArrayList<CoreDict>();
  Map beans=new HashMap();
  beans.put("String_Node_Str",dicts);
  XLSReadStatus readStatus=mainReader.read(inputXLS,beans);
  System.out.println(dicts);
  return JsonResult.success();
}

Fixed version (ground truth):
@PostMapping(MODEL + "String_Node_Str") @Function("String_Node_Str") @ResponseBody public JsonResult importExcel(@RequestParam("String_Node_Str") MultipartFile file) throws Exception {
  if (file.isEmpty()) {
    return JsonResult.fail();
  }
  String fileName=file.getOriginalFilename();
  InputStream ins=file.getInputStream();
  InputStream inputXML=Thread.currentThread().getContextClassLoader().getResourceAsStream("String_Node_Str");
  XLSReader mainReader=ReaderBuilder.buildFromXML(inputXML);
  InputStream inputXLS=ins;
  List<DictExcelImportData> dicts=new ArrayList<DictExcelImportData>();
  Map beans=new HashMap();
  beans.put("String_Node_Str",dicts);
  XLSReadStatus readStatus=mainReader.read(inputXLS,beans);
  try {
    this.dictService.batchInsert(dicts);
    return JsonResult.success();
  }
 catch (  Exception ex) {
    return JsonResult.failMessage(ex.getMessage());
  }
}
Program: 76697
Project: 76697
Buggy source:
@PostMapping(MODEL + "String_Node_Str") @Function("String_Node_Str") @ResponseBody public JsonResult<String> export(HttpServletResponse response,UserQuery condtion){
  String excelTemplate="String_Node_Str";
  PageQuery<CoreUser> page=condtion.getPageQuery();
  page.setPageSize(Integer.MAX_VALUE);
  page.setPageNumber(1);
  page.setTotalRow(Integer.MAX_VALUE);
  List<UserExcelData> users=userConsoleService.queryExcel(page);
  try (InputStream is=Thread.currentThread().getContextClassLoader().getResourceAsStream(excelTemplate)){
    if (is == null) {
      throw new PlatformException("String_Node_Str" + excelTemplate);
    }
    FileItem item=fileService.createFileTemp("String_Node_Str");
    OutputStream os=item.openOutpuStream();
    Context context=new Context();
    context.putVar("String_Node_Str",users);
    JxlsHelper.getInstance().processTemplate(is,os,context);
    return JsonResult.success(item.getId());
  }
 catch (  IOException e) {
    throw new PlatformException(e.getMessage());
  }
}

Fixed version (ground truth):
@PostMapping(MODEL + "String_Node_Str") @Function("String_Node_Str") @ResponseBody public JsonResult<String> export(HttpServletResponse response,UserQuery condtion){
  String excelTemplate="String_Node_Str";
  PageQuery<CoreUser> page=condtion.getPageQuery();
  page.setPageSize(Integer.MAX_VALUE);
  page.setPageNumber(1);
  page.setTotalRow(Integer.MAX_VALUE);
  List<UserExcelExportData> users=userConsoleService.queryExcel(page);
  try (InputStream is=Thread.currentThread().getContextClassLoader().getResourceAsStream(excelTemplate)){
    if (is == null) {
      throw new PlatformException("String_Node_Str" + excelTemplate);
    }
    FileItem item=fileService.createFileTemp("String_Node_Str");
    OutputStream os=item.openOutpuStream();
    Context context=new Context();
    context.putVar("String_Node_Str",users);
    JxlsHelper.getInstance().processTemplate(is,os,context);
    return JsonResult.success(item.getId());
  }
 catch (  IOException e) {
    throw new PlatformException(e.getMessage());
  }
}
Program: 76698
Project: 76698
Buggy source:
public void batchDelCoreDictByIds(List<String> ids);

Fixed version (ground truth):
public void batchDelCoreDictByIds(List<Long> ids);
Program: 76699
Project: 76699
Buggy source:
public void batchDelCoreDict(List<String> ids){
  try {
    dictDao.batchDelCoreDictByIds(ids);
  }
 catch (  Exception e) {
    throw new PlatformException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public void batchDelCoreDict(List<Long> ids){
  try {
    dictDao.batchDelCoreDictByIds(ids);
  }
 catch (  Exception e) {
    throw new PlatformException("String_Node_Str",e);
  }
}
Program: 76700
Project: 76700
Buggy source:
public List<UserExcelData> queryExcel(PageQuery<CoreUser> query){
  PageQuery<CoreUser> ret=userDao.queryByCondtion(query);
  List<CoreUser> list=ret.getList();
  OrgItem orgRoot=platformService.buildOrg();
  List<UserExcelData> items=new ArrayList<>();
  for (  CoreUser user : list) {
    UserExcelData userItem=new UserExcelData();
    userItem.setCode(user.getCode());
    userItem.setId(user.getId());
    userItem.setName(user.getName());
    CoreDict dict=dictService.findCoreDict(user.getState());
    userItem.setStateText(dict.getName());
    if (StringUtils.isNotEmpty(user.getJobType1())) {
      dict=dictService.findCoreDict(user.getJobType1());
      userItem.setJobType1Text(dict.getName());
    }
    String orgName=orgRoot.findChild(user.getOrgId()).getName();
    userItem.setOrgText(orgName);
    items.add(userItem);
  }
  return items;
}

Fixed version (ground truth):
public List<UserExcelData> queryExcel(PageQuery<CoreUser> query){
  PageQuery<CoreUser> ret=userDao.queryByCondtion(query);
  List<CoreUser> list=ret.getList();
  OrgItem orgRoot=platformService.buildOrg();
  List<UserExcelData> items=new ArrayList<>();
  for (  CoreUser user : list) {
    UserExcelData userItem=new UserExcelData();
    userItem.setCode(user.getCode());
    userItem.setId(user.getId());
    userItem.setName(user.getName());
    CoreDict dict=dictService.findCoreDict(CoreDictType.USER_STATE,user.getState());
    userItem.setStateText(dict.getName());
    if (StringUtils.isNotEmpty(user.getJobType1())) {
      dict=dictService.findCoreDict("String_Node_Str",user.getJobType1());
      userItem.setJobType1Text(dict.getName());
    }
    String orgName=orgRoot.findChild(user.getOrgId()).getName();
    userItem.setOrgText(orgName);
    items.add(userItem);
  }
  return items;
}
Program: 76701
Project: 76701
Buggy source:
@GetMapping(MODEL + "String_Node_Str") @Function("String_Node_Str") public ModelAndView edit(String id){
  ModelAndView view=new ModelAndView("String_Node_Str");
  CoreDict dict=dictService.queryById(id);
  view.addObject("String_Node_Str",dict);
  return view;
}

Fixed version (ground truth):
@GetMapping(MODEL + "String_Node_Str") @Function("String_Node_Str") public ModelAndView edit(Long id){
  ModelAndView view=new ModelAndView("String_Node_Str");
  CoreDict dict=dictService.queryById(id);
  view.addObject("String_Node_Str",dict);
  return view;
}
Program: 76702
Project: 76702
Buggy source:
@PostMapping(MODEL + "String_Node_Str") @Function("String_Node_Str") @ResponseBody public JsonResult delete(String ids){
  if (ids.endsWith("String_Node_Str")) {
    ids=StringUtils.substringBeforeLast(ids,"String_Node_Str");
  }
  List<String> idList=Arrays.asList(ids.split("String_Node_Str"));
  dictService.batchDelCoreDict(idList);
  return new JsonResult().success();
}

Fixed version (ground truth):
@PostMapping(MODEL + "String_Node_Str") @Function("String_Node_Str") @ResponseBody public JsonResult delete(String ids){
  List<Long> dels=ConvertUtil.str2longs(ids);
  dictService.batchDelCoreDict(dels);
  return new JsonResult().success();
}
Program: 76703
Project: 76703
Buggy source:
@Override public void createWorld(String id,WorldGenerator generator){
  World world=new SimpleGeneratedWorld(id,worldLoader.getDataSource(id),generator);
  worldMap.put(id,world);
}

Fixed version (ground truth):
@Override public void createWorld(String id,WorldGenerator generator){
  World world;
  try {
    world=new SimpleGeneratedWorld(id,worldLoader.getDataSource(id),generator);
    worldMap.put(id,world);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str",e);
  }
}
Program: 76704
Project: 76704
Buggy source:
public PaletteBlockStateStorage(ByteBuf in) throws IOException {
  this.bitsPerEntry=in.readUnsignedByte();
  int stateCount=ByteBufUtils.readVarInt(in);
  for (int i=0; i < stateCount; i++) {
    this.palette.add(BlockState.of(ByteBufUtils.readVarInt(in)));
  }
  int dataAmount=ByteBufUtils.readVarInt(in);
  long[] data=new long[dataAmount];
  for (int i=0; i < dataAmount; dataAmount++) {
    data[i]=in.readLong();
  }
  this.baseStorage=new EntrySizeBasedStorage(this.bitsPerEntry,data);
}

Fixed version (ground truth):
public PaletteBlockStateStorage(ByteBuf in) throws IOException {
  this.bitsPerEntry=in.readUnsignedByte();
  int stateCount=ByteBufUtils.readVarInt(in);
  for (int i=0; i < stateCount; i++) {
    this.palette.add(BlockState.of(ByteBufUtils.readVarInt(in)));
  }
  int dataAmount=ByteBufUtils.readVarInt(in);
  long[] data=new long[dataAmount];
  for (int i=0; i < dataAmount; i++) {
    data[i]=in.readLong();
  }
  this.baseStorage=new EntrySizeBasedStorage(this.bitsPerEntry,data);
}
Program: 76705
Project: 76705
Buggy source:
public void finishLogin(Connection connection,UUID uuid,String accountName,UserProperty[] properties){
  if (connectionLoginDataMap.remove(connection) == null || connection.isClosed())   return;
  Collection<UserProperty> userProperties=new ArrayList<>(Arrays.asList(properties));
  AsyncLoginEvent event=CleanstoneServer.publishEvent(new AsyncLoginEvent(connection,uuid,accountName,userProperties));
  if (event.isCancelled()) {
    stopLogin(connection,event.getKickReason());
    return;
  }
  SetCompressionPacket setCompressionPacket=new SetCompressionPacket(0);
  LoginSuccessPacket loginSuccessPacket=new LoginSuccessPacket(uuid,accountName);
  connection.sendPacket(loginSuccessPacket);
  logger.info("String_Node_Str" + accountName + "String_Node_Str"+ uuid.toString()+ "String_Node_Str");
  connection.setProtocolState(VanillaProtocolState.PLAY);
  CleanstoneServer.publishEvent(new AsyncLoginSuccessEvent(connection,uuid,accountName,userProperties));
}

Fixed version (ground truth):
public void finishLogin(Connection connection,UUID uuid,String accountName,UserProperty[] properties){
  if (connectionLoginDataMap.remove(connection) == null || connection.isClosed())   return;
  if (properties == null) {
    properties=new UserProperty[0];
  }
  Collection<UserProperty> userProperties=new ArrayList<>(Arrays.asList(properties));
  AsyncLoginEvent event=CleanstoneServer.publishEvent(new AsyncLoginEvent(connection,uuid,accountName,userProperties));
  if (event.isCancelled()) {
    stopLogin(connection,event.getKickReason());
    return;
  }
  SetCompressionPacket setCompressionPacket=new SetCompressionPacket(0);
  LoginSuccessPacket loginSuccessPacket=new LoginSuccessPacket(uuid,accountName);
  connection.sendPacket(loginSuccessPacket);
  logger.info("String_Node_Str" + accountName + "String_Node_Str"+ uuid.toString()+ "String_Node_Str");
  connection.setProtocolState(VanillaProtocolState.PLAY);
  CleanstoneServer.publishEvent(new AsyncLoginSuccessEvent(connection,uuid,accountName,userProperties));
}
Program: 76706
Project: 76706
Buggy source:
@Nullable @Override public Chunk loadExistingChunk(int x,int y){
  ByteBuf blocksKey=ChunkDataKeyFactory.create(x,y,StandardChunkDataType.BLOCKS);
  BlockDataStorage blockDataStorage;
  try {
    blockDataStorage=new BlockDataStorage(get(blocksKey),hasSkyLight);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str" + x + "String_Node_Str"+ y+ "String_Node_Str"+ worldID+ "String_Node_Str",e);
    return null;
  }
  return new SimpleChunk(blockDataStorage.constructTable(),blockDataStorage,Collections.emptyList(),x,y);
}

Fixed version (ground truth):
@Nullable @Override public Chunk loadExistingChunk(int x,int y){
  ByteBuf blocksKey=ChunkDataKeyFactory.create(x,y,StandardChunkDataType.BLOCKS);
  BlockDataStorage blockDataStorage;
  try {
    blockDataStorage=new BlockDataStorage(get(blocksKey),hasSkyLight);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str" + x + "String_Node_Str"+ y+ "String_Node_Str"+ worldID+ "String_Node_Str",e);
    return null;
  }
catch (  NullPointerException e) {
    return null;
  }
  return new SimpleChunk(blockDataStorage.constructTable(),blockDataStorage,Collections.emptyList(),x,y);
}
Program: 76707
Project: 76707
Buggy source:
@Override public ListenableFuture<Chunk> getChunk(int x,int y){
  if (isChunkLoaded(x,y)) {
    return new AsyncResult<>(getLoadedChunk(x,y));
  }
  ListenableFuture<Chunk> chunkFuture=world.getChunkProvider().getChunk(x,y);
  chunkFuture.addCallback((chunk) -> chunks[x][y]=chunk,(error) -> logger.error("String_Node_Str" + x + "String_Node_Str"+ y,error));
  return chunkFuture;
}

Fixed version (ground truth):
@Override public ListenableFuture<Chunk> getChunk(int x,int y){
  if (isChunkLoaded(x,y)) {
    return new AsyncResult<>(getLoadedChunk(x,y));
  }
  ListenableFuture<Chunk> chunkFuture=chunkProvider.getChunk(x,y);
  chunkFuture.addCallback((chunk) -> chunks[x][y]=chunk,(error) -> logger.error("String_Node_Str" + x + "String_Node_Str"+ y,error));
  return chunkFuture;
}
Program: 76708
Project: 76708
Buggy source:
public SimpleRegion(int x,int y,RegionWorker regionWorker,World world){
  this(x,y,new SimpleChunk[Region.CHUNK_COUNT_ROOT][Region.CHUNK_COUNT_ROOT],regionWorker,world);
}

Fixed version (ground truth):
public SimpleRegion(int x,int y,RegionWorker regionWorker,ChunkProvider chunkProvider){
  this(x,y,new SimpleChunk[Region.CHUNK_COUNT_ROOT][Region.CHUNK_COUNT_ROOT],regionWorker,chunkProvider);
}
Program: 76709
Project: 76709
Buggy source:
@Override public ListenableFuture<Region> getRegion(int x,int y){
  return null;
}

Fixed version (ground truth):
@Override public ListenableFuture<Region> getRegion(int x,int y){
  final Pair coordPair=Pair.of(x,y);
  if (regions.containsKey(coordPair)) {
    return new AsyncResult<>(regions.get(coordPair));
  }
  return loadRegion(x,y);
}
Program: 76710
Project: 76710
Buggy source:
@Override public void unloadRegion(int x,int y){
}

Fixed version (ground truth):
@Override public void unloadRegion(int x,int y){
  regions.remove(Pair.of(x,y));
}
Program: 76711
Project: 76711
Buggy source:
@Override public Collection<Region> getLoadedRegions(){
  return null;
}

Fixed version (ground truth):
@Override public Collection<Region> getLoadedRegions(){
  return regions.values();
}
Program: 76712
Project: 76712
Buggy source:
@Override public ListenableFuture<Region> loadRegion(int x,int y){
  return null;
}

Fixed version (ground truth):
@Override public ListenableFuture<Region> loadRegion(int x,int y){
  Region region=new SimpleRegion(x,y,new LocalRegionWorker(),chunkProvider);
  regions.put(Pair.of(x,y),region);
  return new AsyncResult<>(region);
}
Program: 76713
Project: 76713
Buggy source:
public SimpleRegionManager(AsyncListenableTaskExecutor localWorkerExecutor){
  regions=new HashMap<>();
}

Fixed version (ground truth):
public SimpleRegionManager(ChunkProvider chunkProvider){
  this.chunkProvider=chunkProvider;
  regions=new HashMap<>();
}
Program: 76714
Project: 76714
Buggy source:
@Override public ListenableFuture<Chunk> getChunk(int x,int y){
  return executor.submitListenable(() -> {
    Chunk chunk=dataSource.loadExistingChunk(x,y);
    if (chunk == null) {
      chunk=generator.generateChunk(x,y);
    }
    return chunk;
  }
);
}

Fixed version (ground truth):
@Override public ListenableFuture<Chunk> getChunk(int x,int y){
  return executor.submitListenable(() -> {
    Chunk chunk=dataSource.loadExistingChunk(x,y);
    if (chunk == null) {
      chunk=generator.generateChunk(x,y);
      dataSource.saveChunk(chunk);
    }
    return chunk;
  }
);
}
Program: 76715
Project: 76715
Buggy source:
protected void sendChunkLoad(Player player,int x,int y){
  BlockDataStorage storage=flatWorldGenerator.generateChunk(x,y).getBlockDataStorage();
  ChunkDataPacket chunkDataPacket=new ChunkDataPacket(x,y,true,storage,new NamedBinaryTag[]{});
  player.sendPacket(chunkDataPacket);
}

Fixed version (ground truth):
protected void sendChunkLoad(Player player,int x,int y){
  World world=player.getEntity().getLocation().getPosition().getWorld();
  world.getChunkProvider().getChunk(x,y).addCallback(chunk -> {
    if (chunk == null) {
      logger.error("String_Node_Str",x,y);
      return;
    }
    ChunkDataPacket chunkDataPacket=new ChunkDataPacket(x,y,true,chunk.getBlockDataStorage(),new NamedBinaryTag[]{});
    player.sendPacket(chunkDataPacket);
  }
,throwable -> {
    logger.error("String_Node_Str",throwable);
  }
);
}
Program: 76716
Project: 76716
Buggy source:
private int getUnoccupiedEntityID(){
  ThreadLocalRandom current=ThreadLocalRandom.current();
  int random=current.nextInt();
  while (entityMap.containsKey(random)) {
    random=current.nextInt();
  }
  return random;
}

Fixed version (ground truth):
private int getUnoccupiedEntityID(){
  int random=current.nextInt();
  while (entityMap.containsKey(random)) {
    random=current.nextInt();
  }
  return random;
}
Program: 76717
Project: 76717
Buggy source:
/** 
 * This sends the Player Spawn Packet for every Player to the Joined User
 */
private void sendToJoined(Player player){
  playerManager.getOnlinePlayers().forEach(onlinePlayer -> {
    if (onlinePlayer == player) {
      return;
    }
    Entity entity=player.getEntity();
    Location location=entity.getLocation();
    SpawnPlayerPacket spawnPlayerPacket=new SpawnPlayerPacket(entity.getEntityID(),onlinePlayer.getId().getUUID(),location.getPosition().getX(),location.getPosition().getY(),location.getPosition().getZ(),location.getRotation().getYaw(),location.getRotation().getPitch(),null);
    player.sendPacket(spawnPlayerPacket);
  }
);
}

Fixed version (ground truth):
/** 
 * This sends the Player Spawn Packet for every Player to the Joined User
 */
private void sendToJoined(Player player){
  playerManager.getOnlinePlayers().forEach(onlinePlayer -> {
    if (onlinePlayer == player) {
      return;
    }
    Entity entity=onlinePlayer.getEntity();
    Location location=entity.getLocation();
    SpawnPlayerPacket spawnPlayerPacket=new SpawnPlayerPacket(entity.getEntityID(),onlinePlayer.getId().getUUID(),location.getPosition().getX(),location.getPosition().getY(),location.getPosition().getZ(),location.getRotation().getYaw(),location.getRotation().getPitch(),null);
    player.sendPacket(spawnPlayerPacket);
  }
);
}
Program: 76718
Project: 76718
Buggy source:
@Async(value="String_Node_Str") @EventListener public void onPlayerPositionAndLookPacket(PlayerInboundPacketEvent event){
  if (!(event.getPacket() instanceof InPlayerPositionAndLookPacket)) {
    return;
  }
  InPlayerPositionAndLookPacket playerPositionAndLookPacket=(InPlayerPositionAndLookPacket)event.getPacket();
  Entity entity=event.getPlayer().getEntity();
  if (entity == null) {
    return;
  }
  Position oldPosition=entity.getLocation().getPosition();
  Rotation oldRotation=entity.getLocation().getRotation();
  Position newPosition=new Position(oldPosition);
  Rotation newRotation=new Rotation(oldRotation);
  newPosition.setX(playerPositionAndLookPacket.getX());
  newPosition.setY(playerPositionAndLookPacket.getY());
  newPosition.setZ(playerPositionAndLookPacket.getZ());
  newRotation.setPitch(playerPositionAndLookPacket.getPitch());
  newRotation.setYaw(playerPositionAndLookPacket.getYaw());
  entity.getLocation().setPosition(newPosition);
  entity.getLocation().setRotation(newRotation);
  CleanstoneServer.publishEvent(new PlayerMoveEvent(event.getPlayer(),oldPosition,oldRotation,newPosition,newRotation));
}

Fixed version (ground truth):
@Async(value="String_Node_Str") @EventListener public void onPlayerPositionAndLookPacket(PlayerInboundPacketEvent event){
  if (!(event.getPacket() instanceof InPlayerPositionAndLookPacket)) {
    return;
  }
  InPlayerPositionAndLookPacket playerPositionAndLookPacket=(InPlayerPositionAndLookPacket)event.getPacket();
  Entity entity=event.getPlayer().getEntity();
  if (entity == null) {
    return;
  }
  Position oldPosition=entity.getLocation().getPosition();
  Rotation oldRotation=entity.getLocation().getRotation();
  Position newPosition=new Position(oldPosition);
  Rotation newRotation=new Rotation(oldRotation);
  newPosition.setX(playerPositionAndLookPacket.getX());
  newPosition.setY(playerPositionAndLookPacket.getY());
  newPosition.setZ(playerPositionAndLookPacket.getZ());
  newRotation.setPitch(playerPositionAndLookPacket.getPitch());
  newRotation.setYaw(playerPositionAndLookPacket.getYaw());
  entity.setLocation(new Location(newPosition,newRotation));
  CleanstoneServer.publishEvent(new PlayerMoveEvent(event.getPlayer(),oldPosition,oldRotation,newPosition,newRotation));
}
Program: 76719
Project: 76719
Buggy source:
@Async(value="String_Node_Str") @EventListener public void onPlayerPositionPacket(PlayerInboundPacketEvent event){
  if (!(event.getPacket() instanceof PlayerPositionPacket)) {
    return;
  }
  PlayerPositionPacket playerPositionPacket=(PlayerPositionPacket)event.getPacket();
  Human entity=event.getPlayer().getEntity();
  if (entity == null) {
    return;
  }
  Position oldPosition=entity.getLocation().getPosition();
  Rotation oldRotation=entity.getLocation().getRotation();
  Position newPosition=new Position(oldPosition);
  newPosition.setX(playerPositionPacket.getX());
  newPosition.setY(playerPositionPacket.getFeetY());
  newPosition.setZ(playerPositionPacket.getZ());
  entity.getLocation().setPosition(newPosition);
  CleanstoneServer.publishEvent(new PlayerMoveEvent(event.getPlayer(),oldPosition,oldRotation,newPosition,oldRotation));
}

Fixed version (ground truth):
@Async(value="String_Node_Str") @EventListener public void onPlayerPositionPacket(PlayerInboundPacketEvent event){
  if (!(event.getPacket() instanceof PlayerPositionPacket)) {
    return;
  }
  PlayerPositionPacket playerPositionPacket=(PlayerPositionPacket)event.getPacket();
  Human entity=event.getPlayer().getEntity();
  if (entity == null) {
    return;
  }
  Position oldPosition=entity.getLocation().getPosition();
  Rotation oldRotation=entity.getLocation().getRotation();
  Position newPosition=new Position(oldPosition);
  newPosition.setX(playerPositionPacket.getX());
  newPosition.setY(playerPositionPacket.getFeetY());
  newPosition.setZ(playerPositionPacket.getZ());
  entity.setLocation(new Location(newPosition,oldRotation));
  CleanstoneServer.publishEvent(new PlayerMoveEvent(event.getPlayer(),oldPosition,oldRotation,newPosition,oldRotation));
}
Program: 76720
Project: 76720
Buggy source:
@Async(value="String_Node_Str") @EventListener public void onPlayerLookPacket(PlayerInboundPacketEvent event){
  if (!(event.getPacket() instanceof PlayerLookPacket)) {
    return;
  }
  PlayerLookPacket playerLookPacket=(PlayerLookPacket)event.getPacket();
  Entity entity=event.getPlayer().getEntity();
  if (entity == null) {
    return;
  }
  Position oldPosition=entity.getLocation().getPosition();
  Rotation oldRotation=entity.getLocation().getRotation();
  Rotation newRotation=new Rotation(oldRotation);
  newRotation.setPitch(playerLookPacket.getPitch());
  newRotation.setYaw(playerLookPacket.getYaw());
  entity.getLocation().setRotation(newRotation);
  CleanstoneServer.publishEvent(new PlayerMoveEvent(event.getPlayer(),oldPosition,oldRotation,oldPosition,newRotation));
}

Fixed version (ground truth):
@Async(value="String_Node_Str") @EventListener public void onPlayerLookPacket(PlayerInboundPacketEvent event){
  if (!(event.getPacket() instanceof PlayerLookPacket)) {
    return;
  }
  PlayerLookPacket playerLookPacket=(PlayerLookPacket)event.getPacket();
  Entity entity=event.getPlayer().getEntity();
  if (entity == null) {
    return;
  }
  Position oldPosition=entity.getLocation().getPosition();
  Rotation oldRotation=entity.getLocation().getRotation();
  Rotation newRotation=new Rotation(oldRotation);
  newRotation.setPitch(playerLookPacket.getPitch());
  newRotation.setYaw(playerLookPacket.getYaw());
  entity.setLocation(new Location(oldPosition,newRotation));
  CleanstoneServer.publishEvent(new PlayerMoveEvent(event.getPlayer(),oldPosition,oldRotation,oldPosition,newRotation));
}
Program: 76721
Project: 76721
Buggy source:
@Override public Packet decode(ByteBuf byteBuf){
  String locale;
  try {
    locale=ByteBufUtils.readUTF8(byteBuf);
  }
 catch (  IOException e) {
    e.printStackTrace();
    locale="String_Node_Str";
  }
  final byte viewDistance=byteBuf.readByte();
  ChatMode chatMode;
  try {
    chatMode=ChatMode.fromModeID(ByteBufUtils.readVarInt(byteBuf));
  }
 catch (  IOException e) {
    e.printStackTrace();
    chatMode=ChatMode.ENABLED;
  }
  final boolean chatColors=byteBuf.readBoolean();
  final DisplayedSkinParts[] displayedSkinParts=DisplayedSkinParts.fromBitMask(byteBuf.readByte());
  MainHand mainHand;
  try {
    mainHand=MainHand.fromHandID(ByteBufUtils.readVarInt(byteBuf));
  }
 catch (  IOException e) {
    e.printStackTrace();
    mainHand=MainHand.RIGHT;
  }
  return new ClientSettingsPacket(locale,viewDistance,chatMode,chatColors,displayedSkinParts,mainHand);
}

Fixed version (ground truth):
@Override public Packet decode(ByteBuf byteBuf){
  String locale;
  try {
    locale=ByteBufUtils.readUTF8(byteBuf);
  }
 catch (  IOException e) {
    logger.error(e.getMessage());
    locale="String_Node_Str";
  }
  final byte viewDistance=byteBuf.readByte();
  ChatMode chatMode;
  try {
    chatMode=ChatMode.fromModeID(ByteBufUtils.readVarInt(byteBuf));
  }
 catch (  IOException e) {
    logger.error(e.getMessage());
    chatMode=ChatMode.ENABLED;
  }
  final boolean chatColors=byteBuf.readBoolean();
  final DisplayedSkinParts[] displayedSkinParts=DisplayedSkinParts.fromBitMask(byteBuf.readByte());
  MainHand mainHand;
  try {
    mainHand=MainHand.fromHandID(ByteBufUtils.readVarInt(byteBuf));
  }
 catch (  IOException e) {
    logger.error(e.getMessage());
    mainHand=MainHand.RIGHT;
  }
  return new ClientSettingsPacket(locale,viewDistance,chatMode,chatColors,displayedSkinParts,mainHand);
}
Program: 76722
Project: 76722
Buggy source:
@Nullable public InetAddress convert(String address){
  try {
    return InetAddress.getByName(address);
  }
 catch (  UnknownHostException e) {
    e.printStackTrace();
    return null;
  }
}

Fixed version (ground truth):
@Nullable public InetAddress convert(@NotNull String address){
  try {
    return InetAddress.getByName(address);
  }
 catch (  UnknownHostException e) {
    logger.error(e.getMessage());
    return null;
  }
}
Program: 76723
Project: 76723
Buggy source:
public void init(){
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
public void init(){
}
Program: 76724
Project: 76724
Buggy source:
public void destroy(){
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
public void destroy(){
}
Program: 76725
Project: 76725
Buggy source:
public void run(){
  System.out.println("String_Node_Str");
  cleanstoneNetworking.start();
  minecraftNetworking.start();
}

Fixed version (ground truth):
public void run(){
}
Program: 76726
Project: 76726
Buggy source:
public void run(){
  System.out.println("String_Node_Str");
  cleanstoneNetworking.start();
}

Fixed version (ground truth):
public void run(){
}
Program: 76727
Project: 76727
Buggy source:
@Override protected void initChannel(Channel channel){
  channel.pipeline().addLast(new IdentificationHandler(nettyNetworking,nettyNetworking.getClientAddressBlacklist()),new EncryptionDecoder(),new ByteStreamDecoder(),new CompressionDecoder(),new PacketDataDecoder(nettyNetworking.getProtocol()),new InboundPacketHandler(nettyNetworking));
  channel.pipeline().addFirst(new OutboundPacketHandler(nettyNetworking),new PacketEncoder(nettyNetworking.getProtocol()),new CompressionEncoder(),new ByteStreamEncoder(),new EncryptionEncoder());
}

Fixed version (ground truth):
@Override protected void initChannel(Channel channel){
  channel.pipeline().addLast("String_Node_Str",new IdentificationHandler(nettyNetworking));
  channel.pipeline().addLast("String_Node_Str",new ChannelInboundHandlerAdapter());
  channel.pipeline().addLast("String_Node_Str",new ByteStreamDecoder());
  channel.pipeline().addLast("String_Node_Str",new ChannelInboundHandlerAdapter());
  channel.pipeline().addLast("String_Node_Str",new PacketDataDecoder(nettyNetworking.getProtocol()));
  channel.pipeline().addLast("String_Node_Str",new InboundPacketHandler(nettyNetworking));
  channel.pipeline().addFirst("String_Node_Str",new OutboundPacketHandler(nettyNetworking));
  channel.pipeline().addFirst("String_Node_Str",new PacketEncoder(nettyNetworking.getProtocol()));
  channel.pipeline().addFirst("String_Node_Str",new ChannelOutboundHandlerAdapter());
  channel.pipeline().addFirst("String_Node_Str",new ByteStreamEncoder());
  channel.pipeline().addFirst("String_Node_Str",new ChannelOutboundHandlerAdapter());
}
Program: 76728
Project: 76728
Buggy source:
@Override public void exceptionCaught(ChannelHandlerContext ctx,Throwable cause){
  cause.printStackTrace();
  ctx.close();
}

Fixed version (ground truth):
@Override public void exceptionCaught(ChannelHandlerContext ctx,Throwable cause){
  cause.printStackTrace();
  logger.error("String_Node_Str");
  ctx.close();
}
Program: 76729
Project: 76729
Buggy source:
@Override protected void decode(ChannelHandlerContext ctx,ByteBuf in,List<Object> out) throws IOException {
  Connection connection=ctx.channel().attr(AttributeKey.<Connection>valueOf("String_Node_Str")).get();
  in.markReaderIndex();
  int remainingPacketLength;
  try {
    remainingPacketLength=ByteBufUtils.readVarInt(in);
    if (in.readableBytes() < remainingPacketLength)     throw new NotEnoughReadableBytesException();
  }
 catch (  NotEnoughReadableBytesException e) {
    in.resetReaderIndex();
    return;
  }
  if (!connection.isCompressionEnabled()) {
    out.add(in);
  }
 else {
    int uncompressedDataLength=ByteBufUtils.readVarInt(in);
    ctx.channel().attr(AttributeKey.<Integer>valueOf("String_Node_Str")).set(uncompressedDataLength);
    out.add(in);
  }
}

Fixed version (ground truth):
@Override protected void decode(ChannelHandlerContext ctx,ByteBuf in,List<Object> out) throws IOException {
  Connection connection=ctx.channel().attr(AttributeKey.<Connection>valueOf("String_Node_Str")).get();
  logger.info("String_Node_Str");
  in.markReaderIndex();
  int remainingPacketLength;
  try {
    remainingPacketLength=ByteBufUtils.readVarInt(in);
    if (in.readableBytes() < remainingPacketLength)     throw new NotEnoughReadableBytesException();
  }
 catch (  NotEnoughReadableBytesException e) {
    in.resetReaderIndex();
    return;
  }
  if (!connection.isCompressionEnabled()) {
    out.add(in);
  }
 else {
    int uncompressedDataLength=ByteBufUtils.readVarInt(in);
    ctx.channel().attr(AttributeKey.<Integer>valueOf("String_Node_Str")).set(uncompressedDataLength);
    out.add(in);
  }
}
Program: 76730
Project: 76730
Buggy source:
@Override protected void decode(ChannelHandlerContext ctx,ByteBuf in,List<Object> out) throws Exception {
  Connection connection=ctx.channel().attr(AttributeKey.<Connection>valueOf("String_Node_Str")).get();
  int uncompressedDataLength=ctx.channel().attr(AttributeKey.<Integer>valueOf("String_Node_Str")).get();
  if (connection.isCompressionEnabled() && uncompressedDataLength != 0)   super.decode(ctx,in,out);
 else   out.add(in);
}

Fixed version (ground truth):
@Override protected void decode(ChannelHandlerContext ctx,ByteBuf in,List<Object> out) throws Exception {
  super.decode(ctx,in,out);
}
Program: 76731
Project: 76731
Buggy source:
@Override protected void decode(ChannelHandlerContext ctx,ByteBuf in,List<Object> out) throws Exception {
  Connection connection=ctx.channel().attr(AttributeKey.<Connection>valueOf("String_Node_Str")).get();
  if (!connection.isEncryptionEnabled()) {
    out.add(in);
  }
 else {
    try {
      SecretKey sharedSecret=connection.getSharedSecret();
      Cipher cipher=Cipher.getInstance("String_Node_Str");
      cipher.init(Cipher.DECRYPT_MODE,sharedSecret,new IvParameterSpec(sharedSecret.getEncoded()));
      ByteBuffer outNioBuf=ByteBuffer.allocate(in.readableBytes());
      try {
        cipher.update(in.nioBuffer(),outNioBuf);
      }
 catch (      ShortBufferException e) {
        throw new DecoderException("String_Node_Str",e);
      }
      outNioBuf.flip();
      out.add(Unpooled.wrappedBuffer(outNioBuf));
    }
  finally {
      ReferenceCountUtil.release(in);
    }
  }
}

Fixed version (ground truth):
@Override protected void decode(ChannelHandlerContext ctx,ByteBuf in,List<Object> out) throws Exception {
  Connection connection=ctx.channel().attr(AttributeKey.<Connection>valueOf("String_Node_Str")).get();
  try {
    SecretKey sharedSecret=connection.getSharedSecret();
    Cipher cipher=Cipher.getInstance("String_Node_Str");
    cipher.init(Cipher.DECRYPT_MODE,sharedSecret,new IvParameterSpec(sharedSecret.getEncoded()));
    ByteBuffer outNioBuf=ByteBuffer.allocate(in.readableBytes());
    try {
      cipher.update(in.nioBuffer(),outNioBuf);
    }
 catch (    ShortBufferException e) {
      throw new DecoderException("String_Node_Str",e);
    }
    outNioBuf.flip();
    out.add(Unpooled.wrappedBuffer(outNioBuf));
  }
  finally {
    ReferenceCountUtil.release(in);
  }
}
Program: 76732
Project: 76732
Buggy source:
public IdentificationHandler(Networking networking,Collection<String> addressBlacklist){
  this.networking=networking;
  this.addressBlacklist=addressBlacklist;
}

Fixed version (ground truth):
public IdentificationHandler(Networking networking){
  this.networking=networking;
  this.addressBlacklist=networking.getClientAddressBlacklist();
}
Program: 76733
Project: 76733
Buggy source:
@Override public void channelRead(ChannelHandlerContext ctx,Object msg){
  InetSocketAddress socketAddress=(InetSocketAddress)ctx.channel().remoteAddress();
  InetAddress inetaddress=socketAddress.getAddress();
  String ipAddress=inetaddress.getHostAddress();
  if (addressBlacklist.contains(ipAddress))   ctx.close();
  Attribute<Connection> connectionKey=ctx.channel().attr(AttributeKey.valueOf("String_Node_Str"));
  if (connectionKey.get() == null) {
    Connection connection=new NettyConnection(ctx.channel(),inetaddress,networking.getProtocol().getDefaultClientLayer(),networking.getProtocol().getDefaultState());
    connectionKey.set(connection);
    if (CleanstoneServer.publishEvent(new ConnectionOpenEvent(connection,networking)).isCancelled()) {
      ctx.close();
    }
    ctx.channel().closeFuture().addListener((a) -> CleanstoneServer.publishEvent(new ConnectionClosedEvent(connection,networking)));
  }
  ctx.fireChannelRead(msg);
}

Fixed version (ground truth):
@Override public void channelRead(ChannelHandlerContext ctx,Object msg){
  InetSocketAddress socketAddress=(InetSocketAddress)ctx.channel().remoteAddress();
  InetAddress inetaddress=socketAddress.getAddress();
  String ipAddress=inetaddress.getHostAddress();
  logger.info("String_Node_Str" + ipAddress);
  if (addressBlacklist.contains(ipAddress))   ctx.close();
  Attribute<Connection> connectionKey=ctx.channel().attr(AttributeKey.valueOf("String_Node_Str"));
  if (connectionKey.get() == null) {
    logger.info("String_Node_Str");
    Connection connection=new NettyConnection(ctx.channel(),inetaddress,networking.getProtocol().getDefaultClientLayer(),networking.getProtocol().getDefaultState());
    connectionKey.set(connection);
    if (CleanstoneServer.publishEvent(new ConnectionOpenEvent(connection,networking)).isCancelled()) {
      ctx.close();
    }
    ctx.channel().closeFuture().addListener((a) -> CleanstoneServer.publishEvent(new ConnectionClosedEvent(connection,networking)));
  }
  ctx.fireChannelRead(msg);
}
Program: 76734
Project: 76734
Buggy source:
@Override public int creatorId(){
  return 318585602;
}

Fixed version (ground truth):
@Override public int creatorId(){
  return 1234567890;
}
Program: 76737
Project: 76737
Buggy source:
@Override public void onBindViewHolder(final FilesViewHolder holder,int position){
  holder.bind(new FileModel(receivedFiles[position]));
  filesViewHolders.add(holder);
}

Fixed version (ground truth):
@Override public void onBindViewHolder(final FilesViewHolder holder,int position){
  filesViewHolders.add(holder);
  holder.bind(new FileModel(receivedFiles[position]));
}
Program: 76738
Project: 76738
Buggy source:
FilesViewHolder(View itemView,Context context){
  super(itemView);
  this.view=itemView;
  this.context=context;
  tvItemTitle=itemView.findViewById(R.id.tvItemTitle);
  ivItemType=itemView.findViewById(R.id.ivItemType);
}

Fixed version (ground truth):
FilesViewHolder(View itemView,Context context){
  super(itemView);
  this.view=itemView;
  this.context=context;
  tvItemTitle=itemView.findViewById(R.id.tvItemTitle);
  ivItemType=itemView.findViewById(R.id.ivItemType);
  progressBar=itemView.findViewById(R.id.progressBar);
}
Program: 76739
Project: 76739
Buggy source:
public PeersAdapter(List<WifiP2pDevice> peersList,final Context context,final WifiP2pManager manager,final WifiP2pManager.Channel channel,final Activity activity,final WifiP2pManager.ConnectionInfoListener infoListener){
  this.peersList=peersList;
  this.context=context;
  this.manager=manager;
  this.channel=channel;
  this.activity=activity;
  this.infoListener=infoListener;
  listener=new WifiP2pManager.ActionListener(){
    @Override public void onSuccess(){
      Toast.makeText(context,"String_Node_Str",Toast.LENGTH_LONG).show();
      manager.requestConnectionInfo(channel,infoListener);
      Log.d("String_Node_Str","String_Node_Str");
      tempHolder.statePeer.setImageResource(R.drawable.d_icon_done);
    }
    @Override public void onFailure(    int reason){
      Toast.makeText(context,"String_Node_Str",Toast.LENGTH_LONG).show();
      Log.d("String_Node_Str","String_Node_Str");
    }
  }
;
}

Fixed version (ground truth):
public PeersAdapter(List<WifiP2pDevice> peersList,final Context context,final WifiP2pManager manager,final WifiP2pManager.Channel channel,final Activity activity,final WifiP2pManager.ConnectionInfoListener infoListener){
  this.peersList=peersList;
  this.context=context;
  this.manager=manager;
  this.channel=channel;
  this.activity=activity;
  this.infoListener=infoListener;
  listener=new WifiP2pManager.ActionListener(){
    @Override public void onSuccess(){
      Toast.makeText(context,"String_Node_Str",Toast.LENGTH_LONG).show();
      tempHolder.statePeer.setImageResource(R.drawable.d_icon_done);
      tempHolder.itemSyncing.setVisibility(View.INVISIBLE);
      manager.requestConnectionInfo(channel,infoListener);
      Log.d("String_Node_Str","String_Node_Str");
    }
    @Override public void onFailure(    int reason){
      Toast.makeText(context,"String_Node_Str",Toast.LENGTH_LONG).show();
      Log.d("String_Node_Str","String_Node_Str");
    }
  }
;
}
Program: 76740
Project: 76740
Buggy source:
@Override public void onSuccess(){
  Toast.makeText(context,"String_Node_Str",Toast.LENGTH_LONG).show();
  manager.requestConnectionInfo(channel,infoListener);
  Log.d("String_Node_Str","String_Node_Str");
  tempHolder.statePeer.setImageResource(R.drawable.d_icon_done);
}

Fixed version (ground truth):
@Override public void onSuccess(){
  Toast.makeText(context,"String_Node_Str",Toast.LENGTH_LONG).show();
  tempHolder.statePeer.setImageResource(R.drawable.d_icon_done);
  tempHolder.itemSyncing.setVisibility(View.INVISIBLE);
  manager.requestConnectionInfo(channel,infoListener);
  Log.d("String_Node_Str","String_Node_Str");
}
Program: 76741
Project: 76741
Buggy source:
@Override public void onBindViewHolder(PeersViewHolder holder,int position){
  Log.d("String_Node_Str","String_Node_Str");
  holder.setPeer(peersList.get(position));
  try {
    final String deviceAddress=holder.device.deviceAddress;
    holder.peerView.setOnClickListener(v -> {
      Log.d("String_Node_Str","String_Node_Str");
      ConnectPeer.connect(deviceAddress,manager,channel,context,listener);
      holder.statePeer.setImageResource(R.drawable.d_icon_refresh);
      tempHolder=holder;
    }
);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public void onBindViewHolder(PeersViewHolder holder,int position){
  Log.d("String_Node_Str","String_Node_Str");
  holder.setPeer(peersList.get(position));
  try {
    final String deviceAddress=holder.device.deviceAddress;
    holder.peerView.setOnClickListener(v -> {
      Log.d("String_Node_Str","String_Node_Str");
      ConnectPeer.connect(deviceAddress,manager,channel,context,listener);
      holder.statePeer.setImageResource(R.drawable.d_icon_refresh);
      holder.statePeer.setVisibility(View.VISIBLE);
      holder.itemSyncing.setVisibility(View.VISIBLE);
      tempHolder=holder;
    }
);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 76742
Project: 76742
Buggy source:
public PeersViewHolder(View itemView){
  super(itemView);
  peerName=itemView.findViewById(R.id.tvItemTitle);
  statePeer=itemView.findViewById(R.id.imgState);
  peerView=itemView;
}

Fixed version (ground truth):
public PeersViewHolder(View itemView){
  super(itemView);
  peerName=itemView.findViewById(R.id.tvItemTitle);
  statePeer=itemView.findViewById(R.id.ivItemSyncStatus);
  itemSyncing=itemView.findViewById(R.id.tvItemSyncing);
  peerView=itemView;
}
Program: 76743
Project: 76743
Buggy source:
@Override protected void onProgressUpdate(CustomObject... values){
  super.onProgressUpdate(values);
  for (int i=0; i < this.fileList.receivedFiles.length; i++) {
    if (this.fileList.receivedFiles[i].getName().equals(values[0].name)) {
      FilesViewHolder holder=this.fileList.filesViewHolders.get(i);
      if (holder.progressBar.getVisibility() != View.VISIBLE) {
        holder.progressBar.setVisibility(View.VISIBLE);
      }
      holder.progressBar.setProgress((int)((values[0].totalProgress * 100) / fileSizeOriginal));
    }
 else {
      this.fileList.notifyAdapter();
    }
  }
}

Fixed version (ground truth):
@Override protected void onProgressUpdate(CustomObject... values){
  super.onProgressUpdate(values);
  boolean isNotContain=true;
  for (int i=0; i < this.fileList.receivedFiles.length; i++) {
    if (this.fileList.receivedFiles[i].getName().equals(values[0].name)) {
      isNotContain=false;
      if (this.fileList.filesViewHolders.size() != this.fileList.receivedFiles.length) {
        break;
      }
      FilesViewHolder holder=this.fileList.filesViewHolders.get(i);
      if (holder.progressBar.getVisibility() != View.VISIBLE) {
        holder.progressBar.setVisibility(View.VISIBLE);
      }
      holder.progressBar.setProgress((int)((values[0].totalProgress * 100) / fileSizeOriginal));
    }
  }
  if (isNotContain) {
    this.fileList.notifyAdapter();
  }
}
Program: 76744
Project: 76744
Buggy source:
@Override protected void onPostExecute(Void aVoid){
  super.onPostExecute(aVoid);
  fileList.notifyAdapter();
  Toast.makeText(context,"String_Node_Str",Toast.LENGTH_LONG).show();
  Log.d("String_Node_Str","String_Node_Str");
  Log.d("String_Node_Str",file.length() + "String_Node_Str");
  try {
    serverSocket.close();
    client.close();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Override protected void onPostExecute(Void aVoid){
  super.onPostExecute(aVoid);
  this.fileList.filesViewHolders.get(fileList.receivedFiles.length - 1).progressBar.setVisibility(View.INVISIBLE);
  this.fileList.notifyAdapter();
  Toast.makeText(context,"String_Node_Str",Toast.LENGTH_LONG).show();
  Log.d("String_Node_Str","String_Node_Str");
  try {
    serverSocket.close();
    client.close();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 76745
Project: 76745
Buggy source:
public TransferData(Context context,ArrayList<Uri> uris,ArrayList<String> fileNames,ArrayList<Long> filesLength,InetAddress serverAddress){
  this.context=context;
  this.uris=uris;
  this.fileNames=fileNames;
  this.filesLength=filesLength;
  this.serverAddress=serverAddress;
  Log.d("String_Node_Str",serverAddress.getHostAddress());
  Toast.makeText(context,"String_Node_Str",Toast.LENGTH_SHORT).show();
}

Fixed version (ground truth):
public TransferData(Context context,ArrayList<Uri> uris,ArrayList<String> fileNames,ArrayList<Long> filesLength,InetAddress serverAddress,final WifiP2pManager manager,final WifiP2pManager.Channel channel){
  this.context=context;
  this.channel=channel;
  this.manager=manager;
  this.uris=uris;
  this.fileNames=fileNames;
  this.filesLength=filesLength;
  this.serverAddress=serverAddress;
  Log.d("String_Node_Str",serverAddress.getHostAddress());
  Toast.makeText(context,"String_Node_Str",Toast.LENGTH_SHORT).show();
}
Program: 76747
Project: 76747
Buggy source:
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
switch (requestCode) {
case ChooseFile.FILE_TRANSFER_CODE:
    if (data == null)     return;
  ArrayList<Uri> uris=new ArrayList<>();
ArrayList<Long> filesLength=new ArrayList<>();
ArrayList<String> fileNames=new ArrayList<>();
try {
ClipData clipData=data.getClipData();
if (clipData != null) {
for (int i=0; i < clipData.getItemCount(); i++) {
  uris.add(clipData.getItemAt(i).getUri());
  String fileName=PathUtil.getPath(getApplicationContext(),clipData.getItemAt(i).getUri());
  filesLength.add(new File(fileName).length());
  fileName=FilesUtil.getFileName(fileName);
  fileNames.add(fileName);
  Log.d("String_Node_Str",clipData.getItemAt(i).getUri().toString());
  Log.d("String_Node_Str",fileName);
}
}
 else {
Uri uri=data.getData();
uris.add(uri);
String fileName=PathUtil.getPath(getApplicationContext(),uri);
filesLength.add(new File(fileName).length());
fileName=FilesUtil.getFileName(fileName);
fileNames.add(fileName);
}
TransferData transferData=new TransferData(SendFileActivity.this,uris,fileNames,filesLength,serverAddress);
transferData.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
 catch (Exception e) {
e.printStackTrace();
}
}
}

Fixed version (ground truth):
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
switch (requestCode) {
case ChooseFile.FILE_TRANSFER_CODE:
    if (data == null)     return;
  ArrayList<Uri> uris=new ArrayList<>();
ArrayList<Long> filesLength=new ArrayList<>();
ArrayList<String> fileNames=new ArrayList<>();
try {
ClipData clipData=data.getClipData();
if (clipData != null) {
for (int i=0; i < clipData.getItemCount(); i++) {
  uris.add(clipData.getItemAt(i).getUri());
  String fileName=PathUtil.getPath(getApplicationContext(),clipData.getItemAt(i).getUri());
  filesLength.add(new File(fileName).length());
  fileName=FilesUtil.getFileName(fileName);
  fileNames.add(fileName);
  Log.d("String_Node_Str",clipData.getItemAt(i).getUri().toString());
  Log.d("String_Node_Str",fileName);
}
}
 else {
Uri uri=data.getData();
uris.add(uri);
String fileName=PathUtil.getPath(getApplicationContext(),uri);
filesLength.add(new File(fileName).length());
fileName=FilesUtil.getFileName(fileName);
fileNames.add(fileName);
}
TransferData transferData=new TransferData(SendFileActivity.this,uris,fileNames,filesLength,serverAddress,p2pManager,channel);
transferData.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
 catch (Exception e) {
e.printStackTrace();
}
}
}