nus-yam/ex-repair huggingface dataset:
Program: 38607
Project: 38607
Buggy source:
private void toggleHistoryPanel(){
  final View view=findViewById(R.id.mainPanel);
  final View viewList=findViewById(R.id.historyPanel);
  View rootView=viewList.getRootView();
  final AbsoluteLayout.LayoutParams lp=(AbsoluteLayout.LayoutParams)view.getLayoutParams();
  final AbsoluteLayout.LayoutParams lph=(AbsoluteLayout.LayoutParams)viewList.getLayoutParams();
  final int positionHistoryPanel=(int)(rootView.getWidth() - viewList.getWidth());
  if (!mShowingHistoryPanel) {
    mShowingHistoryPanel=true;
    view.animate().setDuration(200).x(-viewList.getWidth()).withLayer().withEndAction(new Runnable(){
      public void run(){
        view.setLayoutParams(lp);
        lph.x=positionHistoryPanel;
        viewList.setLayoutParams(lph);
        viewList.setAlpha(0);
        viewList.setVisibility(View.VISIBLE);
        viewList.animate().setDuration(100).alpha(1.0f).start();
      }
    }
).start();
  }
 else {
    mShowingHistoryPanel=false;
    viewList.setVisibility(View.INVISIBLE);
    view.animate().setDuration(200).x(0).withLayer().withEndAction(new Runnable(){
      public void run(){
        lp.x=0;
        view.setLayoutParams(lp);
      }
    }
).start();
  }
  invalidateOptionsMenu();
}

Fixed version (ground truth):
private void toggleHistoryPanel(){
  final View view=findViewById(R.id.mainPanel);
  final View viewList=findViewById(R.id.historyPanel);
  if (mShowingImageStatePanel) {
    findViewById(R.id.imageStatePanel).setVisibility(View.INVISIBLE);
    mShowingImageStatePanel=false;
  }
  if (!mShowingHistoryPanel) {
    mShowingHistoryPanel=true;
    view.animate().setDuration(200).x(-viewList.getWidth()).withLayer().withEndAction(new Runnable(){
      public void run(){
        viewList.setAlpha(0);
        viewList.setVisibility(View.VISIBLE);
        viewList.animate().setDuration(100).alpha(1.0f).start();
      }
    }
).start();
  }
 else {
    mShowingHistoryPanel=false;
    viewList.setVisibility(View.INVISIBLE);
    view.animate().setDuration(200).x(0).withLayer().start();
  }
  invalidateOptionsMenu();
}
Program: 38608
Project: 38608
Buggy source:
private OnClickListener createOnClickShadowRecoveryButton(){
  return new View.OnClickListener(){
    @Override public void onClick(    View v){
      hideImageViews();
      mImageShow.setVisibility(View.VISIBLE);
      mImageShow.setShowControls(true);
      ImagePreset preset=mImageShow.getImagePreset();
      ImageFilter filter=preset.getFilter("String_Node_Str");
      if (filter == null) {
        ImageFilterHue contrast=new ImageFilterHue();
        ImagePreset copy=new ImagePreset(preset);
        copy.add(contrast);
        copy.setHistoryName(contrast.name());
        copy.setIsFx(false);
        filter=copy.getFilter("String_Node_Str");
        mImageShow.setImagePreset(copy);
      }
      mImageShow.setCurrentFilter(filter);
      unselectPanelButtons(mColorsPanelButtons);
      mShadowRecoveryButton.setSelected(true);
      invalidateViews();
    }
  }
;
}

Fixed version (ground truth):
private OnClickListener createOnClickShadowRecoveryButton(){
  return new View.OnClickListener(){
    @Override public void onClick(    View v){
      hideImageViews();
      mImageShow.setVisibility(View.VISIBLE);
      mImageShow.setShowControls(true);
      ImagePreset preset=mImageShow.getImagePreset();
      ImageFilter filter=preset.getFilter("String_Node_Str");
      if (filter == null) {
        ImageFilterHue contrast=new ImageFilterHue();
        ImagePreset copy=new ImagePreset(preset);
        copy.add(contrast);
        copy.setHistoryName(contrast.getName());
        copy.setIsFx(false);
        filter=copy.getFilter("String_Node_Str");
        mImageShow.setImagePreset(copy);
      }
      mImageShow.setCurrentFilter(filter);
      unselectPanelButtons(mColorsPanelButtons);
      mShadowRecoveryButton.setSelected(true);
      invalidateViews();
    }
  }
;
}
Program: 38609
Project: 38609
Buggy source:
@Override public boolean onCreateOptionsMenu(Menu menu){
  getMenuInflater().inflate(R.menu.filtershow_activity_menu,menu);
  MenuItem item=menu.findItem(R.id.operationsButton);
  if (mShowingHistoryPanel) {
    item.setTitle(R.string.hide_history_panel);
  }
 else {
    item.setTitle(R.string.show_history_panel);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onCreateOptionsMenu(Menu menu){
  getMenuInflater().inflate(R.menu.filtershow_activity_menu,menu);
  MenuItem showHistory=menu.findItem(R.id.operationsButton);
  if (mShowingHistoryPanel) {
    showHistory.setTitle(R.string.hide_history_panel);
  }
 else {
    showHistory.setTitle(R.string.show_history_panel);
  }
  MenuItem showState=menu.findItem(R.id.showImageStateButton);
  if (mShowingImageStatePanel) {
    showState.setTitle(R.string.hide_imagestate_panel);
  }
 else {
    showState.setTitle(R.string.show_imagestate_panel);
  }
  return true;
}
Program: 38610
Project: 38610
Buggy source:
@Override protected boolean onItemSelected(MenuItem item){
switch (item.getItemId()) {
case android.R.id.home:
{
      onUpPressed();
      return true;
    }
case R.id.action_cancel:
  mActivity.getStateManager().finishState(this);
return true;
case R.id.action_select:
mSelectionManager.setAutoLeaveSelectionMode(false);
mSelectionManager.enterSelectionMode();
return true;
case R.id.action_group_by:
{
mActivity.getGalleryActionBar().showClusterDialog(this);
return true;
}
case R.id.action_slideshow:
{
Bundle data=new Bundle();
data.putString(SlideshowPage.KEY_SET_PATH,mMediaSetPath.toString());
data.putBoolean(SlideshowPage.KEY_REPEAT,true);
mActivity.getStateManager().startStateForResult(SlideshowPage.class,REQUEST_SLIDESHOW,data);
return true;
}
case R.id.action_filmstrip:
{
int targetPhoto=mSlotView.getVisibleStart();
prepareAnimationBackToFilmstrip(targetPhoto);
if (mLaunchedFromPhotoPage) {
mActivity.getTransitionStore().put(PhotoPage.KEY_ALBUMPAGE_TRANSITION,PhotoPage.MSG_ALBUMPAGE_RESUMED);
onBackPressed();
}
 else {
pickPhoto(targetPhoto,true);
}
return true;
}
case R.id.action_details:
{
if (mShowDetails) {
hideDetails();
}
 else {
showDetails();
}
return true;
}
case R.id.action_camera:
{
GalleryUtils.startCameraActivity(mActivity);
return true;
}
default :
return false;
}
}

Fixed version (ground truth):
@Override protected boolean onItemSelected(MenuItem item){
switch (item.getItemId()) {
case android.R.id.home:
{
      onUpPressed();
      return true;
    }
case R.id.action_cancel:
  mActivity.getStateManager().finishState(this);
return true;
case R.id.action_select:
mSelectionManager.setAutoLeaveSelectionMode(false);
mSelectionManager.enterSelectionMode();
return true;
case R.id.action_group_by:
{
mActivity.getGalleryActionBar().showClusterDialog(this);
return true;
}
case R.id.action_slideshow:
{
Bundle data=new Bundle();
data.putString(SlideshowPage.KEY_SET_PATH,mMediaSetPath.toString());
data.putBoolean(SlideshowPage.KEY_REPEAT,true);
mActivity.getStateManager().startStateForResult(SlideshowPage.class,REQUEST_SLIDESHOW,data);
return true;
}
case R.id.action_filmstrip:
{
if (mAlbumDataAdapter.size() < 1) return true;
int targetPhoto=mSlotView.getVisibleStart();
prepareAnimationBackToFilmstrip(targetPhoto);
if (mLaunchedFromPhotoPage) {
mActivity.getTransitionStore().put(PhotoPage.KEY_ALBUMPAGE_TRANSITION,PhotoPage.MSG_ALBUMPAGE_RESUMED);
onBackPressed();
}
 else {
pickPhoto(targetPhoto,true);
}
return true;
}
case R.id.action_details:
{
if (mShowDetails) {
hideDetails();
}
 else {
showDetails();
}
return true;
}
case R.id.action_camera:
{
GalleryUtils.startCameraActivity(mActivity);
return true;
}
default :
return false;
}
}
Program: 38612
Project: 38612
Buggy source:
public FilterDeleteSet(Path path,MediaSet baseSet){
  super(path,INVALID_DATA_VERSION);
  mBaseSet=baseSet;
  mBaseSet.addContentListener(this);
}

Fixed version (ground truth):
public FilterDeleteSet(Path path,MediaSet baseSet){
  super(path,INVALID_DATA_VERSION);
  mBaseSet=baseSet;
  mBaseSet.addContentListener(this);
  mMediaItemCount=mBaseSet.getMediaItemCount() - mCurrent.size();
}
Program: 38613
Project: 38613
Buggy source:
@Override protected boolean onItemSelected(MenuItem item){
switch (item.getItemId()) {
case android.R.id.home:
{
      onUpPressed();
      return true;
    }
case R.id.action_cancel:
  mActivity.getStateManager().finishState(this);
return true;
case R.id.action_select:
mSelectionManager.setAutoLeaveSelectionMode(false);
mSelectionManager.enterSelectionMode();
return true;
case R.id.action_group_by:
{
mActivity.getGalleryActionBar().showClusterDialog(this);
return true;
}
case R.id.action_slideshow:
{
Bundle data=new Bundle();
data.putString(SlideshowPage.KEY_SET_PATH,mMediaSetPath.toString());
data.putBoolean(SlideshowPage.KEY_REPEAT,true);
mActivity.getStateManager().startStateForResult(SlideshowPage.class,REQUEST_SLIDESHOW,data);
return true;
}
case R.id.action_filmstrip:
{
int targetPhoto=mSlotView.getVisibleStart();
prepareAnimationBackToFilmstrip(targetPhoto);
if (mLaunchedFromPhotoPage) {
mActivity.getTransitionStore().put(PhotoPage.KEY_ALBUMPAGE_TRANSITION,PhotoPage.MSG_ALBUMPAGE_RESUMED);
onBackPressed();
}
 else {
pickPhoto(targetPhoto,true);
}
return true;
}
case R.id.action_details:
{
if (mShowDetails) {
hideDetails();
}
 else {
showDetails();
}
return true;
}
case R.id.action_camera:
{
GalleryUtils.startCameraActivity(mActivity);
return true;
}
default :
return false;
}
}

Fixed version (ground truth):
@Override protected boolean onItemSelected(MenuItem item){
switch (item.getItemId()) {
case android.R.id.home:
{
      onUpPressed();
      return true;
    }
case R.id.action_cancel:
  mActivity.getStateManager().finishState(this);
return true;
case R.id.action_select:
mSelectionManager.setAutoLeaveSelectionMode(false);
mSelectionManager.enterSelectionMode();
return true;
case R.id.action_group_by:
{
mActivity.getGalleryActionBar().showClusterDialog(this);
return true;
}
case R.id.action_slideshow:
{
Bundle data=new Bundle();
data.putString(SlideshowPage.KEY_SET_PATH,mMediaSetPath.toString());
data.putBoolean(SlideshowPage.KEY_REPEAT,true);
mActivity.getStateManager().startStateForResult(SlideshowPage.class,REQUEST_SLIDESHOW,data);
return true;
}
case R.id.action_filmstrip:
{
if (mAlbumDataAdapter.size() < 1) return true;
int targetPhoto=mSlotView.getVisibleStart();
prepareAnimationBackToFilmstrip(targetPhoto);
if (mLaunchedFromPhotoPage) {
mActivity.getTransitionStore().put(PhotoPage.KEY_ALBUMPAGE_TRANSITION,PhotoPage.MSG_ALBUMPAGE_RESUMED);
onBackPressed();
}
 else {
pickPhoto(targetPhoto,true);
}
return true;
}
case R.id.action_details:
{
if (mShowDetails) {
hideDetails();
}
 else {
showDetails();
}
return true;
}
case R.id.action_camera:
{
GalleryUtils.startCameraActivity(mActivity);
return true;
}
default :
return false;
}
}
Program: 38615
Project: 38615
Buggy source:
public FilterDeleteSet(Path path,MediaSet baseSet){
  super(path,INVALID_DATA_VERSION);
  mBaseSet=baseSet;
  mBaseSet.addContentListener(this);
}

Fixed version (ground truth):
public FilterDeleteSet(Path path,MediaSet baseSet){
  super(path,INVALID_DATA_VERSION);
  mBaseSet=baseSet;
  mBaseSet.addContentListener(this);
  mMediaItemCount=mBaseSet.getMediaItemCount() - mCurrent.size();
}
Program: 38616
Project: 38616
Buggy source:
private void prepareAnimationBackToFilmstrip(int slotIndex){
  prepareFadeOutTexture();
  TransitionStore transitions=mActivity.getTransitionStore();
  transitions.put(PhotoPage.KEY_INDEX_HINT,slotIndex);
  transitions.put(PhotoPage.KEY_MEDIA_ITEM_PATH,mAlbumDataAdapter.get(slotIndex).getPath());
  transitions.put(PhotoPage.KEY_OPEN_ANIMATION_RECT,getSlotRect(slotIndex));
}

Fixed version (ground truth):
private void prepareAnimationBackToFilmstrip(int slotIndex){
  if (!mAlbumDataAdapter.isActive(slotIndex))   return;
  prepareFadeOutTexture();
  TransitionStore transitions=mActivity.getTransitionStore();
  transitions.put(PhotoPage.KEY_INDEX_HINT,slotIndex);
  transitions.put(PhotoPage.KEY_MEDIA_ITEM_PATH,mAlbumDataAdapter.get(slotIndex).getPath());
  transitions.put(PhotoPage.KEY_OPEN_ANIMATION_RECT,getSlotRect(slotIndex));
}
Program: 38617
Project: 38617
Buggy source:
private void prepareAnimationBackToFilmstrip(int slotIndex){
  if (!mAlbumDataAdapter.isActive(slotIndex))   return;
  prepareFadeOutTexture();
  TransitionStore transitions=mActivity.getTransitionStore();
  transitions.put(PhotoPage.KEY_INDEX_HINT,slotIndex);
  transitions.put(PhotoPage.KEY_MEDIA_ITEM_PATH,mAlbumDataAdapter.get(slotIndex).getPath());
  transitions.put(PhotoPage.KEY_OPEN_ANIMATION_RECT,getSlotRect(slotIndex));
}

Fixed version (ground truth):
private void prepareAnimationBackToFilmstrip(int slotIndex){
  if (mAlbumDataAdapter == null || !mAlbumDataAdapter.isActive(slotIndex))   return;
  prepareFadeOutTexture();
  TransitionStore transitions=mActivity.getTransitionStore();
  transitions.put(PhotoPage.KEY_INDEX_HINT,slotIndex);
  transitions.put(PhotoPage.KEY_MEDIA_ITEM_PATH,mAlbumDataAdapter.get(slotIndex).getPath());
  transitions.put(PhotoPage.KEY_OPEN_ANIMATION_RECT,getSlotRect(slotIndex));
}
Program: 38618
Project: 38618
Buggy source:
@Override protected void onResume(){
  super.onResume();
  transitionFromAlbumPageIfNeeded();
  mActivity.getGLRoot().freeze();
  mIsActive=true;
  setContentPane(mRootPane);
  mModel.resume();
  mPhotoView.resume();
  mActionBar.setDisplayOptions(((mSecureAlbum == null) && (mSetPathString != null)),true);
  mActionBar.addOnMenuVisibilityListener(mMenuVisibilityListener);
  if (mAppBridge != null && !mHasActivityResult) {
    mPhotoView.resetToFirstPicture();
  }
  mHasActivityResult=false;
  mHandler.sendEmptyMessageDelayed(MSG_UNFREEZE_GLROOT,UNFREEZE_GLROOT_TIMEOUT);
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  if (mModel == null) {
    mActivity.getStateManager().finishState(this);
    return;
  }
  transitionFromAlbumPageIfNeeded();
  mActivity.getGLRoot().freeze();
  mIsActive=true;
  setContentPane(mRootPane);
  mModel.resume();
  mPhotoView.resume();
  mActionBar.setDisplayOptions(((mSecureAlbum == null) && (mSetPathString != null)),true);
  mActionBar.addOnMenuVisibilityListener(mMenuVisibilityListener);
  if (mAppBridge != null && !mHasActivityResult) {
    mPhotoView.resetToFirstPicture();
  }
  mHasActivityResult=false;
  mHandler.sendEmptyMessageDelayed(MSG_UNFREEZE_GLROOT,UNFREEZE_GLROOT_TIMEOUT);
}
Program: 38619
Project: 38619
Buggy source:
@Override public void onPause(){
  super.onPause();
  mIsActive=false;
  mActivity.getGLRoot().unfreeze();
  mHandler.removeMessages(MSG_UNFREEZE_GLROOT);
  if (isFinishing())   preparePhotoFallbackView();
  DetailsHelper.pause();
  mPhotoView.pause();
  mModel.pause();
  mHandler.removeMessages(MSG_HIDE_BARS);
  mActionBar.removeOnMenuVisibilityListener(mMenuVisibilityListener);
  onCommitDeleteImage();
  mMenuExecutor.pause();
  if (mMediaSet != null)   mMediaSet.clearDeletion();
}

Fixed version (ground truth):
@Override public void onPause(){
  super.onPause();
  mIsActive=false;
  mActivity.getGLRoot().unfreeze();
  mHandler.removeMessages(MSG_UNFREEZE_GLROOT);
  DetailsHelper.pause();
  if (mModel != null) {
    if (isFinishing())     preparePhotoFallbackView();
    mModel.pause();
  }
  mPhotoView.pause();
  mHandler.removeMessages(MSG_HIDE_BARS);
  mActionBar.removeOnMenuVisibilityListener(mMenuVisibilityListener);
  onCommitDeleteImage();
  mMenuExecutor.pause();
  if (mMediaSet != null)   mMediaSet.clearDeletion();
}
Program: 38622
Project: 38622
Buggy source:
private void prepareAnimationBackToFilmstrip(int slotIndex){
  prepareFadeOutTexture();
  TransitionStore transitions=mActivity.getTransitionStore();
  transitions.put(PhotoPage.KEY_INDEX_HINT,slotIndex);
  transitions.put(PhotoPage.KEY_MEDIA_ITEM_PATH,mAlbumDataAdapter.get(slotIndex).getPath());
  transitions.put(PhotoPage.KEY_OPEN_ANIMATION_RECT,getSlotRect(slotIndex));
}

Fixed version (ground truth):
private void prepareAnimationBackToFilmstrip(int slotIndex){
  if (!mAlbumDataAdapter.isActive(slotIndex))   return;
  prepareFadeOutTexture();
  TransitionStore transitions=mActivity.getTransitionStore();
  transitions.put(PhotoPage.KEY_INDEX_HINT,slotIndex);
  transitions.put(PhotoPage.KEY_MEDIA_ITEM_PATH,mAlbumDataAdapter.get(slotIndex).getPath());
  transitions.put(PhotoPage.KEY_OPEN_ANIMATION_RECT,getSlotRect(slotIndex));
}
Program: 38623
Project: 38623
Buggy source:
public <T>T get(Object key,T valueIfNull){
  T value=get(key);
  return value == null ? valueIfNull : value;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public <T>T get(Object key,T valueIfNull){
  T value=(T)mStorage.get(key);
  return value == null ? valueIfNull : value;
}
Program: 38624
Project: 38624
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_ACTION_BAR);
  requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
  setContentView(R.layout.movie_view);
  View rootView=findViewById(R.id.movie_view_root);
  setSystemUiVisibility(rootView);
  Intent intent=getIntent();
  initializeActionBar(intent);
  mFinishOnCompletion=intent.getBooleanExtra(MediaStore.EXTRA_FINISH_ON_COMPLETION,true);
  mTreatUpAsBack=intent.getBooleanExtra(KEY_TREAT_UP_AS_BACK,false);
  mPlayer=new MoviePlayer(rootView,this,intent.getData(),savedInstanceState,!mFinishOnCompletion){
    @Override public void onCompletion(){
      if (mFinishOnCompletion) {
        finish();
      }
    }
  }
;
  if (intent.hasExtra(MediaStore.EXTRA_SCREEN_ORIENTATION)) {
    int orientation=intent.getIntExtra(MediaStore.EXTRA_SCREEN_ORIENTATION,ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    if (orientation != getRequestedOrientation()) {
      setRequestedOrientation(orientation);
    }
  }
  Window win=getWindow();
  WindowManager.LayoutParams winParams=win.getAttributes();
  winParams.buttonBrightness=WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_OFF;
  winParams.flags|=WindowManager.LayoutParams.FLAG_FULLSCREEN;
  win.setAttributes(winParams);
  win.setBackgroundDrawable(null);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getSherlock().requestFeature(Window.FEATURE_ACTION_BAR);
  getSherlock().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
  setContentView(R.layout.movie_view);
  View rootView=findViewById(R.id.movie_view_root);
  setSystemUiVisibility(rootView);
  Intent intent=getIntent();
  initializeActionBar(intent);
  mFinishOnCompletion=intent.getBooleanExtra(MediaStore.EXTRA_FINISH_ON_COMPLETION,true);
  mTreatUpAsBack=intent.getBooleanExtra(KEY_TREAT_UP_AS_BACK,false);
  mPlayer=new MoviePlayer(rootView,this,intent.getData(),savedInstanceState,!mFinishOnCompletion){
    @Override public void onCompletion(){
      if (mFinishOnCompletion) {
        finish();
      }
    }
  }
;
  if (intent.hasExtra(MediaStore.EXTRA_SCREEN_ORIENTATION)) {
    int orientation=intent.getIntExtra(MediaStore.EXTRA_SCREEN_ORIENTATION,ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    if (orientation != getRequestedOrientation()) {
      setRequestedOrientation(orientation);
    }
  }
  Window win=getWindow();
  WindowManager.LayoutParams winParams=win.getAttributes();
  winParams.buttonBrightness=WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_OFF;
  winParams.flags|=WindowManager.LayoutParams.FLAG_FULLSCREEN;
  win.setAttributes(winParams);
  win.setBackgroundDrawable(null);
}
Program: 38625
Project: 38625
Buggy source:
private PopupWindow createPopupWindow(){
  PopupWindow popup=new PopupWindow(mContext);
  popup.setOnDismissListener(mOnDismissListener);
  popup.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.menu_dropdown_panel_holo_dark));
  mContentList=new ListView(mContext);
  mContentList.setAdapter(new ItemDataAdapter());
  mContentList.setOnItemClickListener(mOnItemClickListener);
  popup.setContentView(mContentList);
  popup.setFocusable(true);
  popup.setOutsideTouchable(true);
  return popup;
}

Fixed version (ground truth):
private PopupWindow createPopupWindow(){
  PopupWindow popup=new PopupWindow(mContext);
  popup.setOnDismissListener(mOnDismissListener);
  popup.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.menu_dropdown_panel_holo_dark));
  mContentList=new ListView(mContext,null,com.actionbarsherlock.R.attr.dropDownListViewStyle);
  mContentList.setAdapter(new ItemDataAdapter());
  mContentList.setOnItemClickListener(mOnItemClickListener);
  popup.setContentView(mContentList);
  popup.setFocusable(true);
  popup.setOutsideTouchable(true);
  return popup;
}
Program: 38626
Project: 38626
Buggy source:
@Override public void setHomeButtonEnabled(boolean enabled){
  mActionBar.setHomeButtonEnabled(enabled);
}

Fixed version (ground truth):
@Override @TargetApi(ApiHelper.VERSION_CODES.ICE_CREAM_SANDWICH) public void setHomeButtonEnabled(boolean enabled){
  if (ApiHelper.HAS_ACTION_BAR_SET_HOME_BUTTON_ENABLED) {
    mActionBar.setHomeButtonEnabled(enabled);
  }
}
Program: 38627
Project: 38627
Buggy source:
@Override public void setLogo(Drawable logo){
  mActionBar.setLogo(logo);
}

Fixed version (ground truth):
@Override @TargetApi(ApiHelper.VERSION_CODES.ICE_CREAM_SANDWICH) public void setLogo(Drawable logo){
  if (ApiHelper.HAS_ACTION_BAR_SET_LOGO) {
    mActionBar.setLogo(logo);
  }
}
Program: 38628
Project: 38628
Buggy source:
@Override public void setShareIntent(Intent intent){
  if (mShareMenuItem != null) {
    mShareMenuItem.setEnabled(intent != null);
  }
  if (mShareActionProvider != null) {
    mShareActionProvider.setShareIntent(intent);
  }
}

Fixed version (ground truth):
@Override @TargetApi(ApiHelper.VERSION_CODES.ICE_CREAM_SANDWICH) public void setShareIntent(Intent intent){
  if (mShareMenuItem != null) {
    mShareMenuItem.setEnabled(intent != null);
    if (ApiHelper.HAS_SHARE_ACTION_PROVIDER) {
      mShareActionProvider.get().setShareIntent(intent);
    }
  }
}
Program: 38629
Project: 38629
Buggy source:
public SystemActionBarWrapper(Activity activity){
  mActivity=activity;
  mActionBar=activity.getActionBar();
}

Fixed version (ground truth):
@TargetApi(ApiHelper.VERSION_CODES.ICE_CREAM_SANDWICH) public SystemActionBarWrapper(Activity activity){
  mActivity=activity;
  mActionBar=activity.getActionBar();
  if (ApiHelper.HAS_SHARE_ACTION_PROVIDER) {
    mShareActionProvider.set(new ShareActionProvider(activity));
  }
}
Program: 38630
Project: 38630
Buggy source:
@Override public boolean createActionMenu(Menu menu,int menuRes){
  mActivity.getMenuInflater().inflate(menuRes,menu);
  mMenu=menu;
  mShareMenuItem=menu.findItem(R.id.action_share);
  if (mShareMenuItem != null) {
    mShareActionProvider=new ShareActionProvider(mActivity);
    mShareMenuItem.setActionProvider(mShareActionProvider);
  }
  return true;
}

Fixed version (ground truth):
@Override @TargetApi(ApiHelper.VERSION_CODES.ICE_CREAM_SANDWICH) public boolean createActionMenu(Menu menu,int menuRes){
  mActivity.getMenuInflater().inflate(menuRes,menu);
  mMenu=menu;
  mShareMenuItem=menu.findItem(R.id.action_share);
  if (mShareMenuItem != null && ApiHelper.HAS_SHARE_ACTION_PROVIDER) {
    mShareMenuItem.setActionProvider(mShareActionProvider.get());
  }
  return true;
}
Program: 38631
Project: 38631
Buggy source:
@Override public void inflateMenu(int menuRes){
  Utils.assertTrue(mMenu != null);
  mActionMode.getMenuInflater().inflate(menuRes,mMenu);
  mShareMenuItem=mMenu.findItem(R.id.action_share);
  if (mShareMenuItem != null) {
    mShareMenuItem.setActionProvider(mShareActionProvider);
  }
}

Fixed version (ground truth):
@Override @TargetApi(ApiHelper.VERSION_CODES.ICE_CREAM_SANDWICH) public void inflateMenu(int menuRes){
  Utils.assertTrue(mMenu != null);
  mActionMode.getMenuInflater().inflate(menuRes,mMenu);
  mShareMenuItem=mMenu.findItem(R.id.action_share);
  if (mShareMenuItem != null && ApiHelper.HAS_SHARE_ACTION_PROVIDER) {
    mShareMenuItem.setActionProvider(mShareActionProvider.get());
  }
}
Program: 38632
Project: 38632
Buggy source:
@Override public void setOnShareTargetSelectedListener(final OnShareTargetSelectedListener listener){
  mShareActionProvider.setOnShareTargetSelectedListener(new ShareActionProvider.OnShareTargetSelectedListener(){
    @Override public boolean onShareTargetSelected(    ShareActionProvider source,    Intent intent){
      return listener.onShareTargetSelected(intent);
    }
  }
);
}

Fixed version (ground truth):
@Override @TargetApi(ApiHelper.VERSION_CODES.ICE_CREAM_SANDWICH) public void setOnShareTargetSelectedListener(final OnShareTargetSelectedListener listener){
  if (mShareActionProvider.get() == null)   return;
  mShareActionProvider.get().setOnShareTargetSelectedListener(new ShareActionProvider.OnShareTargetSelectedListener(){
    @Override public boolean onShareTargetSelected(    ShareActionProvider source,    Intent intent){
      return listener.onShareTargetSelected(intent);
    }
  }
);
}
Program: 38633
Project: 38633
Buggy source:
public SystemActionModeWrapper(Activity activity,ActionModeInterface.Callback callback){
  mShareActionProvider=new ShareActionProvider(activity);
  activity.startActionMode(new CallbackWrapper(callback));
}

Fixed version (ground truth):
@TargetApi(ApiHelper.VERSION_CODES.ICE_CREAM_SANDWICH) public SystemActionModeWrapper(Activity activity,ActionModeInterface.Callback callback){
  if (ApiHelper.HAS_SHARE_ACTION_PROVIDER) {
    mShareActionProvider.set(new ShareActionProvider(activity));
  }
  activity.startActionMode(new CallbackWrapper(callback));
}
Program: 38634
Project: 38634
Buggy source:
@Override public void setShareIntent(Intent shareIntent){
  if (mShareMenuItem != null) {
    mShareMenuItem.setEnabled(shareIntent != null);
    mShareActionProvider.setShareIntent(shareIntent);
  }
}

Fixed version (ground truth):
@Override @TargetApi(ApiHelper.VERSION_CODES.ICE_CREAM_SANDWICH) public void setShareIntent(Intent shareIntent){
  if (mShareMenuItem != null) {
    mShareMenuItem.setEnabled(shareIntent != null);
    if (ApiHelper.HAS_SHARE_ACTION_PROVIDER) {
      mShareActionProvider.get().setShareIntent(shareIntent);
    }
  }
}
Program: 38635
Project: 38635
Buggy source:
public void updateSupportedOperation(){
  if (mMenuTask != null) {
    mMenuTask.cancel();
  }
  updateSelectionMenu();
  final boolean hasShareButton=mActionMode.hasShareButton();
  if (hasShareButton)   mActionMode.setShareIntent(null);
  mMenuTask=mActivity.getThreadPool().submit(new Job<Void>(){
    @Override public Void run(    final JobContext jc){
      final int operation=computeMenuOptions(jc);
      final Intent intent=hasShareButton ? computeSharingIntent(jc) : null;
      mMainHandler.post(new Runnable(){
        @Override public void run(){
          mMenuTask=null;
          if (!jc.isCancelled()) {
            MenuExecutor.updateMenuOperation(mActionMode,operation);
            if (hasShareButton) {
              mActionMode.setShareIntent(intent);
            }
          }
        }
      }
);
      return null;
    }
  }
);
}

Fixed version (ground truth):
public void updateSupportedOperation(){
  if (mMenuTask != null) {
    mMenuTask.cancel();
  }
  updateSelectionMenu();
  final boolean hasShareButton=mActionMode.hasShareButton();
  if (hasShareButton)   mActionMode.setShareIntent(null);
  mMenuTask=mActivity.getThreadPool().submit(new Job<Void>(){
    @Override public Void run(    final JobContext jc){
      final int operation=computeMenuOptions(jc);
      final Intent intent=hasShareButton ? computeSharingIntent(jc) : null;
      mMainHandler.post(new Runnable(){
        @Override public void run(){
          mMenuTask=null;
          if (!jc.isCancelled()) {
            MenuExecutor.updateMenuOperation(mActionMode,operation);
            if (hasShareButton) {
              mActionMode.setShareIntent(intent);
              mMenuExecutor.setShareIntent(intent);
            }
          }
        }
      }
);
      return null;
    }
  }
);
}
Program: 38636
Project: 38636
Buggy source:
@Override public void run(){
  mMenuTask=null;
  if (!jc.isCancelled()) {
    MenuExecutor.updateMenuOperation(mActionMode,operation);
    if (hasShareButton) {
      mActionMode.setShareIntent(intent);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  mMenuTask=null;
  if (!jc.isCancelled()) {
    MenuExecutor.updateMenuOperation(mActionMode,operation);
    if (hasShareButton) {
      mActionMode.setShareIntent(intent);
      mMenuExecutor.setShareIntent(intent);
    }
  }
}
Program: 38637
Project: 38637
Buggy source:
@Override public void setHomeButtonEnabled(boolean enabled){
  mActionBar.setHomeButtonEnabled(enabled);
}

Fixed version (ground truth):
@Override @TargetApi(ApiHelper.VERSION_CODES.ICE_CREAM_SANDWICH) public void setHomeButtonEnabled(boolean enabled){
  if (ApiHelper.HAS_ACTION_BAR_SET_HOME_BUTTON_ENABLED) {
    mActionBar.setHomeButtonEnabled(enabled);
  }
}
Program: 38638
Project: 38638
Buggy source:
@Override public void setLogo(Drawable logo){
  mActionBar.setLogo(logo);
}

Fixed version (ground truth):
@Override @TargetApi(ApiHelper.VERSION_CODES.ICE_CREAM_SANDWICH) public void setLogo(Drawable logo){
  if (ApiHelper.HAS_ACTION_BAR_SET_LOGO) {
    mActionBar.setLogo(logo);
  }
}
Program: 38639
Project: 38639
Buggy source:
@Override public void setShareIntent(Intent intent){
  if (mShareMenuItem != null) {
    mShareMenuItem.setEnabled(intent != null);
  }
  if (mShareActionProvider != null) {
    mShareActionProvider.setShareIntent(intent);
  }
}

Fixed version (ground truth):
@Override @TargetApi(ApiHelper.VERSION_CODES.ICE_CREAM_SANDWICH) public void setShareIntent(Intent intent){
  if (mShareMenuItem != null) {
    mShareMenuItem.setEnabled(intent != null);
    if (ApiHelper.HAS_SHARE_ACTION_PROVIDER) {
      mShareActionProvider.get().setShareIntent(intent);
    }
  }
}
Program: 38640
Project: 38640
Buggy source:
public SystemActionBarWrapper(Activity activity){
  mActivity=activity;
  mActionBar=activity.getActionBar();
}

Fixed version (ground truth):
@TargetApi(ApiHelper.VERSION_CODES.ICE_CREAM_SANDWICH) public SystemActionBarWrapper(Activity activity){
  mActivity=activity;
  mActionBar=activity.getActionBar();
  if (ApiHelper.HAS_SHARE_ACTION_PROVIDER) {
    mShareActionProvider.set(new ShareActionProvider(activity));
  }
}
Program: 38641
Project: 38641
Buggy source:
@Override public boolean createActionMenu(Menu menu,int menuRes){
  mActivity.getMenuInflater().inflate(menuRes,menu);
  mMenu=menu;
  mShareMenuItem=menu.findItem(R.id.action_share);
  if (mShareMenuItem != null) {
    mShareActionProvider=new ShareActionProvider(mActivity);
    mShareMenuItem.setActionProvider(mShareActionProvider);
  }
  return true;
}

Fixed version (ground truth):
@Override @TargetApi(ApiHelper.VERSION_CODES.ICE_CREAM_SANDWICH) public boolean createActionMenu(Menu menu,int menuRes){
  mActivity.getMenuInflater().inflate(menuRes,menu);
  mMenu=menu;
  mShareMenuItem=menu.findItem(R.id.action_share);
  if (mShareMenuItem != null && ApiHelper.HAS_SHARE_ACTION_PROVIDER) {
    mShareMenuItem.setActionProvider(mShareActionProvider.get());
  }
  return true;
}
Program: 38642
Project: 38642
Buggy source:
@Override public void inflateMenu(int menuRes){
  Utils.assertTrue(mMenu != null);
  mActionMode.getMenuInflater().inflate(menuRes,mMenu);
  mShareMenuItem=mMenu.findItem(R.id.action_share);
  if (mShareMenuItem != null) {
    mShareMenuItem.setActionProvider(mShareActionProvider);
  }
}

Fixed version (ground truth):
@Override @TargetApi(ApiHelper.VERSION_CODES.ICE_CREAM_SANDWICH) public void inflateMenu(int menuRes){
  Utils.assertTrue(mMenu != null);
  mActionMode.getMenuInflater().inflate(menuRes,mMenu);
  mShareMenuItem=mMenu.findItem(R.id.action_share);
  if (mShareMenuItem != null && ApiHelper.HAS_SHARE_ACTION_PROVIDER) {
    mShareMenuItem.setActionProvider(mShareActionProvider.get());
  }
}
Program: 38643
Project: 38643
Buggy source:
@Override public void setOnShareTargetSelectedListener(final OnShareTargetSelectedListener listener){
  mShareActionProvider.setOnShareTargetSelectedListener(new ShareActionProvider.OnShareTargetSelectedListener(){
    @Override public boolean onShareTargetSelected(    ShareActionProvider source,    Intent intent){
      return listener.onShareTargetSelected(intent);
    }
  }
);
}

Fixed version (ground truth):
@Override @TargetApi(ApiHelper.VERSION_CODES.ICE_CREAM_SANDWICH) public void setOnShareTargetSelectedListener(final OnShareTargetSelectedListener listener){
  if (mShareActionProvider.get() == null)   return;
  mShareActionProvider.get().setOnShareTargetSelectedListener(new ShareActionProvider.OnShareTargetSelectedListener(){
    @Override public boolean onShareTargetSelected(    ShareActionProvider source,    Intent intent){
      return listener.onShareTargetSelected(intent);
    }
  }
);
}
Program: 38644
Project: 38644
Buggy source:
public SystemActionModeWrapper(Activity activity,ActionModeInterface.Callback callback){
  mShareActionProvider=new ShareActionProvider(activity);
  activity.startActionMode(new CallbackWrapper(callback));
}

Fixed version (ground truth):
@TargetApi(ApiHelper.VERSION_CODES.ICE_CREAM_SANDWICH) public SystemActionModeWrapper(Activity activity,ActionModeInterface.Callback callback){
  if (ApiHelper.HAS_SHARE_ACTION_PROVIDER) {
    mShareActionProvider.set(new ShareActionProvider(activity));
  }
  activity.startActionMode(new CallbackWrapper(callback));
}
Program: 38645
Project: 38645
Buggy source:
@Override public void setShareIntent(Intent shareIntent){
  if (mShareMenuItem != null) {
    mShareMenuItem.setEnabled(shareIntent != null);
    mShareActionProvider.setShareIntent(shareIntent);
  }
}

Fixed version (ground truth):
@Override @TargetApi(ApiHelper.VERSION_CODES.ICE_CREAM_SANDWICH) public void setShareIntent(Intent shareIntent){
  if (mShareMenuItem != null) {
    mShareMenuItem.setEnabled(shareIntent != null);
    if (ApiHelper.HAS_SHARE_ACTION_PROVIDER) {
      mShareActionProvider.get().setShareIntent(shareIntent);
    }
  }
}
Program: 38646
Project: 38646
Buggy source:
public void updateSupportedOperation(){
  if (mMenuTask != null) {
    mMenuTask.cancel();
  }
  updateSelectionMenu();
  final boolean hasShareButton=mActionMode.hasShareButton();
  if (hasShareButton)   mActionMode.setShareIntent(null);
  mMenuTask=mActivity.getThreadPool().submit(new Job<Void>(){
    @Override public Void run(    final JobContext jc){
      final int operation=computeMenuOptions(jc);
      final Intent intent=hasShareButton ? computeSharingIntent(jc) : null;
      mMainHandler.post(new Runnable(){
        @Override public void run(){
          mMenuTask=null;
          if (!jc.isCancelled()) {
            MenuExecutor.updateMenuOperation(mActionMode,operation);
            if (hasShareButton) {
              mActionMode.setShareIntent(intent);
            }
          }
        }
      }
);
      return null;
    }
  }
);
}

Fixed version (ground truth):
public void updateSupportedOperation(){
  if (mMenuTask != null) {
    mMenuTask.cancel();
  }
  updateSelectionMenu();
  final boolean hasShareButton=mActionMode.hasShareButton();
  if (hasShareButton)   mActionMode.setShareIntent(null);
  mMenuTask=mActivity.getThreadPool().submit(new Job<Void>(){
    @Override public Void run(    final JobContext jc){
      final int operation=computeMenuOptions(jc);
      final Intent intent=hasShareButton ? computeSharingIntent(jc) : null;
      mMainHandler.post(new Runnable(){
        @Override public void run(){
          mMenuTask=null;
          if (!jc.isCancelled()) {
            MenuExecutor.updateMenuOperation(mActionMode,operation);
            if (hasShareButton) {
              mActionMode.setShareIntent(intent);
              mMenuExecutor.setShareIntent(intent);
            }
          }
        }
      }
);
      return null;
    }
  }
);
}
Program: 38647
Project: 38647
Buggy source:
@Override public void run(){
  mMenuTask=null;
  if (!jc.isCancelled()) {
    MenuExecutor.updateMenuOperation(mActionMode,operation);
    if (hasShareButton) {
      mActionMode.setShareIntent(intent);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  mMenuTask=null;
  if (!jc.isCancelled()) {
    MenuExecutor.updateMenuOperation(mActionMode,operation);
    if (hasShareButton) {
      mActionMode.setShareIntent(intent);
      mMenuExecutor.setShareIntent(intent);
    }
  }
}
Program: 38648
Project: 38648
Buggy source:
/** 
 * Try to seek the tiff data. If there is no tiff data, return false, else return true and the inputstream will be at the start of tiff data
 */
private boolean seekTiffData(InputStream inputStream) throws IOException, ExifInvalidFormatException {
  DataInputStream dataStream=new DataInputStream(inputStream);
  if (dataStream.readShort() != SOI) {
    throw new ExifInvalidFormatException("String_Node_Str");
  }
  if (dataStream.readShort() != APP1) {
    return false;
  }
  dataStream.readShort();
  if (dataStream.readInt() != EXIF_HEADER || dataStream.readShort() != EXIF_HEADER_TAIL) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Try to seek the tiff data. If there is no tiff data, return false, else return true and the inputstream will be at the start of tiff data
 */
private boolean seekTiffData(InputStream inputStream) throws IOException, ExifInvalidFormatException {
  DataInputStream dataStream=new DataInputStream(inputStream);
  if (dataStream.readShort() != SOI) {
    throw new ExifInvalidFormatException("String_Node_Str");
  }
  short tag=dataStream.readShort();
  if (tag == APP0) {
    int length=dataStream.readUnsignedShort();
    if ((length - 2) != dataStream.skip(length - 2)) {
      throw new EOFException();
    }
    tag=dataStream.readShort();
  }
  if (tag != APP1) {
    return false;
  }
  dataStream.readShort();
  if (dataStream.readInt() != EXIF_HEADER || dataStream.readShort() != EXIF_HEADER_TAIL) {
    return false;
  }
  return true;
}
Program: 38649
Project: 38649
Buggy source:
/** 
 * Try to seek the tiff data. If there is no tiff data, return false, else return true and the inputstream will be at the start of tiff data
 */
private boolean seekTiffData(InputStream inputStream) throws IOException, ExifInvalidFormatException {
  DataInputStream dataStream=new DataInputStream(inputStream);
  if (dataStream.readShort() != SOI) {
    throw new ExifInvalidFormatException("String_Node_Str");
  }
  if (dataStream.readShort() != APP1) {
    return false;
  }
  dataStream.readShort();
  if (dataStream.readInt() != EXIF_HEADER || dataStream.readShort() != EXIF_HEADER_TAIL) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Try to seek the tiff data. If there is no tiff data, return false, else return true and the inputstream will be at the start of tiff data
 */
private boolean seekTiffData(InputStream inputStream) throws IOException, ExifInvalidFormatException {
  DataInputStream dataStream=new DataInputStream(inputStream);
  if (dataStream.readShort() != SOI) {
    throw new ExifInvalidFormatException("String_Node_Str");
  }
  short tag=dataStream.readShort();
  if (tag == APP0) {
    int length=dataStream.readUnsignedShort();
    if ((length - 2) != dataStream.skip(length - 2)) {
      throw new EOFException();
    }
    tag=dataStream.readShort();
  }
  if (tag != APP1) {
    return false;
  }
  dataStream.readShort();
  if (dataStream.readInt() != EXIF_HEADER || dataStream.readShort() != EXIF_HEADER_TAIL) {
    return false;
  }
  return true;
}
Program: 38650
Project: 38650
Buggy source:
public int next() throws IOException {
  int offset=mTiffStream.getReadByteCount();
  if (offset < mEndOfTagOffset) {
    skipTo(mNextOffset);
    if (mNextOffset < mEndOfTagOffset) {
      mNextOffset+=TAG_SIZE;
      return TYPE_NEW_TAG;
    }
  }
  if (offset == mEndOfTagOffset) {
    mOffsetToNextIfd=mTiffStream.readInt();
  }
  if (!mCorrespondingTag.isEmpty()) {
    mCurrTag=mCorrespondingTag.pollFirst();
    skipTo(mCurrTag.getOffset());
    if (isSubIfdTag(mCurrTag.getTagId())) {
      return TYPE_SUB_IFD;
    }
 else {
      return TYPE_VALUE_OF_PREV_TAG;
    }
  }
 else {
    if (offset <= mOffsetToNextIfd) {
      skipTo(mOffsetToNextIfd);
      mOffsetToNextIfd=0;
      return TYPE_NEXT_IFD;
    }
 else {
      return TYPE_END;
    }
  }
}

Fixed version (ground truth):
public int next() throws IOException {
  int offset=mTiffStream.getReadByteCount();
  if (offset < mEndOfTagOffset) {
    offset=mNextOffset;
    skipTo(mNextOffset);
    if (mNextOffset < mEndOfTagOffset) {
      mNextOffset+=TAG_SIZE;
      return TYPE_NEW_TAG;
    }
  }
  if (offset == mEndOfTagOffset) {
    mOffsetToNextIfd=mTiffStream.readInt();
  }
  if (!mCorrespondingTag.isEmpty()) {
    mCurrTag=mCorrespondingTag.pollFirst();
    skipTo(mCurrTag.getOffset());
    if (isSubIfdTag(mCurrTag.getTagId())) {
      return TYPE_SUB_IFD;
    }
 else {
      return TYPE_VALUE_OF_PREV_TAG;
    }
  }
 else {
    if (offset <= mOffsetToNextIfd) {
      skipTo(mOffsetToNextIfd);
      mOffsetToNextIfd=0;
      return TYPE_NEXT_IFD;
    }
 else {
      return TYPE_END;
    }
  }
}
Program: 38651
Project: 38651
Buggy source:
public int next() throws IOException {
  int offset=mTiffStream.getReadByteCount();
  if (offset < mEndOfTagOffset) {
    skipTo(mNextOffset);
    if (mNextOffset < mEndOfTagOffset) {
      mNextOffset+=TAG_SIZE;
      return TYPE_NEW_TAG;
    }
  }
  if (offset == mEndOfTagOffset) {
    mOffsetToNextIfd=mTiffStream.readInt();
  }
  if (!mCorrespondingTag.isEmpty()) {
    mCurrTag=mCorrespondingTag.pollFirst();
    skipTo(mCurrTag.getOffset());
    if (isSubIfdTag(mCurrTag.getTagId())) {
      return TYPE_SUB_IFD;
    }
 else {
      return TYPE_VALUE_OF_PREV_TAG;
    }
  }
 else {
    if (offset <= mOffsetToNextIfd) {
      skipTo(mOffsetToNextIfd);
      return TYPE_NEXT_IFD;
    }
 else {
      return TYPE_END;
    }
  }
}

Fixed version (ground truth):
public int next() throws IOException {
  int offset=mTiffStream.getReadByteCount();
  if (offset < mEndOfTagOffset) {
    skipTo(mNextOffset);
    if (mNextOffset < mEndOfTagOffset) {
      mNextOffset+=TAG_SIZE;
      return TYPE_NEW_TAG;
    }
  }
  if (offset == mEndOfTagOffset) {
    mOffsetToNextIfd=mTiffStream.readInt();
  }
  if (!mCorrespondingTag.isEmpty()) {
    mCurrTag=mCorrespondingTag.pollFirst();
    skipTo(mCurrTag.getOffset());
    if (isSubIfdTag(mCurrTag.getTagId())) {
      return TYPE_SUB_IFD;
    }
 else {
      return TYPE_VALUE_OF_PREV_TAG;
    }
  }
 else {
    if (offset <= mOffsetToNextIfd) {
      skipTo(mOffsetToNextIfd);
      mOffsetToNextIfd=0;
      return TYPE_NEXT_IFD;
    }
 else {
      return TYPE_END;
    }
  }
}
Program: 38652
Project: 38652
Buggy source:
public int next() throws IOException {
  int offset=mTiffStream.getReadByteCount();
  if (offset < mEndOfTagOffset) {
    skipTo(mNextOffset);
    if (mNextOffset < mEndOfTagOffset) {
      mNextOffset+=TAG_SIZE;
      return TYPE_NEW_TAG;
    }
  }
  if (offset == mEndOfTagOffset) {
    mOffsetToNextIfd=mTiffStream.readInt();
  }
  if (!mCorrespondingTag.isEmpty()) {
    mCurrTag=mCorrespondingTag.pollFirst();
    skipTo(mCurrTag.getOffset());
    if (isSubIfdTag(mCurrTag.getTagId())) {
      return TYPE_SUB_IFD;
    }
 else {
      return TYPE_VALUE_OF_PREV_TAG;
    }
  }
 else {
    if (offset <= mOffsetToNextIfd) {
      skipTo(mOffsetToNextIfd);
      mOffsetToNextIfd=0;
      return TYPE_NEXT_IFD;
    }
 else {
      return TYPE_END;
    }
  }
}

Fixed version (ground truth):
public int next() throws IOException {
  int offset=mTiffStream.getReadByteCount();
  if (offset < mEndOfTagOffset) {
    offset=mNextOffset;
    skipTo(mNextOffset);
    if (mNextOffset < mEndOfTagOffset) {
      mNextOffset+=TAG_SIZE;
      return TYPE_NEW_TAG;
    }
  }
  if (offset == mEndOfTagOffset) {
    mOffsetToNextIfd=mTiffStream.readInt();
  }
  if (!mCorrespondingTag.isEmpty()) {
    mCurrTag=mCorrespondingTag.pollFirst();
    skipTo(mCurrTag.getOffset());
    if (isSubIfdTag(mCurrTag.getTagId())) {
      return TYPE_SUB_IFD;
    }
 else {
      return TYPE_VALUE_OF_PREV_TAG;
    }
  }
 else {
    if (offset <= mOffsetToNextIfd) {
      skipTo(mOffsetToNextIfd);
      mOffsetToNextIfd=0;
      return TYPE_NEXT_IFD;
    }
 else {
      return TYPE_END;
    }
  }
}
Program: 38653
Project: 38653
Buggy source:
public int next() throws IOException {
  int offset=mTiffStream.getReadByteCount();
  if (offset < mEndOfTagOffset) {
    skipTo(mNextOffset);
    mNextOffset+=TAG_SIZE;
    return TYPE_NEW_TAG;
  }
  if (offset == mEndOfTagOffset) {
    mOffsetToNextIfd=mTiffStream.readInt();
  }
  if (!mCorrespondingTag.isEmpty()) {
    mCurrTag=mCorrespondingTag.pollFirst();
    skipTo(mCurrTag.getOffset());
    if (isSubIfdTag(mCurrTag.getTagId())) {
      return TYPE_SUB_IFD;
    }
 else {
      return TYPE_VALUE_OF_PREV_TAG;
    }
  }
 else {
    if (offset <= mOffsetToNextIfd) {
      skipTo(mOffsetToNextIfd);
      return TYPE_NEXT_IFD;
    }
 else {
      return TYPE_END;
    }
  }
}

Fixed version (ground truth):
public int next() throws IOException {
  int offset=mTiffStream.getReadByteCount();
  if (offset < mEndOfTagOffset) {
    skipTo(mNextOffset);
    if (mNextOffset < mEndOfTagOffset) {
      mNextOffset+=TAG_SIZE;
      return TYPE_NEW_TAG;
    }
  }
  if (offset == mEndOfTagOffset) {
    mOffsetToNextIfd=mTiffStream.readInt();
  }
  if (!mCorrespondingTag.isEmpty()) {
    mCurrTag=mCorrespondingTag.pollFirst();
    skipTo(mCurrTag.getOffset());
    if (isSubIfdTag(mCurrTag.getTagId())) {
      return TYPE_SUB_IFD;
    }
 else {
      return TYPE_VALUE_OF_PREV_TAG;
    }
  }
 else {
    if (offset <= mOffsetToNextIfd) {
      skipTo(mOffsetToNextIfd);
      return TYPE_NEXT_IFD;
    }
 else {
      return TYPE_END;
    }
  }
}
Program: 38654
Project: 38654
Buggy source:
public int next() throws IOException {
  int offset=mTiffStream.getReadByteCount();
  if (offset < mEndOfTagOffset) {
    skipTo(mNextOffset);
    mNextOffset+=TAG_SIZE;
    return TYPE_NEW_TAG;
  }
  if (offset == mEndOfTagOffset) {
    mOffsetToNextIfd=mTiffStream.readInt();
  }
  if (!mCorrespondingTag.isEmpty()) {
    mCurrTag=mCorrespondingTag.pollFirst();
    skipTo(mCurrTag.getOffset());
    if (isSubIfdTag(mCurrTag.getTagId())) {
      return TYPE_SUB_IFD;
    }
 else {
      return TYPE_VALUE_OF_PREV_TAG;
    }
  }
 else {
    if (offset <= mOffsetToNextIfd) {
      skipTo(mOffsetToNextIfd);
      return TYPE_NEXT_IFD;
    }
 else {
      return TYPE_END;
    }
  }
}

Fixed version (ground truth):
public int next() throws IOException {
  int offset=mTiffStream.getReadByteCount();
  if (offset < mEndOfTagOffset) {
    skipTo(mNextOffset);
    if (mNextOffset < mEndOfTagOffset) {
      mNextOffset+=TAG_SIZE;
      return TYPE_NEW_TAG;
    }
  }
  if (offset == mEndOfTagOffset) {
    mOffsetToNextIfd=mTiffStream.readInt();
  }
  if (!mCorrespondingTag.isEmpty()) {
    mCurrTag=mCorrespondingTag.pollFirst();
    skipTo(mCurrTag.getOffset());
    if (isSubIfdTag(mCurrTag.getTagId())) {
      return TYPE_SUB_IFD;
    }
 else {
      return TYPE_VALUE_OF_PREV_TAG;
    }
  }
 else {
    if (offset <= mOffsetToNextIfd) {
      skipTo(mOffsetToNextIfd);
      return TYPE_NEXT_IFD;
    }
 else {
      return TYPE_END;
    }
  }
}