nus-yam/ex-repair huggingface dataset:
Program: 38575
Project: 38575
Buggy source:
@Override public void handleMessage(Message message){
switch (message.what) {
case MSG_HIDE_BARS:
{
      hideBars();
      break;
    }
case MSG_REFRESH_BOTTOM_CONTROLS:
{
    if (mBottomControls != null)     mBottomControls.refresh();
    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;
}
case MSG_WANT_BARS:
{
wantBars();
break;
}
case MSG_UNFREEZE_GLROOT:
{
mActivity.getGLRoot().unfreeze();
break;
}
case MSG_ON_CAMERA_CENTER:
{
mSkipUpdateCurrentPhoto=false;
boolean updateNeeded=false;
if (!mPhotoView.getFilmMode()) {
lockOrientation();
updateNeeded=true;
}
 else if (SystemClock.uptimeMillis() < mCameraSwitchCutoff && mMediaSet.getMediaItemCount() > 1) {
mPhotoView.switchToImage(1);
}
 else {
mPhotoView.setFilmMode(false);
updateNeeded=true;
}
if (updateNeeded) {
updateBars();
updateCurrentPhoto(mModel.getMediaItem(0));
}
break;
}
case MSG_ON_PICTURE_CENTER:
{
if (mCurrentPhoto != null && (mCurrentPhoto.getSupportedOperations() & MediaObject.SUPPORT_ACTION) != 0) {
mPhotoView.setFilmMode(true);
}
break;
}
default :
throw new AssertionError(message.what);
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message message){
switch (message.what) {
case MSG_HIDE_BARS:
{
      hideBars();
      break;
    }
case MSG_REFRESH_BOTTOM_CONTROLS:
{
    if (mBottomControls != null)     mBottomControls.refresh();
    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;
}
case MSG_WANT_BARS:
{
wantBars();
break;
}
case MSG_UNFREEZE_GLROOT:
{
mActivity.getGLRoot().unfreeze();
break;
}
case MSG_ON_CAMERA_CENTER:
{
mSkipUpdateCurrentPhoto=false;
boolean stayedOnCamera=false;
if (!mPhotoView.getFilmMode()) {
stayedOnCamera=true;
}
 else if (SystemClock.uptimeMillis() < mCameraSwitchCutoff && mMediaSet.getMediaItemCount() > 1) {
mPhotoView.switchToImage(1);
}
 else {
mPhotoView.setFilmMode(false);
stayedOnCamera=true;
}
if (stayedOnCamera) {
lockOrientation();
updateBars();
updateCurrentPhoto(mModel.getMediaItem(0));
}
break;
}
case MSG_ON_PICTURE_CENTER:
{
if (mCurrentPhoto != null && (mCurrentPhoto.getSupportedOperations() & MediaObject.SUPPORT_ACTION) != 0) {
mPhotoView.setFilmMode(true);
}
break;
}
default :
throw new AssertionError(message.what);
}
}
Program: 38576
Project: 38576
Buggy source:
public LocalMergeAlbum(Path path,Comparator<MediaItem> comparator,MediaSet[] sources,int bucketId){
  super(path,INVALID_DATA_VERSION);
  mComparator=comparator;
  mSources=sources;
  mName=sources.length == 0 ? "String_Node_Str" : sources[0].getName();
  mBucketId=bucketId;
  for (  MediaSet set : mSources) {
    set.addContentListener(this);
  }
}

Fixed version (ground truth):
public LocalMergeAlbum(Path path,Comparator<MediaItem> comparator,MediaSet[] sources,int bucketId){
  super(path,INVALID_DATA_VERSION);
  mComparator=comparator;
  mSources=sources;
  mName=sources.length == 0 ? "String_Node_Str" : sources[0].getName();
  mBucketId=bucketId;
  for (  MediaSet set : mSources) {
    set.addContentListener(this);
  }
  reload();
}
Program: 38577
Project: 38577
Buggy source:
@Override public ArrayList<MediaItem> getMediaItem(int start,int count){
  SortedMap<Integer,int[]> head=mIndex.headMap(start + 1);
  int markPos;
  try {
    markPos=head.lastKey();
  }
 catch (  NoSuchElementException e) {
    Log.e(TAG,"String_Node_Str" + start + "String_Node_Str"+ count+ "String_Node_Str");
    Log.e(TAG,"String_Node_Str");
    for (    MediaSet set : mSources) {
      Log.e(TAG,"String_Node_Str" + set.getPath());
    }
    throw e;
  }
  int[] subPos=head.get(markPos).clone();
  MediaItem[] slot=new MediaItem[mSources.length];
  int size=mSources.length;
  for (int i=0; i < size; i++) {
    slot[i]=mFetcher[i].getItem(subPos[i]);
  }
  ArrayList<MediaItem> result=new ArrayList<MediaItem>();
  for (int i=markPos; i < start + count; i++) {
    int k=-1;
    for (int j=0; j < size; j++) {
      if (slot[j] != null) {
        if (k == -1 || mComparator.compare(slot[j],slot[k]) < 0) {
          k=j;
        }
      }
    }
    if (k == -1)     break;
    subPos[k]++;
    if (i >= start) {
      result.add(slot[k]);
    }
    slot[k]=mFetcher[k].getItem(subPos[k]);
    if ((i + 1) % PAGE_SIZE == 0) {
      mIndex.put(i + 1,subPos.clone());
    }
  }
  return result;
}

Fixed version (ground truth):
@Override public ArrayList<MediaItem> getMediaItem(int start,int count){
  SortedMap<Integer,int[]> head=mIndex.headMap(start + 1);
  int markPos=head.lastKey();
  int[] subPos=head.get(markPos).clone();
  MediaItem[] slot=new MediaItem[mSources.length];
  int size=mSources.length;
  for (int i=0; i < size; i++) {
    slot[i]=mFetcher[i].getItem(subPos[i]);
  }
  ArrayList<MediaItem> result=new ArrayList<MediaItem>();
  for (int i=markPos; i < start + count; i++) {
    int k=-1;
    for (int j=0; j < size; j++) {
      if (slot[j] != null) {
        if (k == -1 || mComparator.compare(slot[j],slot[k]) < 0) {
          k=j;
        }
      }
    }
    if (k == -1)     break;
    subPos[k]++;
    if (i >= start) {
      result.add(slot[k]);
    }
    slot[k]=mFetcher[k].getItem(subPos[k]);
    if ((i + 1) % PAGE_SIZE == 0) {
      mIndex.put(i + 1,subPos.clone());
    }
  }
  return result;
}
Program: 38578
Project: 38578
Buggy source:
@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):
@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: 38579
Project: 38579
Buggy source:
public void run(){
  lp.x=0;
  view.setLayoutParams(lp);
}

Fixed version (ground truth):
public void run(){
  viewList.setAlpha(0);
  viewList.setVisibility(View.VISIBLE);
  viewList.animate().setDuration(100).alpha(1.0f).start();
}
Program: 38580
Project: 38580
Buggy source:
public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.undoButton:
{
      HistoryAdapter adapter=(HistoryAdapter)mImageShow.getListAdapter();
      int position=adapter.undo();
      mImageShow.onItemClick(position);
      mImageShow.showToast("String_Node_Str");
      invalidateViews();
      return true;
    }
case R.id.redoButton:
{
    HistoryAdapter adapter=(HistoryAdapter)mImageShow.getListAdapter();
    int position=adapter.redo();
    mImageShow.onItemClick(position);
    mImageShow.showToast("String_Node_Str");
    invalidateViews();
    return true;
  }
case R.id.operationsButton:
{
  toggleHistoryPanel();
  return true;
}
case android.R.id.home:
{
saveImage();
return true;
}
}
return false;
}

Fixed version (ground truth):
public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.undoButton:
{
      HistoryAdapter adapter=(HistoryAdapter)mImageShow.getHistoryAdapter();
      int position=adapter.undo();
      mImageShow.onItemClick(position);
      mImageShow.showToast("String_Node_Str");
      invalidateViews();
      return true;
    }
case R.id.redoButton:
{
    HistoryAdapter adapter=(HistoryAdapter)mImageShow.getHistoryAdapter();
    int position=adapter.redo();
    mImageShow.onItemClick(position);
    mImageShow.showToast("String_Node_Str");
    invalidateViews();
    return true;
  }
case R.id.showImageStateButton:
{
  toggleImageStatePanel();
  return true;
}
case R.id.operationsButton:
{
toggleHistoryPanel();
return true;
}
case android.R.id.home:
{
saveImage();
return true;
}
}
return false;
}
Program: 38581
Project: 38581
Buggy source:
private void resetHistory(){
  HistoryAdapter adapter=(HistoryAdapter)mImageShow.getListAdapter();
  adapter.reset();
  ImagePreset original=new ImagePreset(adapter.getItem(0));
  mImageShow.setImagePreset(original);
  invalidateViews();
}

Fixed version (ground truth):
private void resetHistory(){
  HistoryAdapter adapter=(HistoryAdapter)mImageShow.getHistoryAdapter();
  adapter.reset();
  ImagePreset original=new ImagePreset(adapter.getItem(0));
  mImageShow.setImagePreset(original);
  invalidateViews();
}
Program: 38582
Project: 38582
Buggy source:
private OnClickListener createOnClickSaturationButton(){
  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) {
        ImageFilterSaturated sat=new ImageFilterSaturated();
        ImagePreset copy=new ImagePreset(preset);
        copy.add(sat);
        copy.setHistoryName(sat.name());
        copy.setIsFx(false);
        filter=copy.getFilter("String_Node_Str");
        mImageShow.setImagePreset(copy);
      }
      mImageShow.setCurrentFilter(filter);
      unselectPanelButtons(mColorsPanelButtons);
      mSaturationButton.setSelected(true);
      invalidateViews();
    }
  }
;
}

Fixed version (ground truth):
private OnClickListener createOnClickSaturationButton(){
  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) {
        ImageFilterSaturated sat=new ImageFilterSaturated();
        ImagePreset copy=new ImagePreset(preset);
        copy.add(sat);
        copy.setHistoryName(sat.getName());
        copy.setIsFx(false);
        filter=copy.getFilter("String_Node_Str");
        mImageShow.setImagePreset(copy);
      }
      mImageShow.setCurrentFilter(filter);
      unselectPanelButtons(mColorsPanelButtons);
      mSaturationButton.setSelected(true);
      invalidateViews();
    }
  }
;
}
Program: 38583
Project: 38583
Buggy source:
private OnClickListener createOnClickVibranceButton(){
  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);
      mVibranceButton.setSelected(true);
      invalidateViews();
    }
  }
;
}

Fixed version (ground truth):
private OnClickListener createOnClickVibranceButton(){
  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);
      mVibranceButton.setSelected(true);
      invalidateViews();
    }
  }
;
}
Program: 38585
Project: 38585
Buggy source:
private OnClickListener createOnClickContrastButton(){
  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) {
        ImageFilterContrast contrast=new ImageFilterContrast();
        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);
      mContrastButton.setSelected(true);
      invalidateViews();
    }
  }
;
}

Fixed version (ground truth):
private OnClickListener createOnClickContrastButton(){
  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) {
        ImageFilterContrast contrast=new ImageFilterContrast();
        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);
      mContrastButton.setSelected(true);
      invalidateViews();
    }
  }
;
}
Program: 38586
Project: 38586
Buggy source:
private void fillListBorders(LinearLayout listBorders){
  int p=0;
  ImageFilter[] borders=new ImageFilter[8];
  borders[p++]=new ImageFilterBorder(null);
  Drawable npd3=getResources().getDrawable(R.drawable.filtershow_border_film3);
  borders[p++]=new ImageFilterBorder(npd3);
  Drawable npd=getResources().getDrawable(R.drawable.filtershow_border_scratch3);
  borders[p++]=new ImageFilterBorder(npd);
  Drawable npd2=getResources().getDrawable(R.drawable.filtershow_border_black);
  borders[p++]=new ImageFilterBorder(npd2);
  Drawable npd6=getResources().getDrawable(R.drawable.filtershow_border_rounded_black);
  borders[p++]=new ImageFilterBorder(npd6);
  Drawable npd4=getResources().getDrawable(R.drawable.filtershow_border_white);
  borders[p++]=new ImageFilterBorder(npd4);
  Drawable npd5=getResources().getDrawable(R.drawable.filtershow_border_rounded_white);
  borders[p++]=new ImageFilterBorder(npd5);
  for (int i=0; i < p; i++) {
    ImageSmallFilter filter=new ImageSmallFilter(getBaseContext());
    filter.setImageFilter(borders[i]);
    filter.setController(this);
    filter.setImageLoader(mImageLoader);
    listBorders.addView(filter);
  }
}

Fixed version (ground truth):
private void fillListBorders(LinearLayout listBorders){
  int p=0;
  ImageFilter[] borders=new ImageFilter[8];
  borders[p++]=new ImageFilterBorder(null);
  Drawable npd3=getResources().getDrawable(R.drawable.filtershow_border_film3);
  borders[p++]=new ImageFilterBorder(npd3);
  Drawable npd=getResources().getDrawable(R.drawable.filtershow_border_scratch3);
  borders[p++]=new ImageFilterBorder(npd);
  Drawable npd2=getResources().getDrawable(R.drawable.filtershow_border_black);
  borders[p++]=new ImageFilterBorder(npd2);
  Drawable npd6=getResources().getDrawable(R.drawable.filtershow_border_rounded_black);
  borders[p++]=new ImageFilterBorder(npd6);
  Drawable npd4=getResources().getDrawable(R.drawable.filtershow_border_white);
  borders[p++]=new ImageFilterBorder(npd4);
  Drawable npd5=getResources().getDrawable(R.drawable.filtershow_border_rounded_white);
  borders[p++]=new ImageFilterBorder(npd5);
  for (int i=0; i < p; i++) {
    ImageSmallFilter filter=new ImageSmallFilter(getBaseContext());
    filter.setImageFilter(borders[i]);
    filter.setController(this);
    filter.setImageLoader(mImageLoader);
    filter.setShowTitle(false);
    listBorders.addView(filter);
  }
}
Program: 38587
Project: 38587
Buggy source:
private OnClickListener createOnClickExposureButton(){
  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) {
        ImageFilterBrightness bright=new ImageFilterBrightness();
        ImagePreset copy=new ImagePreset(preset);
        copy.add(bright);
        copy.setHistoryName(bright.name());
        copy.setIsFx(false);
        filter=copy.getFilter("String_Node_Str");
        mImageShow.setImagePreset(copy);
      }
      mImageShow.setCurrentFilter(filter);
      unselectPanelButtons(mColorsPanelButtons);
      mExposureButton.setSelected(true);
      invalidateViews();
    }
  }
;
}

Fixed version (ground truth):
private OnClickListener createOnClickExposureButton(){
  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) {
        ImageFilterBrightness bright=new ImageFilterBrightness();
        ImagePreset copy=new ImagePreset(preset);
        copy.add(bright);
        copy.setHistoryName(bright.getName());
        copy.setIsFx(false);
        filter=copy.getFilter("String_Node_Str");
        mImageShow.setImagePreset(copy);
      }
      mImageShow.setCurrentFilter(filter);
      unselectPanelButtons(mColorsPanelButtons);
      mExposureButton.setSelected(true);
      invalidateViews();
    }
  }
;
}
Program: 38588
Project: 38588
Buggy source:
private OnClickListener createOnClickVignetteButton(){
  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) {
        ImageFilterVignette vignette=new ImageFilterVignette();
        ImagePreset copy=new ImagePreset(preset);
        copy.add(vignette);
        copy.setHistoryName(vignette.name());
        copy.setIsFx(false);
        filter=copy.getFilter("String_Node_Str");
        mImageShow.setImagePreset(copy);
      }
      mImageShow.setCurrentFilter(filter);
      unselectPanelButtons(mColorsPanelButtons);
      mVignetteButton.setSelected(true);
      invalidateViews();
    }
  }
;
}

Fixed version (ground truth):
private OnClickListener createOnClickVignetteButton(){
  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) {
        ImageFilterVignette vignette=new ImageFilterVignette();
        ImagePreset copy=new ImagePreset(preset);
        copy.add(vignette);
        copy.setHistoryName(vignette.getName());
        copy.setIsFx(false);
        filter=copy.getFilter("String_Node_Str");
        mImageShow.setImagePreset(copy);
      }
      mImageShow.setCurrentFilter(filter);
      unselectPanelButtons(mColorsPanelButtons);
      mVignetteButton.setSelected(true);
      invalidateViews();
    }
  }
;
}
Program: 38589
Project: 38589
Buggy source:
private OnClickListener createOnClickTintButton(){
  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);
      mTintButton.setSelected(true);
      invalidateViews();
    }
  }
;
}

Fixed version (ground truth):
private OnClickListener createOnClickTintButton(){
  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);
      mTintButton.setSelected(true);
      invalidateViews();
    }
  }
;
}
Program: 38590
Project: 38590
Buggy source:
public void useImageFilter(ImageFilter imageFilter){
  if (imageFilter == null) {
    return;
  }
  ImagePreset oldPreset=mImageShow.getImagePreset();
  ImagePreset copy=new ImagePreset(oldPreset);
  if (imageFilter.name().equalsIgnoreCase("String_Node_Str")) {
    copy.remove("String_Node_Str");
    copy.setHistoryName("String_Node_Str");
  }
  copy.add(imageFilter);
  invalidateViews();
}

Fixed version (ground truth):
public void useImageFilter(ImageFilter imageFilter){
  if (imageFilter == null) {
    return;
  }
  ImagePreset oldPreset=mImageShow.getImagePreset();
  ImagePreset copy=new ImagePreset(oldPreset);
  if (imageFilter.getName().equalsIgnoreCase("String_Node_Str")) {
    copy.remove("String_Node_Str");
    copy.setHistoryName("String_Node_Str");
  }
  copy.add(imageFilter);
  mImageShow.setImagePreset(copy);
  invalidateViews();
}
Program: 38591
Project: 38591
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: 38592
Project: 38592
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: 38593
Project: 38593
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: 38594
Project: 38594
Buggy source:
@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):
@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: 38595
Project: 38595
Buggy source:
public void run(){
  lp.x=0;
  view.setLayoutParams(lp);
}

Fixed version (ground truth):
public void run(){
  viewList.setAlpha(0);
  viewList.setVisibility(View.VISIBLE);
  viewList.animate().setDuration(100).alpha(1.0f).start();
}
Program: 38596
Project: 38596
Buggy source:
public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.undoButton:
{
      HistoryAdapter adapter=(HistoryAdapter)mImageShow.getListAdapter();
      int position=adapter.undo();
      mImageShow.onItemClick(position);
      mImageShow.showToast("String_Node_Str");
      invalidateViews();
      return true;
    }
case R.id.redoButton:
{
    HistoryAdapter adapter=(HistoryAdapter)mImageShow.getListAdapter();
    int position=adapter.redo();
    mImageShow.onItemClick(position);
    mImageShow.showToast("String_Node_Str");
    invalidateViews();
    return true;
  }
case R.id.operationsButton:
{
  toggleHistoryPanel();
  return true;
}
case android.R.id.home:
{
saveImage();
return true;
}
}
return false;
}

Fixed version (ground truth):
public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.undoButton:
{
      HistoryAdapter adapter=(HistoryAdapter)mImageShow.getHistoryAdapter();
      int position=adapter.undo();
      mImageShow.onItemClick(position);
      mImageShow.showToast("String_Node_Str");
      invalidateViews();
      return true;
    }
case R.id.redoButton:
{
    HistoryAdapter adapter=(HistoryAdapter)mImageShow.getHistoryAdapter();
    int position=adapter.redo();
    mImageShow.onItemClick(position);
    mImageShow.showToast("String_Node_Str");
    invalidateViews();
    return true;
  }
case R.id.showImageStateButton:
{
  toggleImageStatePanel();
  return true;
}
case R.id.operationsButton:
{
toggleHistoryPanel();
return true;
}
case android.R.id.home:
{
saveImage();
return true;
}
}
return false;
}
Program: 38597
Project: 38597
Buggy source:
private void resetHistory(){
  HistoryAdapter adapter=(HistoryAdapter)mImageShow.getListAdapter();
  adapter.reset();
  ImagePreset original=new ImagePreset(adapter.getItem(0));
  mImageShow.setImagePreset(original);
  invalidateViews();
}

Fixed version (ground truth):
private void resetHistory(){
  HistoryAdapter adapter=(HistoryAdapter)mImageShow.getHistoryAdapter();
  adapter.reset();
  ImagePreset original=new ImagePreset(adapter.getItem(0));
  mImageShow.setImagePreset(original);
  invalidateViews();
}
Program: 38598
Project: 38598
Buggy source:
private OnClickListener createOnClickSaturationButton(){
  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) {
        ImageFilterSaturated sat=new ImageFilterSaturated();
        ImagePreset copy=new ImagePreset(preset);
        copy.add(sat);
        copy.setHistoryName(sat.name());
        copy.setIsFx(false);
        filter=copy.getFilter("String_Node_Str");
        mImageShow.setImagePreset(copy);
      }
      mImageShow.setCurrentFilter(filter);
      unselectPanelButtons(mColorsPanelButtons);
      mSaturationButton.setSelected(true);
      invalidateViews();
    }
  }
;
}

Fixed version (ground truth):
private OnClickListener createOnClickSaturationButton(){
  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) {
        ImageFilterSaturated sat=new ImageFilterSaturated();
        ImagePreset copy=new ImagePreset(preset);
        copy.add(sat);
        copy.setHistoryName(sat.getName());
        copy.setIsFx(false);
        filter=copy.getFilter("String_Node_Str");
        mImageShow.setImagePreset(copy);
      }
      mImageShow.setCurrentFilter(filter);
      unselectPanelButtons(mColorsPanelButtons);
      mSaturationButton.setSelected(true);
      invalidateViews();
    }
  }
;
}
Program: 38599
Project: 38599
Buggy source:
private OnClickListener createOnClickVibranceButton(){
  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);
      mVibranceButton.setSelected(true);
      invalidateViews();
    }
  }
;
}

Fixed version (ground truth):
private OnClickListener createOnClickVibranceButton(){
  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);
      mVibranceButton.setSelected(true);
      invalidateViews();
    }
  }
;
}
Program: 38601
Project: 38601
Buggy source:
private OnClickListener createOnClickContrastButton(){
  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) {
        ImageFilterContrast contrast=new ImageFilterContrast();
        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);
      mContrastButton.setSelected(true);
      invalidateViews();
    }
  }
;
}

Fixed version (ground truth):
private OnClickListener createOnClickContrastButton(){
  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) {
        ImageFilterContrast contrast=new ImageFilterContrast();
        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);
      mContrastButton.setSelected(true);
      invalidateViews();
    }
  }
;
}
Program: 38602
Project: 38602
Buggy source:
private void fillListBorders(LinearLayout listBorders){
  int p=0;
  ImageFilter[] borders=new ImageFilter[8];
  borders[p++]=new ImageFilterBorder(null);
  Drawable npd3=getResources().getDrawable(R.drawable.filtershow_border_film3);
  borders[p++]=new ImageFilterBorder(npd3);
  Drawable npd=getResources().getDrawable(R.drawable.filtershow_border_scratch3);
  borders[p++]=new ImageFilterBorder(npd);
  Drawable npd2=getResources().getDrawable(R.drawable.filtershow_border_black);
  borders[p++]=new ImageFilterBorder(npd2);
  Drawable npd6=getResources().getDrawable(R.drawable.filtershow_border_rounded_black);
  borders[p++]=new ImageFilterBorder(npd6);
  Drawable npd4=getResources().getDrawable(R.drawable.filtershow_border_white);
  borders[p++]=new ImageFilterBorder(npd4);
  Drawable npd5=getResources().getDrawable(R.drawable.filtershow_border_rounded_white);
  borders[p++]=new ImageFilterBorder(npd5);
  for (int i=0; i < p; i++) {
    ImageSmallFilter filter=new ImageSmallFilter(getBaseContext());
    filter.setImageFilter(borders[i]);
    filter.setController(this);
    filter.setImageLoader(mImageLoader);
    listBorders.addView(filter);
  }
}

Fixed version (ground truth):
private void fillListBorders(LinearLayout listBorders){
  int p=0;
  ImageFilter[] borders=new ImageFilter[8];
  borders[p++]=new ImageFilterBorder(null);
  Drawable npd3=getResources().getDrawable(R.drawable.filtershow_border_film3);
  borders[p++]=new ImageFilterBorder(npd3);
  Drawable npd=getResources().getDrawable(R.drawable.filtershow_border_scratch3);
  borders[p++]=new ImageFilterBorder(npd);
  Drawable npd2=getResources().getDrawable(R.drawable.filtershow_border_black);
  borders[p++]=new ImageFilterBorder(npd2);
  Drawable npd6=getResources().getDrawable(R.drawable.filtershow_border_rounded_black);
  borders[p++]=new ImageFilterBorder(npd6);
  Drawable npd4=getResources().getDrawable(R.drawable.filtershow_border_white);
  borders[p++]=new ImageFilterBorder(npd4);
  Drawable npd5=getResources().getDrawable(R.drawable.filtershow_border_rounded_white);
  borders[p++]=new ImageFilterBorder(npd5);
  for (int i=0; i < p; i++) {
    ImageSmallFilter filter=new ImageSmallFilter(getBaseContext());
    filter.setImageFilter(borders[i]);
    filter.setController(this);
    filter.setImageLoader(mImageLoader);
    filter.setShowTitle(false);
    listBorders.addView(filter);
  }
}
Program: 38603
Project: 38603
Buggy source:
private OnClickListener createOnClickExposureButton(){
  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) {
        ImageFilterBrightness bright=new ImageFilterBrightness();
        ImagePreset copy=new ImagePreset(preset);
        copy.add(bright);
        copy.setHistoryName(bright.name());
        copy.setIsFx(false);
        filter=copy.getFilter("String_Node_Str");
        mImageShow.setImagePreset(copy);
      }
      mImageShow.setCurrentFilter(filter);
      unselectPanelButtons(mColorsPanelButtons);
      mExposureButton.setSelected(true);
      invalidateViews();
    }
  }
;
}

Fixed version (ground truth):
private OnClickListener createOnClickExposureButton(){
  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) {
        ImageFilterBrightness bright=new ImageFilterBrightness();
        ImagePreset copy=new ImagePreset(preset);
        copy.add(bright);
        copy.setHistoryName(bright.getName());
        copy.setIsFx(false);
        filter=copy.getFilter("String_Node_Str");
        mImageShow.setImagePreset(copy);
      }
      mImageShow.setCurrentFilter(filter);
      unselectPanelButtons(mColorsPanelButtons);
      mExposureButton.setSelected(true);
      invalidateViews();
    }
  }
;
}
Program: 38604
Project: 38604
Buggy source:
private OnClickListener createOnClickVignetteButton(){
  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) {
        ImageFilterVignette vignette=new ImageFilterVignette();
        ImagePreset copy=new ImagePreset(preset);
        copy.add(vignette);
        copy.setHistoryName(vignette.name());
        copy.setIsFx(false);
        filter=copy.getFilter("String_Node_Str");
        mImageShow.setImagePreset(copy);
      }
      mImageShow.setCurrentFilter(filter);
      unselectPanelButtons(mColorsPanelButtons);
      mVignetteButton.setSelected(true);
      invalidateViews();
    }
  }
;
}

Fixed version (ground truth):
private OnClickListener createOnClickVignetteButton(){
  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) {
        ImageFilterVignette vignette=new ImageFilterVignette();
        ImagePreset copy=new ImagePreset(preset);
        copy.add(vignette);
        copy.setHistoryName(vignette.getName());
        copy.setIsFx(false);
        filter=copy.getFilter("String_Node_Str");
        mImageShow.setImagePreset(copy);
      }
      mImageShow.setCurrentFilter(filter);
      unselectPanelButtons(mColorsPanelButtons);
      mVignetteButton.setSelected(true);
      invalidateViews();
    }
  }
;
}
Program: 38605
Project: 38605
Buggy source:
private OnClickListener createOnClickTintButton(){
  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);
      mTintButton.setSelected(true);
      invalidateViews();
    }
  }
;
}

Fixed version (ground truth):
private OnClickListener createOnClickTintButton(){
  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);
      mTintButton.setSelected(true);
      invalidateViews();
    }
  }
;
}
Program: 38606
Project: 38606
Buggy source:
public void useImageFilter(ImageFilter imageFilter){
  if (imageFilter == null) {
    return;
  }
  ImagePreset oldPreset=mImageShow.getImagePreset();
  ImagePreset copy=new ImagePreset(oldPreset);
  if (imageFilter.name().equalsIgnoreCase("String_Node_Str")) {
    copy.remove("String_Node_Str");
    copy.setHistoryName("String_Node_Str");
  }
  copy.add(imageFilter);
  invalidateViews();
}

Fixed version (ground truth):
public void useImageFilter(ImageFilter imageFilter){
  if (imageFilter == null) {
    return;
  }
  ImagePreset oldPreset=mImageShow.getImagePreset();
  ImagePreset copy=new ImagePreset(oldPreset);
  if (imageFilter.getName().equalsIgnoreCase("String_Node_Str")) {
    copy.remove("String_Node_Str");
    copy.setHistoryName("String_Node_Str");
  }
  copy.add(imageFilter);
  mImageShow.setImagePreset(copy);
  invalidateViews();
}