Program: 166618
Project: 166618
Buggy source:
/** 
 * Either turns on or off the flashlight
 * @param onOrOff - true for on, false for off
 */
private void turnOnOrOff(boolean onOrOff){
  if (onOrOff) {
    Intent i=new Intent(this,FlashlightActivity.class);
    i.putExtra("String_Node_Str",false);
    Notification.Builder builder=new Notification.Builder(this);
    builder.setContentTitle(getString(R.string.flashlight_activated));
    builder.setOngoing(true);
    builder.setSmallIcon(R.drawable.ic_launcher);
    builder.addAction(0,getString(R.string.turn_off),PendingIntent.getActivity(this,193,i,0));
    ((NotificationManager)getSystemService(NOTIFICATION_SERVICE)).notify(1224,builder.build());
    if (mCamera == null) {
      preview=(SurfaceView)findViewById(R.id.PREVIEW);
      mHolder=preview.getHolder();
      mHolder.addCallback(this);
      mCamera=Camera.open();
      try {
        mCamera.setPreviewDisplay(mHolder);
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
    Parameters params=mCamera.getParameters();
    if (!params.getSupportedFlashModes().contains(Parameters.FLASH_MODE_TORCH)) {
      Toast.makeText(this,getString(R.string.no_flashlight_access),Toast.LENGTH_LONG).show();
      finish();
      return;
    }
    params.setFlashMode(Parameters.FLASH_MODE_TORCH);
    mCamera.setParameters(params);
    try {
      mCamera.startPreview();
    }
 catch (    Exception e) {
      Toast.makeText(this,getString(R.string.no_flashlight_access),Toast.LENGTH_LONG).show();
      finish();
      return;
    }
  }
 else {
    finish();
  }
}

Fixed version (ground truth):
/** 
 * Either turns on or off the flashlight
 * @param onOrOff - true for on, false for off
 */
private void turnOnOrOff(boolean onOrOff){
  if (onOrOff) {
    Intent i=new Intent(this,FlashlightActivity.class);
    i.putExtra("String_Node_Str",false);
    Notification.Builder builder=new Notification.Builder(this);
    builder.setContentTitle(getString(R.string.flashlight_activated));
    builder.setOngoing(true);
    builder.setSmallIcon(R.drawable.ic_launcher);
    builder.addAction(0,getString(R.string.turn_off),PendingIntent.getActivity(this,193,i,0));
    ((NotificationManager)getSystemService(NOTIFICATION_SERVICE)).notify(1224,builder.build());
    if (mCamera == null) {
      preview=(SurfaceView)findViewById(R.id.PREVIEW);
      mHolder=preview.getHolder();
      mHolder.addCallback(this);
      mCamera=Camera.open();
      try {
        mCamera.setPreviewDisplay(mHolder);
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
    Parameters params=mCamera.getParameters();
    if (!params.getSupportedFlashModes().contains(Parameters.FLASH_MODE_TORCH)) {
      Toast.makeText(this,getString(R.string.no_flashlight_access),Toast.LENGTH_LONG).show();
      finish();
      return;
    }
    params.setFlashMode(Parameters.FLASH_MODE_TORCH);
    mCamera.setParameters(params);
    try {
      mCamera.startPreview();
    }
 catch (    Exception e) {
      Toast.makeText(this,getString(R.string.no_flashlight_access),Toast.LENGTH_LONG).show();
      finish();
      return;
    }
  }
 else {
    finish();
    GoogleNowUtil.resetGoogleNow(this);
  }
}