Program: 38661
Project: 38661
Buggy source:
@Override public void onCreate(Bundle data,Bundle restoreState){
  mActionBar=mActivity.getGalleryActionBar();
  mSelectionManager=new SelectionManager(mActivity,false);
  mMenuExecutor=new MenuExecutor(mActivity,mSelectionManager);
  mPhotoView=new PhotoView(mActivity);
  mPhotoView.setListener(this);
  mRootPane.addComponent(mPhotoView);
  mApplication=(GalleryApp)((Activity)mActivity).getApplication();
  mOrientationManager=mActivity.getOrientationManager();
  mOrientationManager.addListener(this);
  mSetPathString=data.getString(KEY_MEDIA_SET_PATH);
  mOriginalSetPathString=mSetPathString;
  mNfcAdapter=NfcAdapter.getDefaultAdapter(mActivity.getAndroidContext());
  Path itemPath=Path.fromString(data.getString(KEY_MEDIA_ITEM_PATH));
  if (mSetPathString != null) {
    mAppBridge=(AppBridge)data.getParcelable(KEY_APP_BRIDGE);
    if (mAppBridge != null) {
      mOrientationManager.lockOrientation();
      mScreenNail=mAppBridge.attachScreenNail();
      int id=SnailSource.registerScreenNail(mScreenNail);
      Path screenNailSetPath=SnailSource.getSetPath(id);
      Path screenNailItemPath=SnailSource.getItemPath(id);
      mScreenNailItem=(MediaItem)mActivity.getDataManager().getMediaObject(screenNailItemPath);
      mSetPathString="String_Node_Str" + screenNailSetPath + "String_Node_Str"+ mSetPathString+ "String_Node_Str";
      itemPath=screenNailItemPath;
      mFlags|=FLAG_HIDE_ACTION_BAR;
      mShowBars=false;
    }
    mMediaSet=mActivity.getDataManager().getMediaSet(mSetPathString);
    mCurrentIndex=data.getInt(KEY_INDEX_HINT,0);
    if (mMediaSet == null) {
      Log.w(TAG,"String_Node_Str" + mSetPathString);
    }
    PhotoDataAdapter pda=new PhotoDataAdapter(mActivity,mPhotoView,mMediaSet,itemPath,mCurrentIndex,mAppBridge == null ? -1 : 0);
    mModel=pda;
    mPhotoView.setModel(mModel);
    pda.setDataListener(new PhotoDataAdapter.DataListener(){
      @Override public void onPhotoChanged(      int index,      Path item){
        mCurrentIndex=index;
        if (item != null) {
          MediaItem photo=mModel.getCurrentMediaItem();
          if (photo != null)           updateCurrentPhoto(photo);
        }
        updateBars();
      }
      @Override public void onLoadingFinished(){
        GalleryUtils.setSpinnerVisibility((Activity)mActivity,false);
        if (!mModel.isEmpty()) {
          MediaItem photo=mModel.getCurrentMediaItem();
          if (photo != null)           updateCurrentPhoto(photo);
        }
 else         if (mIsActive) {
          mActivity.getStateManager().finishState(PhotoPage.this);
        }
      }
      @Override public void onLoadingStarted(){
        GalleryUtils.setSpinnerVisibility((Activity)mActivity,true);
      }
    }
);
  }
 else {
    MediaItem mediaItem=(MediaItem)mActivity.getDataManager().getMediaObject(itemPath);
    mModel=new SinglePhotoDataAdapter(mActivity,mPhotoView,mediaItem);
    mPhotoView.setModel(mModel);
    updateCurrentPhoto(mediaItem);
  }
  mHandler=new SynchronizedHandler(mActivity.getGLRoot()){
    @Override public void handleMessage(    Message message){
switch (message.what) {
case MSG_HIDE_BARS:
{
          hideBars();
          break;
        }
case MSG_LOCK_ORIENTATION:
{
        mOrientationManager.lockOrientation();
        break;
      }
case MSG_UNLOCK_ORIENTATION:
{
      mOrientationManager.unlockOrientation();
      break;
    }
case MSG_ON_FULL_SCREEN_CHANGED:
{
    mAppBridge.onFullScreenChanged(message.arg1 == 1);
    break;
  }
case MSG_UPDATE_ACTION_BAR:
{
  updateBars();
  break;
}
default :
throw new AssertionError(message.what);
}
}
}
;
if (restoreState == null) {
mPhotoView.setOpenAnimationRect((Rect)data.getParcelable(KEY_OPEN_ANIMATION_RECT));
}
}

Fixed version (ground truth):
@Override public void onCreate(Bundle data,Bundle restoreState){
  mActionBar=mActivity.getGalleryActionBar();
  mSelectionManager=new SelectionManager(mActivity,false);
  mMenuExecutor=new MenuExecutor(mActivity,mSelectionManager);
  mPhotoView=new PhotoView(mActivity);
  mPhotoView.setListener(this);
  mRootPane.addComponent(mPhotoView);
  mApplication=(GalleryApp)((Activity)mActivity).getApplication();
  mOrientationManager=mActivity.getOrientationManager();
  mOrientationManager.addListener(this);
  mSetPathString=data.getString(KEY_MEDIA_SET_PATH);
  mOriginalSetPathString=mSetPathString;
  mNfcAdapter=NfcAdapter.getDefaultAdapter(mActivity.getAndroidContext());
  Path itemPath=Path.fromString(data.getString(KEY_MEDIA_ITEM_PATH));
  if (mSetPathString != null) {
    mAppBridge=(AppBridge)data.getParcelable(KEY_APP_BRIDGE);
    if (mAppBridge != null) {
      mOrientationManager.lockOrientation();
      mScreenNail=mAppBridge.attachScreenNail();
      int id=SnailSource.registerScreenNail(mScreenNail);
      Path screenNailSetPath=SnailSource.getSetPath(id);
      Path screenNailItemPath=SnailSource.getItemPath(id);
      mScreenNailItem=(MediaItem)mActivity.getDataManager().getMediaObject(screenNailItemPath);
      mSetPathString="String_Node_Str" + screenNailSetPath + "String_Node_Str"+ mSetPathString+ "String_Node_Str";
      itemPath=screenNailItemPath;
      mFlags|=FLAG_HIDE_ACTION_BAR;
      mShowBars=false;
    }
    mMediaSet=mActivity.getDataManager().getMediaSet(mSetPathString);
    mCurrentIndex=data.getInt(KEY_INDEX_HINT,0);
    if (mMediaSet == null) {
      Log.w(TAG,"String_Node_Str" + mSetPathString);
    }
    PhotoDataAdapter pda=new PhotoDataAdapter(mActivity,mPhotoView,mMediaSet,itemPath,mCurrentIndex,mAppBridge == null ? -1 : 0);
    mModel=pda;
    mPhotoView.setModel(mModel);
    pda.setDataListener(new PhotoDataAdapter.DataListener(){
      @Override public void onPhotoChanged(      int index,      Path item){
        mCurrentIndex=index;
        if (item != null) {
          MediaItem photo=mModel.getCurrentMediaItem();
          if (photo != null)           updateCurrentPhoto(photo);
        }
        updateBars();
      }
      @Override public void onLoadingFinished(){
        GalleryUtils.setSpinnerVisibility((Activity)mActivity,false);
        if (!mModel.isEmpty()) {
          MediaItem photo=mModel.getCurrentMediaItem();
          if (photo != null)           updateCurrentPhoto(photo);
        }
 else         if (mIsActive) {
          mActivity.getStateManager().finishState(PhotoPage.this);
        }
      }
      @Override public void onLoadingStarted(){
        GalleryUtils.setSpinnerVisibility((Activity)mActivity,true);
      }
    }
);
  }
 else {
    MediaItem mediaItem=(MediaItem)mActivity.getDataManager().getMediaObject(itemPath);
    mModel=new SinglePhotoDataAdapter(mActivity,mPhotoView,mediaItem);
    mPhotoView.setModel(mModel);
    updateCurrentPhoto(mediaItem);
  }
  mHandler=new SynchronizedHandler(mActivity.getGLRoot()){
    @Override public void handleMessage(    Message message){
switch (message.what) {
case MSG_HIDE_BARS:
{
          hideBars();
          break;
        }
case MSG_LOCK_ORIENTATION:
{
        mOrientationManager.lockOrientation();
        updateBars();
        break;
      }
case MSG_UNLOCK_ORIENTATION:
{
      mOrientationManager.unlockOrientation();
      updateBars();
      break;
    }
case MSG_ON_FULL_SCREEN_CHANGED:
{
    mAppBridge.onFullScreenChanged(message.arg1 == 1);
    break;
  }
case MSG_UPDATE_ACTION_BAR:
{
  updateBars();
  break;
}
default :
throw new AssertionError(message.what);
}
}
}
;
if (restoreState == null) {
mPhotoView.setOpenAnimationRect((Rect)data.getParcelable(KEY_OPEN_ANIMATION_RECT));
}
}