nus-yam/ex-repair huggingface dataset:
Program: 197701
Project: 197701
Buggy source:
public void open(final ParcelFileDescriptor source,final Runnable callback){
  mPageContentCache.invalidate();
  new AsyncTask<Void,Void,Integer>(){
    @Override protected void onPreExecute(){
      Intent intent=new Intent(mContext,PdfRendererService.class);
      mContext.bindService(intent,AsyncRenderer.this,Context.BIND_AUTO_CREATE);
    }
    @Override protected Integer doInBackground(    Void... params){
synchronized (mLock) {
        while (mRenderer == null) {
          try {
            mLock.wait();
          }
 catch (          InterruptedException ie) {
          }
        }
        try {
          return mRenderer.openDocument(source);
        }
 catch (        RemoteException re) {
          Log.e(LOG_TAG,"String_Node_Str");
          return MALFORMED_PDF_FILE_ERROR;
        }
      }
    }
    @Override public void onPostExecute(    Integer pageCount){
      if (pageCount == MALFORMED_PDF_FILE_ERROR) {
        mOnMalformedPdfFileListener.onMalformedPdfFile();
        mPageCount=PrintDocumentInfo.PAGE_COUNT_UNKNOWN;
      }
 else {
        mPageCount=pageCount;
      }
      if (callback != null) {
        callback.run();
      }
    }
  }
.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR,(Void[])null);
}

Fixed version (ground truth):
public void open(final ParcelFileDescriptor source,final Runnable callback){
  mPageContentCache.invalidate();
  new AsyncTask<Void,Void,Integer>(){
    @Override protected void onPreExecute(){
      Intent intent=new Intent(mContext,PdfRendererService.class);
      mContext.bindService(intent,AsyncRenderer.this,Context.BIND_AUTO_CREATE);
    }
    @Override protected Integer doInBackground(    Void... params){
synchronized (mLock) {
        while (mRenderer == null) {
          try {
            mLock.wait();
          }
 catch (          InterruptedException ie) {
          }
        }
        try {
          return mRenderer.openDocument(source);
        }
 catch (        RemoteException re) {
          Log.e(LOG_TAG,"String_Node_Str");
          return MALFORMED_PDF_FILE_ERROR;
        }
 finally {
          IoUtils.closeQuietly(source);
        }
      }
    }
    @Override public void onPostExecute(    Integer pageCount){
      if (pageCount == MALFORMED_PDF_FILE_ERROR) {
        mOnMalformedPdfFileListener.onMalformedPdfFile();
        mPageCount=PrintDocumentInfo.PAGE_COUNT_UNKNOWN;
      }
 else {
        mPageCount=pageCount;
      }
      if (callback != null) {
        callback.run();
      }
    }
  }
.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR,(Void[])null);
}
Program: 197702
Project: 197702
Buggy source:
private Bitmap getBitmapForSize(int width,int height){
  if (mBitmap != null) {
    if (mBitmap.getWidth() == width && mBitmap.getHeight() == height) {
      return mBitmap;
    }
    mBitmap.recycle();
  }
  mBitmap=Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_8888);
  return mBitmap;
}

Fixed version (ground truth):
private Bitmap getBitmapForSize(int width,int height){
  if (mBitmap != null) {
    if (mBitmap.getWidth() == width && mBitmap.getHeight() == height) {
      mBitmap.eraseColor(Color.WHITE);
      return mBitmap;
    }
    mBitmap.recycle();
  }
  mBitmap=Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_8888);
  mBitmap.eraseColor(Color.WHITE);
  return mBitmap;
}
Program: 197703
Project: 197703
Buggy source:
public PrintPreviewController(PrintActivity activity,MutexFileProvider fileProvider){
  mActivity=activity;
  mHandler=new MyHandler(activity.getMainLooper());
  mFileProvider=fileProvider;
  mPrintOptionsLayout=(PrintOptionsLayout)activity.findViewById(R.id.options_container);
  mPageAdapter=new PageAdapter(activity,activity,this);
  final int columnCount=mActivity.getResources().getInteger(R.integer.preview_page_per_row_count);
  mLayoutManger=new StaggeredGridLayoutManager(columnCount,OrientationHelper.VERTICAL);
  mRecyclerView=(RecyclerView)activity.findViewById(R.id.preview_content);
  mRecyclerView.setLayoutManager(mLayoutManger);
  mRecyclerView.setAdapter(mPageAdapter);
  mPreloadController=new PreloadController(mRecyclerView);
  mRecyclerView.setOnScrollListener(mPreloadController);
  mContentView=(PrintContentView)activity.findViewById(R.id.options_content);
  mEmbeddedContentContainer=(EmbeddedContentContainer)activity.findViewById(R.id.embedded_content_container);
  mEmbeddedContentContainer.setOnSizeChangeListener(this);
}

Fixed version (ground truth):
public PrintPreviewController(PrintActivity activity,MutexFileProvider fileProvider){
  mActivity=activity;
  mHandler=new MyHandler(activity.getMainLooper());
  mFileProvider=fileProvider;
  mPrintOptionsLayout=(PrintOptionsLayout)activity.findViewById(R.id.options_container);
  mPageAdapter=new PageAdapter(activity,activity,this);
  final int columnCount=mActivity.getResources().getInteger(R.integer.preview_page_per_row_count);
  mLayoutManger=new GridLayoutManager(mActivity,columnCount);
  mRecyclerView=(RecyclerView)activity.findViewById(R.id.preview_content);
  mRecyclerView.setLayoutManager(mLayoutManger);
  mRecyclerView.setAdapter(mPageAdapter);
  mPreloadController=new PreloadController(mRecyclerView);
  mRecyclerView.setOnScrollListener(mPreloadController);
  mContentView=(PrintContentView)activity.findViewById(R.id.options_content);
  mEmbeddedContentContainer=(EmbeddedContentContainer)activity.findViewById(R.id.embedded_content_container);
  mEmbeddedContentContainer.setOnSizeChangeListener(this);
}
Program: 197704
Project: 197704
Buggy source:
public void init(PageContentProvider provider,MediaSize mediaSize,Margins minMargins){
  if (mProvider == null ? provider == null : mProvider.equals(provider) && ((mAttributes.getMediaSize() == null) ? mediaSize == null : mAttributes.getMediaSize().equals(mediaSize)) && ((mAttributes.getMinMargins() == null) ? minMargins == null : mAttributes.getMinMargins().equals(minMargins))) {
    return;
  }
  mProvider=provider;
  mAttributes.setMediaSize(mediaSize);
  mAttributes.setMinMargins(minMargins);
  mContentRequested=false;
  if (mProvider == null && getBackground() != mEmptyState) {
    setBackground(mEmptyState);
  }
  requestPageContentIfNeeded();
}

Fixed version (ground truth):
public void init(PageContentProvider provider,MediaSize mediaSize,Margins minMargins){
  final boolean providerChanged=(mProvider == null) ? provider != null : !mProvider.equals(provider);
  final boolean mediaSizeChanged=(mMediaSize == null) ? mediaSize != null : !mMediaSize.equals(mediaSize);
  final boolean marginsChanged=(mMinMargins == null) ? minMargins != null : !mMinMargins.equals(minMargins);
  if (!providerChanged && !mediaSizeChanged && !marginsChanged) {
    return;
  }
  mProvider=provider;
  mMediaSize=mediaSize;
  mMinMargins=minMargins;
  mContentRequested=false;
  mNeedsLayout=mNeedsLayout || mediaSizeChanged || marginsChanged;
  if (mProvider == null && getBackground() != mEmptyState) {
    setBackground(mEmptyState);
  }
  requestPageContentIfNeeded();
}
Program: 197705
Project: 197705
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  requestPageContentIfNeeded();
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  mNeedsLayout=false;
  requestPageContentIfNeeded();
}
Program: 197706
Project: 197706
Buggy source:
private void requestPageContentIfNeeded(){
  if (getWidth() > 0 && getHeight() > 0 && !mContentRequested && mProvider != null) {
    mContentRequested=true;
    mProvider.getPageContent(new RenderSpec(getWidth(),getHeight(),mAttributes),this);
  }
}

Fixed version (ground truth):
private void requestPageContentIfNeeded(){
  if (getWidth() > 0 && getHeight() > 0 && !mContentRequested && mProvider != null && !mNeedsLayout) {
    mContentRequested=true;
    mProvider.getPageContent(new RenderSpec(getWidth(),getHeight(),mMediaSize,mMinMargins),this);
  }
}
Program: 197707
Project: 197707
Buggy source:
public RenderSpec(int bitmapWidth,int bitmapHeight,PrintAttributes printAttributes){
  this.bitmapWidth=bitmapWidth;
  this.bitmapHeight=bitmapHeight;
  this.printAttributes=printAttributes;
}

Fixed version (ground truth):
public RenderSpec(int bitmapWidth,int bitmapHeight,MediaSize mediaSize,Margins minMargins){
  this.bitmapWidth=bitmapWidth;
  this.bitmapHeight=bitmapHeight;
  printAttributes.setMediaSize(mediaSize);
  printAttributes.setMinMargins(minMargins);
}
Program: 197708
Project: 197708
Buggy source:
public void open(final ParcelFileDescriptor source,final Runnable callback){
  mPageContentCache.invalidate();
  new AsyncTask<Void,Void,Integer>(){
    @Override protected void onPreExecute(){
      Intent intent=new Intent(mContext,PdfRendererService.class);
      mContext.bindService(intent,AsyncRenderer.this,Context.BIND_AUTO_CREATE);
    }
    @Override protected Integer doInBackground(    Void... params){
synchronized (mLock) {
        while (mRenderer == null) {
          try {
            mLock.wait();
          }
 catch (          InterruptedException ie) {
          }
        }
        try {
          return mRenderer.openDocument(source);
        }
 catch (        RemoteException re) {
          Log.e(LOG_TAG,"String_Node_Str");
          return MALFORMED_PDF_FILE_ERROR;
        }
      }
    }
    @Override public void onPostExecute(    Integer pageCount){
      if (pageCount == MALFORMED_PDF_FILE_ERROR) {
        mOnMalformedPdfFileListener.onMalformedPdfFile();
        mPageCount=PrintDocumentInfo.PAGE_COUNT_UNKNOWN;
      }
 else {
        mPageCount=pageCount;
      }
      if (callback != null) {
        callback.run();
      }
    }
  }
.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR,(Void[])null);
}

Fixed version (ground truth):
public void open(final ParcelFileDescriptor source,final Runnable callback){
  mPageContentCache.invalidate();
  new AsyncTask<Void,Void,Integer>(){
    @Override protected void onPreExecute(){
      Intent intent=new Intent(mContext,PdfRendererService.class);
      mContext.bindService(intent,AsyncRenderer.this,Context.BIND_AUTO_CREATE);
    }
    @Override protected Integer doInBackground(    Void... params){
synchronized (mLock) {
        while (mRenderer == null) {
          try {
            mLock.wait();
          }
 catch (          InterruptedException ie) {
          }
        }
        try {
          return mRenderer.openDocument(source);
        }
 catch (        RemoteException re) {
          Log.e(LOG_TAG,"String_Node_Str");
          return MALFORMED_PDF_FILE_ERROR;
        }
 finally {
          IoUtils.closeQuietly(source);
        }
      }
    }
    @Override public void onPostExecute(    Integer pageCount){
      if (pageCount == MALFORMED_PDF_FILE_ERROR) {
        mOnMalformedPdfFileListener.onMalformedPdfFile();
        mPageCount=PrintDocumentInfo.PAGE_COUNT_UNKNOWN;
      }
 else {
        mPageCount=pageCount;
      }
      if (callback != null) {
        callback.run();
      }
    }
  }
.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR,(Void[])null);
}
Program: 197709
Project: 197709
Buggy source:
private Bitmap getBitmapForSize(int width,int height){
  if (mBitmap != null) {
    if (mBitmap.getWidth() == width && mBitmap.getHeight() == height) {
      return mBitmap;
    }
    mBitmap.recycle();
  }
  mBitmap=Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_8888);
  return mBitmap;
}

Fixed version (ground truth):
private Bitmap getBitmapForSize(int width,int height){
  if (mBitmap != null) {
    if (mBitmap.getWidth() == width && mBitmap.getHeight() == height) {
      mBitmap.eraseColor(Color.WHITE);
      return mBitmap;
    }
    mBitmap.recycle();
  }
  mBitmap=Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_8888);
  mBitmap.eraseColor(Color.WHITE);
  return mBitmap;
}
Program: 197710
Project: 197710
Buggy source:
public PrintPreviewController(PrintActivity activity,MutexFileProvider fileProvider){
  mActivity=activity;
  mHandler=new MyHandler(activity.getMainLooper());
  mFileProvider=fileProvider;
  mPrintOptionsLayout=(PrintOptionsLayout)activity.findViewById(R.id.options_container);
  mPageAdapter=new PageAdapter(activity,activity,this);
  final int columnCount=mActivity.getResources().getInteger(R.integer.preview_page_per_row_count);
  mLayoutManger=new StaggeredGridLayoutManager(columnCount,OrientationHelper.VERTICAL);
  mRecyclerView=(RecyclerView)activity.findViewById(R.id.preview_content);
  mRecyclerView.setLayoutManager(mLayoutManger);
  mRecyclerView.setAdapter(mPageAdapter);
  mPreloadController=new PreloadController(mRecyclerView);
  mRecyclerView.setOnScrollListener(mPreloadController);
  mContentView=(PrintContentView)activity.findViewById(R.id.options_content);
  mEmbeddedContentContainer=(EmbeddedContentContainer)activity.findViewById(R.id.embedded_content_container);
  mEmbeddedContentContainer.setOnSizeChangeListener(this);
}

Fixed version (ground truth):
public PrintPreviewController(PrintActivity activity,MutexFileProvider fileProvider){
  mActivity=activity;
  mHandler=new MyHandler(activity.getMainLooper());
  mFileProvider=fileProvider;
  mPrintOptionsLayout=(PrintOptionsLayout)activity.findViewById(R.id.options_container);
  mPageAdapter=new PageAdapter(activity,activity,this);
  final int columnCount=mActivity.getResources().getInteger(R.integer.preview_page_per_row_count);
  mLayoutManger=new GridLayoutManager(mActivity,columnCount);
  mRecyclerView=(RecyclerView)activity.findViewById(R.id.preview_content);
  mRecyclerView.setLayoutManager(mLayoutManger);
  mRecyclerView.setAdapter(mPageAdapter);
  mPreloadController=new PreloadController(mRecyclerView);
  mRecyclerView.setOnScrollListener(mPreloadController);
  mContentView=(PrintContentView)activity.findViewById(R.id.options_content);
  mEmbeddedContentContainer=(EmbeddedContentContainer)activity.findViewById(R.id.embedded_content_container);
  mEmbeddedContentContainer.setOnSizeChangeListener(this);
}
Program: 197711
Project: 197711
Buggy source:
public void init(PageContentProvider provider,MediaSize mediaSize,Margins minMargins){
  if (mProvider == null ? provider == null : mProvider.equals(provider) && ((mAttributes.getMediaSize() == null) ? mediaSize == null : mAttributes.getMediaSize().equals(mediaSize)) && ((mAttributes.getMinMargins() == null) ? minMargins == null : mAttributes.getMinMargins().equals(minMargins))) {
    return;
  }
  mProvider=provider;
  mAttributes.setMediaSize(mediaSize);
  mAttributes.setMinMargins(minMargins);
  mContentRequested=false;
  if (mProvider == null && getBackground() != mEmptyState) {
    setBackground(mEmptyState);
  }
  requestPageContentIfNeeded();
}

Fixed version (ground truth):
public void init(PageContentProvider provider,MediaSize mediaSize,Margins minMargins){
  final boolean providerChanged=(mProvider == null) ? provider != null : !mProvider.equals(provider);
  final boolean mediaSizeChanged=(mMediaSize == null) ? mediaSize != null : !mMediaSize.equals(mediaSize);
  final boolean marginsChanged=(mMinMargins == null) ? minMargins != null : !mMinMargins.equals(minMargins);
  if (!providerChanged && !mediaSizeChanged && !marginsChanged) {
    return;
  }
  mProvider=provider;
  mMediaSize=mediaSize;
  mMinMargins=minMargins;
  mContentRequested=false;
  mNeedsLayout=mNeedsLayout || mediaSizeChanged || marginsChanged;
  if (mProvider == null && getBackground() != mEmptyState) {
    setBackground(mEmptyState);
  }
  requestPageContentIfNeeded();
}
Program: 197712
Project: 197712
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  requestPageContentIfNeeded();
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  mNeedsLayout=false;
  requestPageContentIfNeeded();
}
Program: 197713
Project: 197713
Buggy source:
private void requestPageContentIfNeeded(){
  if (getWidth() > 0 && getHeight() > 0 && !mContentRequested && mProvider != null) {
    mContentRequested=true;
    mProvider.getPageContent(new RenderSpec(getWidth(),getHeight(),mAttributes),this);
  }
}

Fixed version (ground truth):
private void requestPageContentIfNeeded(){
  if (getWidth() > 0 && getHeight() > 0 && !mContentRequested && mProvider != null && !mNeedsLayout) {
    mContentRequested=true;
    mProvider.getPageContent(new RenderSpec(getWidth(),getHeight(),mMediaSize,mMinMargins),this);
  }
}
Program: 197714
Project: 197714
Buggy source:
public RenderSpec(int bitmapWidth,int bitmapHeight,PrintAttributes printAttributes){
  this.bitmapWidth=bitmapWidth;
  this.bitmapHeight=bitmapHeight;
  this.printAttributes=printAttributes;
}

Fixed version (ground truth):
public RenderSpec(int bitmapWidth,int bitmapHeight,MediaSize mediaSize,Margins minMargins){
  this.bitmapWidth=bitmapWidth;
  this.bitmapHeight=bitmapHeight;
  printAttributes.setMediaSize(mediaSize);
  printAttributes.setMinMargins(minMargins);
}
Program: 197715
Project: 197715
Buggy source:
public void open(final ParcelFileDescriptor source,final Runnable callback){
  mPageContentCache.invalidate();
  new AsyncTask<Void,Void,Integer>(){
    @Override protected void onPreExecute(){
      Intent intent=new Intent(mContext,PdfRendererService.class);
      mContext.bindService(intent,AsyncRenderer.this,Context.BIND_AUTO_CREATE);
    }
    @Override protected Integer doInBackground(    Void... params){
synchronized (mLock) {
        while (mRenderer == null) {
          try {
            mLock.wait();
          }
 catch (          InterruptedException ie) {
          }
        }
        try {
          return mRenderer.openDocument(source);
        }
 catch (        RemoteException re) {
          Log.e(LOG_TAG,"String_Node_Str");
          return MALFORMED_PDF_FILE_ERROR;
        }
      }
    }
    @Override public void onPostExecute(    Integer pageCount){
      if (pageCount == MALFORMED_PDF_FILE_ERROR) {
        mOnMalformedPdfFileListener.onMalformedPdfFile();
        mPageCount=PrintDocumentInfo.PAGE_COUNT_UNKNOWN;
      }
 else {
        mPageCount=pageCount;
      }
      if (callback != null) {
        callback.run();
      }
    }
  }
.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR,(Void[])null);
}

Fixed version (ground truth):
public void open(final ParcelFileDescriptor source,final Runnable callback){
  mPageContentCache.invalidate();
  new AsyncTask<Void,Void,Integer>(){
    @Override protected void onPreExecute(){
      Intent intent=new Intent(mContext,PdfRendererService.class);
      mContext.bindService(intent,AsyncRenderer.this,Context.BIND_AUTO_CREATE);
    }
    @Override protected Integer doInBackground(    Void... params){
synchronized (mLock) {
        while (mRenderer == null) {
          try {
            mLock.wait();
          }
 catch (          InterruptedException ie) {
          }
        }
        try {
          return mRenderer.openDocument(source);
        }
 catch (        RemoteException re) {
          Log.e(LOG_TAG,"String_Node_Str");
          return MALFORMED_PDF_FILE_ERROR;
        }
 finally {
          IoUtils.closeQuietly(source);
        }
      }
    }
    @Override public void onPostExecute(    Integer pageCount){
      if (pageCount == MALFORMED_PDF_FILE_ERROR) {
        mOnMalformedPdfFileListener.onMalformedPdfFile();
        mPageCount=PrintDocumentInfo.PAGE_COUNT_UNKNOWN;
      }
 else {
        mPageCount=pageCount;
      }
      if (callback != null) {
        callback.run();
      }
    }
  }
.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR,(Void[])null);
}
Program: 197716
Project: 197716
Buggy source:
private Bitmap getBitmapForSize(int width,int height){
  if (mBitmap != null) {
    if (mBitmap.getWidth() == width && mBitmap.getHeight() == height) {
      return mBitmap;
    }
    mBitmap.recycle();
  }
  mBitmap=Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_8888);
  return mBitmap;
}

Fixed version (ground truth):
private Bitmap getBitmapForSize(int width,int height){
  if (mBitmap != null) {
    if (mBitmap.getWidth() == width && mBitmap.getHeight() == height) {
      mBitmap.eraseColor(Color.WHITE);
      return mBitmap;
    }
    mBitmap.recycle();
  }
  mBitmap=Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_8888);
  mBitmap.eraseColor(Color.WHITE);
  return mBitmap;
}
Program: 197717
Project: 197717
Buggy source:
public PrintPreviewController(PrintActivity activity,MutexFileProvider fileProvider){
  mActivity=activity;
  mHandler=new MyHandler(activity.getMainLooper());
  mFileProvider=fileProvider;
  mPrintOptionsLayout=(PrintOptionsLayout)activity.findViewById(R.id.options_container);
  mPageAdapter=new PageAdapter(activity,activity,this);
  final int columnCount=mActivity.getResources().getInteger(R.integer.preview_page_per_row_count);
  mLayoutManger=new StaggeredGridLayoutManager(columnCount,OrientationHelper.VERTICAL);
  mRecyclerView=(RecyclerView)activity.findViewById(R.id.preview_content);
  mRecyclerView.setLayoutManager(mLayoutManger);
  mRecyclerView.setAdapter(mPageAdapter);
  mPreloadController=new PreloadController(mRecyclerView);
  mRecyclerView.setOnScrollListener(mPreloadController);
  mContentView=(PrintContentView)activity.findViewById(R.id.options_content);
  mEmbeddedContentContainer=(EmbeddedContentContainer)activity.findViewById(R.id.embedded_content_container);
  mEmbeddedContentContainer.setOnSizeChangeListener(this);
}

Fixed version (ground truth):
public PrintPreviewController(PrintActivity activity,MutexFileProvider fileProvider){
  mActivity=activity;
  mHandler=new MyHandler(activity.getMainLooper());
  mFileProvider=fileProvider;
  mPrintOptionsLayout=(PrintOptionsLayout)activity.findViewById(R.id.options_container);
  mPageAdapter=new PageAdapter(activity,activity,this);
  final int columnCount=mActivity.getResources().getInteger(R.integer.preview_page_per_row_count);
  mLayoutManger=new GridLayoutManager(mActivity,columnCount);
  mRecyclerView=(RecyclerView)activity.findViewById(R.id.preview_content);
  mRecyclerView.setLayoutManager(mLayoutManger);
  mRecyclerView.setAdapter(mPageAdapter);
  mPreloadController=new PreloadController(mRecyclerView);
  mRecyclerView.setOnScrollListener(mPreloadController);
  mContentView=(PrintContentView)activity.findViewById(R.id.options_content);
  mEmbeddedContentContainer=(EmbeddedContentContainer)activity.findViewById(R.id.embedded_content_container);
  mEmbeddedContentContainer.setOnSizeChangeListener(this);
}
Program: 197718
Project: 197718
Buggy source:
public void init(PageContentProvider provider,MediaSize mediaSize,Margins minMargins){
  if (mProvider == null ? provider == null : mProvider.equals(provider) && ((mAttributes.getMediaSize() == null) ? mediaSize == null : mAttributes.getMediaSize().equals(mediaSize)) && ((mAttributes.getMinMargins() == null) ? minMargins == null : mAttributes.getMinMargins().equals(minMargins))) {
    return;
  }
  mProvider=provider;
  mAttributes.setMediaSize(mediaSize);
  mAttributes.setMinMargins(minMargins);
  mContentRequested=false;
  if (mProvider == null && getBackground() != mEmptyState) {
    setBackground(mEmptyState);
  }
  requestPageContentIfNeeded();
}

Fixed version (ground truth):
public void init(PageContentProvider provider,MediaSize mediaSize,Margins minMargins){
  final boolean providerChanged=(mProvider == null) ? provider != null : !mProvider.equals(provider);
  final boolean mediaSizeChanged=(mMediaSize == null) ? mediaSize != null : !mMediaSize.equals(mediaSize);
  final boolean marginsChanged=(mMinMargins == null) ? minMargins != null : !mMinMargins.equals(minMargins);
  if (!providerChanged && !mediaSizeChanged && !marginsChanged) {
    return;
  }
  mProvider=provider;
  mMediaSize=mediaSize;
  mMinMargins=minMargins;
  mContentRequested=false;
  mNeedsLayout=mNeedsLayout || mediaSizeChanged || marginsChanged;
  if (mProvider == null && getBackground() != mEmptyState) {
    setBackground(mEmptyState);
  }
  requestPageContentIfNeeded();
}
Program: 197719
Project: 197719
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  requestPageContentIfNeeded();
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  mNeedsLayout=false;
  requestPageContentIfNeeded();
}
Program: 197720
Project: 197720
Buggy source:
private void requestPageContentIfNeeded(){
  if (getWidth() > 0 && getHeight() > 0 && !mContentRequested && mProvider != null) {
    mContentRequested=true;
    mProvider.getPageContent(new RenderSpec(getWidth(),getHeight(),mAttributes),this);
  }
}

Fixed version (ground truth):
private void requestPageContentIfNeeded(){
  if (getWidth() > 0 && getHeight() > 0 && !mContentRequested && mProvider != null && !mNeedsLayout) {
    mContentRequested=true;
    mProvider.getPageContent(new RenderSpec(getWidth(),getHeight(),mMediaSize,mMinMargins),this);
  }
}
Program: 197721
Project: 197721
Buggy source:
public RenderSpec(int bitmapWidth,int bitmapHeight,PrintAttributes printAttributes){
  this.bitmapWidth=bitmapWidth;
  this.bitmapHeight=bitmapHeight;
  this.printAttributes=printAttributes;
}

Fixed version (ground truth):
public RenderSpec(int bitmapWidth,int bitmapHeight,MediaSize mediaSize,Margins minMargins){
  this.bitmapWidth=bitmapWidth;
  this.bitmapHeight=bitmapHeight;
  printAttributes.setMediaSize(mediaSize);
  printAttributes.setMinMargins(minMargins);
}
Program: 197722
Project: 197722
Buggy source:
public void open(final ParcelFileDescriptor source,final Runnable callback){
  mPageContentCache.invalidate();
  new AsyncTask<Void,Void,Integer>(){
    @Override protected void onPreExecute(){
      Intent intent=new Intent(mContext,PdfRendererService.class);
      mContext.bindService(intent,AsyncRenderer.this,Context.BIND_AUTO_CREATE);
    }
    @Override protected Integer doInBackground(    Void... params){
synchronized (mLock) {
        while (mRenderer == null) {
          try {
            mLock.wait();
          }
 catch (          InterruptedException ie) {
          }
        }
        try {
          return mRenderer.openDocument(source);
        }
 catch (        RemoteException re) {
          Log.e(LOG_TAG,"String_Node_Str");
          return MALFORMED_PDF_FILE_ERROR;
        }
      }
    }
    @Override public void onPostExecute(    Integer pageCount){
      if (pageCount == MALFORMED_PDF_FILE_ERROR) {
        mOnMalformedPdfFileListener.onMalformedPdfFile();
        mPageCount=PrintDocumentInfo.PAGE_COUNT_UNKNOWN;
      }
 else {
        mPageCount=pageCount;
      }
      if (callback != null) {
        callback.run();
      }
    }
  }
.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR,(Void[])null);
}

Fixed version (ground truth):
public void open(final ParcelFileDescriptor source,final Runnable callback){
  mPageContentCache.invalidate();
  new AsyncTask<Void,Void,Integer>(){
    @Override protected void onPreExecute(){
      Intent intent=new Intent(mContext,PdfRendererService.class);
      mContext.bindService(intent,AsyncRenderer.this,Context.BIND_AUTO_CREATE);
    }
    @Override protected Integer doInBackground(    Void... params){
synchronized (mLock) {
        while (mRenderer == null) {
          try {
            mLock.wait();
          }
 catch (          InterruptedException ie) {
          }
        }
        try {
          return mRenderer.openDocument(source);
        }
 catch (        RemoteException re) {
          Log.e(LOG_TAG,"String_Node_Str");
          return MALFORMED_PDF_FILE_ERROR;
        }
 finally {
          IoUtils.closeQuietly(source);
        }
      }
    }
    @Override public void onPostExecute(    Integer pageCount){
      if (pageCount == MALFORMED_PDF_FILE_ERROR) {
        mOnMalformedPdfFileListener.onMalformedPdfFile();
        mPageCount=PrintDocumentInfo.PAGE_COUNT_UNKNOWN;
      }
 else {
        mPageCount=pageCount;
      }
      if (callback != null) {
        callback.run();
      }
    }
  }
.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR,(Void[])null);
}
Program: 197723
Project: 197723
Buggy source:
private Bitmap getBitmapForSize(int width,int height){
  if (mBitmap != null) {
    if (mBitmap.getWidth() == width && mBitmap.getHeight() == height) {
      return mBitmap;
    }
    mBitmap.recycle();
  }
  mBitmap=Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_8888);
  return mBitmap;
}

Fixed version (ground truth):
private Bitmap getBitmapForSize(int width,int height){
  if (mBitmap != null) {
    if (mBitmap.getWidth() == width && mBitmap.getHeight() == height) {
      mBitmap.eraseColor(Color.WHITE);
      return mBitmap;
    }
    mBitmap.recycle();
  }
  mBitmap=Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_8888);
  mBitmap.eraseColor(Color.WHITE);
  return mBitmap;
}
Program: 197724
Project: 197724
Buggy source:
public PrintPreviewController(PrintActivity activity,MutexFileProvider fileProvider){
  mActivity=activity;
  mHandler=new MyHandler(activity.getMainLooper());
  mFileProvider=fileProvider;
  mPrintOptionsLayout=(PrintOptionsLayout)activity.findViewById(R.id.options_container);
  mPageAdapter=new PageAdapter(activity,activity,this);
  final int columnCount=mActivity.getResources().getInteger(R.integer.preview_page_per_row_count);
  mLayoutManger=new StaggeredGridLayoutManager(columnCount,OrientationHelper.VERTICAL);
  mRecyclerView=(RecyclerView)activity.findViewById(R.id.preview_content);
  mRecyclerView.setLayoutManager(mLayoutManger);
  mRecyclerView.setAdapter(mPageAdapter);
  mPreloadController=new PreloadController(mRecyclerView);
  mRecyclerView.setOnScrollListener(mPreloadController);
  mContentView=(PrintContentView)activity.findViewById(R.id.options_content);
  mEmbeddedContentContainer=(EmbeddedContentContainer)activity.findViewById(R.id.embedded_content_container);
  mEmbeddedContentContainer.setOnSizeChangeListener(this);
}

Fixed version (ground truth):
public PrintPreviewController(PrintActivity activity,MutexFileProvider fileProvider){
  mActivity=activity;
  mHandler=new MyHandler(activity.getMainLooper());
  mFileProvider=fileProvider;
  mPrintOptionsLayout=(PrintOptionsLayout)activity.findViewById(R.id.options_container);
  mPageAdapter=new PageAdapter(activity,activity,this);
  final int columnCount=mActivity.getResources().getInteger(R.integer.preview_page_per_row_count);
  mLayoutManger=new GridLayoutManager(mActivity,columnCount);
  mRecyclerView=(RecyclerView)activity.findViewById(R.id.preview_content);
  mRecyclerView.setLayoutManager(mLayoutManger);
  mRecyclerView.setAdapter(mPageAdapter);
  mPreloadController=new PreloadController(mRecyclerView);
  mRecyclerView.setOnScrollListener(mPreloadController);
  mContentView=(PrintContentView)activity.findViewById(R.id.options_content);
  mEmbeddedContentContainer=(EmbeddedContentContainer)activity.findViewById(R.id.embedded_content_container);
  mEmbeddedContentContainer.setOnSizeChangeListener(this);
}
Program: 197725
Project: 197725
Buggy source:
public void init(PageContentProvider provider,MediaSize mediaSize,Margins minMargins){
  if (mProvider == null ? provider == null : mProvider.equals(provider) && ((mAttributes.getMediaSize() == null) ? mediaSize == null : mAttributes.getMediaSize().equals(mediaSize)) && ((mAttributes.getMinMargins() == null) ? minMargins == null : mAttributes.getMinMargins().equals(minMargins))) {
    return;
  }
  mProvider=provider;
  mAttributes.setMediaSize(mediaSize);
  mAttributes.setMinMargins(minMargins);
  mContentRequested=false;
  if (mProvider == null && getBackground() != mEmptyState) {
    setBackground(mEmptyState);
  }
  requestPageContentIfNeeded();
}

Fixed version (ground truth):
public void init(PageContentProvider provider,MediaSize mediaSize,Margins minMargins){
  final boolean providerChanged=(mProvider == null) ? provider != null : !mProvider.equals(provider);
  final boolean mediaSizeChanged=(mMediaSize == null) ? mediaSize != null : !mMediaSize.equals(mediaSize);
  final boolean marginsChanged=(mMinMargins == null) ? minMargins != null : !mMinMargins.equals(minMargins);
  if (!providerChanged && !mediaSizeChanged && !marginsChanged) {
    return;
  }
  mProvider=provider;
  mMediaSize=mediaSize;
  mMinMargins=minMargins;
  mContentRequested=false;
  mNeedsLayout=mNeedsLayout || mediaSizeChanged || marginsChanged;
  if (mProvider == null && getBackground() != mEmptyState) {
    setBackground(mEmptyState);
  }
  requestPageContentIfNeeded();
}
Program: 197726
Project: 197726
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  requestPageContentIfNeeded();
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  mNeedsLayout=false;
  requestPageContentIfNeeded();
}
Program: 197727
Project: 197727
Buggy source:
private void requestPageContentIfNeeded(){
  if (getWidth() > 0 && getHeight() > 0 && !mContentRequested && mProvider != null) {
    mContentRequested=true;
    mProvider.getPageContent(new RenderSpec(getWidth(),getHeight(),mAttributes),this);
  }
}

Fixed version (ground truth):
private void requestPageContentIfNeeded(){
  if (getWidth() > 0 && getHeight() > 0 && !mContentRequested && mProvider != null && !mNeedsLayout) {
    mContentRequested=true;
    mProvider.getPageContent(new RenderSpec(getWidth(),getHeight(),mMediaSize,mMinMargins),this);
  }
}
Program: 197728
Project: 197728
Buggy source:
public RenderSpec(int bitmapWidth,int bitmapHeight,PrintAttributes printAttributes){
  this.bitmapWidth=bitmapWidth;
  this.bitmapHeight=bitmapHeight;
  this.printAttributes=printAttributes;
}

Fixed version (ground truth):
public RenderSpec(int bitmapWidth,int bitmapHeight,MediaSize mediaSize,Margins minMargins){
  this.bitmapWidth=bitmapWidth;
  this.bitmapHeight=bitmapHeight;
  printAttributes.setMediaSize(mediaSize);
  printAttributes.setMinMargins(minMargins);
}
Program: 197729
Project: 197729
Buggy source:
public void open(final ParcelFileDescriptor source,final Runnable callback){
  mPageContentCache.invalidate();
  new AsyncTask<Void,Void,Integer>(){
    @Override protected void onPreExecute(){
      Intent intent=new Intent(mContext,PdfRendererService.class);
      mContext.bindService(intent,AsyncRenderer.this,Context.BIND_AUTO_CREATE);
    }
    @Override protected Integer doInBackground(    Void... params){
synchronized (mLock) {
        while (mRenderer == null) {
          try {
            mLock.wait();
          }
 catch (          InterruptedException ie) {
          }
        }
        try {
          return mRenderer.openDocument(source);
        }
 catch (        RemoteException re) {
          Log.e(LOG_TAG,"String_Node_Str");
          return MALFORMED_PDF_FILE_ERROR;
        }
      }
    }
    @Override public void onPostExecute(    Integer pageCount){
      if (pageCount == MALFORMED_PDF_FILE_ERROR) {
        mOnMalformedPdfFileListener.onMalformedPdfFile();
        mPageCount=PrintDocumentInfo.PAGE_COUNT_UNKNOWN;
      }
 else {
        mPageCount=pageCount;
      }
      if (callback != null) {
        callback.run();
      }
    }
  }
.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR,(Void[])null);
}

Fixed version (ground truth):
public void open(final ParcelFileDescriptor source,final Runnable callback){
  mPageContentCache.invalidate();
  new AsyncTask<Void,Void,Integer>(){
    @Override protected void onPreExecute(){
      Intent intent=new Intent(mContext,PdfRendererService.class);
      mContext.bindService(intent,AsyncRenderer.this,Context.BIND_AUTO_CREATE);
    }
    @Override protected Integer doInBackground(    Void... params){
synchronized (mLock) {
        while (mRenderer == null) {
          try {
            mLock.wait();
          }
 catch (          InterruptedException ie) {
          }
        }
        try {
          return mRenderer.openDocument(source);
        }
 catch (        RemoteException re) {
          Log.e(LOG_TAG,"String_Node_Str");
          return MALFORMED_PDF_FILE_ERROR;
        }
 finally {
          IoUtils.closeQuietly(source);
        }
      }
    }
    @Override public void onPostExecute(    Integer pageCount){
      if (pageCount == MALFORMED_PDF_FILE_ERROR) {
        mOnMalformedPdfFileListener.onMalformedPdfFile();
        mPageCount=PrintDocumentInfo.PAGE_COUNT_UNKNOWN;
      }
 else {
        mPageCount=pageCount;
      }
      if (callback != null) {
        callback.run();
      }
    }
  }
.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR,(Void[])null);
}
Program: 197730
Project: 197730
Buggy source:
private Bitmap getBitmapForSize(int width,int height){
  if (mBitmap != null) {
    if (mBitmap.getWidth() == width && mBitmap.getHeight() == height) {
      return mBitmap;
    }
    mBitmap.recycle();
  }
  mBitmap=Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_8888);
  return mBitmap;
}

Fixed version (ground truth):
private Bitmap getBitmapForSize(int width,int height){
  if (mBitmap != null) {
    if (mBitmap.getWidth() == width && mBitmap.getHeight() == height) {
      mBitmap.eraseColor(Color.WHITE);
      return mBitmap;
    }
    mBitmap.recycle();
  }
  mBitmap=Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_8888);
  mBitmap.eraseColor(Color.WHITE);
  return mBitmap;
}
Program: 197731
Project: 197731
Buggy source:
public PrintPreviewController(PrintActivity activity,MutexFileProvider fileProvider){
  mActivity=activity;
  mHandler=new MyHandler(activity.getMainLooper());
  mFileProvider=fileProvider;
  mPrintOptionsLayout=(PrintOptionsLayout)activity.findViewById(R.id.options_container);
  mPageAdapter=new PageAdapter(activity,activity,this);
  final int columnCount=mActivity.getResources().getInteger(R.integer.preview_page_per_row_count);
  mLayoutManger=new StaggeredGridLayoutManager(columnCount,OrientationHelper.VERTICAL);
  mRecyclerView=(RecyclerView)activity.findViewById(R.id.preview_content);
  mRecyclerView.setLayoutManager(mLayoutManger);
  mRecyclerView.setAdapter(mPageAdapter);
  mPreloadController=new PreloadController(mRecyclerView);
  mRecyclerView.setOnScrollListener(mPreloadController);
  mContentView=(PrintContentView)activity.findViewById(R.id.options_content);
  mEmbeddedContentContainer=(EmbeddedContentContainer)activity.findViewById(R.id.embedded_content_container);
  mEmbeddedContentContainer.setOnSizeChangeListener(this);
}

Fixed version (ground truth):
public PrintPreviewController(PrintActivity activity,MutexFileProvider fileProvider){
  mActivity=activity;
  mHandler=new MyHandler(activity.getMainLooper());
  mFileProvider=fileProvider;
  mPrintOptionsLayout=(PrintOptionsLayout)activity.findViewById(R.id.options_container);
  mPageAdapter=new PageAdapter(activity,activity,this);
  final int columnCount=mActivity.getResources().getInteger(R.integer.preview_page_per_row_count);
  mLayoutManger=new GridLayoutManager(mActivity,columnCount);
  mRecyclerView=(RecyclerView)activity.findViewById(R.id.preview_content);
  mRecyclerView.setLayoutManager(mLayoutManger);
  mRecyclerView.setAdapter(mPageAdapter);
  mPreloadController=new PreloadController(mRecyclerView);
  mRecyclerView.setOnScrollListener(mPreloadController);
  mContentView=(PrintContentView)activity.findViewById(R.id.options_content);
  mEmbeddedContentContainer=(EmbeddedContentContainer)activity.findViewById(R.id.embedded_content_container);
  mEmbeddedContentContainer.setOnSizeChangeListener(this);
}
Program: 197732
Project: 197732
Buggy source:
public void init(PageContentProvider provider,MediaSize mediaSize,Margins minMargins){
  if (mProvider == null ? provider == null : mProvider.equals(provider) && ((mAttributes.getMediaSize() == null) ? mediaSize == null : mAttributes.getMediaSize().equals(mediaSize)) && ((mAttributes.getMinMargins() == null) ? minMargins == null : mAttributes.getMinMargins().equals(minMargins))) {
    return;
  }
  mProvider=provider;
  mAttributes.setMediaSize(mediaSize);
  mAttributes.setMinMargins(minMargins);
  mContentRequested=false;
  if (mProvider == null && getBackground() != mEmptyState) {
    setBackground(mEmptyState);
  }
  requestPageContentIfNeeded();
}

Fixed version (ground truth):
public void init(PageContentProvider provider,MediaSize mediaSize,Margins minMargins){
  final boolean providerChanged=(mProvider == null) ? provider != null : !mProvider.equals(provider);
  final boolean mediaSizeChanged=(mMediaSize == null) ? mediaSize != null : !mMediaSize.equals(mediaSize);
  final boolean marginsChanged=(mMinMargins == null) ? minMargins != null : !mMinMargins.equals(minMargins);
  if (!providerChanged && !mediaSizeChanged && !marginsChanged) {
    return;
  }
  mProvider=provider;
  mMediaSize=mediaSize;
  mMinMargins=minMargins;
  mContentRequested=false;
  mNeedsLayout=mNeedsLayout || mediaSizeChanged || marginsChanged;
  if (mProvider == null && getBackground() != mEmptyState) {
    setBackground(mEmptyState);
  }
  requestPageContentIfNeeded();
}
Program: 197733
Project: 197733
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  requestPageContentIfNeeded();
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  mNeedsLayout=false;
  requestPageContentIfNeeded();
}
Program: 197734
Project: 197734
Buggy source:
private void requestPageContentIfNeeded(){
  if (getWidth() > 0 && getHeight() > 0 && !mContentRequested && mProvider != null) {
    mContentRequested=true;
    mProvider.getPageContent(new RenderSpec(getWidth(),getHeight(),mAttributes),this);
  }
}

Fixed version (ground truth):
private void requestPageContentIfNeeded(){
  if (getWidth() > 0 && getHeight() > 0 && !mContentRequested && mProvider != null && !mNeedsLayout) {
    mContentRequested=true;
    mProvider.getPageContent(new RenderSpec(getWidth(),getHeight(),mMediaSize,mMinMargins),this);
  }
}
Program: 197735
Project: 197735
Buggy source:
public RenderSpec(int bitmapWidth,int bitmapHeight,PrintAttributes printAttributes){
  this.bitmapWidth=bitmapWidth;
  this.bitmapHeight=bitmapHeight;
  this.printAttributes=printAttributes;
}

Fixed version (ground truth):
public RenderSpec(int bitmapWidth,int bitmapHeight,MediaSize mediaSize,Margins minMargins){
  this.bitmapWidth=bitmapWidth;
  this.bitmapHeight=bitmapHeight;
  printAttributes.setMediaSize(mediaSize);
  printAttributes.setMinMargins(minMargins);
}
Program: 197736
Project: 197736
Buggy source:
public void open(final ParcelFileDescriptor source,final Runnable callback){
  mPageContentCache.invalidate();
  new AsyncTask<Void,Void,Integer>(){
    @Override protected void onPreExecute(){
      Intent intent=new Intent(mContext,PdfRendererService.class);
      mContext.bindService(intent,AsyncRenderer.this,Context.BIND_AUTO_CREATE);
    }
    @Override protected Integer doInBackground(    Void... params){
synchronized (mLock) {
        while (mRenderer == null) {
          try {
            mLock.wait();
          }
 catch (          InterruptedException ie) {
          }
        }
        try {
          return mRenderer.openDocument(source);
        }
 catch (        RemoteException re) {
          Log.e(LOG_TAG,"String_Node_Str");
          return MALFORMED_PDF_FILE_ERROR;
        }
      }
    }
    @Override public void onPostExecute(    Integer pageCount){
      if (pageCount == MALFORMED_PDF_FILE_ERROR) {
        mOnMalformedPdfFileListener.onMalformedPdfFile();
        mPageCount=PrintDocumentInfo.PAGE_COUNT_UNKNOWN;
      }
 else {
        mPageCount=pageCount;
      }
      if (callback != null) {
        callback.run();
      }
    }
  }
.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR,(Void[])null);
}

Fixed version (ground truth):
public void open(final ParcelFileDescriptor source,final Runnable callback){
  mPageContentCache.invalidate();
  new AsyncTask<Void,Void,Integer>(){
    @Override protected void onPreExecute(){
      Intent intent=new Intent(mContext,PdfRendererService.class);
      mContext.bindService(intent,AsyncRenderer.this,Context.BIND_AUTO_CREATE);
    }
    @Override protected Integer doInBackground(    Void... params){
synchronized (mLock) {
        while (mRenderer == null) {
          try {
            mLock.wait();
          }
 catch (          InterruptedException ie) {
          }
        }
        try {
          return mRenderer.openDocument(source);
        }
 catch (        RemoteException re) {
          Log.e(LOG_TAG,"String_Node_Str");
          return MALFORMED_PDF_FILE_ERROR;
        }
 finally {
          IoUtils.closeQuietly(source);
        }
      }
    }
    @Override public void onPostExecute(    Integer pageCount){
      if (pageCount == MALFORMED_PDF_FILE_ERROR) {
        mOnMalformedPdfFileListener.onMalformedPdfFile();
        mPageCount=PrintDocumentInfo.PAGE_COUNT_UNKNOWN;
      }
 else {
        mPageCount=pageCount;
      }
      if (callback != null) {
        callback.run();
      }
    }
  }
.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR,(Void[])null);
}
Program: 197737
Project: 197737
Buggy source:
private Bitmap getBitmapForSize(int width,int height){
  if (mBitmap != null) {
    if (mBitmap.getWidth() == width && mBitmap.getHeight() == height) {
      return mBitmap;
    }
    mBitmap.recycle();
  }
  mBitmap=Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_8888);
  return mBitmap;
}

Fixed version (ground truth):
private Bitmap getBitmapForSize(int width,int height){
  if (mBitmap != null) {
    if (mBitmap.getWidth() == width && mBitmap.getHeight() == height) {
      mBitmap.eraseColor(Color.WHITE);
      return mBitmap;
    }
    mBitmap.recycle();
  }
  mBitmap=Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_8888);
  mBitmap.eraseColor(Color.WHITE);
  return mBitmap;
}
Program: 197738
Project: 197738
Buggy source:
public PrintPreviewController(PrintActivity activity,MutexFileProvider fileProvider){
  mActivity=activity;
  mHandler=new MyHandler(activity.getMainLooper());
  mFileProvider=fileProvider;
  mPrintOptionsLayout=(PrintOptionsLayout)activity.findViewById(R.id.options_container);
  mPageAdapter=new PageAdapter(activity,activity,this);
  final int columnCount=mActivity.getResources().getInteger(R.integer.preview_page_per_row_count);
  mLayoutManger=new StaggeredGridLayoutManager(columnCount,OrientationHelper.VERTICAL);
  mRecyclerView=(RecyclerView)activity.findViewById(R.id.preview_content);
  mRecyclerView.setLayoutManager(mLayoutManger);
  mRecyclerView.setAdapter(mPageAdapter);
  mPreloadController=new PreloadController(mRecyclerView);
  mRecyclerView.setOnScrollListener(mPreloadController);
  mContentView=(PrintContentView)activity.findViewById(R.id.options_content);
  mEmbeddedContentContainer=(EmbeddedContentContainer)activity.findViewById(R.id.embedded_content_container);
  mEmbeddedContentContainer.setOnSizeChangeListener(this);
}

Fixed version (ground truth):
public PrintPreviewController(PrintActivity activity,MutexFileProvider fileProvider){
  mActivity=activity;
  mHandler=new MyHandler(activity.getMainLooper());
  mFileProvider=fileProvider;
  mPrintOptionsLayout=(PrintOptionsLayout)activity.findViewById(R.id.options_container);
  mPageAdapter=new PageAdapter(activity,activity,this);
  final int columnCount=mActivity.getResources().getInteger(R.integer.preview_page_per_row_count);
  mLayoutManger=new GridLayoutManager(mActivity,columnCount);
  mRecyclerView=(RecyclerView)activity.findViewById(R.id.preview_content);
  mRecyclerView.setLayoutManager(mLayoutManger);
  mRecyclerView.setAdapter(mPageAdapter);
  mPreloadController=new PreloadController(mRecyclerView);
  mRecyclerView.setOnScrollListener(mPreloadController);
  mContentView=(PrintContentView)activity.findViewById(R.id.options_content);
  mEmbeddedContentContainer=(EmbeddedContentContainer)activity.findViewById(R.id.embedded_content_container);
  mEmbeddedContentContainer.setOnSizeChangeListener(this);
}