nus-yam/ex-repair huggingface dataset:
Program: 34003
Project: 34003
Buggy source:
private void onActionZoom(View view){
  int originalWidth=view.getWidth();
  int originalHeight=view.getHeight();
  long currentTime=System.nanoTime();
  if (time != 0 && (currentTime - time) > 10000000) {
    int leftOffset=(int)(originalWidth - (originalWidth * scaleListener.scaleFactor));
    int topOffset=(int)(originalHeight - (originalHeight * scaleListener.scaleFactor));
    Log.e(TAG,"String_Node_Str" + leftOffset + "String_Node_Str"+ topOffset);
    RelativeLayout.LayoutParams layoutParams=(RelativeLayout.LayoutParams)view.getLayoutParams();
    layoutParams.setMargins(leftOffset,topOffset,leftOffset,topOffset);
    view.setLayoutParams(layoutParams);
    if (view.getX() >= 0) {
      view.setX(0);
    }
    if (view.getX() + view.getWidth() <= screenWidth) {
      view.setX(screenWidth - view.getWidth());
    }
  }
  time=System.nanoTime();
}

Fixed version (ground truth):
private void onActionZoom(View view){
  int originalWidth=view.getWidth();
  int originalHeight=view.getHeight();
  long currentTime=System.nanoTime();
  if (time != 0 && (currentTime - time) > 10000000) {
    int leftOffset=(int)(originalWidth - (originalWidth * scaleListener.scaleFactor));
    int topOffset=(int)(originalHeight - (originalHeight * scaleListener.scaleFactor));
    Log.e(TAG,"String_Node_Str" + leftOffset + "String_Node_Str"+ topOffset);
    RelativeLayout.LayoutParams layoutParams=(RelativeLayout.LayoutParams)view.getLayoutParams();
    layoutParams.setMargins(leftOffset,topOffset,leftOffset,topOffset);
    view.setLayoutParams(layoutParams);
    if (view.getX() >= 0) {
      view.setX(0);
    }
    if (view.getX() + view.getWidth() <= getScreenWidth()) {
      view.setX(getScreenWidth() - view.getWidth());
    }
  }
  time=System.nanoTime();
}
Program: 34004
Project: 34004
Buggy source:
@Override public boolean onTouch(View view,MotionEvent event){
  if (gestureDetector != null) {
    gestureDetector.onTouchEvent(event);
  }
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
    lastX=event.getX();
  lastY=event.getY();
break;
case MotionEvent.ACTION_UP:
float upX=event.getX();
float upY=event.getY();
if (lastX == upX && lastY == upY) {
onClick();
}
lastX=-1;
lastY=-1;
break;
case MotionEvent.ACTION_MOVE:
if (scaleListener != null) {
if (scaleListener.zoom) {
if (scaleListener.getOriginalScaleFactor() < 1.0 || view.getHeight() < screenHeight) {
onActionZoom(view);
}
}
 else {
onActionMove(event,view);
}
}
lastX=event.getX();
lastY=event.getY();
break;
}
return true;
}

Fixed version (ground truth):
@Override public boolean onTouch(View view,MotionEvent event){
  if (gestureDetector != null) {
    gestureDetector.onTouchEvent(event);
  }
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
    lastX=event.getX();
  lastY=event.getY();
break;
case MotionEvent.ACTION_UP:
float upX=event.getX();
float upY=event.getY();
if (lastX == upX && lastY == upY) {
onClick();
}
lastX=-1;
lastY=-1;
break;
case MotionEvent.ACTION_MOVE:
if (scaleListener != null) {
if (scaleListener.zoom) {
if (scaleListener.getOriginalScaleFactor() < 1.0 || view.getHeight() < getScreenHeight()) {
onActionZoom(view);
}
}
 else {
onActionMove(event,view);
}
}
lastX=event.getX();
lastY=event.getY();
break;
}
return true;
}
Program: 34005
Project: 34005
Buggy source:
private void onActionMove(MotionEvent event,View view){
  if (lastX >= 0 && lastY > 0) {
    float newX=event.getX();
    float newY=event.getY();
    int xDiffInt=(int)(newX - lastX);
    int yDiffInt=(int)(newY - lastY);
    Log.d(TAG,"String_Node_Str" + newX + "String_Node_Str"+ lastX+ "String_Node_Str"+ xDiffInt+ "String_Node_Str"+ newY+ "String_Node_Str"+ lastY+ "String_Node_Str"+ yDiffInt);
    RelativeLayout.LayoutParams layoutParams=(RelativeLayout.LayoutParams)view.getLayoutParams();
    if (xDiffInt > 0) {
      if (layoutParams.leftMargin < 0) {
        if (view.getX() >= 0) {
          view.setX(0);
        }
 else {
          view.setX(view.getX() + xDiffInt);
        }
      }
    }
 else     if (xDiffInt < 0) {
      if (layoutParams.rightMargin < 0) {
        if (view.getX() + view.getWidth() <= screenWidth) {
          view.setX(screenWidth - view.getWidth());
        }
 else {
          view.setX(view.getX() + xDiffInt);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void onActionMove(MotionEvent event,View view){
  if (lastX >= 0 && lastY > 0) {
    float newX=event.getX();
    float newY=event.getY();
    int xDiffInt=(int)(newX - lastX);
    int yDiffInt=(int)(newY - lastY);
    Log.d(TAG,"String_Node_Str" + newX + "String_Node_Str"+ lastX+ "String_Node_Str"+ xDiffInt+ "String_Node_Str"+ newY+ "String_Node_Str"+ lastY+ "String_Node_Str"+ yDiffInt);
    RelativeLayout.LayoutParams layoutParams=(RelativeLayout.LayoutParams)view.getLayoutParams();
    if (xDiffInt > 0) {
      if (layoutParams.leftMargin < 0) {
        if (view.getX() >= 0) {
          view.setX(0);
        }
 else {
          view.setX(view.getX() + xDiffInt);
        }
      }
    }
 else     if (xDiffInt < 0) {
      if (layoutParams.rightMargin < 0) {
        if (view.getX() + view.getWidth() <= getScreenWidth()) {
          view.setX(getScreenWidth() - view.getWidth());
        }
 else {
          view.setX(view.getX() + xDiffInt);
        }
      }
    }
  }
}
Program: 34006
Project: 34006
Buggy source:
@Override public void onConfigurationChanged(Configuration newConfig){
  super.onConfigurationChanged(newConfig);
  getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
  getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
  int orientation=newConfig.orientation;
  if (orientation == Configuration.ORIENTATION_PORTRAIT) {
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    showToolbar();
    setOpaqueTitleBackground();
  }
 else {
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setGradientTitleBackground();
    if (!paused && !end && !isProgressViewVisible())     hideToolbar();
 else     showToolbar();
  }
  this.invalidateOptionsMenu();
}

Fixed version (ground truth):
@Override public void onConfigurationChanged(Configuration newConfig){
  super.onConfigurationChanged(newConfig);
  getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
  getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
  int orientation=newConfig.orientation;
  if (orientation == Configuration.ORIENTATION_PORTRAIT) {
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    showToolbar();
    adoptSwipeListenerToLandscape(false);
  }
 else {
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setGradientTitleBackground();
    adoptSwipeListenerToLandscape(true);
    if (!paused && !end && !isProgressViewVisible())     hideToolbar();
 else     showToolbar();
  }
  this.invalidateOptionsMenu();
}
Program: 34007
Project: 34007
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  try {
    super.onCreate(savedInstanceState);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    initAnalyticsObjects();
    readShortcutCameraId();
    if (!liveViewCameraId.isEmpty()) {
      startingCameraID=liveViewCameraId;
      liveViewCameraId="String_Node_Str";
    }
    launchSleepTimer();
    setDisplayOrientation();
    setContentView(R.layout.activity_video);
    mToolbar=(Toolbar)findViewById(R.id.spinner_tool_bar);
    setOpaqueTitleBackground();
    setSupportActionBar(mToolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    mCameraListSpinner=(Spinner)findViewById(R.id.spinner_camera_list);
    initialPageElements();
    checkIsShortcutCameraExists();
    startPlay();
    if (showCameraCreated) {
      CustomSnackbar.showLong(this,R.string.create_success);
      showCameraCreated=false;
    }
  }
 catch (  OutOfMemoryError e) {
    Log.e(TAG,e.toString() + "String_Node_Str" + Log.getStackTraceString(e));
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  try {
    super.onCreate(savedInstanceState);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    initAnalyticsObjects();
    readShortcutCameraId();
    if (!liveViewCameraId.isEmpty()) {
      startingCameraID=liveViewCameraId;
      liveViewCameraId="String_Node_Str";
    }
    launchSleepTimer();
    setDisplayOrientation();
    setContentView(R.layout.activity_video);
    mToolbar=(Toolbar)findViewById(R.id.spinner_tool_bar);
    setGradientTitleBackground();
    setSupportActionBar(mToolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    mCameraListSpinner=(Spinner)findViewById(R.id.spinner_camera_list);
    initialPageElements();
    checkIsShortcutCameraExists();
    startPlay();
    if (showCameraCreated) {
      CustomSnackbar.showLong(this,R.string.create_success);
      showCameraCreated=false;
    }
  }
 catch (  OutOfMemoryError e) {
    Log.e(TAG,e.toString() + "String_Node_Str" + Log.getStackTraceString(e));
  }
}
Program: 34008
Project: 34008
Buggy source:
/** 
 * TextureView.SurfaceTextureListener
 */
@Override public void onSurfaceTextureAvailable(SurfaceTexture surface,int width,int height){
  playIntro();
}

Fixed version (ground truth):
/** 
 * TextureView.SurfaceTextureListener
 */
@Override public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture,int width,int height){
  playIntro(surfaceTexture);
}
Program: 34009
Project: 34009
Buggy source:
private void playIntro(){
  if (player != null) {
    player.release();
    player=null;
  }
  try {
    player=new MediaPlayer();
    AssetFileDescriptor afd=getResources().openRawResourceFd(R.raw.gpoview);
    player.setDataSource(afd.getFileDescriptor(),afd.getStartOffset(),afd.getDeclaredLength());
    player.setOnPreparedListener(this);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  player.setOnVideoSizeChangedListener(new MediaPlayer.OnVideoSizeChangedListener(){
    @Override public void onVideoSizeChanged(    MediaPlayer mp,    int width,    int height){
      mVideoWidth=width;
      mVideoHeight=height;
      updateTextureViewSize();
    }
  }
);
  player.prepareAsync();
}

Fixed version (ground truth):
private void playIntro(SurfaceTexture surfaceTexture){
  if (player != null) {
    player.release();
    player=null;
  }
  try {
    player=new MediaPlayer();
    AssetFileDescriptor afd=getResources().openRawResourceFd(R.raw.gpoview);
    player.setDataSource(afd.getFileDescriptor(),afd.getStartOffset(),afd.getDeclaredLength());
    player.setOnPreparedListener(this);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  player.setSurface(new Surface(surfaceTexture));
  player.setOnVideoSizeChangedListener(new MediaPlayer.OnVideoSizeChangedListener(){
    @Override public void onVideoSizeChanged(    MediaPlayer mp,    int width,    int height){
      mVideoWidth=width;
      mVideoHeight=height;
      updateTextureViewSize();
    }
  }
);
  player.prepareAsync();
}
Program: 34010
Project: 34010
Buggy source:
/** 
 * MediaPlayer.OnPreparedListener Callback for player.prepareAsync();
 */
@Override public void onPrepared(MediaPlayer mp){
  mp.setSurface(new Surface(getSurfaceTexture()));
  mp.setLooping(true);
  mp.start();
}

Fixed version (ground truth):
/** 
 * MediaPlayer.OnPreparedListener Callback for player.prepareAsync();
 */
@Override public void onPrepared(MediaPlayer mp){
  mp.setLooping(true);
  mp.start();
}
Program: 34011
Project: 34011
Buggy source:
@Override public void onClick(DialogInterface dialog,int which){
  launchTestSnapshot();
}

Fixed version (ground truth):
@Override public void onClick(View v){
  String externalHost=externalHostEdit.getText().toString();
  if (Commons.isLocalIp(externalHost)) {
    showLocalIpWarning();
  }
 else {
    launchTestSnapshot();
  }
}
Program: 34014
Project: 34014
Buggy source:
public boolean passed(){
  String externalHost=mIpEditText.getText().toString();
  if (externalHost.isEmpty()) {
    onHostEmpty();
    return false;
  }
 else {
    String httpPort=mHttpPortEditText.getText().toString();
    String rtspPort=mRtspPortEditText.getText().toString();
    if (httpPort.isEmpty()) {
      onHttpEmpty();
      return false;
    }
 else {
      if (!mHttpPortEditText.isPortStringValid()) {
        onInvalidHttpPort();
        return false;
      }
    }
    if (!rtspPort.isEmpty() && !mRtspPortEditText.isPortStringValid()) {
      onInvalidRtspPort();
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean passed(){
  String externalHost=mIpEditText.getText().toString();
  if (externalHost.isEmpty()) {
    onHostEmpty();
    return false;
  }
 else {
    if (Commons.isLocalIp(externalHost)) {
      onLocalIp();
      return false;
    }
 else {
      String httpPort=mHttpPortEditText.getText().toString();
      String rtspPort=mRtspPortEditText.getText().toString();
      if (httpPort.isEmpty()) {
        onHttpEmpty();
        return false;
      }
 else {
        if (!mHttpPortEditText.isPortStringValid()) {
          onInvalidHttpPort();
          return false;
        }
      }
      if (!rtspPort.isEmpty() && !mRtspPortEditText.isPortStringValid()) {
        onInvalidRtspPort();
        return false;
      }
    }
  }
  return true;
}
Program: 34015
Project: 34015
Buggy source:
private void updatePortStatus(boolean isPortOpen){
  if (mStatusViewReference != null) {
    TextView statusView=mStatusViewReference.get();
    statusView.setVisibility(View.VISIBLE);
    statusView.setText(isPortOpen ? R.string.port_is_open : R.string.port_is_closed);
    statusView.setTextColor(isPortOpen ? mContext.getResources().getColor(R.color.mint_green) : mContext.getResources().getColor(R.color.orange_red));
  }
}

Fixed version (ground truth):
private void updatePortStatus(boolean isPortOpen){
  if (mStatusViewReference != null) {
    TextView statusView=mStatusViewReference.get();
    if (statusView != null) {
      statusView.setVisibility(View.VISIBLE);
      statusView.setText(isPortOpen ? R.string.port_is_open : R.string.port_is_closed);
      statusView.setTextColor(isPortOpen ? mContext.getResources().getColor(R.color.mint_green) : mContext.getResources().getColor(R.color.orange_red));
    }
  }
}
Program: 34016
Project: 34016
Buggy source:
public void show(String message){
  progressDialog.setMessage(message);
  progressDialog.setCanceledOnTouchOutside(false);
  progressDialog.show();
}

Fixed version (ground truth):
public void show(String message){
  progressDialog.setMessage(message);
  progressDialog.setCanceledOnTouchOutside(false);
  if (!activity.isFinishing()) {
    progressDialog.show();
  }
}
Program: 34018
Project: 34018
Buggy source:
@Override public void onItemSelected(AdapterView<?> parent,View view,int position,long id){
  if (timeCounter != null) {
    timeCounter.stop();
    timeCounter=null;
  }
  if (browseJpgTask != null && browseJpgTask.getStatus() != AsyncTask.Status.RUNNING) {
    browseJpgTask.cancel(true);
  }
  browseJpgTask=null;
  showImagesVideo=false;
  evercamCamera=cameraList.get(position);
  showPtzControl(false);
  if (evercamCamera.isOffline()) {
    offlineTextView.setVisibility(View.VISIBLE);
    progressView.setVisibility(View.GONE);
    surfaceView.setVisibility(View.GONE);
    imageView.setVisibility(View.GONE);
  }
 else {
    offlineTextView.setVisibility(View.GONE);
    setCameraForPlaying(cameraList.get(position));
    createPlayer(evercamCamera);
    if (evercamCamera.hasModel()) {
      new CheckOnvifTask(VideoActivity.this,evercamCamera).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    }
  }
}

Fixed version (ground truth):
@Override public void onItemSelected(AdapterView<?> parent,View view,int position,long id){
  if (timeCounter != null) {
    timeCounter.stop();
    timeCounter=null;
  }
  if (browseJpgTask != null && browseJpgTask.getStatus() != AsyncTask.Status.RUNNING) {
    browseJpgTask.cancel(true);
  }
  browseJpgTask=null;
  showImagesVideo=false;
  evercamCamera=cameraList.get(position);
  startingCameraID=evercamCamera.getCameraId();
  showPtzControl(false);
  if (evercamCamera.isOffline()) {
    offlineTextView.setVisibility(View.VISIBLE);
    progressView.setVisibility(View.GONE);
    surfaceView.setVisibility(View.GONE);
    imageView.setVisibility(View.GONE);
  }
 else {
    offlineTextView.setVisibility(View.GONE);
    setCameraForPlaying(cameraList.get(position));
    createPlayer(evercamCamera);
    if (evercamCamera.hasModel()) {
      new CheckOnvifTask(VideoActivity.this,evercamCamera).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    }
  }
}
Program: 34019
Project: 34019
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_add_camera);
  setUpDefaultToolbar();
  setHomeIconAsCancel();
  mViewFlipper=(ViewFlipper)findViewById(R.id.add_camera_view_flipper);
  mProgressBar=(ProgressBar)findViewById(R.id.add_camera_progress_bar);
  mProgressBar.getProgressDrawable().setColorFilter(getResources().getColor(R.color.orange_red),PorterDuff.Mode.SRC_IN);
  mProgressBar.setProgress(33);
  if (savedInstanceState != null) {
    mSelectedModel=(SelectedModel)savedInstanceState.get(KEY_SELECTED_MODEL);
  }
  initModelSelectorUI();
  initConnectCameraUI();
  initCameraNameView();
  if (savedInstanceState != null) {
    int flipperPosition=savedInstanceState.getInt(KEY_FLIPPER_POSITION);
    if (flipperPosition == 0) {
      showModelSelectorView();
    }
 else     if (flipperPosition == 1) {
      showConnectCameraView();
    }
 else     if (flipperPosition == 2) {
      showCameraNameView();
    }
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_add_camera);
  setUpDefaultToolbar();
  setHomeIconAsCancel();
  mViewFlipper=(ViewFlipper)findViewById(R.id.add_camera_view_flipper);
  mProgressBar=(ProgressBar)findViewById(R.id.add_camera_progress_bar);
  mProgressBar.getProgressDrawable().setColorFilter(getResources().getColor(R.color.orange_red),PorterDuff.Mode.SRC_IN);
  mProgressBar.setProgress(33);
  if (savedInstanceState != null) {
    mSelectedModel=(SelectedModel)savedInstanceState.get(KEY_SELECTED_MODEL);
  }
  mHandler=new Handler();
  initModelSelectorUI();
  initConnectCameraUI();
  initCameraNameView();
  if (savedInstanceState != null) {
    int flipperPosition=savedInstanceState.getInt(KEY_FLIPPER_POSITION);
    if (flipperPosition == 0) {
      showModelSelectorView();
    }
 else     if (flipperPosition == 1) {
      showConnectCameraView();
    }
 else     if (flipperPosition == 2) {
      showCameraNameView();
    }
  }
}
Program: 34020
Project: 34020
Buggy source:
private void quitAddCamera(){
  int currentPosition=mViewFlipper.getDisplayedChild();
  if (currentPosition == 0) {
    finish();
  }
 else {
    CustomedDialog.getConfirmCancelAddCameraDialog(this).show();
  }
}

Fixed version (ground truth):
private void quitAddCamera(){
  CustomedDialog.getConfirmCancelAddCameraDialog(this).show();
}
Program: 34021
Project: 34021
Buggy source:
private void showConnectCameraView(){
  mViewFlipper.setDisplayedChild(1);
  mProgressBar.setProgress(67);
  setTitle(R.string.title_connect_camera);
  updateMessage(mConnectExplainView,0,R.string.connect_camera_explain_message);
  populateSelectedModel(mSelectedModelTextView,mSelectedModel);
  autoPopulateExternalIP(mPublicIpEditText);
}

Fixed version (ground truth):
private void showConnectCameraView(){
  mViewFlipper.setDisplayedChild(1);
  mProgressBar.setProgress(67);
  setTitle(R.string.title_connect_camera);
  updateMessage(mConnectExplainView,0,R.string.connect_camera_explain_message);
  populateSelectedModel(mSelectedModelTextView,mSelectedModel);
  mHandler.postDelayed(new Runnable(){
    @Override public void run(){
      autoPopulateExternalIP(mPublicIpEditText);
    }
  }
,100);
}
Program: 34023
Project: 34023
Buggy source:
private void showCameraNameView(){
  mViewFlipper.setDisplayedChild(2);
  mProgressBar.setProgress(100);
  setTitle(R.string.title_name_camera);
}

Fixed version (ground truth):
public void showCameraNameView(){
  mViewFlipper.setDisplayedChild(2);
  mProgressBar.setProgress(100);
  setTitle(R.string.title_name_camera);
}
Program: 34024
Project: 34024
Buggy source:
/** 
 * Return a pop up dialog that shows camera snapshot.
 * @param drawable the image drawable returned to show in pop up dialog
 */
public static AlertDialog getSnapshotDialog(Activity activity,Drawable drawable){
  AlertDialog snapshotDialog=new AlertDialog.Builder(activity).create();
  LayoutInflater mInflater=LayoutInflater.from(activity);
  final View snapshotView=mInflater.inflate(R.layout.test_snapshot_dialog,null);
  ImageView snapshotImageView=(ImageView)snapshotView.findViewById(R.id.test_snapshot_image);
  snapshotImageView.setImageDrawable(drawable);
  snapshotDialog.setView(snapshotView);
  Window window=snapshotDialog.getWindow();
  WindowManager.LayoutParams layoutParams=window.getAttributes();
  layoutParams.y=-CamerasActivity.readScreenHeight(activity) / 9;
  window.setAttributes(layoutParams);
  return snapshotDialog;
}

Fixed version (ground truth):
/** 
 * Return a pop up dialog that shows camera snapshot.
 * @param drawable the image drawable returned to show in pop up dialog
 */
public static AlertDialog getSnapshotDialog(final Activity activity,Drawable drawable){
  Builder builder=new AlertDialog.Builder(activity);
  final AlertDialog snapshotDialog=builder.create();
  snapshotDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
  LayoutInflater mInflater=LayoutInflater.from(activity);
  final View snapshotView=mInflater.inflate(R.layout.test_snapshot_dialog,null);
  Button nextButton=(Button)snapshotView.findViewById(R.id.connect_camera_next_button);
  if (activity instanceof AddCameraActivity) {
    nextButton.setVisibility(View.VISIBLE);
    nextButton.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View v){
        ((AddCameraActivity)activity).showCameraNameView();
        snapshotDialog.dismiss();
      }
    }
);
  }
  ImageView snapshotImageView=(ImageView)snapshotView.findViewById(R.id.test_snapshot_image);
  snapshotImageView.setImageDrawable(drawable);
  snapshotDialog.setView(snapshotView);
  return snapshotDialog;
}
Program: 34025
Project: 34025
Buggy source:
@Override protected void onPreExecute(){
  customProgressDialog=new CustomProgressDialog(activity);
  customProgressDialog.show(activity.getString(R.string.retrieving_snapshot));
}

Fixed version (ground truth):
@Override protected void onPreExecute(){
  if (activity instanceof AddEditCameraActivity) {
    customProgressDialog=new CustomProgressDialog(activity);
    customProgressDialog.show(activity.getString(R.string.retrieving_snapshot));
  }
 else   if (activity instanceof AddCameraActivity) {
    ((AddCameraActivity)activity).showTestSnapshotProgress(true);
  }
}
Program: 34026
Project: 34026
Buggy source:
@Override protected void onPostExecute(Drawable drawable){
  customProgressDialog.dismiss();
  KeenClient client=KeenHelper.getClient(activity);
  if (drawable != null) {
    if (activity instanceof AddCameraActivity) {
      ((AddCameraActivity)activity).showConnectCameraNextButton(true);
    }
    CustomedDialog.getSnapshotDialog(activity,drawable).show();
    new TestSnapshotFeedbackItem(activity,AppData.defaultUser.getUsername(),true,true).setSnapshot_url(url).setCam_username(username).setCam_password(password).sendToKeenIo(client);
  }
 else {
    String username="String_Node_Str";
    if (AppData.defaultUser != null) {
      username=AppData.defaultUser.getUsername();
    }
    if (errorMessage == null) {
      CustomToast.showInCenterLong(activity,R.string.snapshot_test_failed);
      new TestSnapshotFeedbackItem(activity,username,false,true).setSnapshot_url(url).setCam_username(username).setCam_password(password).sendToKeenIo(client);
    }
 else {
      CustomToast.showInCenterLong(activity,errorMessage);
      new TestSnapshotFeedbackItem(activity,username,false,false).setSnapshot_url(url).setCam_username(username).setCam_password(password).sendToKeenIo(client);
    }
  }
}

Fixed version (ground truth):
@Override protected void onPostExecute(Drawable drawable){
  if (activity instanceof AddEditCameraActivity) {
    customProgressDialog.dismiss();
  }
 else   if (activity instanceof AddCameraActivity) {
    ((AddCameraActivity)activity).showTestSnapshotProgress(false);
  }
  KeenClient client=KeenHelper.getClient(activity);
  if (drawable != null) {
    CustomedDialog.getSnapshotDialog(activity,drawable).show();
    new TestSnapshotFeedbackItem(activity,AppData.defaultUser.getUsername(),true,true).setSnapshot_url(url).setCam_username(username).setCam_password(password).sendToKeenIo(client);
  }
 else {
    String username="String_Node_Str";
    if (AppData.defaultUser != null) {
      username=AppData.defaultUser.getUsername();
    }
    if (errorMessage == null) {
      CustomToast.showInCenterLong(activity,R.string.snapshot_test_failed);
      new TestSnapshotFeedbackItem(activity,username,false,true).setSnapshot_url(url).setCam_username(username).setCam_password(password).sendToKeenIo(client);
    }
 else {
      CustomToast.showInCenterLong(activity,errorMessage);
      new TestSnapshotFeedbackItem(activity,username,false,false).setSnapshot_url(url).setCam_username(username).setCam_password(password).sendToKeenIo(client);
    }
  }
}
Program: 34028
Project: 34028
Buggy source:
@Override protected void onPostExecute(Boolean isExpired){
  if (isExpired) {
    new EvercamAccount(MainActivity.this).remove(AppData.defaultUser.getEmail(),null);
    finish();
    Intent slideIntent=new Intent(MainActivity.this,SlideActivity.class);
    startActivity(slideIntent);
  }
 else {
    finish();
    startCamerasActivity();
  }
}

Fixed version (ground truth):
@Override protected void onPostExecute(Boolean isExpired){
  if (isExpired) {
    new EvercamAccount(MainActivity.this).remove(AppData.defaultUser.getEmail(),null);
    finish();
    Intent slideIntent=new Intent(MainActivity.this,SlideActivity.class);
    startActivity(slideIntent);
  }
 else {
    registerUserWithIntercom(AppData.defaultUser);
    finish();
    startCamerasActivity();
  }
}
Program: 34029
Project: 34029
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  View headerView=getActivity().getLayoutInflater().inflate(R.layout.share_list_header,getListView(),false);
  mShareAdapter=new ShareListArrayAdapter(getActivity(),R.layout.share_list_item,mShareList);
  getListView().addHeaderView(headerView);
  getListView().setDivider(null);
  setListAdapter(mShareAdapter);
  mSharingStatusImageView=(ImageView)headerView.findViewById(R.id.share_status_icon_image_view);
  mSharingStatusTextView=(TextView)headerView.findViewById(R.id.sharing_status_text_view);
  mSharingStatusDetailTextView=(TextView)headerView.findViewById(R.id.sharing_status_detail_text_view);
  retrieveSharingStatusFromCamera();
  FetchShareListTask.launch(SharingActivity.evercamCamera.getCameraId(),getActivity());
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  View headerView=getActivity().getLayoutInflater().inflate(R.layout.share_list_header,getListView(),false);
  mShareAdapter=new ShareListArrayAdapter(getActivity(),R.layout.share_list_item,mShareList);
  getListView().addHeaderView(headerView);
  getListView().setDivider(null);
  setListAdapter(mShareAdapter);
  mSharingStatusImageView=(ImageView)headerView.findViewById(R.id.share_status_icon_image_view);
  mSharingStatusTextView=(TextView)headerView.findViewById(R.id.sharing_status_text_view);
  mSharingStatusDetailTextView=(TextView)headerView.findViewById(R.id.sharing_status_detail_text_view);
  retrieveSharingStatusFromCamera();
  if (SharingActivity.evercamCamera != null) {
    FetchShareListTask.launch(SharingActivity.evercamCamera.getCameraId(),getActivity());
  }
}
Program: 34030
Project: 34030
Buggy source:
/** 
 * Return '3G' or 'WiFi'
 */
public String getNetworkString(){
  if (isConnectedWifi()) {
    return mContext.getString(R.string.wifi);
  }
 else   if (isConnectedMobile()) {
    return mContext.getString(R.string.three_g);
  }
  return mContext.getString(R.string.unknown);
}

Fixed version (ground truth):
/** 
 * Return '3G' or 'WiFi'
 */
public String getNetworkString(){
  if (mContext != null) {
    if (isConnectedWifi()) {
      return mContext.getString(R.string.wifi);
    }
 else     if (isConnectedMobile()) {
      return mContext.getString(R.string.three_g);
    }
    return mContext.getString(R.string.unknown);
  }
 else {
    return "String_Node_Str";
  }
}
Program: 34033
Project: 34033
Buggy source:
public void addNonCameraDevice(Device device){
  nonCameraDevices.add(device);
}

Fixed version (ground truth):
public void addNonCameraDevice(final Device device){
  runOnUiThread(new Runnable(){
    @Override public void run(){
      nonCameraDevices.add(device);
    }
  }
);
}
Program: 34035
Project: 34035
Buggy source:
@Override public void run(){
  String modelName=String.valueOf(input);
  String message="String_Node_Str" + device.toString() + "String_Node_Str"+ modelName;
  IntercomSendMessageTask.launch(context,AppData.defaultUser.getUsername(),message);
}

Fixed version (ground truth):
@Override public void run(){
  if (AppData.defaultUser != null) {
    String modelName=String.valueOf(input);
    String message="String_Node_Str" + device.toString() + "String_Node_Str"+ modelName;
    IntercomSendMessageTask.launch(context,AppData.defaultUser.getUsername(),message);
  }
}
Program: 34036
Project: 34036
Buggy source:
public static void showReportCameraModelDialog(final Context context,final Device device){
  new MaterialDialog.Builder(context).title(R.string.msg_specify_camera_model).content(R.string.msg_report_camera_model).negativeText(R.string.cancel).positiveText(R.string.report).input(R.string.hint_camera_model,R.string.empty,new MaterialDialog.InputCallback(){
    @Override public void onInput(    MaterialDialog dialog,    final CharSequence input){
      new Thread(new Runnable(){
        @Override public void run(){
          String modelName=String.valueOf(input);
          String message="String_Node_Str" + device.toString() + "String_Node_Str"+ modelName;
          IntercomSendMessageTask.launch(context,AppData.defaultUser.getUsername(),message);
        }
      }
).start();
    }
  }
).show();
}

Fixed version (ground truth):
public static void showReportCameraModelDialog(final Context context,final Device device){
  new MaterialDialog.Builder(context).title(R.string.msg_specify_camera_model).content(R.string.msg_report_camera_model).negativeText(R.string.cancel).positiveText(R.string.report).input(R.string.hint_camera_model,R.string.empty,new MaterialDialog.InputCallback(){
    @Override public void onInput(    MaterialDialog dialog,    final CharSequence input){
      new Thread(new Runnable(){
        @Override public void run(){
          if (AppData.defaultUser != null) {
            String modelName=String.valueOf(input);
            String message="String_Node_Str" + device.toString() + "String_Node_Str"+ modelName;
            IntercomSendMessageTask.launch(context,AppData.defaultUser.getUsername(),message);
          }
        }
      }
).start();
    }
  }
).show();
}
Program: 34037
Project: 34037
Buggy source:
@Override public void onInput(MaterialDialog dialog,final CharSequence input){
  new Thread(new Runnable(){
    @Override public void run(){
      String modelName=String.valueOf(input);
      String message="String_Node_Str" + device.toString() + "String_Node_Str"+ modelName;
      IntercomSendMessageTask.launch(context,AppData.defaultUser.getUsername(),message);
    }
  }
).start();
}

Fixed version (ground truth):
@Override public void onInput(MaterialDialog dialog,final CharSequence input){
  new Thread(new Runnable(){
    @Override public void run(){
      if (AppData.defaultUser != null) {
        String modelName=String.valueOf(input);
        String message="String_Node_Str" + device.toString() + "String_Node_Str"+ modelName;
        IntercomSendMessageTask.launch(context,AppData.defaultUser.getUsername(),message);
      }
    }
  }
).start();
}
Program: 34038
Project: 34038
Buggy source:
@Override public void onListItemClick(ListView listView,View view,int position,long id){
  if (position == 0) {
    SharingStatus status=new SharingStatus(SharingActivity.evercamCamera.isDiscoverable(),SharingActivity.evercamCamera.isPublic());
    String selectedItem=getString(status.getStatusStringId());
    CustomedDialog.getShareStatusDialog(this,selectedItem).show();
  }
 else {
    CameraShareInterface shareInterface=mShareList.get(position - 1);
    CustomedDialog.getRightsStatusDialog(this,shareInterface).show();
  }
}

Fixed version (ground truth):
@Override public void onListItemClick(ListView listView,View view,int position,long id){
  if (position == 0 && SharingActivity.evercamCamera != null) {
    SharingStatus status=new SharingStatus(SharingActivity.evercamCamera.isDiscoverable(),SharingActivity.evercamCamera.isPublic());
    String selectedItem=getString(status.getStatusStringId());
    CustomedDialog.getShareStatusDialog(this,selectedItem).show();
  }
 else {
    CameraShareInterface shareInterface=mShareList.get(position - 1);
    CustomedDialog.getRightsStatusDialog(this,shareInterface).show();
  }
}
Program: 34039
Project: 34039
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  try {
    super.onCreate(savedInstanceState);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    initAnalyticsObjects();
    readShortcutCameraId();
    if (!liveViewCameraId.isEmpty()) {
      startingCameraID=liveViewCameraId;
      liveViewCameraId="String_Node_Str";
    }
    launchSleepTimer();
    setDisplayOriention();
    try {
      GStreamer.init(this);
    }
 catch (    Exception e) {
      Log.e(TAG,e.getLocalizedMessage());
      EvercamPlayApplication.sendCaughtException(this,e);
      finish();
      return;
    }
    nativeInit();
    setContentView(R.layout.video_activity_layout);
    mToolbar=(Toolbar)findViewById(R.id.spinner_tool_bar);
    setOpaqueTitleBackground();
    setSupportActionBar(mToolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    mCameraListSpinner=(Spinner)findViewById(R.id.spinner_camera_list);
    initialPageElements();
    checkIsShortcutCameraExists();
    startPlay();
    if (showCameraCreated) {
      CustomSnackbar.showLong(this,R.string.create_success);
      showCameraCreated=false;
    }
  }
 catch (  OutOfMemoryError e) {
    Log.e(TAG,e.toString() + "String_Node_Str" + Log.getStackTraceString(e));
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  try {
    super.onCreate(savedInstanceState);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    initAnalyticsObjects();
    readShortcutCameraId();
    if (!liveViewCameraId.isEmpty()) {
      startingCameraID=liveViewCameraId;
      liveViewCameraId="String_Node_Str";
    }
    launchSleepTimer();
    setDisplayOrientation();
    try {
      GStreamer.init(this);
    }
 catch (    Exception e) {
      Log.e(TAG,e.getLocalizedMessage());
      EvercamPlayApplication.sendCaughtException(this,e);
      finish();
      return;
    }
    nativeInit();
    setContentView(R.layout.video_activity_layout);
    mToolbar=(Toolbar)findViewById(R.id.spinner_tool_bar);
    setOpaqueTitleBackground();
    setSupportActionBar(mToolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    mCameraListSpinner=(Spinner)findViewById(R.id.spinner_camera_list);
    initialPageElements();
    checkIsShortcutCameraExists();
    startPlay();
    if (showCameraCreated) {
      CustomSnackbar.showLong(this,R.string.create_success);
      showCameraCreated=false;
    }
  }
 catch (  OutOfMemoryError e) {
    Log.e(TAG,e.toString() + "String_Node_Str" + Log.getStackTraceString(e));
  }
}
Program: 34040
Project: 34040
Buggy source:
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (requestCode == Constants.REQUEST_CODE_PATCH_CAMERA || requestCode == Constants.REQUEST_CODE_VIEW_CAMERA) {
    if (resultCode == Constants.RESULT_TRUE) {
      new Handler().postDelayed(new Runnable(){
        @Override public void run(){
          CustomSnackbar.showLong(VideoActivity.this,R.string.patch_success);
        }
      }
,1000);
      startPlay();
    }
 else     if (resultCode == Constants.RESULT_FALSE) {
      startPlay();
    }
  }
 else {
    if (resultCode == Constants.RESULT_DELETED) {
      setResult(Constants.RESULT_TRUE);
      finish();
    }
 else     if (resultCode == Constants.RESULT_TRANSFERRED) {
      setResult(Constants.RESULT_TRANSFERRED);
      finish();
    }
 else     if (resultCode == Constants.RESULT_ACCESS_REMOVED) {
      setResult(Constants.RESULT_ACCESS_REMOVED);
      finish();
    }
 else     if (resultCode == Constants.RESULT_NO_ACCESS) {
      setResult(Constants.RESULT_NO_ACCESS);
      finish();
    }
 else {
      startPlay();
    }
  }
}

Fixed version (ground truth):
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (requestCode == Constants.REQUEST_CODE_PATCH_CAMERA || requestCode == Constants.REQUEST_CODE_VIEW_CAMERA) {
    if (resultCode == Constants.RESULT_TRUE) {
      new Handler().postDelayed(new Runnable(){
        @Override public void run(){
          CustomSnackbar.showLong(VideoActivity.this,R.string.patch_success);
        }
      }
,1000);
      startPlay();
    }
 else     if (resultCode == Constants.RESULT_FALSE) {
      startPlay();
    }
 else     if (resultCode == Constants.RESULT_DELETED) {
      setResult(Constants.RESULT_TRUE);
      finish();
    }
  }
 else {
    if (resultCode == Constants.RESULT_TRANSFERRED) {
      setResult(Constants.RESULT_TRANSFERRED);
      finish();
    }
 else     if (resultCode == Constants.RESULT_ACCESS_REMOVED) {
      setResult(Constants.RESULT_ACCESS_REMOVED);
      finish();
    }
 else     if (resultCode == Constants.RESULT_NO_ACCESS) {
      setResult(Constants.RESULT_NO_ACCESS);
      finish();
    }
 else {
      startPlay();
    }
  }
}
Program: 34041
Project: 34041
Buggy source:
private void onVideoLoadFailed(){
  Log.d(TAG,"String_Node_Str");
  runOnUiThread(new Runnable(){
    public void run(){
      EvercamPlayApplication.sendEventAnalytics(VideoActivity.this,R.string.category_streaming_rtsp,R.string.action_streaming_rtsp_failed,R.string.label_streaming_rtsp_failed);
      StreamFeedbackItem failedItem=new StreamFeedbackItem(VideoActivity.this,AppData.defaultUser.getUsername(),false);
      failedItem.setCameraId(evercamCamera.getCameraId());
      failedItem.setUrl(createUri(evercamCamera));
      failedItem.setType(StreamFeedbackItem.TYPE_RTSP);
      sendToLogentries(logger,failedItem.toJson());
      failedItem.sendToKeenIo(client);
      isPlayingJpg=true;
      CustomSnackbar.showShort(VideoActivity.this,R.string.msg_switch_to_jpg);
      showImagesVideo=true;
      createBrowseJpgTask();
    }
  }
);
}

Fixed version (ground truth):
private void onVideoLoadFailed(){
  Log.d(TAG,"String_Node_Str");
  runOnUiThread(new Runnable(){
    public void run(){
      EvercamPlayApplication.sendEventAnalytics(VideoActivity.this,R.string.category_streaming_rtsp,R.string.action_streaming_rtsp_failed,R.string.label_streaming_rtsp_failed);
      StreamFeedbackItem failedItem=new StreamFeedbackItem(VideoActivity.this,AppData.defaultUser.getUsername(),false);
      failedItem.setCameraId(evercamCamera.getCameraId());
      failedItem.setUrl(createUri(evercamCamera));
      failedItem.setType(StreamFeedbackItem.TYPE_RTSP);
      sendToLogentries(logger,failedItem.toJson());
      failedItem.sendToKeenIo(client);
      CustomSnackbar.showShort(VideoActivity.this,R.string.msg_switch_to_jpg);
      showImagesVideo=true;
      createBrowseJpgTask();
    }
  }
);
}
Program: 34042
Project: 34042
Buggy source:
private void onVideoLoaded(){
  Log.d(TAG,"String_Node_Str");
  runOnUiThread(new Runnable(){
    public void run(){
      isPlayingJpg=false;
      hideProgressView();
      surfaceView.setVisibility(View.VISIBLE);
      imageView.setVisibility(View.GONE);
      startTimeCounter();
      EvercamPlayApplication.sendEventAnalytics(VideoActivity.this,R.string.category_streaming_rtsp,R.string.action_streaming_rtsp_success,R.string.label_streaming_rtsp_success);
      StreamFeedbackItem successItem=new StreamFeedbackItem(VideoActivity.this,AppData.defaultUser.getUsername(),true);
      successItem.setCameraId(evercamCamera.getCameraId());
      successItem.setUrl(createUri(evercamCamera));
      successItem.setType(StreamFeedbackItem.TYPE_RTSP);
      if (startTime != null) {
        float timeDifferenceFloat=Commons.calculateTimeDifferenceFrom(startTime);
        Log.d(TAG,"String_Node_Str" + timeDifferenceFloat + "String_Node_Str");
        successItem.setLoadTime(timeDifferenceFloat);
        startTime=null;
      }
      sendToLogentries(logger,successItem.toJson());
      successItem.sendToKeenIo(client);
    }
  }
);
}

Fixed version (ground truth):
private void onVideoLoaded(){
  Log.d(TAG,"String_Node_Str");
  runOnUiThread(new Runnable(){
    public void run(){
      hideProgressView();
      surfaceView.setVisibility(View.VISIBLE);
      imageView.setVisibility(View.GONE);
      startTimeCounter();
      EvercamPlayApplication.sendEventAnalytics(VideoActivity.this,R.string.category_streaming_rtsp,R.string.action_streaming_rtsp_success,R.string.label_streaming_rtsp_success);
      StreamFeedbackItem successItem=new StreamFeedbackItem(VideoActivity.this,AppData.defaultUser.getUsername(),true);
      successItem.setCameraId(evercamCamera.getCameraId());
      successItem.setUrl(createUri(evercamCamera));
      successItem.setType(StreamFeedbackItem.TYPE_RTSP);
      if (startTime != null) {
        float timeDifferenceFloat=Commons.calculateTimeDifferenceFrom(startTime);
        Log.d(TAG,"String_Node_Str" + timeDifferenceFloat + "String_Node_Str");
        successItem.setLoadTime(timeDifferenceFloat);
        startTime=null;
      }
      sendToLogentries(logger,successItem.toJson());
      successItem.sendToKeenIo(client);
    }
  }
);
}
Program: 34043
Project: 34043
Buggy source:
public void retrieveSharingStatusFromCamera(){
  SharingStatus status=new SharingStatus(SharingActivity.evercamCamera.isDiscoverable(),SharingActivity.evercamCamera.isPublic());
  updateSharingStatusUi(status);
}

Fixed version (ground truth):
public void retrieveSharingStatusFromCamera(){
  if (SharingActivity.evercamCamera != null) {
    SharingStatus status=new SharingStatus(SharingActivity.evercamCamera.isDiscoverable(),SharingActivity.evercamCamera.isPublic());
    updateSharingStatusUi(status);
  }
}
Program: 34044
Project: 34044
Buggy source:
/** 
 * Get the network info
 */
private NetworkInfo getNetworkInfo(){
  ConnectivityManager connectivityManager=(ConnectivityManager)mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
  return connectivityManager.getActiveNetworkInfo();
}

Fixed version (ground truth):
/** 
 * Get the network info
 */
private NetworkInfo getNetworkInfo(){
  if (mContext != null) {
    ConnectivityManager connectivityManager=(ConnectivityManager)mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
    return connectivityManager.getActiveNetworkInfo();
  }
  return null;
}
Program: 34045
Project: 34045
Buggy source:
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (requestCode == Constants.REQUEST_CODE_ADD_CAMERA) {
    reloadCameraList=(resultCode == Constants.RESULT_TRUE);
  }
 else   if (requestCode == Constants.REQUEST_CODE_DELETE_CAMERA) {
    if (resultCode == Constants.RESULT_TRUE) {
      reloadCameraList=true;
    }
  }
 else   if (requestCode == Constants.REQUEST_CODE_MANAGE_ACCOUNT) {
    reloadCameraList=(resultCode == Constants.RESULT_ACCOUNT_CHANGED);
  }
  if (resultCode == Constants.RESULT_TRANSFERRED) {
    reloadCameraList=true;
    CustomSnackbar.showMultiLine(activity,R.string.msg_transfer_success);
  }
}

Fixed version (ground truth):
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (requestCode == Constants.REQUEST_CODE_ADD_CAMERA) {
    reloadCameraList=(resultCode == Constants.RESULT_TRUE);
  }
 else   if (requestCode == Constants.REQUEST_CODE_DELETE_CAMERA) {
    if (resultCode == Constants.RESULT_TRUE) {
      reloadCameraList=true;
    }
  }
 else   if (requestCode == Constants.REQUEST_CODE_MANAGE_ACCOUNT) {
    reloadCameraList=(resultCode == Constants.RESULT_ACCOUNT_CHANGED);
  }
  if (resultCode == Constants.RESULT_TRANSFERRED) {
    reloadCameraList=true;
    CustomSnackbar.showMultiLine(activity,R.string.msg_transfer_success);
  }
 else   if (resultCode == Constants.RESULT_ACCESS_REMOVED) {
    reloadCameraList=true;
    CustomSnackbar.show(activity,R.string.msg_share_updated);
  }
}
Program: 34046
Project: 34046
Buggy source:
public static AlertDialog getConfirmRemoveShareDialog(Activity activity,final CameraShareInterface shareInterface,final RightsStatus newRightStatus){
  int positiveButtonTextId=R.string.remove;
  int messageTextId=R.string.msg_confirm_remove_share;
  if (shareInterface instanceof CameraShareRequest) {
    positiveButtonTextId=R.string.revoke;
    messageTextId=R.string.msg_confirm_revoke_share_request;
  }
  return getConfirmDialog(activity,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      newRightStatus.updateOnShare(shareInterface);
    }
  }
,messageTextId,positiveButtonTextId);
}

Fixed version (ground truth):
public static AlertDialog getConfirmRemoveShareDialog(Activity activity,final CameraShareInterface shareInterface,final RightsStatus newRightStatus){
  int positiveButtonTextId=R.string.remove;
  int messageTextId=R.string.msg_confirm_remove_share;
  if (shareInterface instanceof CameraShareRequest) {
    positiveButtonTextId=R.string.revoke;
    messageTextId=R.string.msg_confirm_revoke_share_request;
  }
 else   if (shareInterface instanceof CameraShare) {
    if (((CameraShare)shareInterface).getUserId().equals(AppData.defaultUser.getUsername())) {
      messageTextId=R.string.msg_confirm_remove_self;
    }
  }
  return getConfirmDialog(activity,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      newRightStatus.updateOnShare(shareInterface);
    }
  }
,messageTextId,positiveButtonTextId);
}