nus-yam/ex-repair huggingface dataset:
Program: 94605
Project: 94605
Buggy source:
public void merge(Configuration config){
  if (config == null) {
    System.out.println("String_Node_Str");
  }
  loadFile();
  if (login != null) {
    config.setLogin(login);
  }
  if (password != null) {
    config.setPassword(password);
  }
  if (computeMethod != null) {
    config.setComputeMethod(ComputeType.valueOf(computeMethod));
  }
  if (gpu != null) {
    GPUDevice device=GPU.getGPUDevice(gpu);
    if (device != null) {
      config.setUseGPU(device);
    }
  }
  if (cacheDir != null) {
    config.setCacheDir(new File(cacheDir));
  }
}

Fixed version (ground truth):
/** 
 * Merge the Settings file with the Configuration. The Configuration will have high priority.
 */
public void merge(Configuration config){
  if (config == null) {
    System.out.println("String_Node_Str");
  }
  loadFile();
  if (config.login().isEmpty() && login != null) {
    config.setLogin(login);
  }
  if (config.password().isEmpty() && password != null) {
    config.setPassword(password);
  }
  if (config.getComputeMethod() == null && computeMethod != null) {
    config.setComputeMethod(ComputeType.valueOf(computeMethod));
  }
  if (config.getGPUDevice() == null && gpu != null) {
    GPUDevice device=GPU.getGPUDevice(gpu);
    if (device != null) {
      config.setUseGPU(device);
    }
  }
  if (config.getUserSpecifiedACacheDir() == false && cacheDir != null) {
    config.setCacheDir(new File(cacheDir));
  }
}
Program: 94606
Project: 94606
Buggy source:
public static String md5(String path_of_file_){
  try {
    MessageDigest md=MessageDigest.getInstance("String_Node_Str");
    InputStream is=Files.newInputStream(Paths.get(path_of_file_));
    DigestInputStream dis=new DigestInputStream(is,md);
    byte[] buffer=new byte[8192];
    while (dis.read(buffer) > 0)     ;
    return DatatypeConverter.printHexBinary(md.digest()).toLowerCase();
  }
 catch (  NoSuchAlgorithmException|IOException e) {
    return "String_Node_Str";
  }
}

Fixed version (ground truth):
public static String md5(String path_of_file_){
  try {
    MessageDigest md=MessageDigest.getInstance("String_Node_Str");
    InputStream is=Files.newInputStream(Paths.get(path_of_file_));
    DigestInputStream dis=new DigestInputStream(is,md);
    byte[] buffer=new byte[8192];
    while (dis.read(buffer) > 0)     ;
    String data=DatatypeConverter.printHexBinary(md.digest()).toLowerCase();
    dis.close();
    is.close();
    return data;
  }
 catch (  NoSuchAlgorithmException|IOException e) {
    return "String_Node_Str";
  }
}
Program: 94607
Project: 94607
Buggy source:
/** 
 * Merge the Settings file with the Configuration. The Configuration will have high priority.
 */
public void merge(Configuration config){
  if (config == null) {
    System.out.println("String_Node_Str");
  }
  loadFile();
  if (config.login().isEmpty() && login != null) {
    config.setLogin(login);
  }
  if (config.password().isEmpty() && password != null) {
    config.setPassword(password);
  }
  if ((config.getComputeMethod() == null && computeMethod != null) || (config.getComputeMethod() != ComputeType.valueOf(computeMethod) && computeMethod != null)) {
    config.setComputeMethod(ComputeType.valueOf(computeMethod));
  }
  if (config.getGPUDevice() == null && gpu != null) {
    GPUDevice device=GPU.getGPUDevice(gpu);
    if (device != null) {
      config.setUseGPU(device);
    }
  }
  if (config.getUserSpecifiedACacheDir() == false && cacheDir != null) {
    config.setCacheDir(new File(cacheDir));
  }
  config.setAutoSignIn(Boolean.valueOf(autoSignIn));
}

Fixed version (ground truth):
/** 
 * Merge the Settings file with the Configuration. The Configuration will have high priority.
 */
public void merge(Configuration config){
  if (config == null) {
    System.out.println("String_Node_Str");
  }
  loadFile();
  if (config.login().isEmpty() && login != null) {
    config.setLogin(login);
  }
  if (config.password().isEmpty() && password != null) {
    config.setPassword(password);
  }
  if ((config.getComputeMethod() == null && computeMethod != null) || (computeMethod != null && config.getComputeMethod() != ComputeType.valueOf(computeMethod))) {
    config.setComputeMethod(ComputeType.valueOf(computeMethod));
  }
  if (config.getGPUDevice() == null && gpu != null) {
    GPUDevice device=GPU.getGPUDevice(gpu);
    if (device != null) {
      config.setUseGPU(device);
    }
  }
  if (config.getUserSpecifiedACacheDir() == false && cacheDir != null) {
    config.setCacheDir(new File(cacheDir));
  }
  config.setAutoSignIn(Boolean.valueOf(autoSignIn));
}
Program: 94608
Project: 94608
Buggy source:
public static String humanString(Type in){
switch (in) {
case TOO_OLD_CLIENT:
    return "String_Node_Str";
case AUTHENTICATION_FAILED:
  return "String_Node_Str";
case NOOUTPUTFILE:
return "String_Node_Str";
case RENDERER_CRASHED:
return "String_Node_Str";
case RENDERER_MISSING_LIBRARIES:
return "String_Node_Str";
case RENDERER_KILLED:
return "String_Node_Str";
case SESSION_DISABLED:
return "String_Node_Str";
case RENDERER_NOT_AVAILABLE:
return "String_Node_Str";
case OS_NOT_SUPPORTED:
return "String_Node_Str";
case CPU_NOT_SUPPORTED:
return "String_Node_Str";
default :
return in.toString();
}
}

Fixed version (ground truth):
public static String humanString(Type in){
switch (in) {
case TOO_OLD_CLIENT:
    return "String_Node_Str";
case AUTHENTICATION_FAILED:
  return "String_Node_Str";
case DOWNLOAD_FILE:
return "String_Node_Str";
case NOOUTPUTFILE:
return "String_Node_Str";
case RENDERER_CRASHED:
return "String_Node_Str";
case RENDERER_MISSING_LIBRARIES:
return "String_Node_Str";
case RENDERER_KILLED:
return "String_Node_Str";
case SESSION_DISABLED:
return "String_Node_Str";
case RENDERER_NOT_AVAILABLE:
return "String_Node_Str";
case OS_NOT_SUPPORTED:
return "String_Node_Str";
case CPU_NOT_SUPPORTED:
return "String_Node_Str";
default :
return in.toString();
}
}
Program: 94609
Project: 94609
Buggy source:
/** 
 * Merge the Settings file with the Configuration. The Configuration will have high priority.
 */
public void merge(Configuration config){
  if (config == null) {
    System.out.println("String_Node_Str");
  }
  loadFile();
  if (config.login().isEmpty() && login != null) {
    config.setLogin(login);
  }
  if (config.password().isEmpty() && password != null) {
    config.setPassword(password);
  }
  if (config.getComputeMethod() == null && computeMethod != null) {
    config.setComputeMethod(ComputeType.valueOf(computeMethod));
  }
  if (config.getGPUDevice() == null && gpu != null) {
    GPUDevice device=GPU.getGPUDevice(gpu);
    if (device != null) {
      config.setUseGPU(device);
    }
  }
  if (config.getUserSpecifiedACacheDir() == false && cacheDir != null) {
    config.setCacheDir(new File(cacheDir));
  }
  config.setAutoSignIn(Boolean.valueOf(autoSignIn));
}

Fixed version (ground truth):
/** 
 * Merge the Settings file with the Configuration. The Configuration will have high priority.
 */
public void merge(Configuration config){
  if (config == null) {
    System.out.println("String_Node_Str");
  }
  loadFile();
  if (config.login().isEmpty() && login != null) {
    config.setLogin(login);
  }
  if (config.password().isEmpty() && password != null) {
    config.setPassword(password);
  }
  if ((config.getComputeMethod() == null && computeMethod != null) || (config.getComputeMethod() != ComputeType.valueOf(computeMethod) && computeMethod != null)) {
    config.setComputeMethod(ComputeType.valueOf(computeMethod));
  }
  if (config.getGPUDevice() == null && gpu != null) {
    GPUDevice device=GPU.getGPUDevice(gpu);
    if (device != null) {
      config.setUseGPU(device);
    }
  }
  if (config.getUserSpecifiedACacheDir() == false && cacheDir != null) {
    config.setCacheDir(new File(cacheDir));
  }
  config.setAutoSignIn(Boolean.valueOf(autoSignIn));
}
Program: 94610
Project: 94610
Buggy source:
public void setCredentials(String contentLogin,String contentPassword){
  client.getConfiguration().setLogin(contentLogin);
  client.getConfiguration().setPassword(contentPassword);
  waitingForAuthentication=false;
synchronized (this) {
    notifyAll();
  }
  showActivity(ActivityType.WORKING);
}

Fixed version (ground truth):
public void setCredentials(String contentLogin,String contentPassword){
  client.getConfiguration().setLogin(contentLogin);
  client.getConfiguration().setPassword(contentPassword);
  waitingForAuthentication=false;
synchronized (this) {
    notifyAll();
  }
  if (threadClient != null && threadClient.isAlive()) {
    System.out.println("String_Node_Str");
  }
 else {
    threadClient=new ThreadClient();
    threadClient.start();
  }
  showActivity(ActivityType.WORKING);
}
Program: 94611
Project: 94611
Buggy source:
@Override public void setClient(Client cli){
}

Fixed version (ground truth):
@Override public void setClient(Client cli){
  client=cli;
}
Program: 94612
Project: 94612
Buggy source:
@Override public void start(){
}

Fixed version (ground truth):
@Override public void start(){
  if (client != null) {
    client.run();
    client.stop();
  }
}
Program: 94613
Project: 94613
Buggy source:
@Override public Client getClient(){
  return null;
}

Fixed version (ground truth):
@Override public Client getClient(){
  return client;
}
Program: 94614
Project: 94614
Buggy source:
@Override public void setClient(Client cli){
}

Fixed version (ground truth):
@Override public void setClient(Client cli){
  client=cli;
}
Program: 94615
Project: 94615
Buggy source:
@Override public void start(){
}

Fixed version (ground truth):
@Override public void start(){
  if (client != null) {
    client.run();
    client.stop();
  }
}
Program: 94616
Project: 94616
Buggy source:
@Override public Client getClient(){
  return null;
}

Fixed version (ground truth):
@Override public Client getClient(){
  return client;
}
Program: 94618
Project: 94618
Buggy source:
public static List<String> listDevices(){
  if (devices == null) {
    generate();
  }
  if (devices == null) {
    return null;
  }
  List<String> devs=new LinkedList<String>();
  for (  GPUDevice dev : devices) {
    devs.add(dev.getModel());
  }
  return devs;
}

Fixed version (ground truth):
public static List<GPUDevice> listDevices(){
  if (devices == null) {
    generate();
  }
  if (devices == null) {
    return null;
  }
  return devices;
}
Program: 94619
Project: 94619
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  if (parent == null) {
    return;
  }
  Configuration config=parent.getConfiguration();
  if (config == null) {
    return;
  }
  if (cacheDir != null) {
    File fromConfig=config.getStorageDir();
    if (fromConfig != null && fromConfig.getAbsolutePath().equals(cacheDir.getAbsolutePath()) == false) {
      config.setCacheDir(cacheDir);
    }
 else {
      System.out.println("String_Node_Str" + cacheDir + "String_Node_Str");
    }
  }
  String selected_gpu=null;
  for (  JCheckBox box : useGPUs) {
    if (box.isSelected()) {
      selected_gpu=box.getText();
    }
  }
  ComputeType method=ComputeType.CPU_ONLY;
  if (useCPU.isSelected() && selected_gpu == null) {
    method=ComputeType.CPU_ONLY;
  }
 else   if (useCPU.isSelected() == false && selected_gpu != null) {
    method=ComputeType.GPU_ONLY;
  }
 else   if (useCPU.isSelected() && selected_gpu != null) {
    method=ComputeType.CPU_GPU;
  }
  config.setComputeMethod(method);
  GPUDevice gpu=GPU.getGPUDevice(selected_gpu);
  if (gpu != null) {
    config.setUseGPU(gpu);
  }
  parent.setCredentials(login.getText(),new String(password.getPassword()));
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  if (parent == null) {
    return;
  }
  Configuration config=parent.getConfiguration();
  if (config == null) {
    return;
  }
  if (cacheDir != null) {
    File fromConfig=config.getStorageDir();
    if (fromConfig != null && fromConfig.getAbsolutePath().equals(cacheDir.getAbsolutePath()) == false) {
      config.setCacheDir(cacheDir);
    }
 else {
      System.out.println("String_Node_Str" + cacheDir + "String_Node_Str");
    }
  }
  GPUDevice selected_gpu=null;
  for (  JCheckBoxGPU box : useGPUs) {
    if (box.isSelected()) {
      selected_gpu=box.getGPUDevice();
    }
  }
  ComputeType method=ComputeType.CPU_ONLY;
  if (useCPU.isSelected() && selected_gpu == null) {
    method=ComputeType.CPU_ONLY;
  }
 else   if (useCPU.isSelected() == false && selected_gpu != null) {
    method=ComputeType.GPU_ONLY;
  }
 else   if (useCPU.isSelected() && selected_gpu != null) {
    method=ComputeType.CPU_GPU;
  }
  config.setComputeMethod(method);
  if (selected_gpu != null) {
    config.setUseGPU(selected_gpu);
  }
  parent.setCredentials(login.getText(),new String(password.getPassword()));
}
Program: 94621
Project: 94621
Buggy source:
public Settings(GuiSwing parent_){
  parent=parent_;
  cacheDir=null;
  useGPUs=new LinkedList<JCheckBox>();
}

Fixed version (ground truth):
public Settings(GuiSwing parent_){
  parent=parent_;
  cacheDir=null;
  useGPUs=new LinkedList<JCheckBoxGPU>();
}
Program: 94623
Project: 94623
Buggy source:
public WinProcess(int pid_) throws IOException {
  this.handle=Kernel32.INSTANCE.OpenProcess(0x0400 | 0x0800 | 0x0001| 0x0200| 0x00100000,false,pid);
  if (this.handle == null) {
    throw new IOException("String_Node_Str" + Kernel32Util.formatMessageFromLastErrorCode(Kernel32.INSTANCE.GetLastError()) + "String_Node_Str"+ pid_+ "String_Node_Str");
  }
  this.pid=pid_;
}

Fixed version (ground truth):
public WinProcess(int pid_) throws IOException {
  this.handle=Kernel32.INSTANCE.OpenProcess(0x0400 | 0x0800 | 0x0001| 0x0200| 0x00100000,false,pid_);
  if (this.handle == null) {
    throw new IOException("String_Node_Str" + Kernel32Util.formatMessageFromLastErrorCode(Kernel32.INSTANCE.GetLastError()) + "String_Node_Str"+ pid_+ "String_Node_Str");
  }
  this.pid=pid_;
}
Program: 94624
Project: 94624
Buggy source:
public int cuDeviceTotalMem(NativeLong bytes[],int dev);

Fixed version (ground truth):
public int cuDeviceTotalMem(long bytes[],int dev);
Program: 94626
Project: 94626
Buggy source:
public WinProcess(int pid_) throws IOException {
  this.handle=Kernel32.INSTANCE.OpenProcess(0x0400 | 0x0800 | 0x0001| 0x0200| 0x00100000,false,pid_);
  if (this.handle == null) {
    throw new IOException("String_Node_Str" + Kernel32Util.formatMessageFromLastErrorCode(Kernel32.INSTANCE.GetLastError()) + "String_Node_Str"+ pid_+ "String_Node_Str");
  }
  this.pid=pid_;
}

Fixed version (ground truth):
public WinProcess(int pid_) throws IOException {
  this();
  this.handle=Kernel32.INSTANCE.OpenProcess(0x0400 | 0x0800 | 0x0001| 0x0200| 0x00100000,false,pid_);
  if (this.handle == null) {
    throw new IOException("String_Node_Str" + Kernel32Util.formatMessageFromLastErrorCode(Kernel32.INSTANCE.GetLastError()) + "String_Node_Str"+ pid_+ "String_Node_Str");
  }
  this.pid=pid_;
}
Program: 94627
Project: 94627
Buggy source:
public Configuration(File cache_dir_,String login_,String password_){
  this.login=login_;
  this.password=password_;
  this.static_exeDirName="String_Node_Str";
  this.maxUploadingJob=1;
  this.nbCores=-1;
  this.computeMethod=ComputeType.CPU_GPU;
  this.GPUDevice=null;
  this.userSpecifiedACacheDir=false;
  this.workingDirectory=null;
  this.storageDirectory=null;
  this.setCacheDir(cache_dir_);
  this.printLog=false;
  this.requestTime=null;
  this.extras="String_Node_Str";
}

Fixed version (ground truth):
public Configuration(File cache_dir_,String login_,String password_){
  this.login=login_;
  this.password=password_;
  this.static_exeDirName="String_Node_Str";
  this.maxUploadingJob=1;
  this.nbCores=-1;
  this.computeMethod=ComputeType.CPU_ONLY;
  this.GPUDevice=null;
  this.userSpecifiedACacheDir=false;
  this.workingDirectory=null;
  this.storageDirectory=null;
  this.setCacheDir(cache_dir_);
  this.printLog=false;
  this.requestTime=null;
  this.extras="String_Node_Str";
}
Program: 94628
Project: 94628
Buggy source:
public void setUseGPU(GPUDevice device){
  this.GPUDevice=device;
  if (device == null) {
    this.computeMethod=ComputeType.CPU_GPU;
  }
}

Fixed version (ground truth):
public void setUseGPU(GPUDevice device){
  this.GPUDevice=device;
}
Program: 94631
Project: 94631
Buggy source:
public int senderLoop(){
  int step=log.newCheckPoint();
  Error.Type ret;
  while (true) {
    Job job_to_send;
    try {
      job_to_send=(Job)jobsToValidate.take();
      this.log.debug("String_Node_Str" + job_to_send);
      ret=confirmJob(job_to_send);
      if (ret != Error.Type.OK) {
        this.gui.error(Error.humainString(ret));
        sendError(step);
      }
 else {
        gui.AddFrameRendered();
      }
    }
 catch (    InterruptedException e) {
    }
  }
}

Fixed version (ground truth):
public int senderLoop(){
  int step=log.newCheckPoint();
  Error.Type ret;
  while (true) {
    Job job_to_send;
    try {
      job_to_send=(Job)jobsToValidate.take();
      this.log.debug("String_Node_Str" + job_to_send);
      ret=confirmJob(job_to_send);
      if (ret != Error.Type.OK) {
        this.gui.error(Error.humanString(ret));
        sendError(step);
      }
 else {
        gui.AddFrameRendered();
      }
    }
 catch (    InterruptedException e) {
    }
  }
}
Program: 94632
Project: 94632
Buggy source:
public static ServerCode statusIsOK(Document document_,String rootname_){
  NodeList ns=document_.getElementsByTagName(rootname_);
  if (ns.getLength() == 0) {
    return Error.ServerCode.ERROR_NO_ROOT;
  }
  Element a_node=(Element)ns.item(0);
  if (a_node.hasAttribute("String_Node_Str")) {
    return Error.ServerCode.fromInt(Integer.parseInt(a_node.getAttribute("String_Node_Str")));
  }
  return Error.ServerCode.UNKNOWN;
}

Fixed version (ground truth):
public static ServerCode statusIsOK(Document document_,String rootname_){
  if (document_ == null) {
    return Error.ServerCode.UNKNOWN;
  }
  NodeList ns=document_.getElementsByTagName(rootname_);
  if (ns.getLength() == 0) {
    return Error.ServerCode.ERROR_NO_ROOT;
  }
  Element a_node=(Element)ns.item(0);
  if (a_node.hasAttribute("String_Node_Str")) {
    return Error.ServerCode.fromInt(Integer.parseInt(a_node.getAttribute("String_Node_Str")));
  }
  return Error.ServerCode.UNKNOWN;
}
Program: 94634
Project: 94634
Buggy source:
@Override protected void finalize() throws Throwable {
  if (this.handle != null) {
    Kernel32.INSTANCE.CloseHandle(this.handle);
    this.handle=null;
  }
  this.pid=-1;
}

Fixed version (ground truth):
@Override protected void finalize() throws Throwable {
  if (this.handle != null) {
    this.handle=null;
  }
  this.pid=-1;
}
Program: 94635
Project: 94635
Buggy source:
private void terminate(){
  Kernel32.INSTANCE.TerminateProcess(this.handle,0);
}

Fixed version (ground truth):
private void terminate(){
  Kernel32.INSTANCE.TerminateProcess(this.handle,0);
  Kernel32.INSTANCE.CloseHandle(this.handle);
}
Program: 94636
Project: 94636
Buggy source:
private void packCircles(List<msg_mission_item> list){
  for (double altitude=coordinate.getAltitude(); altitude <= getTopHeight(); altitude+=heightStep) {
    CircleImpl circleImpl=new CircleImpl(missionImpl,new LatLongAlt(coordinate,(altitude)));
    circleImpl.setRadius(radius);
    list.addAll(circleImpl.packMissionItem());
  }
}

Fixed version (ground truth):
private void packCircles(List<msg_mission_item> list){
  double altitude=coordinate.getAltitude();
  for (int iSteps=0; iSteps < numberOfSteps; iSteps++) {
    CircleImpl circleImpl=new CircleImpl(missionImpl,new LatLongAlt(coordinate,altitude));
    circleImpl.setRadius(radius);
    list.addAll(circleImpl.packMissionItem());
    altitude+=heightStep;
  }
}
Program: 94637
Project: 94637
Buggy source:
@Override protected void onConnectionOpened(){
  AndroidTcpConnection.this.onConnectionOpened();
}

Fixed version (ground truth):
@Override protected void onConnectionOpened(Bundle extras){
  AndroidTcpConnection.this.onConnectionOpened(extras);
}
Program: 94638
Project: 94638
Buggy source:
@Override protected void onConnectionOpened(){
  AndroidUdpConnection.this.onConnectionOpened();
}

Fixed version (ground truth):
@Override protected void onConnectionOpened(Bundle extras){
  AndroidUdpConnection.this.onConnectionOpened(extras);
}
Program: 94639
Project: 94639
Buggy source:
@Override protected void openConnection(Bundle connectionExtras) throws IOException {
  Log.d(BLUE,"String_Node_Str");
  resetConnection();
  BluetoothDevice device=null;
  try {
    device=mBluetoothAdapter.getRemoteDevice(bluetoothAddress);
  }
 catch (  IllegalArgumentException ex) {
  }
  if (device == null) {
    device=findSerialBluetoothBoard();
  }
  Log.d(BLUE,"String_Node_Str" + device.getAddress());
  Log.d(BLUE,"String_Node_Str");
  bluetoothSocket=device.createInsecureRfcommSocketToServiceRecord(UUID.fromString(UUID_SPP_DEVICE));
  Log.d(BLUE,"String_Node_Str");
  mBluetoothAdapter.cancelDiscovery();
  Log.d(BLUE,"String_Node_Str");
  bluetoothSocket.connect();
  Log.d(BLUE,"String_Node_Str");
  out=bluetoothSocket.getOutputStream();
  in=bluetoothSocket.getInputStream();
  onConnectionOpened();
}

Fixed version (ground truth):
@Override protected void openConnection(Bundle connectionExtras) throws IOException {
  Log.d(BLUE,"String_Node_Str");
  resetConnection();
  BluetoothDevice device=null;
  try {
    device=mBluetoothAdapter.getRemoteDevice(bluetoothAddress);
  }
 catch (  IllegalArgumentException ex) {
  }
  if (device == null) {
    device=findSerialBluetoothBoard();
  }
  Log.d(BLUE,"String_Node_Str" + device.getAddress());
  Log.d(BLUE,"String_Node_Str");
  bluetoothSocket=device.createInsecureRfcommSocketToServiceRecord(UUID.fromString(UUID_SPP_DEVICE));
  Log.d(BLUE,"String_Node_Str");
  mBluetoothAdapter.cancelDiscovery();
  Log.d(BLUE,"String_Node_Str");
  bluetoothSocket.connect();
  Log.d(BLUE,"String_Node_Str");
  out=bluetoothSocket.getOutputStream();
  in=bluetoothSocket.getInputStream();
  onConnectionOpened(connectionExtras);
}
Program: 94640
Project: 94640
Buggy source:
@Override protected void onConnectionOpened(){
  SoloConnection.this.onConnectionOpened();
}

Fixed version (ground truth):
@Override protected void onConnectionOpened(Bundle extras){
  SoloConnection.this.onConnectionOpened(extras);
}
Program: 94641
Project: 94641
Buggy source:
private void checkScanResults(List<ScanResult> results){
  if (!isConnecting())   return;
  ScanResult targetResult=null;
  for (  ScanResult result : results) {
    if (result.SSID.equalsIgnoreCase(this.soloLinkId)) {
      targetResult=result;
      break;
    }
  }
  if (targetResult != null) {
    try {
      Bundle connectInfo=new Bundle();
      Bundle extras=super.getConnectionExtras();
      if (extras != null && !extras.isEmpty()) {
        connectInfo.putAll(extras);
      }
      connectInfo.putParcelable(WifiConnectionHandler.EXTRA_SCAN_RESULT,targetResult);
      connectInfo.putString(WifiConnectionHandler.EXTRA_SSID_PASSWORD,soloLinkPassword);
      int connectionResult=wifiHandler.connectToWifi(connectInfo);
      if (connectionResult != 0) {
        @LinkConnectionStatus.FailureCode int failureCode=connectionResult;
        LinkConnectionStatus connectionStatus=LinkConnectionStatus.newFailedConnectionStatus(failureCode,"String_Node_Str" + soloLinkId);
        onConnectionStatus(connectionStatus);
      }
    }
 catch (    IllegalArgumentException e) {
      Timber.e(e,e.getMessage());
      LinkConnectionStatus connectionStatus=LinkConnectionStatus.newFailedConnectionStatus(LinkConnectionStatus.UNKNOWN,e.getMessage());
      onConnectionStatus(connectionStatus);
    }
  }
 else {
    refreshWifiAps();
  }
}

Fixed version (ground truth):
private void checkScanResults(List<ScanResult> results){
  if (!isConnecting())   return;
  ScanResult targetResult=null;
  for (  ScanResult result : results) {
    if (result.SSID.equalsIgnoreCase(this.soloLinkId)) {
      targetResult=result;
      break;
    }
  }
  if (targetResult != null) {
    try {
      Bundle connectInfo=new Bundle();
      Bundle extras=getConnectionExtras();
      if (extras != null && !extras.isEmpty()) {
        connectInfo.putAll(extras);
      }
      connectInfo.putParcelable(WifiConnectionHandler.EXTRA_SCAN_RESULT,targetResult);
      connectInfo.putString(WifiConnectionHandler.EXTRA_SSID_PASSWORD,soloLinkPassword);
      int connectionResult=wifiHandler.connectToWifi(connectInfo);
      if (connectionResult != 0) {
        @LinkConnectionStatus.FailureCode int failureCode=connectionResult;
        LinkConnectionStatus connectionStatus=LinkConnectionStatus.newFailedConnectionStatus(failureCode,"String_Node_Str" + soloLinkId);
        onConnectionStatus(connectionStatus);
      }
    }
 catch (    IllegalArgumentException e) {
      Timber.e(e,e.getMessage());
      LinkConnectionStatus connectionStatus=LinkConnectionStatus.newFailedConnectionStatus(LinkConnectionStatus.UNKNOWN,e.getMessage());
      onConnectionStatus(connectionStatus);
    }
  }
 else {
    refreshWifiAps();
  }
}
Program: 94642
Project: 94642
Buggy source:
public SoloConnection(Context applicationContext,String soloLinkId,String password){
  super(applicationContext);
  this.wifiHandler=new WifiConnectionHandler(applicationContext);
  wifiHandler.setListener(this);
  this.soloLinkId=soloLinkId;
  this.soloLinkPassword=password;
  this.dataLink=new AndroidUdpConnection(applicationContext,SOLO_UDP_PORT){
    @Override protected void onConnectionOpened(){
      SoloConnection.this.onConnectionOpened();
    }
    @Override protected void onConnectionStatus(    LinkConnectionStatus connectionStatus){
      SoloConnection.this.onConnectionStatus(connectionStatus);
    }
  }
;
}

Fixed version (ground truth):
public SoloConnection(Context applicationContext,String soloLinkId,String password){
  super(applicationContext);
  this.wifiHandler=new WifiConnectionHandler(applicationContext);
  wifiHandler.setListener(this);
  this.soloLinkId=soloLinkId;
  this.soloLinkPassword=password;
  this.dataLink=new AndroidUdpConnection(applicationContext,SOLO_UDP_PORT){
    @Override protected void onConnectionOpened(    Bundle extras){
      SoloConnection.this.onConnectionOpened(extras);
    }
    @Override protected void onConnectionStatus(    LinkConnectionStatus connectionStatus){
      SoloConnection.this.onConnectionStatus(connectionStatus);
    }
  }
;
}
Program: 94643
Project: 94643
Buggy source:
private void openUsbDevice(UsbDevice device) throws IOException {
  UsbManager manager=(UsbManager)mContext.getSystemService(Context.USB_SERVICE);
  final UsbSerialDriver serialDriver=UsbSerialProber.openUsbDevice(manager,device);
  if (serialDriver == null) {
    Log.d(TAG,"String_Node_Str");
    throw new IOException("String_Node_Str");
  }
 else {
    Log.d(TAG,"String_Node_Str" + mBaudRate);
    try {
      serialDriver.open();
      serialDriver.setParameters(mBaudRate,8,UsbSerialDriver.STOPBITS_1,UsbSerialDriver.PARITY_NONE);
      serialDriverRef.set(serialDriver);
      onUsbConnectionOpened();
    }
 catch (    IOException e) {
      Log.e(TAG,"String_Node_Str" + e.getMessage(),e);
      try {
        serialDriver.close();
      }
 catch (      IOException e2) {
      }
    }
  }
}

Fixed version (ground truth):
private void openUsbDevice(UsbDevice device,Bundle extras) throws IOException {
  UsbManager manager=(UsbManager)mContext.getSystemService(Context.USB_SERVICE);
  final UsbSerialDriver serialDriver=UsbSerialProber.openUsbDevice(manager,device);
  if (serialDriver == null) {
    Log.d(TAG,"String_Node_Str");
    throw new IOException("String_Node_Str");
  }
 else {
    Log.d(TAG,"String_Node_Str" + mBaudRate);
    try {
      serialDriver.open();
      serialDriver.setParameters(mBaudRate,8,UsbSerialDriver.STOPBITS_1,UsbSerialDriver.PARITY_NONE);
      serialDriverRef.set(serialDriver);
      onUsbConnectionOpened(extras);
    }
 catch (    IOException e) {
      Log.e(TAG,"String_Node_Str" + e.getMessage(),e);
      try {
        serialDriver.close();
      }
 catch (      IOException e2) {
      }
    }
  }
}
Program: 94644
Project: 94644
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  final String action=intent.getAction();
  if (ACTION_USB_PERMISSION.equals(action)) {
    removeWatchdog();
    UsbDevice device=intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
    if (intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED,false)) {
      if (device != null) {
        try {
          openUsbDevice(device);
        }
 catch (        IOException e) {
          Log.e(TAG,e.getMessage(),e);
        }
      }
 else {
        LinkConnectionStatus connectionStatus=LinkConnectionStatus.newFailedConnectionStatus(LinkConnectionStatus.LINK_UNAVAILABLE,"String_Node_Str");
        onUsbConnectionStatus(connectionStatus);
      }
    }
 else {
      Log.d(TAG,"String_Node_Str" + device);
      LinkConnectionStatus connectionStatus=LinkConnectionStatus.newFailedConnectionStatus(LinkConnectionStatus.PERMISSION_DENIED,"String_Node_Str");
      onUsbConnectionStatus(connectionStatus);
    }
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  final String action=intent.getAction();
  if (ACTION_USB_PERMISSION.equals(action)) {
    removeWatchdog();
    UsbDevice device=intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
    if (intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED,false)) {
      if (device != null) {
        try {
          openUsbDevice(device,extrasHolder.get());
        }
 catch (        IOException e) {
          Log.e(TAG,e.getMessage(),e);
        }
      }
 else {
        LinkConnectionStatus connectionStatus=LinkConnectionStatus.newFailedConnectionStatus(LinkConnectionStatus.LINK_UNAVAILABLE,"String_Node_Str");
        onUsbConnectionStatus(connectionStatus);
      }
    }
 else {
      Log.d(TAG,"String_Node_Str" + device);
      LinkConnectionStatus connectionStatus=LinkConnectionStatus.newFailedConnectionStatus(LinkConnectionStatus.PERMISSION_DENIED,"String_Node_Str");
      onUsbConnectionStatus(connectionStatus);
    }
  }
}
Program: 94645
Project: 94645
Buggy source:
@Override protected void openUsbConnection(Bundle extras) throws IOException {
  registerUsbPermissionBroadcastReceiver();
  UsbManager manager=(UsbManager)mContext.getSystemService(Context.USB_SERVICE);
  List<UsbDevice> availableDevices=UsbSerialProber.getAvailableSupportedDevices(manager);
  if (availableDevices.isEmpty()) {
    Log.d(TAG,"String_Node_Str");
    throw new IOException("String_Node_Str");
  }
  UsbDevice device=availableDevices.get(0);
  if (manager.hasPermission(device)) {
    openUsbDevice(device);
  }
 else {
    removeWatchdog();
    scheduler=Executors.newSingleThreadScheduledExecutor();
    scheduler.schedule(permissionWatchdog,15,TimeUnit.SECONDS);
    Log.d(TAG,"String_Node_Str" + device.getDeviceName());
    manager.requestPermission(device,usbPermissionIntent);
  }
}

Fixed version (ground truth):
@Override protected void openUsbConnection(Bundle extras) throws IOException {
  extrasHolder.set(extras);
  registerUsbPermissionBroadcastReceiver();
  UsbManager manager=(UsbManager)mContext.getSystemService(Context.USB_SERVICE);
  List<UsbDevice> availableDevices=UsbSerialProber.getAvailableSupportedDevices(manager);
  if (availableDevices.isEmpty()) {
    Log.d(TAG,"String_Node_Str");
    throw new IOException("String_Node_Str");
  }
  UsbDevice device=availableDevices.get(0);
  if (manager.hasPermission(device)) {
    openUsbDevice(device,extras);
  }
 else {
    removeWatchdog();
    scheduler=Executors.newSingleThreadScheduledExecutor();
    scheduler.schedule(permissionWatchdog,15,TimeUnit.SECONDS);
    Log.d(TAG,"String_Node_Str" + device.getDeviceName());
    manager.requestPermission(device,usbPermissionIntent);
  }
}
Program: 94646
Project: 94646
Buggy source:
protected void onUsbConnectionOpened(){
  parentConnection.onConnectionOpened();
}

Fixed version (ground truth):
protected void onUsbConnectionOpened(Bundle extras){
  parentConnection.onConnectionOpened(extras);
}
Program: 94647
Project: 94647
Buggy source:
@Override protected void openUsbConnection(Bundle extras) throws IOException {
  D2xxManager ftD2xx=null;
  try {
    ftD2xx=D2xxManager.getInstance(mContext);
  }
 catch (  D2xxManager.D2xxException ex) {
    mLogger.logErr(TAG,ex);
  }
  if (ftD2xx == null) {
    throw new IOException("String_Node_Str");
  }
  int DevCount=ftD2xx.createDeviceInfoList(mContext);
  Log.d(TAG,"String_Node_Str" + DevCount + "String_Node_Str");
  if (DevCount < 1) {
    throw new IOException("String_Node_Str");
  }
  FT_Device ftDev=null;
  try {
    ftDev=ftD2xx.openByIndex(mContext,0);
  }
 catch (  NullPointerException e) {
    Log.e(TAG,e.getMessage(),e);
  }
 finally {
    if (ftDev == null) {
      throw new IOException("String_Node_Str");
    }
  }
  Log.d(TAG,"String_Node_Str" + mBaudRate);
  ftDev.setBitMode((byte)0,D2xxManager.FT_BITMODE_RESET);
  ftDev.setBaudRate(mBaudRate);
  ftDev.setDataCharacteristics(D2xxManager.FT_DATA_BITS_8,D2xxManager.FT_STOP_BITS_1,D2xxManager.FT_PARITY_NONE);
  ftDev.setFlowControl(D2xxManager.FT_FLOW_NONE,(byte)0x00,(byte)0x00);
  ftDev.setLatencyTimer(LATENCY_TIMER);
  ftDev.purge((byte)(D2xxManager.FT_PURGE_TX | D2xxManager.FT_PURGE_RX));
  if (!ftDev.isOpen()) {
    throw new IOException("String_Node_Str");
  }
 else {
    Log.d(TAG,"String_Node_Str");
  }
  ftDevRef.set(ftDev);
  onUsbConnectionOpened();
}

Fixed version (ground truth):
@Override protected void openUsbConnection(Bundle extras) throws IOException {
  D2xxManager ftD2xx=null;
  try {
    ftD2xx=D2xxManager.getInstance(mContext);
  }
 catch (  D2xxManager.D2xxException ex) {
    mLogger.logErr(TAG,ex);
  }
  if (ftD2xx == null) {
    throw new IOException("String_Node_Str");
  }
  int DevCount=ftD2xx.createDeviceInfoList(mContext);
  Log.d(TAG,"String_Node_Str" + DevCount + "String_Node_Str");
  if (DevCount < 1) {
    throw new IOException("String_Node_Str");
  }
  FT_Device ftDev=null;
  try {
    ftDev=ftD2xx.openByIndex(mContext,0);
  }
 catch (  NullPointerException e) {
    Log.e(TAG,e.getMessage(),e);
  }
 finally {
    if (ftDev == null) {
      throw new IOException("String_Node_Str");
    }
  }
  Log.d(TAG,"String_Node_Str" + mBaudRate);
  ftDev.setBitMode((byte)0,D2xxManager.FT_BITMODE_RESET);
  ftDev.setBaudRate(mBaudRate);
  ftDev.setDataCharacteristics(D2xxManager.FT_DATA_BITS_8,D2xxManager.FT_STOP_BITS_1,D2xxManager.FT_PARITY_NONE);
  ftDev.setFlowControl(D2xxManager.FT_FLOW_NONE,(byte)0x00,(byte)0x00);
  ftDev.setLatencyTimer(LATENCY_TIMER);
  ftDev.purge((byte)(D2xxManager.FT_PURGE_TX | D2xxManager.FT_PURGE_RX));
  if (!ftDev.isOpen()) {
    throw new IOException("String_Node_Str");
  }
 else {
    Log.d(TAG,"String_Node_Str");
  }
  ftDevRef.set(ftDev);
  onUsbConnectionOpened(extras);
}
Program: 94648
Project: 94648
Buggy source:
protected void onConnectionOpened(){
  if (mConnectionStatus.compareAndSet(MAVLINK_CONNECTING,MAVLINK_CONNECTED)) {
    mLogger.logInfo(TAG,"String_Node_Str");
    mTaskThread=new Thread(mManagerTask,"String_Node_Str");
    mTaskThread.start();
  }
}

Fixed version (ground truth):
protected void onConnectionOpened(Bundle extras){
  if (mConnectionStatus.compareAndSet(MAVLINK_CONNECTING,MAVLINK_CONNECTED)) {
    extrasHolder.set(extras);
    mLogger.logInfo(TAG,"String_Node_Str");
    mTaskThread=new Thread(mManagerTask,"String_Node_Str");
    mTaskThread.start();
  }
}
Program: 94649
Project: 94649
Buggy source:
@Override public final void openConnection(Bundle connectionExtras) throws IOException {
  getTCPStream(connectionExtras);
  onConnectionOpened();
}

Fixed version (ground truth):
@Override public final void openConnection(Bundle connectionExtras) throws IOException {
  getTCPStream(connectionExtras);
  onConnectionOpened(connectionExtras);
}
Program: 94650
Project: 94650
Buggy source:
@Override public final void openConnection(Bundle connectionExtras) throws IOException {
  getUdpStream(connectionExtras);
  onConnectionOpened();
}

Fixed version (ground truth):
@Override public final void openConnection(Bundle connectionExtras) throws IOException {
  getUdpStream(connectionExtras);
  onConnectionOpened(connectionExtras);
}
Program: 94651
Project: 94651
Buggy source:
protected void processReceivedParam(msg_param_value m_value){
  Parameter param=new Parameter(m_value.getParam_Id(),m_value.param_value,m_value.param_type);
  loadParameterMetadata(param);
  parameters.put(param.getName().toLowerCase(Locale.US),param);
  int paramIndex=m_value.param_index;
  if (paramIndex == -1) {
    notifyParameterReceipt(param,0,1);
    notifyParametersReceiptEnd();
    return;
  }
  paramsRollCall.append(paramIndex,true);
  expectedParams=m_value.param_count;
  notifyParameterReceipt(param,paramIndex,m_value.param_count);
  if (parameters.size() >= m_value.param_count) {
    killWatchdog();
    isRefreshing.set(false);
    notifyParametersReceiptEnd();
  }
 else {
    resetWatchdog();
  }
}

Fixed version (ground truth):
protected void processReceivedParam(msg_param_value m_value){
  if (!isRefreshing.get())   return;
  Parameter param=new Parameter(m_value.getParam_Id(),m_value.param_value,m_value.param_type);
  loadParameterMetadata(param);
  parameters.put(param.getName().toLowerCase(Locale.US),param);
  int paramIndex=m_value.param_index;
  if (paramIndex == -1) {
    notifyParameterReceipt(param,0,1);
    notifyParametersReceiptEnd();
    return;
  }
  paramsRollCall.append(paramIndex,true);
  expectedParams=m_value.param_count;
  notifyParameterReceipt(param,paramIndex,m_value.param_count);
  if (parameters.size() >= m_value.param_count) {
    if (isRefreshing.compareAndSet(true,false)) {
      killWatchdog();
      notifyParametersReceiptEnd();
    }
  }
 else {
    resetWatchdog();
  }
}
Program: 94652
Project: 94652
Buggy source:
public double[] parseRange() throws ParseException {
  final DecimalFormat format=formatter;
  final String[] parts=this.range.split("String_Node_Str");
  if (parts.length != 2) {
    throw new IllegalArgumentException();
  }
  final double[] outRange=new double[2];
  outRange[RANGE_LOW]=format.parse(parts[RANGE_LOW]).doubleValue();
  outRange[RANGE_HIGH]=format.parse(parts[RANGE_HIGH]).doubleValue();
  return outRange;
}

Fixed version (ground truth):
public double[] parseRange() throws ParseException {
  final DecimalFormat format=formatter;
  final String[] parts=this.range.split("String_Node_Str");
  if (parts.length < 2) {
    throw new IllegalArgumentException();
  }
  final double[] outRange=new double[2];
  outRange[RANGE_LOW]=format.parse(parts[0]).doubleValue();
  outRange[RANGE_HIGH]=format.parse(parts[outRange.length - 1]).doubleValue();
  return outRange;
}
Program: 94653
Project: 94653
Buggy source:
private void dispatchAttributeEvent(String attributeEvent,Bundle extrasBundle){
  for (  IObserver observer : observersList) {
    try {
      observer.onAttributeUpdated(attributeEvent,extrasBundle);
    }
 catch (    RemoteException e) {
      Timber.e(e,e.getMessage());
      try {
        removeAttributesObserver(observer);
      }
 catch (      RemoteException e1) {
        Timber.e(e,e1.getMessage());
      }
    }
  }
}

Fixed version (ground truth):
private void dispatchAttributeEvent(String attributeEvent,Bundle extrasBundle){
  if (extrasBundle == emptyBundle)   extrasBundle=null;
  for (  IObserver observer : observersList) {
    try {
      observer.onAttributeUpdated(attributeEvent,extrasBundle);
    }
 catch (    RemoteException e) {
      Timber.e(e,e.getMessage());
      try {
        removeAttributesObserver(observer);
      }
 catch (      RemoteException e1) {
        Timber.e(e,e1.getMessage());
      }
    }
  }
}
Program: 94654
Project: 94654
Buggy source:
private void notifyAttributeUpdate(String attributeEvent,Bundle extrasBundle){
  if (observersList.isEmpty() || attributeEvent == null) {
    return;
  }
  if (isEventsBufferingEnabled()) {
    eventsBuffer.put(new EventInfo(attributeEvent),extrasBundle);
  }
 else {
    dispatchAttributeEvent(attributeEvent,extrasBundle);
  }
}

Fixed version (ground truth):
private void notifyAttributeUpdate(String attributeEvent,Bundle extrasBundle){
  if (observersList.isEmpty() || attributeEvent == null) {
    return;
  }
  if (AttributeEvent.STATE_CONNECTED.equals(attributeEvent) || AttributeEvent.STATE_DISCONNECTED.equals(attributeEvent) || !isEventsBufferingEnabled()) {
    dispatchAttributeEvent(attributeEvent,extrasBundle);
  }
 else {
    if (extrasBundle == null)     extrasBundle=emptyBundle;
    eventsBuffer.put(new EventInfo(attributeEvent),extrasBundle);
  }
}
Program: 94655
Project: 94655
Buggy source:
private static Firmware getTypeFirmware(int droneType){
switch (droneType) {
case TYPE_COPTER:
    return Firmware.ARDU_COPTER;
case TYPE_PLANE:
  return Firmware.ARDU_PLANE;
case TYPE_ROVER:
return Firmware.APM_ROVER;
case TYPE_SOLO:
return Firmware.SOLO;
case TYPE_UNKNOWN:
default :
return null;
}
}

Fixed version (ground truth):
private static Firmware getTypeFirmware(int droneType){
switch (droneType) {
case TYPE_COPTER:
    return Firmware.ARDU_COPTER;
case TYPE_PLANE:
  return Firmware.ARDU_PLANE;
case TYPE_ROVER:
return Firmware.APM_ROVER;
case TYPE_UNKNOWN:
default :
return null;
}
}
Program: 94657
Project: 94657
Buggy source:
@Override public DroneAttribute getAttribute(String attributeType){
switch (attributeType) {
case AttributeType.TYPE:
    propertyType.setFirmwareVersion(getFirmwareVersion());
  return propertyType;
case SoloAttributes.SOLO_STATE:
return SoloApiUtils.getSoloLinkState(this);
case SoloAttributes.SOLO_GOPRO_STATE:
return soloComp.getGoproState();
case SoloAttributes.SOLO_GOPRO_STATE_V2:
return soloComp.getGoproStateV2();
case AttributeType.STATE:
final State stateAttr=(State)super.getAttribute(attributeType);
stateAttr.addToVehicleUid(SERIAL_NUMBER_LABEL,pixhawkSerialNumber);
stateAttr.addToVehicleUid("String_Node_Str",soloComp.getSoloMacAddress());
stateAttr.addToVehicleUid("String_Node_Str",soloComp.getControllerMacAddress());
return stateAttr;
default :
return super.getAttribute(attributeType);
}
}

Fixed version (ground truth):
@Override public DroneAttribute getAttribute(String attributeType){
switch (attributeType) {
case SoloAttributes.SOLO_STATE:
    return SoloApiUtils.getSoloLinkState(this);
case SoloAttributes.SOLO_GOPRO_STATE:
  return soloComp.getGoproState();
case SoloAttributes.SOLO_GOPRO_STATE_V2:
return soloComp.getGoproStateV2();
case AttributeType.STATE:
final State stateAttr=(State)super.getAttribute(attributeType);
stateAttr.addToVehicleUid(SERIAL_NUMBER_LABEL,pixhawkSerialNumber);
stateAttr.addToVehicleUid("String_Node_Str",soloComp.getSoloMacAddress());
stateAttr.addToVehicleUid("String_Node_Str",soloComp.getControllerMacAddress());
return stateAttr;
default :
return super.getAttribute(attributeType);
}
}
Program: 94658
Project: 94658
Buggy source:
@Override public void run(){
  handler.removeCallbacks(this);
  Set<Map.Entry<EventInfo,Bundle>> eventsToDispatch=eventsBuffer.entrySet();
  for (  Map.Entry<EventInfo,Bundle> entry : eventsToDispatch) {
    String event=entry.getKey().event;
    Bundle extras=entry.getValue();
    eventsToDispatch.remove(entry);
    dispatchAttributeEvent(event,extras);
  }
  if (isEventsBufferingEnabled()) {
    handler.postDelayed(this,connectionParams.getEventsDispatchingPeriod());
  }
}

Fixed version (ground truth):
@Override public void run(){
  eventsFilter.clear();
  EventInfo eventInfo=eventsBuffer.poll();
  while (eventInfo != null) {
    eventsFilter.put(eventInfo.event,eventInfo.extras);
    EventInfo.recycle(eventInfo);
    eventInfo=eventsBuffer.poll();
  }
  for (  Map.Entry<String,Bundle> entry : eventsFilter.entrySet()) {
    dispatchAttributeEvent(entry.getKey(),entry.getValue());
  }
  eventsFilter.clear();
  handler.removeCallbacks(this);
  if (isEventsBufferingEnabled()) {
    handler.postDelayed(this,connectionParams.getEventsDispatchingPeriod());
  }
}
Program: 94659
Project: 94659
Buggy source:
private void dispatchAttributeEvent(String attributeEvent,Bundle extrasBundle){
  if (extrasBundle == emptyBundle)   extrasBundle=null;
  for (  IObserver observer : observersList) {
    try {
      observer.onAttributeUpdated(attributeEvent,extrasBundle);
    }
 catch (    RemoteException e) {
      Timber.e(e,e.getMessage());
      try {
        removeAttributesObserver(observer);
      }
 catch (      RemoteException e1) {
        Timber.e(e,e1.getMessage());
      }
    }
  }
}

Fixed version (ground truth):
private void dispatchAttributeEvent(String attributeEvent,Bundle extrasBundle){
  for (  IObserver observer : observersList) {
    try {
      observer.onAttributeUpdated(attributeEvent,extrasBundle);
    }
 catch (    RemoteException e) {
      Timber.e(e,e.getMessage());
      try {
        removeAttributesObserver(observer);
      }
 catch (      RemoteException e1) {
        Timber.e(e,e1.getMessage());
      }
    }
  }
}
Program: 94660
Project: 94660
Buggy source:
private void notifyAttributeUpdate(String attributeEvent,Bundle extrasBundle){
  if (observersList.isEmpty() || attributeEvent == null) {
    return;
  }
  if (AttributeEvent.STATE_CONNECTED.equals(attributeEvent) || AttributeEvent.STATE_DISCONNECTED.equals(attributeEvent) || !isEventsBufferingEnabled()) {
    dispatchAttributeEvent(attributeEvent,extrasBundle);
  }
 else {
    if (extrasBundle == null)     extrasBundle=emptyBundle;
    eventsBuffer.put(new EventInfo(attributeEvent),extrasBundle);
  }
}

Fixed version (ground truth):
private void notifyAttributeUpdate(String attributeEvent,Bundle extrasBundle){
  if (observersList.isEmpty() || attributeEvent == null) {
    return;
  }
  if (AttributeEvent.STATE_CONNECTED.equals(attributeEvent) || AttributeEvent.STATE_DISCONNECTED.equals(attributeEvent) || !isEventsBufferingEnabled()) {
    dispatchAttributeEvent(attributeEvent,extrasBundle);
  }
 else {
    eventsBuffer.add(EventInfo.obtain(attributeEvent,extrasBundle));
  }
}
Program: 94662
Project: 94662
Buggy source:
public void connect(ConnectionParameter connParams){
  try {
    connParams=checkConnectionParameter(connParams);
    ConnectionParameter currentConnParams=this.connectionParams == null ? this.connectionParams : checkConnectionParameter(this.connectionParams);
    if (!connParams.equals(currentConnParams)) {
      if (this.droneMgr != null) {
        LinkConnectionStatus connectionStatus=LinkConnectionStatus.newFailedConnectionStatus(LinkConnectionStatus.ADDRESS_IN_USE,"String_Node_Str");
        onConnectionStatus(connectionStatus);
        return;
      }
      this.connectionParams=connParams;
      this.droneMgr=service.connectDroneManager(this.connectionParams,ownerId,this);
      if (isEventsBufferingEnabled()) {
        handler.postDelayed(eventsDispatcher,this.connectionParams.getEventsDispatchingPeriod());
      }
    }
  }
 catch (  ConnectionException e) {
    LinkConnectionStatus connectionStatus=LinkConnectionStatus.newFailedConnectionStatus(LinkConnectionStatus.INVALID_CREDENTIALS,e.getMessage());
    onConnectionStatus(connectionStatus);
    disconnect();
  }
}

Fixed version (ground truth):
public void connect(ConnectionParameter connParams){
  try {
    connParams=checkConnectionParameter(connParams);
    ConnectionParameter currentConnParams=this.connectionParams == null ? this.connectionParams : checkConnectionParameter(this.connectionParams);
    if (!connParams.equals(currentConnParams)) {
      if (this.droneMgr != null) {
        LinkConnectionStatus connectionStatus=LinkConnectionStatus.newFailedConnectionStatus(LinkConnectionStatus.ADDRESS_IN_USE,"String_Node_Str");
        onConnectionStatus(connectionStatus);
        return;
      }
      this.connectionParams=connParams;
      this.droneMgr=service.connectDroneManager(this.connectionParams,ownerId,this);
      if (isEventsBufferingEnabled()) {
        eventsBuffer.clear();
        handler.postDelayed(eventsDispatcher,this.connectionParams.getEventsDispatchingPeriod());
      }
    }
  }
 catch (  ConnectionException e) {
    LinkConnectionStatus connectionStatus=LinkConnectionStatus.newFailedConnectionStatus(LinkConnectionStatus.INVALID_CREDENTIALS,e.getMessage());
    onConnectionStatus(connectionStatus);
    disconnect();
  }
}