Program: 34034
Project: 34034
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_scan);
  setUpDefaultToolbar();
  setActivityBackgroundColor(Color.WHITE);
  scanProgressView=findViewById(R.id.scan_status_layout);
  scanResultListView=findViewById(R.id.scan_result_layout);
  scanResultNoCameraView=findViewById(R.id.scan_result_no_camera_layout);
  progressBar=(ProgressBar)findViewById(R.id.horizontal_progress_bar);
  progressBar.getProgressDrawable().setColorFilter(getResources().getColor(R.color.orange_red),PorterDuff.Mode.SRC_IN);
  cameraListView=(ListView)findViewById(R.id.scan_result_list);
  Button addManuallyButton=(Button)findViewById(R.id.button_add_camera_manually);
  Button showAllDeviceButton=(Button)findViewById(R.id.button_show_all_devices);
  View footerView=getLayoutInflater().inflate(R.layout.scan_list_footer,cameraListView,false);
  showAllDeviceButton=(Button)footerView.findViewById(R.id.button_all_devices_in_list);
  cameraListView.addFooterView(footerView);
  deviceAdapter=new ScanResultAdapter(this,R.layout.scan_list_layout,discoveredCameras,drawableArray);
  cameraListView.setAdapter(deviceAdapter);
  cameraListView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> arg0,    View arg1,    int position,    long arg3){
      final DiscoveredCamera cameraInList=(DiscoveredCamera)cameraListView.getItemAtPosition(position);
      if (cameraInList != null) {
        if (isCameraAdded(cameraInList)) {
          CustomedDialog.getStandardAlertDialog(ScanActivity.this,new Dialog.OnClickListener(){
            @Override public void onClick(            DialogInterface dialog,            int which){
              launchAddCameraPage(cameraInList);
            }
          }
,R.string.msg_camera_has_been_added).show();
        }
 else {
          launchAddCameraPage(cameraInList);
        }
      }
    }
  }
);
  showAllDeviceButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      AllDevicesActivity.showAllDevices(ScanActivity.this,nonCameraDevices);
    }
  }
);
  addManuallyButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      startActivityForResult(new Intent(ScanActivity.this,AddEditCameraActivity.class),Constants.REQUEST_CODE_ADD_CAMERA);
    }
  }
);
  showAllDeviceButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      AllDevicesActivity.showAllDevices(ScanActivity.this,nonCameraDevices);
    }
  }
);
  new ScanCheckInternetTask(this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_scan);
  setUpDefaultToolbar();
  setActivityBackgroundColor(Color.WHITE);
  scanProgressView=findViewById(R.id.scan_status_layout);
  scanResultListView=findViewById(R.id.scan_result_layout);
  scanResultNoCameraView=findViewById(R.id.scan_result_no_camera_layout);
  progressBar=(ProgressBar)findViewById(R.id.horizontal_progress_bar);
  progressBar.getProgressDrawable().setColorFilter(getResources().getColor(R.color.orange_red),PorterDuff.Mode.SRC_IN);
  cameraListView=(ListView)findViewById(R.id.scan_result_list);
  Button addManuallyButton=(Button)findViewById(R.id.button_add_camera_manually);
  Button showAllDeviceButton=(Button)findViewById(R.id.button_show_all_devices);
  View footerView=getLayoutInflater().inflate(R.layout.scan_list_footer,cameraListView,false);
  Button showAllDeviceFooterButton=(Button)footerView.findViewById(R.id.button_all_devices_in_list);
  cameraListView.addFooterView(footerView);
  deviceAdapter=new ScanResultAdapter(this,R.layout.scan_list_layout,discoveredCameras,drawableArray);
  cameraListView.setAdapter(deviceAdapter);
  cameraListView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> arg0,    View arg1,    int position,    long arg3){
      final DiscoveredCamera cameraInList=(DiscoveredCamera)cameraListView.getItemAtPosition(position);
      if (cameraInList != null) {
        if (isCameraAdded(cameraInList)) {
          CustomedDialog.getStandardAlertDialog(ScanActivity.this,new Dialog.OnClickListener(){
            @Override public void onClick(            DialogInterface dialog,            int which){
              launchAddCameraPage(cameraInList);
            }
          }
,R.string.msg_camera_has_been_added).show();
        }
 else {
          launchAddCameraPage(cameraInList);
        }
      }
    }
  }
);
  showAllDeviceFooterButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      AllDevicesActivity.showAllDevices(ScanActivity.this,nonCameraDevices);
    }
  }
);
  addManuallyButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      startActivityForResult(new Intent(ScanActivity.this,AddEditCameraActivity.class),Constants.REQUEST_CODE_ADD_CAMERA);
    }
  }
);
  showAllDeviceButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      AllDevicesActivity.showAllDevices(ScanActivity.this,nonCameraDevices);
    }
  }
);
  new ScanCheckInternetTask(this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}