nus-yam/ex-repair huggingface dataset:
Program: 170797
Project: 170797
Buggy source:
@Override public Object run(){
  nd_sem.reserve();
  return (null);
}

Fixed version (ground truth):
@Override public Object run(){
  try {
    if (peer_manager != null) {
      peer_manager.stopAll();
      stats.saveSessionTotals();
      DownloadManagerState dmState=download_manager.getDownloadState();
      dmState.setLongParameter(DownloadManagerState.PARAM_DOWNLOAD_LAST_ACTIVE_TIME,SystemTime.getCurrentTime());
      SimpleTimer.removeTickReceiver(DownloadManagerController.this);
      DownloadManagerRateController.removePeerManager(peer_manager);
      download_manager.getDownloadState().removeListener(dm_attribute_listener,DownloadManagerState.AT_FLAGS,DownloadManagerStateAttributeListener.WRITTEN);
      dm_attribute_listener=null;
    }
    download_manager.informStopped(peer_manager,stateAfterStopping == DownloadManager.STATE_QUEUED);
    peer_manager=null;
    DiskManager dm=getDiskManager();
    if (dm != null) {
      boolean went_async=dm.stop(closing);
      if (went_async) {
        try {
          int wait_count=0;
          Thread.sleep(10);
          while (!dm.isStopped()) {
            wait_count++;
            if (wait_count > 2 * 60 * 10) {
              Debug.out("String_Node_Str");
              break;
            }
 else             if (wait_count % 200 == 0) {
              Debug.out("String_Node_Str" + wait_count + "String_Node_Str");
            }
            Thread.sleep(100);
          }
        }
 catch (        Throwable e) {
          Debug.out(e);
        }
      }
      stats.setCompleted(stats.getCompleted());
      stats.recalcDownloadCompleteBytes();
      if (!download_manager.getAssumedComplete()) {
        download_manager.getDownloadState().save();
      }
      setDiskManager(null,null);
    }
  }
  finally {
    force_start=false;
    if (remove_data) {
      download_manager.deleteDataFiles();
    }
 else {
      if (for_removal && COConfigurationManager.getBooleanParameter("String_Node_Str")) {
        download_manager.deletePartialDataFiles();
      }
    }
    if (remove_torrent) {
      download_manager.deleteTorrentFile();
    }
    List<ExternalSeedPeer> to_remove=new ArrayList<>();
synchronized (http_seeds) {
      to_remove.addAll(http_seeds);
      http_seeds.clear();
    }
    for (    ExternalSeedPeer peer : to_remove) {
      peer.remove();
    }
    if (getState() == DownloadManager.STATE_STOPPING) {
      setState(stateAfterStopping,true);
    }
  }
  return (null);
}
Program: 170800
Project: 170800
Buggy source:
@Override public Object skinObjectInitialShow(SWTSkinObject skinObject,Object params){
  SWTSkinObject soListArea=getSkinObject("String_Node_Str");
  if (soListArea == null) {
    return null;
  }
  MultipleDocumentInterfaceSWT mdi=UIFunctionsManagerSWT.getUIFunctionsSWT().getMDISWT();
  if (mdi != null) {
    mdi_entry=mdi.getEntryFromSkinObject(skinObject);
    if (mdi_entry == null) {
      Debug.out("String_Node_Str");
      mdi_entry=mdi.getCurrentEntrySWT();
    }
  }
  initialize((Composite)soListArea.getControl());
  return null;
}

Fixed version (ground truth):
@Override public Object skinObjectInitialShow(SWTSkinObject skinObject,Object params){
  SWTSkinObject soListArea=getSkinObject("String_Node_Str");
  if (soListArea == null) {
    return null;
  }
  initialize((Composite)soListArea.getControl());
  return null;
}
Program: 170801
Project: 170801
Buggy source:
private static void checkI2PInstall(final String host_name){
synchronized (AENameServiceDescriptor.class) {
    if (i2p_checked) {
      return;
    }
    try {
      Core core=CoreFactory.getSingleton();
      if (core != null) {
        i2p_checked=true;
        PluginInterface pi=core.getPluginManager().getDefaultPluginInterface();
        pi.addListener(new PluginAdapter(){
          @Override public void initializationComplete(){
            if (I2PHelpers.isI2PInstalled()) {
              return;
            }
            final boolean[] install_outcome={false};
            String enable_i2p_reason=MessageText.getString("String_Node_Str",new String[]{host_name});
            I2PHelpers.installI2PHelper(enable_i2p_reason,"String_Node_Str",install_outcome,new Runnable(){
              @Override public void run(){
                if (!install_outcome[0]) {
                }
              }
            }
);
          }
        }
);
      }
    }
 catch (    Throwable e) {
    }
  }
}

Fixed version (ground truth):
private static void checkI2PInstall(final String host_name){
synchronized (AENameServiceJava9.class) {
    if (i2p_checked) {
      return;
    }
    try {
      Core core=CoreFactory.getSingleton();
      if (core != null) {
        i2p_checked=true;
        PluginInterface pi=core.getPluginManager().getDefaultPluginInterface();
        pi.addListener(new PluginAdapter(){
          @Override public void initializationComplete(){
            if (I2PHelpers.isI2PInstalled()) {
              return;
            }
            final boolean[] install_outcome={false};
            String enable_i2p_reason=MessageText.getString("String_Node_Str",new String[]{host_name});
            I2PHelpers.installI2PHelper(enable_i2p_reason,"String_Node_Str",install_outcome,new Runnable(){
              @Override public void run(){
                if (!install_outcome[0]) {
                }
              }
            }
);
          }
        }
);
      }
    }
 catch (    Throwable e) {
    }
  }
}
Program: 170803
Project: 170803
Buggy source:
public ExportedDataSource exportDataSource(){
  return (new ExportedDataSource(){
    public Class<? extends DataSourceImporter> getExporter(){
      return (SubscriptionManagerImpl.class);
    }
    public Map<String,Object> getExport(){
      Map<String,Object> map=new HashMap<>();
      map.put("String_Node_Str",getID());
      return (map);
    }
  }
);
}

Fixed version (ground truth):
public ExportedDataSource exportDataSource(){
  return (new ExportedDataSource(){
    public Class<? extends DataSourceImporter> getExporter(){
      return (SubscriptionManagerImpl.class);
    }
    public Map<String,Object> getExport(){
      Map<String,Object> map=new HashMap<>();
      map.put("String_Node_Str",getID());
      map.put("String_Node_Str",version);
      map.put("String_Node_Str",is_anonymous ? 1L : 0L);
      if (singleton_details != null) {
        Map sd=new HashMap(singleton_details);
        byte[] key=(byte[])sd.get("String_Node_Str");
        if (key instanceof byte[]) {
          sd.put("String_Node_Str",Base32.encode(key));
        }
        map.put("String_Node_Str",sd);
      }
      return (map);
    }
  }
);
}
Program: 170804
Project: 170804
Buggy source:
public Map<String,Object> getExport(){
  Map<String,Object> map=new HashMap<>();
  map.put("String_Node_Str",getID());
  return (map);
}

Fixed version (ground truth):
public Map<String,Object> getExport(){
  Map<String,Object> map=new HashMap<>();
  map.put("String_Node_Str",getID());
  map.put("String_Node_Str",version);
  map.put("String_Node_Str",is_anonymous ? 1L : 0L);
  if (singleton_details != null) {
    Map sd=new HashMap(singleton_details);
    byte[] key=(byte[])sd.get("String_Node_Str");
    if (key instanceof byte[]) {
      sd.put("String_Node_Str",Base32.encode(key));
    }
    map.put("String_Node_Str",sd);
  }
  return (map);
}
Program: 170805
Project: 170805
Buggy source:
public Object importDataSource(Map<String,Object> map){
  return (getSubscriptionByID((String)map.get("String_Node_Str")));
}

Fixed version (ground truth):
public Object importDataSource(Map<String,Object> map){
  String sid=(String)map.get("String_Node_Str");
  Subscription subs=getSubscriptionByID(sid);
  if (subs == null) {
    Map sd=(Map)map.get("String_Node_Str");
    if (sd != null) {
      String key=(String)sd.get("String_Node_Str");
      sd.put("String_Node_Str",Base32.decode(key));
      try {
        subs=createSingletonSubscription(sd,SubscriptionImpl.ADD_TYPE_IMPORT,true);
      }
 catch (      Throwable e) {
      }
    }
    if (subs == null) {
      int version=((Number)map.get("String_Node_Str")).intValue();
      boolean anon=((Number)map.get("String_Node_Str")).intValue() != 0;
      Subscription[] result=new Subscription[1];
      boolean[] returned={false};
synchronized (result) {
        lookupSubscription("String_Node_Str" + sid + "String_Node_Str",new byte[20],Base32.decode(sid),version,anon,new subsLookupListener(){
          @Override public void found(          byte[] hash,          Subscription subscription){
            boolean enable_callback;
synchronized (imported_sids) {
              enable_callback=!imported_sids.contains(sid);
              imported_sids.add(sid);
            }
synchronized (result) {
              result[0]=subscription;
              if (returned[0] && enable_callback) {
                Runnable callback=(Runnable)map.get("String_Node_Str");
                if (callback != null) {
                  callback.run();
                }
              }
            }
          }
          @Override public void failed(          byte[] hash,          SubscriptionException error){
          }
          @Override public void complete(          byte[] hash,          Subscription[] subscriptions){
          }
          @Override public boolean isCancelled(){
            return false;
          }
        }
);
        subs=result[0];
        returned[0]=true;
      }
    }
  }
  return (subs);
}
Program: 170808
Project: 170808
Buggy source:
public AuthAdapter(FragmentManager manager,AnimatedViewPager pager,ImageView authBackground,List<ImageView> sharedElements){
  super(manager);
  this.authBackground=authBackground;
  this.pager=pager;
  this.authArray=new SparseArray<>(getCount());
  this.sharedElements=sharedElements;
  pager.setDuration(400);
  final float textSize=pager.getResources().getDimension(R.dimen.folded_size);
  final float textPadding=pager.getResources().getDimension(R.dimen.folded_label_padding);
  factor=1 - (textSize + textPadding) / (pager.getWidth());
}

Fixed version (ground truth):
public AuthAdapter(FragmentManager manager,AnimatedViewPager pager,ImageView authBackground,List<ImageView> sharedElements){
  super(manager);
  this.authBackground=authBackground;
  this.pager=pager;
  this.authArray=new SparseArray<>(getCount());
  this.sharedElements=sharedElements;
  pager.setDuration(350);
  final float textSize=pager.getResources().getDimension(R.dimen.folded_size);
  final float textPadding=pager.getResources().getDimension(R.dimen.folded_label_padding);
  factor=1 - (textSize + textPadding) / (pager.getWidth());
}
Program: 170809
Project: 170809
Buggy source:
private void setUpMedia(){
  mMediaPlayer=new MediaPlayer();
  mMediaSession=new MediaSession(this,MusicService.SESSION_TAG);
  mMediaSession.setCallback(mSessionCallback);
  setState(PlaybackState.STATE_NONE);
  mMediaSession.setFlags(MediaSession.FLAG_HANDLES_MEDIA_BUTTONS | MediaSession.FLAG_HANDLES_TRANSPORT_CONTROLS);
  mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
  mNoisyIntentFilter=new IntentFilter(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
  mNoisyReceiver=new BecomingNoisyReceiver();
  mAudioManager=(AudioManager)getSystemService(AUDIO_SERVICE);
}

Fixed version (ground truth):
private void setUpMedia(){
  mMediaPlayer=new MediaPlayer();
  mMediaSession=new MediaSession(this,MusicService.SESSION_TAG);
  mMediaSession.setCallback(mSessionCallback);
  setState(PlaybackState.STATE_NONE);
  mMediaSession.setFlags(MediaSession.FLAG_HANDLES_MEDIA_BUTTONS | MediaSession.FLAG_HANDLES_TRANSPORT_CONTROLS);
  mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
  mNoisyIntentFilter=new IntentFilter(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
  mNoisyReceiver=new BecomingNoisyReceiver();
  mAudioManager=(AudioManager)getSystemService(AUDIO_SERVICE);
  registerReceiver(mNoisyReceiver,mNoisyIntentFilter);
}
Program: 170810
Project: 170810
Buggy source:
public void start(){
  mMediaPlayer.start();
  mDuration=mMediaPlayer.getDuration();
  setState(PlaybackState.STATE_PLAYING);
  mTickNotification.notifyPlay(this);
  registerReceiver(mNoisyReceiver,mNoisyIntentFilter);
  mAudioManager.requestAudioFocus(mAudioFocusChangeListener,AudioManager.STREAM_MUSIC,AudioManager.AUDIOFOCUS_GAIN);
  if (mUpdateListener != null) {
    mUpdateListener.startPlay();
  }
}

Fixed version (ground truth):
public void start(){
  mMediaPlayer.start();
  mDuration=mMediaPlayer.getDuration();
  setState(PlaybackState.STATE_PLAYING);
  mTickNotification.notifyPlay(this);
  mAudioManager.requestAudioFocus(mAudioFocusChangeListener,AudioManager.STREAM_MUSIC,AudioManager.AUDIOFOCUS_GAIN);
  if (mUpdateListener != null) {
    mUpdateListener.startPlay();
  }
}
Program: 170812
Project: 170812
Buggy source:
public DataManager(Context context){
  mCacheRepo=new CacheRepoImpl(context);
  mConfigRepo=new ConfigRepoImpl(context);
}

Fixed version (ground truth):
private DataManager(Context context){
  mCacheRepo=new CacheRepoImpl(context);
  mConfigRepo=new ConfigRepoImpl(context);
}
Program: 170813
Project: 170813
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case android.R.id.home:
    if (isNavigatingMain()) {
      mDrawerLayout.openDrawer(GravityCompat.START);
    }
 else {
      super.onBackPressed();
    }
  return true;
case R.id.action_search:
mNavigator.navigeteToSearch(this);
return true;
case R.id.action_clear:
postClearEvent();
return true;
}
return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case android.R.id.home:
    if (isNavigatingMain()) {
      mDrawerLayout.openDrawer(GravityCompat.START);
    }
 else {
      super.onBackPressed();
    }
  return true;
case R.id.action_search:
mNavigator.navigateToSearch(this);
return true;
case R.id.action_clear:
postClearEvent();
return true;
}
return super.onOptionsItemSelected(item);
}
Program: 170814
Project: 170814
Buggy source:
/** 
 * 设置侧滑抽屉的属性
 * @param songEntity 当前播放音乐
 */
private void setNavHeadView(SongEntity songEntity){
  if (songEntity == null) {
    return;
  }
  mNavTitle.setText(songEntity.title);
  mNavSinger.setText(songEntity.artistName);
  ImageLoader.getInstance().display(MainActivity.this,new ImageConfig.Builder().url(songEntity.albumCover).isRound(false).placeholder(R.drawable.ic_default).into(mImgNavHeadBg).build());
  mImgNavHeadBg.setColorFilter(ContextCompat.getColor(MainActivity.this,R.color.colorDarkerTransparent),PorterDuff.Mode.SRC_OVER);
}

Fixed version (ground truth):
/** 
 * 设置侧滑抽屉的属性
 * @param songEntity 当前播放音乐
 */
private void setNavHeadView(SongEntity songEntity){
  if (songEntity == null || isDestroyed()) {
    return;
  }
  mNavTitle.setText(songEntity.title);
  mNavSinger.setText(songEntity.artistName);
  ImageLoader.getInstance().display(MainActivity.this,new ImageConfig.Builder().url(songEntity.albumCover).isRound(false).placeholder(R.drawable.ic_default).into(mImgNavHeadBg).build());
  mImgNavHeadBg.setColorFilter(ContextCompat.getColor(MainActivity.this,R.color.colorDarkerTransparent),PorterDuff.Mode.SRC_OVER);
}
Program: 170815
Project: 170815
Buggy source:
/** 
 * 设置底部快捷控制条的属性
 * @param songEntity 当前播放音乐
 */
private void setMusicBarView(SongEntity songEntity){
  if (!this.isDestroyed() && songEntity != null) {
    mTxtCurSong.setText(SubTextUtil.addEllipsis(songEntity.title,15));
    mTxtCurSinger.setText(SubTextUtil.addEllipsis(songEntity.artistName,15));
    ImageLoader.getInstance().display(MainActivity.this,new ImageConfig.Builder().url(songEntity.albumCover).isRound(false).placeholder(R.drawable.ic_default).into(mImgCurSong).build());
  }
}

Fixed version (ground truth):
/** 
 * 设置底部快捷控制条的属性
 * @param songEntity 当前播放音乐
 */
private void setMusicBarView(SongEntity songEntity){
  if (songEntity == null || isDestroyed()) {
    return;
  }
  mTxtCurSong.setText(SubTextUtil.addEllipsis(songEntity.title,15));
  mTxtCurSinger.setText(SubTextUtil.addEllipsis(songEntity.artistName,15));
  ImageLoader.getInstance().display(MainActivity.this,new ImageConfig.Builder().url(songEntity.albumCover).isRound(false).placeholder(R.drawable.ic_default).into(mImgCurSong).build());
}
Program: 170816
Project: 170816
Buggy source:
@Override public ObservableSource<ResponseBody> apply(List<LrcBean> lrcBeans) throws Exception {
  if (lrcBeans == null || lrcBeans.isEmpty()) {
    return Observable.empty();
  }
  LrcBean lrcBean=lrcBeans.get(0);
  if (lrcBean == null) {
    return Observable.empty();
  }
  return RetrofitHelper.INSTANCE.createApi(SongService.class).downloadLrcFile(lrcBean.lrc);
}

Fixed version (ground truth):
@Override public ObservableSource<ResponseBody> apply(List<LrcBean> lrcBeans) throws Exception {
  if (lrcBeans == null || lrcBeans.isEmpty()) {
    return null;
  }
  LrcBean lrcBean=lrcBeans.get(0);
  if (lrcBean == null) {
    return null;
  }
  return RetrofitHelper.INSTANCE.createApi(SongService.class).downloadLrcFile(lrcBean.lrc);
}
Program: 170817
Project: 170817
Buggy source:
@Override public Observable<ResponseBody> getLrcData(String songName,String singer){
  return RetrofitHelper.INSTANCE.createApi(SongService.class).getOnLrcData(songName,singer).map(new Function<OnLineLrcEntity,List<LrcBean>>(){
    @Override public List<LrcBean> apply(    OnLineLrcEntity onLineLrcEntity) throws Exception {
      if (onLineLrcEntity == null) {
        return Collections.emptyList();
      }
      List<OnLineLrcEntity.ResultBean> result=onLineLrcEntity.result;
      if (result == null || result.isEmpty()) {
        return Collections.emptyList();
      }
      return LrcMapper.transform(result);
    }
  }
).flatMap(new Function<List<LrcBean>,ObservableSource<ResponseBody>>(){
    @Override public ObservableSource<ResponseBody> apply(    List<LrcBean> lrcBeans) throws Exception {
      if (lrcBeans == null || lrcBeans.isEmpty()) {
        return Observable.empty();
      }
      LrcBean lrcBean=lrcBeans.get(0);
      if (lrcBean == null) {
        return Observable.empty();
      }
      return RetrofitHelper.INSTANCE.createApi(SongService.class).downloadLrcFile(lrcBean.lrc);
    }
  }
);
}

Fixed version (ground truth):
@Override public Observable<ResponseBody> getLrcData(String songName,String singer){
  return RetrofitHelper.INSTANCE.createApi(SongService.class).getOnLrcData(songName,singer).map(new Function<OnLineLrcEntity,List<LrcBean>>(){
    @Override public List<LrcBean> apply(    OnLineLrcEntity onLineLrcEntity) throws Exception {
      if (onLineLrcEntity == null) {
        return Collections.emptyList();
      }
      List<OnLineLrcEntity.ResultBean> result=onLineLrcEntity.result;
      if (result == null || result.isEmpty()) {
        return Collections.emptyList();
      }
      return LrcMapper.transform(result);
    }
  }
).flatMap(new Function<List<LrcBean>,ObservableSource<ResponseBody>>(){
    @Override public ObservableSource<ResponseBody> apply(    List<LrcBean> lrcBeans) throws Exception {
      if (lrcBeans == null || lrcBeans.isEmpty()) {
        return null;
      }
      LrcBean lrcBean=lrcBeans.get(0);
      if (lrcBean == null) {
        return null;
      }
      return RetrofitHelper.INSTANCE.createApi(SongService.class).downloadLrcFile(lrcBean.lrc);
    }
  }
);
}
Program: 170818
Project: 170818
Buggy source:
private int getLrcWidth(){
  return (int)(getMeasuredWidth() - mHorizontalPadding * 2);
}

Fixed version (ground truth):
private int getLrcWidth(){
  return (int)(getWidth() - mHorizontalPadding * 2);
}
Program: 170819
Project: 170819
Buggy source:
private int getLrcHeight(){
  return (int)(getMeasuredHeight() - mVerticalPadding * 2);
}

Fixed version (ground truth):
private int getLrcHeight(){
  return (int)(getHeight() - mVerticalPadding * 2);
}
Program: 170820
Project: 170820
Buggy source:
@Override protected void onDraw(Canvas canvas){
  super.onDraw(canvas);
  if (isLrcEmpty()) {
    drawEmptyText(canvas);
    return;
  }
  float y=getLrcHeight() / 2;
  float x=getLrcWidth() * 0.5f + mHorizontalPadding;
  for (int i=0; i < getLrcCount(); i++) {
    if (i > 0) {
      y+=(getTextHeight(i - 1) + getTextHeight(i)) / 2 + mLrcLineSpaceHeight;
    }
    if (mCurrentLine == i) {
      mTextPaint.setColor(mCurrentPlayLineColor);
    }
 else {
      mTextPaint.setColor(mNormalColor);
    }
    @SuppressLint("String_Node_Str") StaticLayout staticLayout=new StaticLayout(mLrcData.get(i).getText(),mTextPaint,getLrcWidth(),Layout.Alignment.ALIGN_NORMAL,1f,0f,false);
    canvas.save();
    canvas.translate(x,y + mVerticalPadding - staticLayout.getHeight() / 2 - mOffset);
    staticLayout.draw(canvas);
    canvas.restore();
  }
}

Fixed version (ground truth):
@Override protected void onDraw(Canvas canvas){
  super.onDraw(canvas);
  if (isLrcEmpty()) {
    drawEmptyText(canvas);
    return;
  }
  mTextPaint.setTextSize(mLrcTextSize);
  mTextPaint.setTextAlign(Paint.Align.CENTER);
  float y=getLrcHeight() / 2;
  float x=getLrcWidth() * 0.5f + mHorizontalPadding;
  canvas.translate(0,-mOffset);
  for (int i=0; i < getLrcCount(); i++) {
    if (i > 0) {
      y+=(getTextHeight(i - 1) + getTextHeight(i)) / 2 + mLrcLineSpaceHeight;
    }
    if (mCurrentLine == i) {
      mTextPaint.setColor(mCurrentPlayLineColor);
    }
 else {
      mTextPaint.setColor(mNormalColor);
    }
    @SuppressLint("String_Node_Str") StaticLayout staticLayout=new StaticLayout(mLrcData.get(i).getText(),mTextPaint,getLrcWidth(),Layout.Alignment.ALIGN_NORMAL,1f,0f,false);
    canvas.save();
    canvas.translate(x,y + mVerticalPadding - staticLayout.getHeight() / 2);
    staticLayout.draw(canvas);
    canvas.restore();
  }
}
Program: 170821
Project: 170821
Buggy source:
public void setLrcData(List<Lrc> lrcData){
  resetView();
  mLrcData=lrcData;
  invalidate();
}

Fixed version (ground truth):
public void setLrcData(List<Lrc> lrcData){
  resetView(DEFAULT_CONTENT);
  mLrcData=lrcData;
  invalidate();
}
Program: 170822
Project: 170822
Buggy source:
@Override public boolean onTouchEvent(MotionEvent event){
  if (isLrcEmpty()) {
    return super.onTouchEvent(event);
  }
  if (mVelocityTracker == null) {
    mVelocityTracker=VelocityTracker.obtain();
  }
  mVelocityTracker.addMovement(event);
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
    removeCallbacks(mScrollRunnable);
  performClick();
if (!mOverScroller.isFinished()) {
  mOverScroller.abortAnimation();
}
mLastMotionY=event.getY();
isUserScroll=true;
break;
case MotionEvent.ACTION_MOVE:
float moveY=event.getY() - mLastMotionY;
if (Math.abs(moveY) > mScaledTouchSlop) {
mOffset-=moveY;
if (mOffset < 0) {
mOffset=Math.max(mOffset,-getTextHeight(0) - mLrcLineSpaceHeight);
}
float maxHeight=getItemOffsetY(getLrcCount() - 1);
if (mOffset > maxHeight) {
mOffset=Math.min(mOffset,maxHeight + getTextHeight(0) + mLrcLineSpaceHeight);
}
invalidate();
mLastMotionY=event.getY();
}
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
handleActionUp();
break;
}
return true;
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(MotionEvent event){
  if (isLrcEmpty()) {
    return super.onTouchEvent(event);
  }
  if (mVelocityTracker == null) {
    mVelocityTracker=VelocityTracker.obtain();
  }
  mVelocityTracker.addMovement(event);
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
    performClick();
  removeCallbacks(mScrollRunnable);
if (!mOverScroller.isFinished()) {
  mOverScroller.abortAnimation();
}
mLastMotionY=event.getY();
isUserScroll=true;
break;
case MotionEvent.ACTION_MOVE:
float moveY=event.getY() - mLastMotionY;
if (Math.abs(moveY) > mScaledTouchSlop) {
mOffset-=moveY;
if (mOffset < 0) {
mOffset=Math.max(mOffset,-getTextHeight(0) - mLrcLineSpaceHeight);
}
float maxHeight=getItemOffsetY(getLrcCount() - 1);
if (mOffset > maxHeight) {
mOffset=Math.min(mOffset,maxHeight + getTextHeight(0) + mLrcLineSpaceHeight);
}
mLastMotionY=event.getY();
postInvalidate();
}
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
handleActionUp();
break;
}
return true;
}
Program: 170823
Project: 170823
Buggy source:
private void resetView(){
  if (mLrcData != null) {
    mLrcData.clear();
  }
  mCurrentLine=0;
  mOffset=0;
  isUserScroll=false;
  removeCallbacks(mScrollRunnable);
  invalidate();
}

Fixed version (ground truth):
public void resetView(String defaultContent){
  if (mLrcData != null) {
    mLrcData.clear();
  }
  mCurrentLine=0;
  mOffset=0;
  isUserScroll=false;
  mDefaultContent=defaultContent;
  removeCallbacks(mScrollRunnable);
  invalidate();
}
Program: 170824
Project: 170824
Buggy source:
@Override public void loadLrc(SongEntity entity){
  LrcUseCase.Param param=new LrcUseCase.Param(entity.title,"String_Node_Str");
  String fileName=entity.title + "String_Node_Str" + entity.artistName+ "String_Node_Str";
  File lrcFile=new File(FileManager.getInstance().getLrcDir().getAbsolutePath(),fileName);
  Observable.just(lrcFile).flatMap(file -> {
    if (file.exists() && file.canRead()) {
      return Observable.just(file);
    }
    return mLrcUseCase.buildObservable(param).flatMap(body -> {
      boolean saveFile=FileManager.getInstance().saveFile(body.byteStream(),fileName);
      return saveFile ? Observable.just(file) : Observable.empty();
    }
);
  }
).map((Function<File,List<Lrc>>)file -> {
    if (file == null || !file.exists()) {
      return Collections.emptyList();
    }
    return LrcParser.parseLrcFromFile(file);
  }
).compose(RxHelper.ioMain()).subscribeWith(new DefaultDisposableObserver<List<Lrc>>(){
    @Override protected void onStart(){
      super.onStart();
      if (getView() == null) {
        return;
      }
      getView().startDownloadLrc();
    }
    @Override public void onNext(    List<Lrc> lrcs){
      super.onNext(lrcs);
      if (getView() == null) {
        return;
      }
      getView().downloadLrcSuccess(lrcs);
    }
    @Override public void onError(    Throwable e){
      super.onError(e);
      if (getView() == null) {
        return;
      }
      getView().downloadFailed(e);
    }
  }
);
}

Fixed version (ground truth):
@Override public void loadLrc(SongEntity entity){
  LrcUseCase.Param param=new LrcUseCase.Param(entity.title,"String_Node_Str");
  String fileName=entity.title + "String_Node_Str" + entity.artistName+ "String_Node_Str";
  File lrcFile=new File(FileManager.getInstance().getLrcDir().getAbsolutePath(),fileName);
  Observable.just(lrcFile).flatMap(file -> {
    if (file.exists() && file.canRead()) {
      return Observable.just(file);
    }
    return mLrcUseCase.buildObservable(param).flatMap(responseBody -> {
      boolean saveFile=FileManager.getInstance().saveFile(responseBody.byteStream(),fileName);
      return saveFile ? Observable.just(file) : null;
    }
);
  }
).map((Function<File,List<Lrc>>)file -> {
    if (file == null || !file.exists()) {
      return Collections.emptyList();
    }
    return LrcParser.parseLrcFromFile(file);
  }
).compose(RxHelper.ioMain()).subscribeWith(new DefaultDisposableObserver<List<Lrc>>(){
    @Override protected void onStart(){
      super.onStart();
      if (getView() == null) {
        return;
      }
      getView().startDownloadLrc();
    }
    @Override public void onNext(    List<Lrc> lrcs){
      super.onNext(lrcs);
      if (getView() == null) {
        return;
      }
      getView().downloadLrcSuccess(lrcs);
    }
    @Override public void onError(    Throwable e){
      super.onError(e);
      if (getView() == null) {
        return;
      }
      getView().downloadFailed(e);
    }
  }
);
}
Program: 170825
Project: 170825
Buggy source:
@Override public void downloadLrcSuccess(List<Lrc> lrcs){
  if (lrcs == null || lrcs.isEmpty()) {
    mLvSimple.setDefaultContent("String_Node_Str");
    return;
  }
  mLvSimple.setCurrentPlayLineColor(ThemeHelper.getThemeColorResId(this));
  mLvSimple.setLrcData(lrcs);
}

Fixed version (ground truth):
@Override public void downloadLrcSuccess(List<Lrc> lrcs){
  if (lrcs == null || lrcs.isEmpty()) {
    mLvSimple.setDefaultContent("String_Node_Str");
    return;
  }
  mLvSimple.setCurrentPlayLineColor(ThemeHelper.getThemeColorResId(this));
  mLvSimple.setLrcData(lrcs);
  mLvSimple.updateTime(MusicManager.getInstance().getCurrentProgress());
  mLvFull.setLrcData(lrcs);
  mLvFull.updateTime(MusicManager.getInstance().getCurrentProgress());
}
Program: 170826
Project: 170826
Buggy source:
@Override public void downloadFailed(Throwable e){
  mLvSimple.setDefaultContent("String_Node_Str");
}

Fixed version (ground truth):
@Override public void downloadFailed(Throwable e){
  mLvSimple.setDefaultContent("String_Node_Str");
  mLvFull.setDefaultContent("String_Node_Str");
}
Program: 170827
Project: 170827
Buggy source:
@Override protected void initViews(){
  mIvPlay.setTransitionName(getString(R.string.play_view_transition_name));
  showBackIcon();
  setModeView();
  mToolbarCommon.setBackgroundColor(Color.TRANSPARENT);
}

Fixed version (ground truth):
@Override protected void initViews(){
  mIvPlay.setTransitionName(getString(R.string.play_view_transition_name));
  showBackIcon();
  setModeView();
  mToolbarCommon.setBackgroundColor(Color.TRANSPARENT);
  mLvSimple.setVisibility(View.VISIBLE);
  mLvFull.setVisibility(View.GONE);
  mLvSimple.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      mFlPlay.setVisibility(View.GONE);
      mLvFull.setVisibility(View.VISIBLE);
      mLvSimple.setVisibility(View.GONE);
      mImageViewBg.setVisibility(View.VISIBLE);
    }
  }
);
}
Program: 170828
Project: 170828
Buggy source:
private void setCurProgress(int progress,int duration){
  mSeekPlay.setMax(duration);
  mSeekPlay.setProgress(progress);
  mLvSimple.updateTime(progress);
}

Fixed version (ground truth):
private void setCurProgress(int progress,int duration){
  mSeekPlay.setMax(duration);
  mSeekPlay.setProgress(progress);
  mLvSimple.updateTime(progress);
  mLvFull.updateTime(progress);
}
Program: 170829
Project: 170829
Buggy source:
@Override public void startDownloadLrc(){
  mLvSimple.setDefaultContent("String_Node_Str");
}

Fixed version (ground truth):
@Override public void startDownloadLrc(){
  mLvSimple.resetView("String_Node_Str");
  mLvFull.resetView("String_Node_Str");
  mLvSimple.setDefaultContent("String_Node_Str");
  mLvFull.setDefaultContent("String_Node_Str");
}
Program: 170830
Project: 170830
Buggy source:
@Override public boolean onTouchEvent(MotionEvent event){
  if (isLrcEmpty()) {
    return super.onTouchEvent(event);
  }
  if (mVelocityTracker == null) {
    mVelocityTracker=VelocityTracker.obtain();
  }
  mVelocityTracker.addMovement(event);
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
    removeCallbacks(mScrollRunnable);
  removeCallbacks(mHideIndicatorRunnable);
if (!mOverScroller.isFinished()) {
  mOverScroller.abortAnimation();
}
mLastMotionX=event.getX();
mLastMotionY=event.getY();
isUserScroll=true;
isDragging=false;
break;
case MotionEvent.ACTION_MOVE:
float moveY=event.getY() - mLastMotionY;
if (Math.abs(moveY) > mScaledTouchSlop) {
isDragging=true;
isShowTimeIndicator=isEnableShowIndicator;
}
if (isDragging) {
mOffset-=moveY;
if (mOffset < 0) {
mOffset=Math.max(mOffset,-getTextHeight(0) - mLrcLineSpaceHeight);
}
float maxHeight=getItemOffsetY(getLrcCount() - 1);
if (mOffset > maxHeight) {
mOffset=Math.min(mOffset,maxHeight + getTextHeight(0) + mLrcLineSpaceHeight);
}
mLastMotionY=event.getY();
postInvalidate();
}
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
if (!isDragging && (!isShowTimeIndicator || !onClickPlayButton(event))) {
performClick();
}
handleActionUp(event);
break;
}
return true;
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(MotionEvent event){
  if (isLrcEmpty()) {
    return super.onTouchEvent(event);
  }
  if (mVelocityTracker == null) {
    mVelocityTracker=VelocityTracker.obtain();
  }
  mVelocityTracker.addMovement(event);
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
    removeCallbacks(mScrollRunnable);
  removeCallbacks(mHideIndicatorRunnable);
if (!mOverScroller.isFinished()) {
  mOverScroller.abortAnimation();
}
mLastMotionX=event.getX();
mLastMotionY=event.getY();
isUserScroll=true;
isDragging=false;
break;
case MotionEvent.ACTION_MOVE:
float moveY=event.getY() - mLastMotionY;
if (Math.abs(moveY) > mScaledTouchSlop) {
isDragging=true;
isShowTimeIndicator=isEnableShowIndicator;
}
if (isDragging) {
mOffset-=moveY;
if (mOffset < 0) {
mOffset=Math.max(mOffset,-getTextHeight(0) - mLrcLineSpaceHeight);
}
float maxHeight=getItemOffsetY(getLrcCount() - 1);
if (mOffset > maxHeight) {
mOffset=Math.min(mOffset,maxHeight + getTextHeight(getLrcCount() - 1) + mLrcLineSpaceHeight);
}
mLastMotionY=event.getY();
postInvalidate();
}
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
if (!isDragging && (!isShowTimeIndicator || !onClickPlayButton(event))) {
performClick();
}
handleActionUp(event);
break;
}
return true;
}
Program: 170831
Project: 170831
Buggy source:
private float getTextHeight(int linePosition){
  String text=mLrcData.get(linePosition).getText();
  StaticLayout staticLayout=mStaticLayoutHashMap.get(text);
  if (staticLayout == null) {
    staticLayout=new StaticLayout(text,mTextPaint,getLrcWidth(),Layout.Alignment.ALIGN_NORMAL,1f,0f,false);
    mStaticLayoutHashMap.put(text,staticLayout);
  }
  return staticLayout.getHeight();
}

Fixed version (ground truth):
private float getTextHeight(int linePosition){
  String text=mLrcData.get(linePosition).getText();
  StaticLayout staticLayout=mStaticLayoutHashMap.get(text);
  if (staticLayout == null) {
    mTextPaint.setTextSize(mLrcTextSize);
    staticLayout=new StaticLayout(text,mTextPaint,getLrcWidth(),Layout.Alignment.ALIGN_NORMAL,1f,0f,false);
    mStaticLayoutHashMap.put(text,staticLayout);
  }
  return staticLayout.getHeight();
}
Program: 170832
Project: 170832
Buggy source:
public void resetView(String defaultContent){
  if (mLrcData != null) {
    mLrcData.clear();
  }
  mLrcMap.clear();
  mStaticLayoutHashMap.clear();
  mCurrentLine=0;
  mOffset=0;
  isUserScroll=false;
  mDefaultContent=defaultContent;
  removeCallbacks(mScrollRunnable);
  postInvalidate();
}

Fixed version (ground truth):
public void resetView(String defaultContent){
  if (mLrcData != null) {
    mLrcData.clear();
  }
  mLrcMap.clear();
  mStaticLayoutHashMap.clear();
  mCurrentLine=0;
  mOffset=0;
  isUserScroll=false;
  isDragging=false;
  mDefaultContent=defaultContent;
  removeCallbacks(mScrollRunnable);
  invalidate();
}
Program: 170833
Project: 170833
Buggy source:
private void drawLrc(Canvas canvas,float x,float y,int i){
  String text=mLrcData.get(i).getText();
  StaticLayout staticLayout=mLrcMap.get(text);
  if (staticLayout == null) {
    staticLayout=new StaticLayout(text,mTextPaint,getLrcWidth(),Layout.Alignment.ALIGN_NORMAL,1f,0f,false);
    mLrcMap.put(text,staticLayout);
  }
  canvas.save();
  canvas.translate(x,y - getTextHeight(i) / 2 - mOffset);
  staticLayout.draw(canvas);
  canvas.restore();
}

Fixed version (ground truth):
private void drawLrc(Canvas canvas,float x,float y,int i){
  String text=mLrcData.get(i).getText();
  StaticLayout staticLayout=mLrcMap.get(text);
  if (staticLayout == null) {
    mTextPaint.setTextSize(mLrcTextSize);
    staticLayout=new StaticLayout(text,mTextPaint,getLrcWidth(),Layout.Alignment.ALIGN_NORMAL,1f,0f,false);
    mLrcMap.put(text,staticLayout);
  }
  canvas.save();
  canvas.translate(x,y - staticLayout.getHeight() / 2 - mOffset);
  staticLayout.draw(canvas);
  canvas.restore();
}
Program: 170834
Project: 170834
Buggy source:
public void setLrcData(List<Lrc> lrcData){
  resetView(DEFAULT_CONTENT);
  mLrcData=lrcData;
  postInvalidate();
}

Fixed version (ground truth):
public void setLrcData(List<Lrc> lrcData){
  resetView(DEFAULT_CONTENT);
  mLrcData=lrcData;
  invalidate();
}
Program: 170835
Project: 170835
Buggy source:
private float getItemOffsetY(int linePosition){
  float tempY=0;
  for (int i=1; i <= linePosition; i++) {
    tempY+=getTextHeight(i) + mLrcLineSpaceHeight;
  }
  return tempY;
}

Fixed version (ground truth):
private float getItemOffsetY(int linePosition){
  float tempY=0;
  for (int i=1; i <= linePosition; i++) {
    tempY+=(getTextHeight(i - 1) + getTextHeight(i)) / 2 + mLrcLineSpaceHeight;
  }
  return tempY;
}
Program: 170837
Project: 170837
Buggy source:
@Override public void showLightViews(boolean favorite){
  isFavorite=favorite;
  isDarkStyle=true;
  setViewsColor(Color.WHITE);
  mImgFavorite.setImageResource(favorite ? R.drawable.ic_favorite_white : R.drawable.ic_favorite_border_white);
  if (favorite) {
    setImageTint();
  }
  mLvSimple.setNormalColor(ContextCompat.getColor(this,R.color.gray_light));
  mLvFull.setNormalColor(ContextCompat.getColor(this,R.color.gray_light));
  mLvFull.setPlayDrawable(ContextCompat.getDrawable(this,R.drawable.play_white));
}

Fixed version (ground truth):
@Override public void showLightViews(boolean favorite){
  isFavorite=favorite;
  isDarkStyle=true;
  setViewsColor(Color.WHITE);
  mImgFavorite.setImageResource(favorite ? R.drawable.ic_favorite_white : R.drawable.ic_favorite_border_white);
  if (favorite) {
    setImageTint();
  }
  mLvSimple.setNormalColor(ContextCompat.getColor(this,R.color.gray_light));
  mLvFull.setNormalColor(ContextCompat.getColor(this,R.color.gray_light));
  mLvFull.setPlayDrawable(ContextCompat.getDrawable(this,R.drawable.play_white));
  mLvFull.setIndicatorLineColor(ContextCompat.getColor(this,R.color.gray_light));
  mLvFull.setIndicatorTextColor(ContextCompat.getColor(this,R.color.gray_light));
}
Program: 170838
Project: 170838
Buggy source:
@Override public void showDarkViews(boolean favorite){
  isFavorite=favorite;
  isDarkStyle=false;
  setViewsColor(Color.BLACK);
  mImgFavorite.setImageResource(favorite ? R.drawable.ic_favorite_white : R.drawable.ic_favorite_border_black);
  if (favorite) {
    setImageTint();
  }
  mLvSimple.setNormalColor(ContextCompat.getColor(this,R.color.txt_black));
  mLvFull.setNormalColor(ContextCompat.getColor(this,R.color.txt_black));
  mLvFull.setPlayDrawable(ContextCompat.getDrawable(this,R.drawable.play_black));
}

Fixed version (ground truth):
@Override public void showDarkViews(boolean favorite){
  isFavorite=favorite;
  isDarkStyle=false;
  setViewsColor(Color.BLACK);
  mImgFavorite.setImageResource(favorite ? R.drawable.ic_favorite_white : R.drawable.ic_favorite_border_black);
  if (favorite) {
    setImageTint();
  }
  mLvSimple.setNormalColor(ContextCompat.getColor(this,R.color.txt_black));
  mLvFull.setNormalColor(ContextCompat.getColor(this,R.color.txt_black));
  mLvFull.setPlayDrawable(ContextCompat.getDrawable(this,R.drawable.play_black));
  mLvFull.setIndicatorLineColor(ContextCompat.getColor(this,R.color.txt_black));
  mLvFull.setIndicatorTextColor(ContextCompat.getColor(this,R.color.txt_black));
}
Program: 170839
Project: 170839
Buggy source:
@Override public void setViewBgColor(int paletteColor){
  mClPlay.setBackgroundColor(paletteColor);
}

Fixed version (ground truth):
@Override public void setViewBgColor(int paletteColor){
}
Program: 170840
Project: 170840
Buggy source:
private void playPrevious(){
  MusicManager.getInstance().skipToPrevious();
  refreshFavoriteIcon();
}

Fixed version (ground truth):
private void playPrevious(){
  mVpPlayView.setCurrentItem(mVpPlayView.getCurrentItem() - 1,true);
  refreshFavoriteIcon();
}
Program: 170841
Project: 170841
Buggy source:
@Override public void onPageSelected(int position){
  if (MusicManager.getInstance().getCurPosition() > position) {
    MusicManager.getInstance().skipToPrevious();
  }
 else   if (MusicManager.getInstance().getCurPosition() < position) {
    MusicManager.getInstance().skipToNext();
  }
}

Fixed version (ground truth):
@Override public void onPageSelected(int position){
  if (MusicManager.getInstance().getCurPosition() > position) {
    mPlayHandler.sendEmptyMessageDelayed(MSG_PREVIOUS,DELAY_PLAY);
  }
 else   if (MusicManager.getInstance().getCurPosition() < position) {
    mPlayHandler.sendEmptyMessageDelayed(MSG_NEXT,DELAY_PLAY);
  }
}
Program: 170842
Project: 170842
Buggy source:
@Override public void onPageScrolled(int position,float positionOffset,int positionOffsetPixels){
  int color=adapter.getColorArr().get(position % songData.size());
  int nextColor=adapter.getColorArr().get((position + 1) % songData.size());
  int evaluateColor=(int)argbEvaluator.evaluate(positionOffset,color,nextColor);
  mClPlay.setBackgroundColor(evaluateColor);
}

Fixed version (ground truth):
@Override public void onPageScrolled(int position,float positionOffset,int positionOffsetPixels){
  int color=mPagerAdapter.getColorArr().get(position % songData.size());
  int nextColor=mPagerAdapter.getColorArr().get((position + 1) % songData.size());
  int evaluateColor=(int)argbEvaluator.evaluate(positionOffset,color,nextColor);
  mClPlay.setBackgroundColor(evaluateColor);
}
Program: 170843
Project: 170843
Buggy source:
@Override public void currentPlay(SongEntity songEntity){
  if (songEntity == null) {
    return;
  }
  mToolbarCommon.setTitle(songEntity.title);
  mToolbarCommon.setSubtitle(songEntity.artistName);
  mTxtTotalLength.setText(songEntity.songLength);
  mPresenter.setCoverImgUrl(songEntity.albumCover);
  mPresenter.isFavoriteSong(songEntity.id);
  if (MusicManager.getInstance().isPlaying() && !mPlayPause.isPlaying()) {
    mPlayPause.playWithoutAnim();
  }
  int curPosition=MusicManager.getInstance().getCurPosition();
  LogUtil.e("String_Node_Str","String_Node_Str" + curPosition);
  mVpPlayView.setCurrentItem(curPosition,false);
}

Fixed version (ground truth):
@Override public void currentPlay(SongEntity songEntity){
  if (songEntity == null) {
    return;
  }
  mToolbarCommon.setTitle(songEntity.title);
  mToolbarCommon.setSubtitle(songEntity.artistName);
  mTxtTotalLength.setText(songEntity.songLength);
  mPresenter.setCoverImgUrl(songEntity.albumCover);
  mPresenter.isFavoriteSong(songEntity.id);
  if (MusicManager.getInstance().isPlaying() && !mPlayPause.isPlaying()) {
    mPlayPause.playWithoutAnim();
  }
  int curPosition=MusicManager.getInstance().getCurPosition();
  LogUtil.e("String_Node_Str","String_Node_Str" + curPosition);
  mVpPlayView.setCurrentItem(curPosition);
}
Program: 170844
Project: 170844
Buggy source:
private void setUpViewPager(){
  mImageViewBg.setVisibility(View.INVISIBLE);
  List<SongEntity> songData=MusicManager.getInstance().getMusicService().getSongData();
  PlayViewAdapter adapter=new PlayViewAdapter(songData);
  mVpPlayView.setPageTransformer(false,new PlayPagerTransformer());
  mVpPlayView.setAdapter(adapter);
  ArgbEvaluator argbEvaluator=new ArgbEvaluator();
  mVpPlayView.addOnPageChangeListener(new ViewPager.OnPageChangeListener(){
    @Override public void onPageScrolled(    int position,    float positionOffset,    int positionOffsetPixels){
      int color=adapter.getColorArr().get(position % songData.size());
      int nextColor=adapter.getColorArr().get((position + 1) % songData.size());
      int evaluateColor=(int)argbEvaluator.evaluate(positionOffset,color,nextColor);
      mClPlay.setBackgroundColor(evaluateColor);
    }
    @Override public void onPageSelected(    int position){
      if (MusicManager.getInstance().getCurPosition() > position) {
        MusicManager.getInstance().skipToPrevious();
      }
 else       if (MusicManager.getInstance().getCurPosition() < position) {
        MusicManager.getInstance().skipToNext();
      }
    }
    @Override public void onPageScrollStateChanged(    int state){
    }
  }
);
}

Fixed version (ground truth):
private void setUpViewPager(){
  mImageViewBg.setVisibility(View.INVISIBLE);
  List<SongEntity> songData=MusicManager.getInstance().getMusicService().getSongData();
  mPagerAdapter=new PlayViewAdapter(songData);
  mVpPlayView.setPageTransformer(false,new PlayPagerTransformer());
  mVpPlayView.setAdapter(mPagerAdapter);
  int curPosition=MusicManager.getInstance().getCurPosition();
  mVpPlayView.setCurrentItem(curPosition);
  mPagerAdapter.setOnPaletteCompleteListener(() -> mClPlay.setBackgroundColor(mPagerAdapter.getColorArr().get(mVpPlayView.getCurrentItem())));
  ArgbEvaluator argbEvaluator=new ArgbEvaluator();
  mVpPlayView.addOnPageChangeListener(new ViewPager.OnPageChangeListener(){
    @Override public void onPageScrolled(    int position,    float positionOffset,    int positionOffsetPixels){
      int color=mPagerAdapter.getColorArr().get(position % songData.size());
      int nextColor=mPagerAdapter.getColorArr().get((position + 1) % songData.size());
      int evaluateColor=(int)argbEvaluator.evaluate(positionOffset,color,nextColor);
      mClPlay.setBackgroundColor(evaluateColor);
    }
    @Override public void onPageSelected(    int position){
      if (MusicManager.getInstance().getCurPosition() > position) {
        mPlayHandler.sendEmptyMessageDelayed(MSG_PREVIOUS,DELAY_PLAY);
      }
 else       if (MusicManager.getInstance().getCurPosition() < position) {
        mPlayHandler.sendEmptyMessageDelayed(MSG_NEXT,DELAY_PLAY);
      }
    }
    @Override public void onPageScrollStateChanged(    int state){
    }
  }
);
}
Program: 170845
Project: 170845
Buggy source:
private void playNext(){
  MusicManager.getInstance().skipToNext();
  refreshFavoriteIcon();
}

Fixed version (ground truth):
private void playNext(){
  mVpPlayView.setCurrentItem(mVpPlayView.getCurrentItem() + 1,true);
  refreshFavoriteIcon();
}
Program: 170846
Project: 170846
Buggy source:
@Override public void onResourceReady(Bitmap resource,Transition<? super Bitmap> transition){
  PaletteColor.mainColorObservable(ThemeHelper.getThemeColorResId(context),resource).subscribe(integer -> {
    mColorArr.put(position,integer);
    Drawable drawable=ScrimUtil.makeCubicGradientScrimDrawable(integer,8,Gravity.BOTTOM);
    frameLayout.setForeground(drawable);
    ivPlay.setImageBitmap(resource);
  }
);
}

Fixed version (ground truth):
@Override public void onResourceReady(Bitmap resource,Transition<? super Bitmap> transition){
  PaletteColor.mainColorObservable(ThemeHelper.getThemeColorResId(context),resource).subscribe(integer -> {
    mColorArr.put(position,integer);
    if (mOnPaletteCompleteListener != null) {
      mOnPaletteCompleteListener.onPaletteComplete();
    }
    Drawable drawable=ScrimUtil.makeCubicGradientScrimDrawable(integer,8,Gravity.BOTTOM);
    frameLayout.setForeground(drawable);
    ivPlay.setImageBitmap(resource);
  }
);
}
Program: 170847
Project: 170847
Buggy source:
@Override public Object instantiateItem(ViewGroup container,int position){
  Context context=container.getContext();
  View view=LayoutInflater.from(context).inflate(R.layout.item_play_view,container,false);
  ImageView ivPlay=(ImageView)view.findViewById(R.id.iv_play);
  FrameLayout frameLayout=(FrameLayout)view.findViewById(R.id.fl_play);
  ImageLoader.INSTANCE.display(context,new ImageConfig.Builder().asBitmap(true).url(mSongEntities.get(position).albumCover).cacheStrategy(ImageConfig.CACHE_NONE).skipMemoryCache(true).isRound(false).placeholder(R.drawable.ic_default).intoTarget(new SimpleTarget<Bitmap>(){
    @Override public void onResourceReady(    Bitmap resource,    Transition<? super Bitmap> transition){
      PaletteColor.mainColorObservable(ThemeHelper.getThemeColorResId(context),resource).subscribe(integer -> {
        mColorArr.put(position,integer);
        Drawable drawable=ScrimUtil.makeCubicGradientScrimDrawable(integer,8,Gravity.BOTTOM);
        frameLayout.setForeground(drawable);
        ivPlay.setImageBitmap(resource);
      }
);
    }
  }
).build());
  container.addView(view);
  return view;
}

Fixed version (ground truth):
@Override public Object instantiateItem(ViewGroup container,int position){
  Context context=container.getContext();
  View view=LayoutInflater.from(context).inflate(R.layout.item_play_view,container,false);
  ImageView ivPlay=(ImageView)view.findViewById(R.id.iv_play);
  FrameLayout frameLayout=(FrameLayout)view.findViewById(R.id.fl_play);
  ImageLoader.INSTANCE.display(context,new ImageConfig.Builder().asBitmap(true).url(mSongEntities.get(position).albumCover).isRound(false).placeholder(R.drawable.ic_default).intoTarget(new SimpleTarget<Bitmap>(){
    @Override public void onResourceReady(    Bitmap resource,    Transition<? super Bitmap> transition){
      PaletteColor.mainColorObservable(ThemeHelper.getThemeColorResId(context),resource).subscribe(integer -> {
        mColorArr.put(position,integer);
        if (mOnPaletteCompleteListener != null) {
          mOnPaletteCompleteListener.onPaletteComplete();
        }
        Drawable drawable=ScrimUtil.makeCubicGradientScrimDrawable(integer,8,Gravity.BOTTOM);
        frameLayout.setForeground(drawable);
        ivPlay.setImageBitmap(resource);
      }
);
    }
  }
).build());
  container.addView(view);
  return view;
}