nus-yam/ex-repair huggingface dataset:
Program: 184439
Project: 184439
Buggy source:
@Override public boolean onDoubleTap(MotionEvent e){
  if (mPausing || !isCameraIdle() || !mPreviewing|| mZoomButtons == null || mZooming) {
    return false;
  }
  if (mZoomValue < mZoomMax) {
    while (mZoomValue < mZoomMax) {
      mZoomValue+=ZOOM_STEP_MIN;
      zoomToLevel(ZOOM_IMMEDIATE);
      try {
        Thread.currentThread().sleep(5);
      }
 catch (      InterruptedException ex) {
      }
    }
  }
 else {
    while (mZoomValue > ZOOM_MIN) {
      mZoomValue-=ZOOM_STEP_MIN;
      zoomToLevel(ZOOM_IMMEDIATE);
      try {
        Thread.currentThread().sleep(5);
      }
 catch (      InterruptedException ex) {
      }
    }
  }
  updateZoomButtonsEnabled();
  return true;
}

Fixed version (ground truth):
@Override public boolean onDoubleTap(MotionEvent e){
  if (mPausing || !isCameraIdle() || !mPreviewing|| mZoomButtons == null || isZooming()) {
    return false;
  }
  if (mZoomValue < mZoomMax) {
    while (mZoomValue < mZoomMax) {
      zoomToLevel(ZOOM_IMMEDIATE,mZoomValue + ZOOM_STEP_MIN);
      try {
        Thread.currentThread().sleep(5);
      }
 catch (      InterruptedException ex) {
      }
    }
  }
 else {
    while (mZoomValue > ZOOM_MIN) {
      zoomToLevel(ZOOM_IMMEDIATE,mZoomValue - ZOOM_STEP_MIN);
      try {
        Thread.currentThread().sleep(5);
      }
 catch (      InterruptedException ex) {
      }
    }
  }
  updateZoomButtonsEnabled();
  return true;
}
Program: 184440
Project: 184440
Buggy source:
public void onZoom(boolean zoomIn){
  if (mZooming)   return;
  if (zoomIn) {
    if (mZoomValue < mZoomMax) {
      mZoomValue+=mZoomStep;
      zoomToLevel(ZOOM_CONTINUOUS);
    }
  }
 else {
    if (mZoomValue > ZOOM_MIN) {
      mZoomValue-=mZoomStep;
      zoomToLevel(ZOOM_CONTINUOUS);
    }
  }
  updateZoomButtonsEnabled();
}

Fixed version (ground truth):
public void onZoom(boolean zoomIn){
  if (isZooming())   return;
  if (zoomIn) {
    if (mZoomValue < mZoomMax) {
      zoomToLevel(ZOOM_CONTINUOUS,mZoomValue + mZoomStep);
    }
  }
 else {
    if (mZoomValue > ZOOM_MIN) {
      zoomToLevel(ZOOM_CONTINUOUS,mZoomValue - mZoomStep);
    }
  }
}
Program: 184441
Project: 184441
Buggy source:
private void showOnScreenSettings(){
  if (mSettings == null) {
    mSettings=new OnScreenSettings(findViewById(R.id.camera_preview));
    CameraSettings helper=new CameraSettings(this,mParameters);
    mSettings.setPreferenceScreen(helper.getPreferenceScreen(R.xml.camera_preferences));
    mSettings.setOnVisibilityChangedListener(this);
  }
  mSettings.expandPanel();
}

Fixed version (ground truth):
private void showOnScreenSettings(){
  if (mSettings == null) {
    mSettings=new OnScreenSettings(findViewById(R.id.camera_preview));
    CameraSettings helper=new CameraSettings(this,mParameters);
    mSettings.setPreferenceScreen(helper.getPreferenceScreen(R.xml.video_preferences));
    mSettings.setOnVisibilityChangedListener(this);
  }
  mSettings.expandPanel();
}
Program: 184442
Project: 184442
Buggy source:
private void startPreview() throws CameraHardwareException {
  if (mPausing || isFinishing())   return;
  ensureCameraDevice();
  if (mPreviewing)   stopPreview();
  setPreviewDisplay(mSurfaceHolder);
  setCameraParameter();
  final long wallTimeStart=SystemClock.elapsedRealtime();
  final long threadTimeStart=Debug.threadCpuTimeNanos();
  mCameraDevice.setOneShotPreviewCallback(mOneShotPreviewCallback);
  mCameraDevice.setErrorCallback(mErrorCallback);
  try {
    Log.v(TAG,"String_Node_Str");
    mCameraDevice.startPreview();
  }
 catch (  Throwable ex) {
    closeCamera();
    throw new RuntimeException("String_Node_Str",ex);
  }
  mPreviewing=true;
  mStatus=IDLE;
  long threadTimeEnd=Debug.threadCpuTimeNanos();
  long wallTimeEnd=SystemClock.elapsedRealtime();
  if ((wallTimeEnd - wallTimeStart) > 3000) {
    Log.w(TAG,"String_Node_Str" + (wallTimeEnd - wallTimeStart) + "String_Node_Str"+ (threadTimeEnd - threadTimeStart) / 1000000 + "String_Node_Str");
  }
}

Fixed version (ground truth):
private void startPreview() throws CameraHardwareException {
  if (mPausing || isFinishing())   return;
  ensureCameraDevice();
  if (mPreviewing)   stopPreview();
  setPreviewDisplay(mSurfaceHolder);
  setCameraParameters();
  final long wallTimeStart=SystemClock.elapsedRealtime();
  final long threadTimeStart=Debug.threadCpuTimeNanos();
  mCameraDevice.setOneShotPreviewCallback(mOneShotPreviewCallback);
  mCameraDevice.setErrorCallback(mErrorCallback);
  try {
    Log.v(TAG,"String_Node_Str");
    mCameraDevice.startPreview();
  }
 catch (  Throwable ex) {
    closeCamera();
    throw new RuntimeException("String_Node_Str",ex);
  }
  mPreviewing=true;
  mStatus=IDLE;
  long threadTimeEnd=Debug.threadCpuTimeNanos();
  long wallTimeEnd=SystemClock.elapsedRealtime();
  if ((wallTimeEnd - wallTimeStart) > 3000) {
    Log.w(TAG,"String_Node_Str" + (wallTimeEnd - wallTimeStart) + "String_Node_Str"+ (threadTimeEnd - threadTimeStart) / 1000000 + "String_Node_Str");
  }
}
Program: 184443
Project: 184443
Buggy source:
public void onZoomUpdate(int zoomLevel,android.hardware.Camera camera){
  mZoomValue=(double)zoomLevel / 1000;
  mZooming=false;
}

Fixed version (ground truth):
public void onZoomUpdate(int zoomLevel,android.hardware.Camera camera){
  mZoomValue=(double)zoomLevel / 1000;
  Log.v(TAG,"String_Node_Str" + zoomLevel);
  updateZoomButtonsEnabled();
}
Program: 184444
Project: 184444
Buggy source:
private void initializeZoom(){
  String zoomState=mParameters.get(PARM_ZOOM_STATE);
  if (zoomState == null)   return;
  mZoomValue=Double.parseDouble(mParameters.get(PARM_ZOOM_TO_LEVEL));
  mZoomMax=Double.parseDouble(mParameters.get(PARM_ZOOM_MAX));
  mZoomStep=Double.parseDouble(mParameters.get(PARM_ZOOM_STEP));
  mParameters.set(PARM_ZOOM_SPEED,ZOOM_SPEED);
  mCameraDevice.setParameters(mParameters);
  mGestureDetector=new GestureDetector(this,new ZoomGestureListener());
  mCameraDevice.setZoomCallback(mZoomCallback);
  mZoomButtons=new ZoomButtonsController(mSurfaceView);
  mZoomButtons.setAutoDismissed(true);
  mZoomButtons.setZoomSpeed(100);
  mZoomButtons.setOnZoomListener(new ZoomButtonsController.OnZoomListener(){
    public void onVisibilityChanged(    boolean visible){
      if (visible) {
        updateZoomButtonsEnabled();
      }
    }
    public void onZoom(    boolean zoomIn){
      if (mZooming)       return;
      if (zoomIn) {
        if (mZoomValue < mZoomMax) {
          mZoomValue+=mZoomStep;
          zoomToLevel(ZOOM_CONTINUOUS);
        }
      }
 else {
        if (mZoomValue > ZOOM_MIN) {
          mZoomValue-=mZoomStep;
          zoomToLevel(ZOOM_CONTINUOUS);
        }
      }
      updateZoomButtonsEnabled();
    }
  }
);
}

Fixed version (ground truth):
private void initializeZoom(){
  String zoomState=mParameters.get(PARM_ZOOM_STATE);
  if (zoomState == null)   return;
  mZoomValue=Double.parseDouble(mParameters.get(PARM_ZOOM_TO_LEVEL));
  mZoomMax=Double.parseDouble(mParameters.get(PARM_ZOOM_MAX));
  mZoomStep=Double.parseDouble(mParameters.get(PARM_ZOOM_STEP));
  mParameters.set(PARM_ZOOM_SPEED,ZOOM_SPEED);
  mCameraDevice.setParameters(mParameters);
  mGestureDetector=new GestureDetector(this,new ZoomGestureListener());
  mCameraDevice.setZoomCallback(mZoomCallback);
  mZoomButtons=new ZoomButtonsController(mSurfaceView);
  mZoomButtons.setAutoDismissed(true);
  mZoomButtons.setZoomSpeed(100);
  mZoomButtons.setOnZoomListener(new ZoomButtonsController.OnZoomListener(){
    public void onVisibilityChanged(    boolean visible){
      if (visible) {
        updateZoomButtonsEnabled();
      }
    }
    public void onZoom(    boolean zoomIn){
      if (isZooming())       return;
      if (zoomIn) {
        if (mZoomValue < mZoomMax) {
          zoomToLevel(ZOOM_CONTINUOUS,mZoomValue + mZoomStep);
        }
      }
 else {
        if (mZoomValue > ZOOM_MIN) {
          zoomToLevel(ZOOM_CONTINUOUS,mZoomValue - mZoomStep);
        }
      }
    }
  }
);
}
Program: 184445
Project: 184445
Buggy source:
private void initializeSecondTime(){
  mOrientationListener.enable();
  readPreference();
  if (mRecordLocation)   startReceivingLocationUpdates();
  installIntentFilter();
  initializeFocusTone();
  checkStorage();
  if (!mIsImageCaptureIntent) {
    updateThumbnailButton();
  }
}

Fixed version (ground truth):
private void initializeSecondTime(){
  mOrientationListener.enable();
  readPreference();
  if (mRecordLocation)   startReceivingLocationUpdates();
  installIntentFilter();
  initializeFocusTone();
  checkStorage();
  if (mZoomButtons != null) {
    mZoomValue=Double.parseDouble(mParameters.get(PARM_ZOOM_TO_LEVEL));
    mCameraDevice.setZoomCallback(mZoomCallback);
  }
  if (!mIsImageCaptureIntent) {
    updateThumbnailButton();
  }
}
Program: 184446
Project: 184446
Buggy source:
private void zoomToLevel(String type){
  if (type == null) {
    Log.e(TAG,"String_Node_Str");
    return;
  }
  if (mZoomValue > mZoomMax)   mZoomValue=mZoomMax;
  if (mZoomValue < ZOOM_MIN)   mZoomValue=ZOOM_MIN;
  mParameters.set(PARM_ZOOM_STATE,ZOOM_STOP);
  mCameraDevice.setParameters(mParameters);
  mParameters.set(PARM_ZOOM_TO_LEVEL,Double.toString(mZoomValue));
  mParameters.set(PARM_ZOOM_STATE,type);
  mCameraDevice.setParameters(mParameters);
  if (ZOOM_CONTINUOUS.equals(type))   mZooming=true;
}

Fixed version (ground truth):
private void zoomToLevel(String type,double zoomValue){
  if (zoomValue > mZoomMax)   zoomValue=mZoomMax;
  if (zoomValue < ZOOM_MIN)   zoomValue=ZOOM_MIN;
  mParameters.set(PARM_ZOOM_STATE,ZOOM_STOP);
  mCameraDevice.setParameters(mParameters);
  mParameters.set(PARM_ZOOM_TO_LEVEL,Double.toString(zoomValue));
  mParameters.set(PARM_ZOOM_STATE,type);
  mCameraDevice.setParameters(mParameters);
  if (ZOOM_IMMEDIATE.equals(type))   mZoomValue=zoomValue;
}
Program: 184447
Project: 184447
Buggy source:
@Override public boolean onDoubleTap(MotionEvent e){
  if (mPausing || !isCameraIdle() || !mPreviewing|| mZoomButtons == null || mZooming) {
    return false;
  }
  if (mZoomValue < mZoomMax) {
    while (mZoomValue < mZoomMax) {
      mZoomValue+=ZOOM_STEP_MIN;
      zoomToLevel(ZOOM_IMMEDIATE);
      try {
        Thread.currentThread().sleep(5);
      }
 catch (      InterruptedException ex) {
      }
    }
  }
 else {
    while (mZoomValue > ZOOM_MIN) {
      mZoomValue-=ZOOM_STEP_MIN;
      zoomToLevel(ZOOM_IMMEDIATE);
      try {
        Thread.currentThread().sleep(5);
      }
 catch (      InterruptedException ex) {
      }
    }
  }
  updateZoomButtonsEnabled();
  return true;
}

Fixed version (ground truth):
@Override public boolean onDoubleTap(MotionEvent e){
  if (mPausing || !isCameraIdle() || !mPreviewing|| mZoomButtons == null || isZooming()) {
    return false;
  }
  if (mZoomValue < mZoomMax) {
    while (mZoomValue < mZoomMax) {
      zoomToLevel(ZOOM_IMMEDIATE,mZoomValue + ZOOM_STEP_MIN);
      try {
        Thread.currentThread().sleep(5);
      }
 catch (      InterruptedException ex) {
      }
    }
  }
 else {
    while (mZoomValue > ZOOM_MIN) {
      zoomToLevel(ZOOM_IMMEDIATE,mZoomValue - ZOOM_STEP_MIN);
      try {
        Thread.currentThread().sleep(5);
      }
 catch (      InterruptedException ex) {
      }
    }
  }
  updateZoomButtonsEnabled();
  return true;
}
Program: 184448
Project: 184448
Buggy source:
public void onZoom(boolean zoomIn){
  if (mZooming)   return;
  if (zoomIn) {
    if (mZoomValue < mZoomMax) {
      mZoomValue+=mZoomStep;
      zoomToLevel(ZOOM_CONTINUOUS);
    }
  }
 else {
    if (mZoomValue > ZOOM_MIN) {
      mZoomValue-=mZoomStep;
      zoomToLevel(ZOOM_CONTINUOUS);
    }
  }
  updateZoomButtonsEnabled();
}

Fixed version (ground truth):
public void onZoom(boolean zoomIn){
  if (isZooming())   return;
  if (zoomIn) {
    if (mZoomValue < mZoomMax) {
      zoomToLevel(ZOOM_CONTINUOUS,mZoomValue + mZoomStep);
    }
  }
 else {
    if (mZoomValue > ZOOM_MIN) {
      zoomToLevel(ZOOM_CONTINUOUS,mZoomValue - mZoomStep);
    }
  }
}
Program: 184449
Project: 184449
Buggy source:
private void startPreview() throws CameraHardwareException {
  if (mPausing || isFinishing())   return;
  ensureCameraDevice();
  if (mPreviewing)   stopPreview();
  setPreviewDisplay(mSurfaceHolder);
  setCameraParameter();
  final long wallTimeStart=SystemClock.elapsedRealtime();
  final long threadTimeStart=Debug.threadCpuTimeNanos();
  mCameraDevice.setOneShotPreviewCallback(mOneShotPreviewCallback);
  mCameraDevice.setErrorCallback(mErrorCallback);
  try {
    Log.v(TAG,"String_Node_Str");
    mCameraDevice.startPreview();
  }
 catch (  Throwable ex) {
    closeCamera();
    throw new RuntimeException("String_Node_Str",ex);
  }
  mPreviewing=true;
  mStatus=IDLE;
  long threadTimeEnd=Debug.threadCpuTimeNanos();
  long wallTimeEnd=SystemClock.elapsedRealtime();
  if ((wallTimeEnd - wallTimeStart) > 3000) {
    Log.w(TAG,"String_Node_Str" + (wallTimeEnd - wallTimeStart) + "String_Node_Str"+ (threadTimeEnd - threadTimeStart) / 1000000 + "String_Node_Str");
  }
}

Fixed version (ground truth):
private void startPreview() throws CameraHardwareException {
  if (mPausing || isFinishing())   return;
  ensureCameraDevice();
  if (mPreviewing)   stopPreview();
  setPreviewDisplay(mSurfaceHolder);
  setCameraParameters();
  final long wallTimeStart=SystemClock.elapsedRealtime();
  final long threadTimeStart=Debug.threadCpuTimeNanos();
  mCameraDevice.setOneShotPreviewCallback(mOneShotPreviewCallback);
  mCameraDevice.setErrorCallback(mErrorCallback);
  try {
    Log.v(TAG,"String_Node_Str");
    mCameraDevice.startPreview();
  }
 catch (  Throwable ex) {
    closeCamera();
    throw new RuntimeException("String_Node_Str",ex);
  }
  mPreviewing=true;
  mStatus=IDLE;
  long threadTimeEnd=Debug.threadCpuTimeNanos();
  long wallTimeEnd=SystemClock.elapsedRealtime();
  if ((wallTimeEnd - wallTimeStart) > 3000) {
    Log.w(TAG,"String_Node_Str" + (wallTimeEnd - wallTimeStart) + "String_Node_Str"+ (threadTimeEnd - threadTimeStart) / 1000000 + "String_Node_Str");
  }
}
Program: 184450
Project: 184450
Buggy source:
public void onZoomUpdate(int zoomLevel,android.hardware.Camera camera){
  mZoomValue=(double)zoomLevel / 1000;
  mZooming=false;
}

Fixed version (ground truth):
public void onZoomUpdate(int zoomLevel,android.hardware.Camera camera){
  mZoomValue=(double)zoomLevel / 1000;
  Log.v(TAG,"String_Node_Str" + zoomLevel);
  updateZoomButtonsEnabled();
}
Program: 184451
Project: 184451
Buggy source:
private void initializeZoom(){
  String zoomState=mParameters.get(PARM_ZOOM_STATE);
  if (zoomState == null)   return;
  mZoomValue=Double.parseDouble(mParameters.get(PARM_ZOOM_TO_LEVEL));
  mZoomMax=Double.parseDouble(mParameters.get(PARM_ZOOM_MAX));
  mZoomStep=Double.parseDouble(mParameters.get(PARM_ZOOM_STEP));
  mParameters.set(PARM_ZOOM_SPEED,ZOOM_SPEED);
  mCameraDevice.setParameters(mParameters);
  mGestureDetector=new GestureDetector(this,new ZoomGestureListener());
  mCameraDevice.setZoomCallback(mZoomCallback);
  mZoomButtons=new ZoomButtonsController(mSurfaceView);
  mZoomButtons.setAutoDismissed(true);
  mZoomButtons.setZoomSpeed(100);
  mZoomButtons.setOnZoomListener(new ZoomButtonsController.OnZoomListener(){
    public void onVisibilityChanged(    boolean visible){
      if (visible) {
        updateZoomButtonsEnabled();
      }
    }
    public void onZoom(    boolean zoomIn){
      if (mZooming)       return;
      if (zoomIn) {
        if (mZoomValue < mZoomMax) {
          mZoomValue+=mZoomStep;
          zoomToLevel(ZOOM_CONTINUOUS);
        }
      }
 else {
        if (mZoomValue > ZOOM_MIN) {
          mZoomValue-=mZoomStep;
          zoomToLevel(ZOOM_CONTINUOUS);
        }
      }
      updateZoomButtonsEnabled();
    }
  }
);
}

Fixed version (ground truth):
private void initializeZoom(){
  String zoomState=mParameters.get(PARM_ZOOM_STATE);
  if (zoomState == null)   return;
  mZoomValue=Double.parseDouble(mParameters.get(PARM_ZOOM_TO_LEVEL));
  mZoomMax=Double.parseDouble(mParameters.get(PARM_ZOOM_MAX));
  mZoomStep=Double.parseDouble(mParameters.get(PARM_ZOOM_STEP));
  mParameters.set(PARM_ZOOM_SPEED,ZOOM_SPEED);
  mCameraDevice.setParameters(mParameters);
  mGestureDetector=new GestureDetector(this,new ZoomGestureListener());
  mCameraDevice.setZoomCallback(mZoomCallback);
  mZoomButtons=new ZoomButtonsController(mSurfaceView);
  mZoomButtons.setAutoDismissed(true);
  mZoomButtons.setZoomSpeed(100);
  mZoomButtons.setOnZoomListener(new ZoomButtonsController.OnZoomListener(){
    public void onVisibilityChanged(    boolean visible){
      if (visible) {
        updateZoomButtonsEnabled();
      }
    }
    public void onZoom(    boolean zoomIn){
      if (isZooming())       return;
      if (zoomIn) {
        if (mZoomValue < mZoomMax) {
          zoomToLevel(ZOOM_CONTINUOUS,mZoomValue + mZoomStep);
        }
      }
 else {
        if (mZoomValue > ZOOM_MIN) {
          zoomToLevel(ZOOM_CONTINUOUS,mZoomValue - mZoomStep);
        }
      }
    }
  }
);
}
Program: 184452
Project: 184452
Buggy source:
private void initializeSecondTime(){
  mOrientationListener.enable();
  readPreference();
  if (mRecordLocation)   startReceivingLocationUpdates();
  installIntentFilter();
  initializeFocusTone();
  checkStorage();
  if (!mIsImageCaptureIntent) {
    updateThumbnailButton();
  }
}

Fixed version (ground truth):
private void initializeSecondTime(){
  mOrientationListener.enable();
  readPreference();
  if (mRecordLocation)   startReceivingLocationUpdates();
  installIntentFilter();
  initializeFocusTone();
  checkStorage();
  if (mZoomButtons != null) {
    mZoomValue=Double.parseDouble(mParameters.get(PARM_ZOOM_TO_LEVEL));
    mCameraDevice.setZoomCallback(mZoomCallback);
  }
  if (!mIsImageCaptureIntent) {
    updateThumbnailButton();
  }
}
Program: 184453
Project: 184453
Buggy source:
private void zoomToLevel(String type){
  if (type == null) {
    Log.e(TAG,"String_Node_Str");
    return;
  }
  if (mZoomValue > mZoomMax)   mZoomValue=mZoomMax;
  if (mZoomValue < ZOOM_MIN)   mZoomValue=ZOOM_MIN;
  mParameters.set(PARM_ZOOM_STATE,ZOOM_STOP);
  mCameraDevice.setParameters(mParameters);
  mParameters.set(PARM_ZOOM_TO_LEVEL,Double.toString(mZoomValue));
  mParameters.set(PARM_ZOOM_STATE,type);
  mCameraDevice.setParameters(mParameters);
  if (ZOOM_CONTINUOUS.equals(type))   mZooming=true;
}

Fixed version (ground truth):
private void zoomToLevel(String type,double zoomValue){
  if (zoomValue > mZoomMax)   zoomValue=mZoomMax;
  if (zoomValue < ZOOM_MIN)   zoomValue=ZOOM_MIN;
  mParameters.set(PARM_ZOOM_STATE,ZOOM_STOP);
  mCameraDevice.setParameters(mParameters);
  mParameters.set(PARM_ZOOM_TO_LEVEL,Double.toString(zoomValue));
  mParameters.set(PARM_ZOOM_STATE,type);
  mCameraDevice.setParameters(mParameters);
  if (ZOOM_IMMEDIATE.equals(type))   mZoomValue=zoomValue;
}
Program: 184454
Project: 184454
Buggy source:
@Override public boolean onDoubleTap(MotionEvent e){
  if (mPausing || !isCameraIdle() || !mPreviewing|| mZoomButtons == null || mZooming) {
    return false;
  }
  if (mZoomValue < mZoomMax) {
    while (mZoomValue < mZoomMax) {
      mZoomValue+=ZOOM_STEP_MIN;
      zoomToLevel(ZOOM_IMMEDIATE);
      try {
        Thread.currentThread().sleep(5);
      }
 catch (      InterruptedException ex) {
      }
    }
  }
 else {
    while (mZoomValue > ZOOM_MIN) {
      mZoomValue-=ZOOM_STEP_MIN;
      zoomToLevel(ZOOM_IMMEDIATE);
      try {
        Thread.currentThread().sleep(5);
      }
 catch (      InterruptedException ex) {
      }
    }
  }
  updateZoomButtonsEnabled();
  return true;
}

Fixed version (ground truth):
@Override public boolean onDoubleTap(MotionEvent e){
  if (mPausing || !isCameraIdle() || !mPreviewing|| mZoomButtons == null || isZooming()) {
    return false;
  }
  if (mZoomValue < mZoomMax) {
    while (mZoomValue < mZoomMax) {
      zoomToLevel(ZOOM_IMMEDIATE,mZoomValue + ZOOM_STEP_MIN);
      try {
        Thread.currentThread().sleep(5);
      }
 catch (      InterruptedException ex) {
      }
    }
  }
 else {
    while (mZoomValue > ZOOM_MIN) {
      zoomToLevel(ZOOM_IMMEDIATE,mZoomValue - ZOOM_STEP_MIN);
      try {
        Thread.currentThread().sleep(5);
      }
 catch (      InterruptedException ex) {
      }
    }
  }
  updateZoomButtonsEnabled();
  return true;
}
Program: 184455
Project: 184455
Buggy source:
public void onZoom(boolean zoomIn){
  if (mZooming)   return;
  if (zoomIn) {
    if (mZoomValue < mZoomMax) {
      mZoomValue+=mZoomStep;
      zoomToLevel(ZOOM_CONTINUOUS);
    }
  }
 else {
    if (mZoomValue > ZOOM_MIN) {
      mZoomValue-=mZoomStep;
      zoomToLevel(ZOOM_CONTINUOUS);
    }
  }
  updateZoomButtonsEnabled();
}

Fixed version (ground truth):
public void onZoom(boolean zoomIn){
  if (isZooming())   return;
  if (zoomIn) {
    if (mZoomValue < mZoomMax) {
      zoomToLevel(ZOOM_CONTINUOUS,mZoomValue + mZoomStep);
    }
  }
 else {
    if (mZoomValue > ZOOM_MIN) {
      zoomToLevel(ZOOM_CONTINUOUS,mZoomValue - mZoomStep);
    }
  }
}
Program: 184456
Project: 184456
Buggy source:
private void closeSubMenu(){
  Util.slideOut(mSubMenu,Util.DIRECTION_RIGHT);
  Util.slideIn(mMainMenu,Util.DIRECTION_LEFT);
  ((MainMenuAdapter)mMainMenu.getAdapter()).notifyDataSetChanged();
}

Fixed version (ground truth):
private void closeSubMenu(){
  Util.slideOut(mSubMenu,Util.DIRECTION_RIGHT);
  Util.slideIn(mMainMenu,Util.DIRECTION_LEFT);
}
Program: 184457
Project: 184457
Buggy source:
public void setVisible(boolean visible){
  if (visible) {
    if (mOwnerView.getWindowToken() == null) {
      if (!mHandler.hasMessages(MSG_POST_SET_VISIBLE)) {
        mHandler.sendEmptyMessage(MSG_POST_SET_VISIBLE);
      }
      return;
    }
  }
  if (mIsVisible == visible) {
    return;
  }
  mIsVisible=visible;
  if (visible) {
    if (mContainerLayoutParams.token == null) {
      mContainerLayoutParams.token=mOwnerView.getWindowToken();
    }
    if (mPostedVisibleInitializer == null) {
      mPostedVisibleInitializer=new Runnable(){
        public void run(){
          refreshPositioningVariables();
        }
      }
;
    }
    mWindowManager.addView(mContainer,mContainerLayoutParams);
    mHandler.post(mPostedVisibleInitializer);
  }
 else {
    mSubMenu.setAdapter(null);
    mSubMenu.setVisibility(View.INVISIBLE);
    mMainMenu.setVisibility(View.VISIBLE);
    mWindowManager.removeView(mContainer);
    mHandler.removeCallbacks(mPostedVisibleInitializer);
  }
  if (mVisibilityListener != null) {
    mVisibilityListener.onVisibilityChanged(mIsVisible);
  }
}

Fixed version (ground truth):
public void setVisible(boolean visible){
  if (visible) {
    if (mOwnerView.getWindowToken() == null) {
      if (!mHandler.hasMessages(MSG_POST_SET_VISIBLE)) {
        mHandler.sendEmptyMessage(MSG_POST_SET_VISIBLE);
      }
      return;
    }
  }
  if (mIsVisible == visible) {
    return;
  }
  mIsVisible=visible;
  if (visible) {
    if (mMainAdapter != null)     mMainAdapter.notifyDataSetChanged();
    if (mContainerLayoutParams.token == null) {
      mContainerLayoutParams.token=mOwnerView.getWindowToken();
    }
    if (mPostedVisibleInitializer == null) {
      mPostedVisibleInitializer=new Runnable(){
        public void run(){
          refreshPositioningVariables();
        }
      }
;
    }
    mWindowManager.addView(mContainer,mContainerLayoutParams);
    mHandler.post(mPostedVisibleInitializer);
  }
 else {
    mSubMenu.setAdapter(null);
    mSubMenu.setVisibility(View.INVISIBLE);
    mMainMenu.setVisibility(View.VISIBLE);
    mWindowManager.removeView(mContainer);
    mHandler.removeCallbacks(mPostedVisibleInitializer);
  }
  if (mVisibilityListener != null) {
    mVisibilityListener.onVisibilityChanged(mIsVisible);
  }
}
Program: 184458
Project: 184458
Buggy source:
public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  CharSequence values[]=mPreference.getEntryValues();
  if (position <= values.length) {
    int idx=mPreference.findIndexOfValue(mPreference.getValue());
    if (idx != position - 1) {
      mPreference.setValueIndex(position - 1);
      notifyDataSetChanged();
      return;
    }
  }
  closeSubMenu();
}

Fixed version (ground truth):
public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  CharSequence values[]=mPreference.getEntryValues();
  if (position <= values.length) {
    int idx=mPreference.findIndexOfValue(mPreference.getValue());
    if (idx != position - 1) {
      mPreference.setValueIndex(position - 1);
      notifyDataSetChanged();
      mMainAdapter.notifyDataSetChanged();
      return;
    }
  }
  closeSubMenu();
}
Program: 184459
Project: 184459
Buggy source:
public void setPreferenceScreen(PreferenceScreen screen){
  ArrayList<Preference> list=new ArrayList<Preference>();
  for (int i=0, n=screen.getPreferenceCount(); i < n; ++i) {
    addPreference(screen.getPreference(i),list);
  }
  MainMenuAdapter mainAdapter=new MainMenuAdapter(mContext,list);
  mMainMenu.setAdapter(mainAdapter);
  mMainMenu.setOnItemClickListener(mainAdapter);
}

Fixed version (ground truth):
public void setPreferenceScreen(PreferenceScreen screen){
  ArrayList<Preference> list=new ArrayList<Preference>();
  for (int i=0, n=screen.getPreferenceCount(); i < n; ++i) {
    addPreference(screen.getPreference(i),list);
  }
  mMainAdapter=new MainMenuAdapter(mContext,list);
  mMainMenu.setAdapter(mMainAdapter);
  mMainMenu.setOnItemClickListener(mMainAdapter);
}
Program: 184461
Project: 184461
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  try {
    CameraHolder holder=CameraHolder.instance();
    holder.open();
    holder.keep();
    holder.release();
  }
 catch (  CameraHardwareException e) {
    return;
  }
  Intent i=new Intent(Intent.ACTION_MAIN);
  i.setClass(context,Camera.class);
  i.addCategory("String_Node_Str");
  i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  context.startActivity(i);
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  CameraHolder holder=CameraHolder.instance();
  if (holder.tryOpen() == null)   return;
  holder.keep();
  holder.release();
  Intent i=new Intent(Intent.ACTION_MAIN);
  i.setClass(context,Camera.class);
  i.addCategory("String_Node_Str");
  i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  context.startActivity(i);
}
Program: 184462
Project: 184462
Buggy source:
@Override public boolean dispatchTouchEvent(MotionEvent m){
  if (mZoomButtonsController.isVisible() && mZoomButtonsController.onTouch(null,m)) {
    scheduleDismissOnScreenControls();
  }
  if (!super.dispatchTouchEvent(m)) {
    return mGestureDetector.onTouchEvent(m);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean dispatchTouchEvent(MotionEvent m){
  if (mZoomButtonsController.isVisible()) {
    scheduleDismissOnScreenControls();
  }
  if (!super.dispatchTouchEvent(m)) {
    return mGestureDetector.onTouchEvent(m);
  }
  return true;
}
Program: 184463
Project: 184463
Buggy source:
@Override public boolean dispatchTouchEvent(MotionEvent m){
  if (mPaused)   return true;
  if (mZoomButtonsController.isVisible() && mZoomButtonsController.onTouch(null,m)) {
    scheduleDismissOnScreenControls();
  }
  if (!super.dispatchTouchEvent(m)) {
    return mGestureDetector.onTouchEvent(m);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean dispatchTouchEvent(MotionEvent m){
  if (mPaused)   return true;
  if (mZoomButtonsController.isVisible()) {
    scheduleDismissOnScreenControls();
  }
  if (!super.dispatchTouchEvent(m)) {
    return mGestureDetector.onTouchEvent(m);
  }
  return true;
}
Program: 184464
Project: 184464
Buggy source:
private void setCameraParameter(){
  mParameters=mCameraDevice.getParameters();
  mParameters.setPreviewSize(mViewFinderWidth,mViewFinderHeight);
  if (mParameters.get(Camera.SUPPORTED_PICTURE_SIZE) != null) {
    String pictureSize=mPreferences.getString(CameraSettings.KEY_PICTURE_SIZE,getString(R.string.pref_camera_picturesize_default));
    if (parameterExists(Camera.SUPPORTED_PICTURE_SIZE,pictureSize)) {
      mParameters.set(PARM_PICTURE_SIZE,pictureSize);
    }
  }
  String jpegQuality=mPreferences.getString(CameraSettings.KEY_JPEG_QUALITY,getString(R.string.pref_camera_jpegquality_default));
  mParameters.set(PARM_JPEG_QUALITY,jpegQuality);
  mCameraDevice.setParameters(mParameters);
}

Fixed version (ground truth):
private void setCameraParameter(){
  mParameters=mCameraDevice.getParameters();
  mParameters.setPreviewSize(mViewFinderWidth,mViewFinderHeight);
  if (mParameters.get(Camera.SUPPORTED_PICTURE_SIZE) != null) {
    String pictureSize=mPreferences.getString(CameraSettings.KEY_PICTURE_SIZE,getString(R.string.pref_camera_picturesize_default));
    if (parameterExists(Camera.SUPPORTED_PICTURE_SIZE,pictureSize)) {
      mParameters.set(PARM_PICTURE_SIZE,pictureSize);
    }
  }
  String jpegQuality=mPreferences.getString(CameraSettings.KEY_JPEG_QUALITY,getString(R.string.pref_camera_jpegquality_default));
  mParameters.set(PARM_JPEG_QUALITY,jpegQuality);
  if (mParameters.get(Camera.SUPPORTED_FLASH_MODE) != null) {
    String flashMode=mPreferences.getString(CameraSettings.KEY_FLASH_MODE,"String_Node_Str");
    mParameters.set(PARM_FLASH_MODE,flashMode);
  }
  mCameraDevice.setParameters(mParameters);
}
Program: 184465
Project: 184465
Buggy source:
public void setListener(ModeChangeListener listener){
  mListener=listener;
  if (listener != null) {
    mListener.onFlashModeChanged(MODE_STRINGS[mCurrentMode]);
  }
}

Fixed version (ground truth):
public void setListener(ModeChangeListener listener){
  mListener=listener;
}
Program: 184466
Project: 184466
Buggy source:
public static int computeSampleSize(BitmapFactory.Options options,int minSideLength,int maxNumOfPixels){
  double w=options.outWidth;
  double h=options.outHeight;
  int lowerBound=(maxNumOfPixels == IImage.UNCONSTRAINED) ? 1 : (int)Math.ceil(Math.sqrt(w * h / maxNumOfPixels));
  int upperBound=(minSideLength == IImage.UNCONSTRAINED) ? 128 : (int)Math.min(Math.floor(w / minSideLength),Math.floor(h / minSideLength));
  if (upperBound < lowerBound) {
    return lowerBound;
  }
  if ((maxNumOfPixels == IImage.UNCONSTRAINED) && (minSideLength == IImage.UNCONSTRAINED)) {
    return 1;
  }
 else   if (minSideLength == IImage.UNCONSTRAINED) {
    return lowerBound;
  }
 else {
    return upperBound;
  }
}

Fixed version (ground truth):
public static int computeSampleSize(BitmapFactory.Options options,int minSideLength,int maxNumOfPixels){
  int initialSize=computeInitialSampleSize(options,minSideLength,maxNumOfPixels);
  int roundedSize;
  if (initialSize <= 8) {
    roundedSize=1;
    while (roundedSize < initialSize) {
      roundedSize<<=1;
    }
  }
 else {
    roundedSize=(initialSize + 7) / 8 * 8;
  }
  return roundedSize;
}
Program: 184467
Project: 184467
Buggy source:
private Bitmap createThumbnailFromUri(Uri uri,long id){
  Bitmap bitmap=Util.makeBitmap(IImage.THUMBNAIL_TARGET_SIZE,IImage.UNCONSTRAINED,uri,mContentResolver);
  if (bitmap != null) {
    storeThumbnail(bitmap,id);
  }
 else {
    bitmap=Util.makeBitmap(IImage.MINI_THUMB_TARGET_SIZE,IImage.UNCONSTRAINED,uri,mContentResolver);
  }
  return bitmap;
}

Fixed version (ground truth):
private Bitmap createThumbnailFromUri(Uri uri,long id){
  Bitmap bitmap=Util.makeBitmap(IImage.THUMBNAIL_TARGET_SIZE,IImage.THUMBNAIL_MAX_NUM_PIXELS,uri,mContentResolver);
  if (bitmap != null) {
    storeThumbnail(bitmap,id);
  }
 else {
    bitmap=Util.makeBitmap(IImage.MINI_THUMB_TARGET_SIZE,IImage.MINI_THUMB_MAX_NUM_PIXELS,uri,mContentResolver);
  }
  return bitmap;
}
Program: 184468
Project: 184468
Buggy source:
private Bitmap createThumbnailFromEXIF(String filePath,long id){
  if (filePath == null)   return null;
  byte[] thumbData=ExifInterface.getExifThumbnail(filePath);
  if (thumbData == null)   return null;
  BitmapFactory.Options options=new BitmapFactory.Options();
  options.inJustDecodeBounds=true;
  BitmapFactory.decodeByteArray(thumbData,0,thumbData.length,options);
  int width=options.outWidth;
  int height=options.outHeight;
  if (width >= IImage.THUMBNAIL_TARGET_SIZE && height >= IImage.THUMBNAIL_TARGET_SIZE) {
    storeThumbnail(thumbData,id,width,height);
    options.inSampleSize=Util.computeSampleSize(options,IImage.MINI_THUMB_TARGET_SIZE,IImage.UNCONSTRAINED);
    options.inDither=false;
    options.inPreferredConfig=Bitmap.Config.ARGB_8888;
    options.inJustDecodeBounds=false;
    return BitmapFactory.decodeByteArray(thumbData,0,thumbData.length,options);
  }
  return null;
}

Fixed version (ground truth):
private Bitmap createThumbnailFromEXIF(String filePath,long id){
  if (filePath == null)   return null;
  byte[] thumbData=ExifInterface.getExifThumbnail(filePath);
  if (thumbData == null)   return null;
  BitmapFactory.Options options=new BitmapFactory.Options();
  options.inJustDecodeBounds=true;
  BitmapFactory.decodeByteArray(thumbData,0,thumbData.length,options);
  int width=options.outWidth;
  int height=options.outHeight;
  if (width >= IImage.THUMBNAIL_TARGET_SIZE && height >= IImage.THUMBNAIL_TARGET_SIZE) {
    storeThumbnail(thumbData,id,width,height);
    options.inSampleSize=Util.computeSampleSize(options,IImage.MINI_THUMB_TARGET_SIZE,IImage.MINI_THUMB_MAX_NUM_PIXELS);
    options.inDither=false;
    options.inPreferredConfig=Bitmap.Config.ARGB_8888;
    options.inJustDecodeBounds=false;
    return BitmapFactory.decodeByteArray(thumbData,0,thumbData.length,options);
  }
  return null;
}
Program: 184469
Project: 184469
Buggy source:
@Override public Bitmap miniThumbBitmap(){
  return fullSizeBitmap(IImage.MINI_THUMB_TARGET_SIZE,IImage.UNCONSTRAINED);
}

Fixed version (ground truth):
@Override public Bitmap miniThumbBitmap(){
  return fullSizeBitmap(IImage.MINI_THUMB_TARGET_SIZE,IImage.MINI_THUMB_MAX_NUM_PIXELS);
}
Program: 184470
Project: 184470
Buggy source:
@Override public Bitmap thumbBitmap(boolean rotateAsNeeded){
  return fullSizeBitmap(IImage.THUMBNAIL_TARGET_SIZE,IImage.UNCONSTRAINED);
}

Fixed version (ground truth):
@Override public Bitmap thumbBitmap(boolean rotateAsNeeded){
  return fullSizeBitmap(IImage.THUMBNAIL_TARGET_SIZE,IImage.THUMBNAIL_MAX_NUM_PIXELS);
}
Program: 184471
Project: 184471
Buggy source:
public Bitmap thumbBitmap(boolean rotateAsNeeded){
  Bitmap bitmap=null;
  if (mContainer.mThumbUri != null) {
    Cursor c=mContentResolver.query(mContainer.mThumbUri,THUMB_PROJECTION,Thumbnails.IMAGE_ID + "String_Node_Str",new String[]{String.valueOf(fullSizeImageId())},null);
    try {
      if (c.moveToFirst()) {
        bitmap=decodeCurrentImage(c.getLong(0));
      }
    }
 catch (    RuntimeException ex) {
      return null;
    }
 finally {
      c.close();
    }
  }
  if (bitmap == null) {
    bitmap=fullSizeBitmap(THUMBNAIL_TARGET_SIZE,IImage.UNCONSTRAINED,IImage.NO_ROTATE,IImage.NO_NATIVE);
    bitmap=mContainer.storeThumbnail(bitmap,mId);
  }
  if (bitmap != null && rotateAsNeeded) {
    bitmap=Util.rotate(bitmap,getDegreesRotated());
  }
  return bitmap;
}

Fixed version (ground truth):
public Bitmap thumbBitmap(boolean rotateAsNeeded){
  Bitmap bitmap=null;
  if (mContainer.mThumbUri != null) {
    Cursor c=mContentResolver.query(mContainer.mThumbUri,THUMB_PROJECTION,Thumbnails.IMAGE_ID + "String_Node_Str",new String[]{String.valueOf(fullSizeImageId())},null);
    try {
      if (c.moveToFirst()) {
        bitmap=decodeCurrentImage(c.getLong(0));
      }
    }
 catch (    RuntimeException ex) {
      return null;
    }
 finally {
      c.close();
    }
  }
  if (bitmap == null) {
    bitmap=fullSizeBitmap(THUMBNAIL_TARGET_SIZE,THUMBNAIL_MAX_NUM_PIXELS,NO_ROTATE,NO_NATIVE);
    bitmap=mContainer.storeThumbnail(bitmap,mId);
  }
  if (bitmap != null && rotateAsNeeded) {
    bitmap=Util.rotate(bitmap,getDegreesRotated());
  }
  return bitmap;
}
Program: 184472
Project: 184472
Buggy source:
public Bitmap thumbBitmap(boolean rotateAsNeeded){
  return fullSizeBitmap(THUMBNAIL_TARGET_SIZE,IImage.UNCONSTRAINED,rotateAsNeeded);
}

Fixed version (ground truth):
public Bitmap thumbBitmap(boolean rotateAsNeeded){
  return fullSizeBitmap(THUMBNAIL_TARGET_SIZE,THUMBNAIL_MAX_NUM_PIXELS,rotateAsNeeded);
}
Program: 184473
Project: 184473
Buggy source:
public Bitmap thumbBitmap(boolean rotateAsNeeded){
  return fullSizeBitmap(THUMBNAIL_TARGET_SIZE,UNCONSTRAINED);
}

Fixed version (ground truth):
public Bitmap thumbBitmap(boolean rotateAsNeeded){
  return fullSizeBitmap(THUMBNAIL_TARGET_SIZE,THUMBNAIL_MAX_NUM_PIXELS);
}
Program: 184474
Project: 184474
Buggy source:
private void autoFocus(){
  if (isCameraIdle() && mPreviewing) {
    Log.v(TAG,"String_Node_Str");
    if (mZoomButtons != null)     mZoomButtons.setVisible(false);
    mFocusStartTime=System.currentTimeMillis();
    mFocusState=FOCUSING;
    updateFocusIndicator();
    mCameraDevice.autoFocus(mAutoFocusCallback);
  }
}

Fixed version (ground truth):
private void autoFocus(){
  if (canTakePicture()) {
    Log.v(TAG,"String_Node_Str");
    if (mZoomButtons != null)     mZoomButtons.setVisible(false);
    mFocusStartTime=System.currentTimeMillis();
    mFocusState=FOCUSING;
    updateFocusIndicator();
    mCameraDevice.autoFocus(mAutoFocusCallback);
  }
}
Program: 184475
Project: 184475
Buggy source:
public static int computeSampleSize(BitmapFactory.Options options,int minSideLength,int maxNumOfPixels){
  double w=options.outWidth;
  double h=options.outHeight;
  int lowerBound=(maxNumOfPixels == IImage.UNCONSTRAINED) ? 1 : (int)Math.ceil(Math.sqrt(w * h / maxNumOfPixels));
  int upperBound=(minSideLength == IImage.UNCONSTRAINED) ? 128 : (int)Math.min(Math.floor(w / minSideLength),Math.floor(h / minSideLength));
  if (upperBound < lowerBound) {
    return lowerBound;
  }
  if ((maxNumOfPixels == IImage.UNCONSTRAINED) && (minSideLength == IImage.UNCONSTRAINED)) {
    return 1;
  }
 else   if (minSideLength == IImage.UNCONSTRAINED) {
    return lowerBound;
  }
 else {
    return upperBound;
  }
}

Fixed version (ground truth):
public static int computeSampleSize(BitmapFactory.Options options,int minSideLength,int maxNumOfPixels){
  int initialSize=computeInitialSampleSize(options,minSideLength,maxNumOfPixels);
  int roundedSize;
  if (initialSize <= 8) {
    roundedSize=1;
    while (roundedSize < initialSize) {
      roundedSize<<=1;
    }
  }
 else {
    roundedSize=(initialSize + 7) / 8 * 8;
  }
  return roundedSize;
}
Program: 184476
Project: 184476
Buggy source:
private Bitmap createThumbnailFromUri(Uri uri,long id){
  Bitmap bitmap=Util.makeBitmap(IImage.THUMBNAIL_TARGET_SIZE,IImage.UNCONSTRAINED,uri,mContentResolver);
  if (bitmap != null) {
    storeThumbnail(bitmap,id);
  }
 else {
    bitmap=Util.makeBitmap(IImage.MINI_THUMB_TARGET_SIZE,IImage.UNCONSTRAINED,uri,mContentResolver);
  }
  return bitmap;
}

Fixed version (ground truth):
private Bitmap createThumbnailFromUri(Uri uri,long id){
  Bitmap bitmap=Util.makeBitmap(IImage.THUMBNAIL_TARGET_SIZE,IImage.THUMBNAIL_MAX_NUM_PIXELS,uri,mContentResolver);
  if (bitmap != null) {
    storeThumbnail(bitmap,id);
  }
 else {
    bitmap=Util.makeBitmap(IImage.MINI_THUMB_TARGET_SIZE,IImage.MINI_THUMB_MAX_NUM_PIXELS,uri,mContentResolver);
  }
  return bitmap;
}
Program: 184477
Project: 184477
Buggy source:
private Bitmap createThumbnailFromEXIF(String filePath,long id){
  if (filePath == null)   return null;
  byte[] thumbData=ExifInterface.getExifThumbnail(filePath);
  if (thumbData == null)   return null;
  BitmapFactory.Options options=new BitmapFactory.Options();
  options.inJustDecodeBounds=true;
  BitmapFactory.decodeByteArray(thumbData,0,thumbData.length,options);
  int width=options.outWidth;
  int height=options.outHeight;
  if (width >= IImage.THUMBNAIL_TARGET_SIZE && height >= IImage.THUMBNAIL_TARGET_SIZE) {
    storeThumbnail(thumbData,id,width,height);
    options.inSampleSize=Util.computeSampleSize(options,IImage.MINI_THUMB_TARGET_SIZE,IImage.UNCONSTRAINED);
    options.inDither=false;
    options.inPreferredConfig=Bitmap.Config.ARGB_8888;
    options.inJustDecodeBounds=false;
    return BitmapFactory.decodeByteArray(thumbData,0,thumbData.length,options);
  }
  return null;
}

Fixed version (ground truth):
private Bitmap createThumbnailFromEXIF(String filePath,long id){
  if (filePath == null)   return null;
  byte[] thumbData=ExifInterface.getExifThumbnail(filePath);
  if (thumbData == null)   return null;
  BitmapFactory.Options options=new BitmapFactory.Options();
  options.inJustDecodeBounds=true;
  BitmapFactory.decodeByteArray(thumbData,0,thumbData.length,options);
  int width=options.outWidth;
  int height=options.outHeight;
  if (width >= IImage.THUMBNAIL_TARGET_SIZE && height >= IImage.THUMBNAIL_TARGET_SIZE) {
    storeThumbnail(thumbData,id,width,height);
    options.inSampleSize=Util.computeSampleSize(options,IImage.MINI_THUMB_TARGET_SIZE,IImage.MINI_THUMB_MAX_NUM_PIXELS);
    options.inDither=false;
    options.inPreferredConfig=Bitmap.Config.ARGB_8888;
    options.inJustDecodeBounds=false;
    return BitmapFactory.decodeByteArray(thumbData,0,thumbData.length,options);
  }
  return null;
}
Program: 184478
Project: 184478
Buggy source:
@Override public Bitmap miniThumbBitmap(){
  return fullSizeBitmap(IImage.MINI_THUMB_TARGET_SIZE,IImage.UNCONSTRAINED);
}

Fixed version (ground truth):
@Override public Bitmap miniThumbBitmap(){
  return fullSizeBitmap(IImage.MINI_THUMB_TARGET_SIZE,IImage.MINI_THUMB_MAX_NUM_PIXELS);
}
Program: 184479
Project: 184479
Buggy source:
@Override public Bitmap thumbBitmap(boolean rotateAsNeeded){
  return fullSizeBitmap(IImage.THUMBNAIL_TARGET_SIZE,IImage.UNCONSTRAINED);
}

Fixed version (ground truth):
@Override public Bitmap thumbBitmap(boolean rotateAsNeeded){
  return fullSizeBitmap(IImage.THUMBNAIL_TARGET_SIZE,IImage.THUMBNAIL_MAX_NUM_PIXELS);
}
Program: 184480
Project: 184480
Buggy source:
public Bitmap thumbBitmap(boolean rotateAsNeeded){
  Bitmap bitmap=null;
  if (mContainer.mThumbUri != null) {
    Cursor c=mContentResolver.query(mContainer.mThumbUri,THUMB_PROJECTION,Thumbnails.IMAGE_ID + "String_Node_Str",new String[]{String.valueOf(fullSizeImageId())},null);
    try {
      if (c.moveToFirst()) {
        bitmap=decodeCurrentImage(c.getLong(0));
      }
    }
 catch (    RuntimeException ex) {
      return null;
    }
 finally {
      c.close();
    }
  }
  if (bitmap == null) {
    bitmap=fullSizeBitmap(THUMBNAIL_TARGET_SIZE,IImage.UNCONSTRAINED,IImage.NO_ROTATE,IImage.NO_NATIVE);
    bitmap=mContainer.storeThumbnail(bitmap,mId);
  }
  if (bitmap != null && rotateAsNeeded) {
    bitmap=Util.rotate(bitmap,getDegreesRotated());
  }
  return bitmap;
}

Fixed version (ground truth):
public Bitmap thumbBitmap(boolean rotateAsNeeded){
  Bitmap bitmap=null;
  if (mContainer.mThumbUri != null) {
    Cursor c=mContentResolver.query(mContainer.mThumbUri,THUMB_PROJECTION,Thumbnails.IMAGE_ID + "String_Node_Str",new String[]{String.valueOf(fullSizeImageId())},null);
    try {
      if (c.moveToFirst()) {
        bitmap=decodeCurrentImage(c.getLong(0));
      }
    }
 catch (    RuntimeException ex) {
      return null;
    }
 finally {
      c.close();
    }
  }
  if (bitmap == null) {
    bitmap=fullSizeBitmap(THUMBNAIL_TARGET_SIZE,THUMBNAIL_MAX_NUM_PIXELS,NO_ROTATE,NO_NATIVE);
    bitmap=mContainer.storeThumbnail(bitmap,mId);
  }
  if (bitmap != null && rotateAsNeeded) {
    bitmap=Util.rotate(bitmap,getDegreesRotated());
  }
  return bitmap;
}
Program: 184481
Project: 184481
Buggy source:
public Bitmap thumbBitmap(boolean rotateAsNeeded){
  return fullSizeBitmap(THUMBNAIL_TARGET_SIZE,IImage.UNCONSTRAINED,rotateAsNeeded);
}

Fixed version (ground truth):
public Bitmap thumbBitmap(boolean rotateAsNeeded){
  return fullSizeBitmap(THUMBNAIL_TARGET_SIZE,THUMBNAIL_MAX_NUM_PIXELS,rotateAsNeeded);
}
Program: 184482
Project: 184482
Buggy source:
public Bitmap thumbBitmap(boolean rotateAsNeeded){
  return fullSizeBitmap(THUMBNAIL_TARGET_SIZE,UNCONSTRAINED);
}

Fixed version (ground truth):
public Bitmap thumbBitmap(boolean rotateAsNeeded){
  return fullSizeBitmap(THUMBNAIL_TARGET_SIZE,THUMBNAIL_MAX_NUM_PIXELS);
}
Program: 184483
Project: 184483
Buggy source:
@Override public boolean dispatchTouchEvent(MotionEvent m){
  boolean sup=super.dispatchTouchEvent(m);
  if (mMode == MODE_NORMAL) {
switch (m.getAction()) {
case MotionEvent.ACTION_DOWN:
      showOnScreenControls(NO_AUTO_DISMISS);
    break;
case MotionEvent.ACTION_UP:
  scheduleDismissOnScreenControls();
break;
}
}
if (sup == false) {
mGestureDetector.onTouchEvent(m);
return true;
}
return true;
}

Fixed version (ground truth):
@Override public boolean dispatchTouchEvent(MotionEvent m){
  boolean sup=super.dispatchTouchEvent(m);
  if (mMode == MODE_NORMAL && isTouchOnImage(m)) {
switch (m.getAction()) {
case MotionEvent.ACTION_DOWN:
      showOnScreenControls(NO_AUTO_DISMISS);
    break;
case MotionEvent.ACTION_UP:
  scheduleDismissOnScreenControls();
break;
}
}
if (sup == false) {
mGestureDetector.onTouchEvent(m);
return true;
}
return true;
}
Program: 184484
Project: 184484
Buggy source:
private void updateItem(Item item){
  if (item != null) {
    mAdapter.addItem(item);
    mAdapter.updateDisplay();
  }
}

Fixed version (ground truth):
private void updateItem(Item item){
  if (mAdapter.getCount() == 0) {
    hideNoImagesView();
  }
  mAdapter.addItem(item);
  mAdapter.updateDisplay();
}
Program: 184485
Project: 184485
Buggy source:
@Override public boolean onSingleTapConfirmed(MotionEvent e){
  if (!canHandleEvent())   return false;
  select(mCurrentSelection,false);
  int index=computeSelectedIndex(e.getX(),e.getY());
  if (index >= 0 && index < mCount) {
    mListener.onImageClicked(index);
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean onSingleTapConfirmed(MotionEvent e){
  if (!canHandleEvent())   return false;
  int index=computeSelectedIndex(e.getX(),e.getY());
  if (index >= 0 && index < mCount) {
    mListener.onImageTapped(index);
    return true;
  }
  return false;
}
Program: 184486
Project: 184486
Buggy source:
private void paintSelection(Canvas canvas){
  if (mCurrentSelection == SELECT_NONE)   return;
  int row=mCurrentSelection / mColumns;
  int col=mCurrentSelection - (row * mColumns);
  int spacing=mSpec.mCellSpacing;
  int leftSpacing=mSpec.mLeftEdgePadding;
  int xPos=leftSpacing + (col * (mSpec.mCellWidth + spacing));
  int yTop=spacing + (row * mBlockHeight);
  int type=OUTLINE_SELECTED;
  if (mCurrentSelectionPressed) {
    type=OUTLINE_PRESSED;
  }
  canvas.drawBitmap(mOutline[type],xPos,yTop,null);
}

Fixed version (ground truth):
private void paintSelection(Canvas canvas){
  if (mCurrentSelection == INDEX_NONE)   return;
  int row=mCurrentSelection / mColumns;
  int col=mCurrentSelection - (row * mColumns);
  int spacing=mSpec.mCellSpacing;
  int leftSpacing=mSpec.mLeftEdgePadding;
  int xPos=leftSpacing + (col * (mSpec.mCellWidth + spacing));
  int yTop=spacing + (row * mBlockHeight);
  int type=OUTLINE_SELECTED;
  if (mCurrentPressState != 0) {
    type=OUTLINE_PRESSED;
  }
  canvas.drawBitmap(mOutline[type],xPos,yTop,null);
}
Program: 184487
Project: 184487
Buggy source:
@Override public boolean onTouchEvent(MotionEvent ev){
  if (!canHandleEvent()) {
    return false;
  }
  mGestureDetector.onTouchEvent(ev);
  return true;
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(MotionEvent ev){
  if (!canHandleEvent()) {
    return false;
  }
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN:
    mCurrentPressState|=TAPPING_FLAG;
  invalidate();
break;
case MotionEvent.ACTION_UP:
mCurrentPressState&=~TAPPING_FLAG;
invalidate();
break;
}
mGestureDetector.onTouchEvent(ev);
return true;
}
Program: 184488
Project: 184488
Buggy source:
@Override public boolean onFling(MotionEvent e1,MotionEvent e2,float velocityX,float velocityY){
  if (!canHandleEvent())   return false;
  final float maxVelocity=2500;
  if (velocityY > maxVelocity) {
    velocityY=maxVelocity;
  }
 else   if (velocityY < -maxVelocity) {
    velocityY=-maxVelocity;
  }
  select(SELECT_NONE,false);
  mScroller=new Scroller(getContext());
  mScroller.fling(0,mScrollY,0,-(int)velocityY,0,0,0,mMaxScrollY);
  computeScroll();
  return true;
}

Fixed version (ground truth):
@Override public boolean onFling(MotionEvent e1,MotionEvent e2,float velocityX,float velocityY){
  if (!canHandleEvent())   return false;
  if (velocityY > MAX_FLING_VELOCITY) {
    velocityY=MAX_FLING_VELOCITY;
  }
 else   if (velocityY < -MAX_FLING_VELOCITY) {
    velocityY=-MAX_FLING_VELOCITY;
  }
  setSelectedIndex(INDEX_NONE);
  mScroller=new Scroller(getContext());
  mScroller.fling(0,mScrollY,0,-(int)velocityY,0,0,0,mMaxScrollY);
  computeScroll();
  return true;
}