nus-yam/ex-repair huggingface dataset:
Program: 40378
Project: 40378
Buggy source:
private void switchSortOrder(){
  String newSortOrder="String_Node_Str";
  SharedPreferences.Editor prefsEditor=mContext.getSharedPreferences(Parameters.SHARED_PREF,MODE_PRIVATE).edit();
  if (getSavedSortOrder().equals(Parameters.SHARED_PREF_SORT_ORDER_RESPONSE_ASC)) {
    newSortOrder=Parameters.SHARED_PREF_SORT_ORDER_NAME_ASC;
  }
 else {
    newSortOrder=Parameters.SHARED_PREF_SORT_ORDER_RESPONSE_ASC;
  }
  prefsEditor.putString(Parameters.SHARED_PREF_SORT_ORDER,newSortOrder);
  prefsEditor.commit();
  redrawList();
}

Fixed version (ground truth):
private void switchSortOrder(){
  ListViewHolder holder=ListViewHolder.getInstance();
  String currentLoadingNode=holder.getCurrentLoadingNode();
  if (currentLoadingNode != null) {
    holder.showLoadingBar(currentLoadingNode,false);
  }
  String newSortOrder="String_Node_Str";
  SharedPreferences.Editor prefsEditor=mContext.getSharedPreferences(Parameters.SHARED_PREF,MODE_PRIVATE).edit();
  if (getSavedSortOrder().equals(Parameters.SHARED_PREF_SORT_ORDER_RESPONSE_ASC)) {
    newSortOrder=Parameters.SHARED_PREF_SORT_ORDER_NAME_ASC;
  }
 else {
    newSortOrder=Parameters.SHARED_PREF_SORT_ORDER_RESPONSE_ASC;
  }
  prefsEditor.putString(Parameters.SHARED_PREF_SORT_ORDER,newSortOrder);
  prefsEditor.commit();
  redrawList();
  if (currentLoadingNode != null) {
    holder.showLoadingBar(currentLoadingNode,true);
  }
}
Program: 40379
Project: 40379
Buggy source:
public void showLoadingBar(int position,final boolean visible){
  final View parentView=mListView.getChildAt(position);
  runOnUiThread(new Runnable(){
    @Override public void run(){
      if (visible) {
        parentView.findViewById(R.id.progressBar).setVisibility(View.VISIBLE);
        parentView.findViewById(R.id.responseTimeView).setVisibility(View.GONE);
      }
 else {
        parentView.findViewById(R.id.progressBar).setVisibility(View.GONE);
        parentView.findViewById(R.id.responseTimeView).setVisibility(View.VISIBLE);
      }
    }
  }
);
}

Fixed version (ground truth):
public void showLoadingBar(int position,final boolean visible){
  final View parentView=mListView.getChildAt(position);
  if (parentView != null) {
    runOnUiThread(new Runnable(){
      @Override public void run(){
        if (visible) {
          parentView.findViewById(R.id.progressBar).setVisibility(View.VISIBLE);
          parentView.findViewById(R.id.responseTimeView).setVisibility(View.GONE);
        }
 else {
          parentView.findViewById(R.id.progressBar).setVisibility(View.GONE);
          parentView.findViewById(R.id.responseTimeView).setVisibility(View.VISIBLE);
        }
      }
    }
);
  }
}
Program: 40385
Project: 40385
Buggy source:
private boolean isPortOpen(StorjNode storjNode){
  try {
    ArrayList<Integer> openPorts=PortScan.onAddress(storjNode.getAddress().getValue()).setTimeOutMillis(1000).setPort(storjNode.getPort().getValue()).doScan();
    if (openPorts.size() > 1 && openPorts.get(0) == storjNode.getPort().getValue())     return true;
 else     return false;
  }
 catch (  UnknownHostException e) {
    e.printStackTrace();
  }
  return false;
}

Fixed version (ground truth):
private boolean isPortOpen(StorjNode storjNode){
  try {
    ArrayList<Integer> openPorts=PortScan.onAddress(storjNode.getAddress().getValue()).setTimeOutMillis(1000).setPort(storjNode.getPort().getValue()).doScan();
    if (openPorts.size() >= 1 && (openPorts.get(0) == storjNode.getPort().getValue()))     return true;
 else     return false;
  }
 catch (  UnknownHostException e) {
    e.printStackTrace();
  }
  return false;
}
Program: 40386
Project: 40386
Buggy source:
public boolean hasActiveInternetConnection(){
  if (isNetworkAvailable()) {
    try {
      HttpURLConnection urlc=(HttpURLConnection)(new URL("String_Node_Str").openConnection());
      urlc.setRequestProperty("String_Node_Str","String_Node_Str");
      urlc.setRequestProperty("String_Node_Str","String_Node_Str");
      urlc.setConnectTimeout(1500);
      urlc.connect();
      return (urlc.getResponseCode() == 200);
    }
 catch (    IOException e) {
      Log.e(TAG,"String_Node_Str",e);
    }
  }
 else {
    Log.e(TAG,"String_Node_Str");
  }
  return false;
}

Fixed version (ground truth):
public boolean hasActiveInternetConnection(){
  if (isNetworkAvailable()) {
    try {
      HttpURLConnection urlc=(HttpURLConnection)(new URL("String_Node_Str").openConnection());
      urlc.setRequestProperty("String_Node_Str","String_Node_Str");
      urlc.setRequestProperty("String_Node_Str","String_Node_Str");
      urlc.setConnectTimeout(1500);
      urlc.connect();
      int responseCode=urlc.getResponseCode();
      urlc.disconnect();
      return (responseCode == 200);
    }
 catch (    IOException e) {
      Log.e(TAG,"String_Node_Str",e);
    }
  }
 else {
    Log.e(TAG,"String_Node_Str");
  }
  return false;
}
Program: 40387
Project: 40387
Buggy source:
private boolean isNodeOffline(StorjNode storjNode){
  Date currentTime=Calendar.getInstance().getTime();
  return (currentTime.getTime() - storjNode.getLastSeen().getTime()) >= getNodeOfflineAfter();
}

Fixed version (ground truth):
private boolean isNodeOffline(StorjNode storjNode){
  Date currentTime=Calendar.getInstance().getTime();
  int gmtOffset=TimeZone.getDefault().getRawOffset() + TimeZone.getDefault().getDSTSavings();
  return (currentTime.getTime() - (storjNode.getLastSeen().getTime() + gmtOffset)) >= getNodeOfflineAfter();
}
Program: 40389
Project: 40389
Buggy source:
@Override public void onClick(View v){
  Log.i(TAG,"String_Node_Str");
  StorjNode selectedNode=(StorjNode)mListView.getAdapter().getItem(position);
  Intent storjNodeDetailIntent=new Intent(MainActivity.this,StorjNodeDetailActivity.class);
  storjNodeDetailIntent.putExtra(StorjNodeDetailActivity.EXTRA_NODEID,selectedNode.getNodeID());
  mContext.startActivity(storjNodeDetailIntent);
}

Fixed version (ground truth):
@Override public void onClick(View v){
  StorjNode selectedNode=(StorjNode)mListView.getAdapter().getItem(position);
  Intent storjNodeDetailIntent=new Intent(MainActivity.this,StorjNodeDetailActivity.class);
  storjNodeDetailIntent.putExtra(StorjNodeDetailActivity.EXTRA_NODEID,selectedNode.getNodeID());
  mContext.startActivity(storjNodeDetailIntent);
}
Program: 40391
Project: 40391
Buggy source:
@Override protected StorjNode doInBackground(List<StorjNode>... lists){
  StorjNode node=null;
  for (  StorjNode storjNode : lists[0]) {
    try {
      JSONObject jsonObject=getJSONObjectFromURL(STORJ_API_URL + "String_Node_Str" + storjNode.getNodeID());
      Log.d(TAG,"String_Node_Str" + jsonObject.toString());
      node=new StorjNode(jsonObject);
      StorjNodeHolder nodeHolder=StorjNodeHolder.getInstance();
      List<StorjNode> storjNodes=nodeHolder.get();
      for (int i=0; i < storjNodes.size(); i++) {
        if (storjNodes.get(i).getNodeID().equals(node.getNodeID())) {
          storjNodes.get(i).copyStorjNode(node);
          storjNodes.get(i).setLastChecked(Calendar.getInstance().getTime());
          Log.i(TAG,"String_Node_Str" + storjNodes.get(i).getResponseTime());
          if (isNodeOffline(storjNodes.get(i)))           sendNodeOfflineNotification(i,storjNodes.get(i));
          break;
        }
      }
      nodeHolder.saveToSharedPreferences(mContext);
      publishProgress(node.getNodeID());
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
catch (    JSONException e) {
      e.printStackTrace();
    }
  }
  return node;
}

Fixed version (ground truth):
@Override protected StorjNode doInBackground(List<StorjNode>... lists){
  StorjNode node=null;
  for (  StorjNode storjNode : lists[0]) {
    try {
      JSONObject jsonObject=getJSONObjectFromURL(STORJ_API_URL + "String_Node_Str" + storjNode.getNodeID());
      Log.d(TAG,"String_Node_Str" + jsonObject.toString());
      node=new StorjNode(jsonObject);
      StorjNodeHolder nodeHolder=StorjNodeHolder.getInstance();
      List<StorjNode> storjNodes=nodeHolder.get();
      for (int i=0; i < storjNodes.size(); i++) {
        if (storjNodes.get(i).getNodeID().equals(node.getNodeID())) {
          storjNodes.get(i).copyStorjNode(node);
          storjNodes.get(i).setLastChecked(Calendar.getInstance().getTime());
          Log.i(TAG,"String_Node_Str" + storjNodes.get(i).getResponseTime());
          if (isNodeOffline(storjNodes.get(i)))           sendNodeOfflineNotification(i,storjNodes.get(i));
          break;
        }
      }
      nodeHolder.saveToSharedPreferences(mContext);
      publishProgress(node.getNodeID());
    }
 catch (    IOException e) {
      Log.i(TAG,"String_Node_Str" + storjNode.getNodeID() + "String_Node_Str");
      resetNode(storjNode);
    }
catch (    JSONException e) {
      e.printStackTrace();
    }
  }
  return node;
}
Program: 40392
Project: 40392
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  mContext=getApplicationContext();
  mListView=(ListView)findViewById(R.id.main_list_view);
  FloatingActionButton addNodeButton=(FloatingActionButton)findViewById(R.id.button_addNewNode);
  addNodeButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      showAddNewNodeDialog();
    }
  }
);
  StorjNodeHolder nodeHolder=StorjNodeHolder.getInstance();
  nodeHolder.getFromSharedPreferences(mContext);
  StorjNode testnode_1=new StorjNode("String_Node_Str");
  StorjNode testnode_2=new StorjNode("String_Node_Str");
  StorjNodeAdapter adapter=new StorjNodeAdapter(this,R.layout.activity_main_row,nodeHolder.get());
  mListView.setAdapter(adapter);
  AlarmManager manager=(AlarmManager)getSystemService(Context.ALARM_SERVICE);
  int interval=1;
  Intent alarmIntent=new Intent(mContext,AlarmReceiver.class);
  PendingIntent pendingIntent=PendingIntent.getBroadcast(mContext,0,alarmIntent,0);
  manager.setInexactRepeating(AlarmManager.RTC_WAKEUP,System.currentTimeMillis(),interval,pendingIntent);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  mContext=getApplicationContext();
  mListView=(ListView)findViewById(R.id.main_list_view);
  FloatingActionButton addNodeButton=(FloatingActionButton)findViewById(R.id.button_addNewNode);
  addNodeButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      showAddNewNodeDialog();
    }
  }
);
  StorjNodeHolder nodeHolder=StorjNodeHolder.getInstance();
  nodeHolder.getFromSharedPreferences(mContext);
  StorjNode testnode_1=new StorjNode("String_Node_Str");
  nodeHolder.add(testnode_1);
  StorjNode testnode_2=new StorjNode("String_Node_Str");
  nodeHolder.add(testnode_2);
  StorjNodeAdapter adapter=new StorjNodeAdapter(this,R.layout.activity_main_row,nodeHolder.get());
  mListView.setAdapter(adapter);
  AlarmManager manager=(AlarmManager)getSystemService(Context.ALARM_SERVICE);
  int interval=1;
  Intent alarmIntent=new Intent(mContext,AlarmReceiver.class);
  PendingIntent pendingIntent=PendingIntent.getBroadcast(mContext,0,alarmIntent,0);
  manager.setInexactRepeating(AlarmManager.RTC_WAKEUP,System.currentTimeMillis(),interval,pendingIntent);
}
Program: 40393
Project: 40393
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  findViewById(R.id.button).setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      download();
    }
  }
);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  findViewById(R.id.btn_start).setOnClickListener(this);
  findViewById(R.id.btn_pause).setOnClickListener(this);
  progressBar=(ProgressBar)findViewById(R.id.pb_download);
}
Program: 40394
Project: 40394
Buggy source:
@Override public void onClick(View view){
  download();
}

Fixed version (ground truth):
@Override public void onClick(View view){
  String name="String_Node_Str";
  String url="String_Node_Str";
  String tag=String.valueOf(url.hashCode());
switch (view.getId()) {
case R.id.btn_start:
    start(name,url,tag);
  break;
case R.id.btn_pause:
pause(tag);
break;
default :
break;
}
}
Program: 40395
Project: 40395
Buggy source:
@Override public void onStart(){
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
@Override public void onStart(){
  L.d("String_Node_Str");
}
Program: 40396
Project: 40396
Buggy source:
@Override public void onDownloadCompleted(Object o){
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
@Override public void onDownloadCompleted(File file){
  L.d("String_Node_Str" + file.getAbsolutePath());
}
Program: 40397
Project: 40397
Buggy source:
@Override public void onDownloadFailed(DownloadException e){
  System.out.println("String_Node_Str" + e);
}

Fixed version (ground truth):
@Override public void onDownloadFailed(DownloadException e){
  e.printStackTrace();
  L.d("String_Node_Str" + e.getErrorMessage());
}
Program: 40398
Project: 40398
Buggy source:
@Override public void onDownloadProgress(long finished,long totalLength,int percent){
  System.out.println("String_Node_Str" + finished + "String_Node_Str"+ totalLength+ "String_Node_Str"+ percent);
}

Fixed version (ground truth):
@Override public void onDownloadProgress(long finished,long totalLength,int percent){
  L.d("String_Node_Str" + percent);
  progressBar.setProgress(percent);
}
Program: 40399
Project: 40399
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  String url="String_Node_Str";
  new GetBuilder().mName("String_Node_Str").folder(new File("String_Node_Str")).uri(url).build().execute(this,new FileCallBack(){
    @Override public void onStart(){
    }
    @Override public void onDownloadProgress(    long finished,    long totalLength,    int percent){
    }
    @Override public void onDownloadFailed(    DownloadException e){
    }
    @Override public void onDownloadCompleted(    File file){
    }
  }
);
  RequestCall call=new GetBuilder().mName("String_Node_Str").folder(new File("String_Node_Str")).uri("String_Node_Str").build();
  DownloadManager.getInstance(this).execute(call,new StringCallback(){
    @Override public void onStart(){
    }
    @Override public void onDownloadFailed(    DownloadException e){
    }
    @Override public void onDownloadCompleted(    String s){
    }
  }
);
  String tag=String.valueOf(url.hashCode());
  DownloadManager.getInstance(this).pause(tag);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  findViewById(R.id.button).setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      download();
    }
  }
);
}
Program: 40400
Project: 40400
Buggy source:
@Override public void onStart(){
}

Fixed version (ground truth):
@Override public void onStart(){
  System.out.println("String_Node_Str");
}
Program: 40401
Project: 40401
Buggy source:
@Override public void onDownloadCompleted(String s){
}

Fixed version (ground truth):
@Override public void onDownloadCompleted(Object o){
  System.out.println("String_Node_Str");
}
Program: 40402
Project: 40402
Buggy source:
@Override public void onDownloadFailed(DownloadException e){
}

Fixed version (ground truth):
@Override public void onDownloadFailed(DownloadException e){
  System.out.println("String_Node_Str" + e);
}
Program: 40403
Project: 40403
Buggy source:
@Override public void onDownloadProgress(long finished,long totalLength,int percent){
}

Fixed version (ground truth):
@Override public void onDownloadProgress(long finished,long totalLength,int percent){
  System.out.println("String_Node_Str" + finished + "String_Node_Str"+ totalLength+ "String_Node_Str"+ percent);
}
Program: 40404
Project: 40404
Buggy source:
/** 
 * 当downloader onConnectCanceled, onConnectFailed, onDownloadCompleted, onDownloadPaused, onDownloadCanceled, onDownloadFailed 等操作时候执行removeDownloader 
 */
public void removeDownloader(String key){
  if (mDownloaderMap.containsKey(key)) {
    mDownloaderMap.remove(key);
  }
}

Fixed version (ground truth):
/** 
 * 当downloader onConnectCanceled, onConnectFailed, onDownloadCompleted, onDownloadPaused, onDownloadCanceled, onDownloadFailed 等操作时候执行removeDownloader 
 */
public void removeDownloader(String tag){
  if (mDownloaderMap.containsKey(tag)) {
    mDownloaderMap.remove(tag);
  }
}
Program: 40405
Project: 40405
Buggy source:
@Override public void onDownloadProgress(final long finished,final long length){
  final int percent=(int)(finished * 100 / length);
  mPlatform.execute(new Runnable(){
    @Override public void run(){
      mCallback.onDownloadProgress(finished,length,percent);
    }
  }
);
}

Fixed version (ground truth):
@Override public void onDownloadProgress(final long finished,final long length){
  final int percent=(int)(finished * 100 / length);
  if (percent != tempPercent) {
    mPlatform.execute(new Runnable(){
      @Override public void run(){
        mCallback.onDownloadProgress(finished,length,percent);
      }
    }
);
  }
  tempPercent=percent;
}
Program: 40406
Project: 40406
Buggy source:
private void initDownloadTasks(long length,boolean acceptRanges){
  mDownloadTasks.clear();
  if (acceptRanges) {
    List<ThreadInfo> threadInfos=getMultiThreadInfos(length);
    int finished=0;
    for (    ThreadInfo threadInfo : threadInfos) {
      finished+=threadInfo.getFinished();
    }
    mDownloadInfo.setFinished(finished);
    for (    ThreadInfo info : threadInfos) {
      mDownloadTasks.add(new MultiDownloadTask(mDownloadInfo,info,mDBManager,this));
    }
  }
 else {
    ThreadInfo info=getSingleThreadInfo();
    mDownloadTasks.add(new SingleDownloadTask(mDownloadInfo,info,this));
  }
}

Fixed version (ground truth):
private void initDownloadTasks(long length,boolean acceptRanges){
  String log=acceptRanges == true ? "String_Node_Str" : "String_Node_Str";
  L.d("String_Node_Str" + log);
  mDownloadTasks.clear();
  if (acceptRanges) {
    List<ThreadInfo> threadInfos=getMultiThreadInfos(length);
    int finished=0;
    for (    ThreadInfo threadInfo : threadInfos) {
      finished+=threadInfo.getFinished();
    }
    mDownloadInfo.setFinished(finished);
    for (    ThreadInfo info : threadInfos) {
      mDownloadTasks.add(new MultiDownloadTask(mDownloadInfo,info,mDBManager,this));
    }
  }
 else {
    ThreadInfo info=getSingleThreadInfo();
    mDownloadTasks.add(new SingleDownloadTask(mDownloadInfo,info,this));
  }
}
Program: 40407
Project: 40407
Buggy source:
public DownloaderImpl(RequestCall call,Platform platform,Callback callback,ExecutorService executorService,DatabaseManager databaseManager,String tag){
  this.mCall=call;
  this.mPlatform=platform;
  this.mCallback=callback;
  this.mExecutor=executorService;
  this.mDBManager=databaseManager;
  this.mTag=tag;
  mDownloadInfo=new DownloadInfo(call.getRequest.mName,call.getRequest.mUri,call.getRequest.mFolder);
  mDownloadTasks=new LinkedList<>();
}

Fixed version (ground truth):
public DownloaderImpl(RequestCall call,Platform platform,Callback callback,ExecutorService executorService,DatabaseManager databaseManager,String tag){
  this.mCall=call;
  this.mPlatform=platform;
  this.mCallback=callback;
  this.mExecutor=executorService;
  this.mDBManager=databaseManager;
  this.mTag=tag;
  mDownloadInfo=new DownloadInfo(call.getRequest.mName,call.getRequest.mUri,call.getRequest.mFolder);
  mDownloadTasks=new LinkedList<>();
  if (mCallback == null)   mCallback=Callback.CALLBACK_DEFAULT;
}
Program: 40408
Project: 40408
Buggy source:
public List<ThreadInfo> getThreadInfos(String tag){
  return threadInfoDao.find(tag);
}

Fixed version (ground truth):
public synchronized List<ThreadInfo> getThreadInfos(String tag){
  return threadInfoDao.find(tag);
}
Program: 40409
Project: 40409
Buggy source:
/** 
 * 使用2个条件找到 相应的ThreadInfo,因为每个文件下载所对应的线程数组(字段threadId 【非主键】都是1,2,3,4,5等), 而字段tag标识url,准确找到某个ThreadInfo
 */
public boolean exists(String tag,int threadId){
  return threadInfoDao.exists(tag,threadId);
}

Fixed version (ground truth):
/** 
 * 使用2个条件找到 相应的ThreadInfo,因为每个文件下载所对应的线程数组(字段threadId 【非主键】都是1,2,3,4,5等), 而字段tag标识url,准确找到某个ThreadInfo
 */
public synchronized boolean exists(String tag,int threadId){
  return threadInfoDao.exists(tag,threadId);
}
Program: 40410
Project: 40410
Buggy source:
public static DatabaseManager getInstance(Context context){
  if (sDataBaseManager == null) {
synchronized (sDataBaseManager) {
      if (sDataBaseManager == null) {
        sDataBaseManager=new DatabaseManager(context);
      }
    }
  }
  return sDataBaseManager;
}

Fixed version (ground truth):
public static DatabaseManager getInstance(Context context){
  if (sDataBaseManager == null) {
synchronized (DatabaseManager.class) {
      if (sDataBaseManager == null) {
        sDataBaseManager=new DatabaseManager(context);
      }
    }
  }
  return sDataBaseManager;
}
Program: 40411
Project: 40411
Buggy source:
@Override public RequestCall build(){
  return new GetRequest(mUri,mFolder,mName).build();
}

Fixed version (ground truth):
@Override public RequestCall build(){
  return new GetRequest(mUri,mFolder,mName,mTag).build();
}
Program: 40412
Project: 40412
Buggy source:
public GetRequest(String uri,File folder,String name){
  this.mUri=uri;
  this.mFolder=folder;
  this.mName=name;
}

Fixed version (ground truth):
public GetRequest(String uri,File folder,String name,String tag){
  this.mUri=uri;
  this.mFolder=folder;
  this.mName=name;
  this.mTag=tag;
}
Program: 40413
Project: 40413
Buggy source:
public void execute(Context context,Callback callback){
  DownloadManager.getInstance(context).execute(this,callback);
}

Fixed version (ground truth):
public void execute(Context context,Callback callback){
  DownloadManager.getInstance(context).start(this,callback);
}
Program: 40414
Project: 40414
Buggy source:
@Override protected void updateDB(ThreadInfo info){
  mDBManager.update(info.getTag(),info.getId(),info.getFinished());
}

Fixed version (ground truth):
@Override protected void updateDB(ThreadInfo info){
  L.d("String_Node_Str" + info.getId() + "String_Node_Str"+ info.getTag());
  mDBManager.update(info.getTag(),info.getId(),info.getFinished());
}
Program: 40415
Project: 40415
Buggy source:
@Override protected void insertIntoDB(ThreadInfo info){
  if (!mDBManager.exists(info.getTag(),info.getId())) {
    mDBManager.add(info);
  }
}

Fixed version (ground truth):
@Override protected void insertIntoDB(ThreadInfo info){
  if (!mDBManager.exists(info.getTag(),info.getId())) {
    L.d("String_Node_Str" + info.getId() + "String_Node_Str"+ info.getTag());
    mDBManager.add(info);
  }
}
Program: 40416
Project: 40416
Buggy source:
@Override protected void insertIntoDB(ThreadInfo info){
}

Fixed version (ground truth):
@Override protected void insertIntoDB(ThreadInfo info){
  L.d("String_Node_Str");
}
Program: 40417
Project: 40417
Buggy source:
public void scrobble(Scrobble scrobble){
  String apiSig=HelperMethods.generateSig(Constants.ARTIST,scrobble.getArtistName(),Constants.TRACK,scrobble.getTrackName(),Constants.TIMESTAMP,String.valueOf(scrobble.getTimestamp()),Constants.METHOD,Constants.TRACK_SCROBBLE_METHOD);
  lastFmApiClient.getLastFmApiService().scrobbleTrack(Constants.TRACK_SCROBBLE_METHOD,scrobble.getArtistName(),scrobble.getTrackName(),Config.API_KEY,apiSig,scrobble.getTimestamp(),App.getSharedPreferences().getString(Constants.USER_SESSION_KEY,"String_Node_Str"),Config.FORMAT).observeOn(AndroidSchedulers.mainThread()).subscribeOn(Schedulers.newThread()).subscribe(new Observer<Response>(){
    @Override public void onSubscribe(    Disposable d){
      compositeDisposable.add(d);
    }
    @Override public void onNext(    Response response){
      if (response != null) {
        if (response.getError() == null) {
          AppLog.log(TAG,String.format("String_Node_Str",scrobble.getArtistName(),scrobble.getTrackName()));
        }
 else {
          handleErrorResponse(response,scrobble);
        }
      }
    }
    @Override public void onError(    Throwable e){
      storeInDb(scrobble);
      AppLog.log(TAG,e.getMessage());
    }
    @Override public void onComplete(){
      resetPenalty();
      if (nowPlaying != null) {
        nowPlaying.setTrackStartTime(System.currentTimeMillis());
      }
      compositeDisposable.clear();
    }
  }
);
}

Fixed version (ground truth):
public void scrobble(Scrobble scrobble){
  String apiSig=HelperMethods.generateSig(Constants.ARTIST,scrobble.getArtistName(),Constants.TRACK,scrobble.getTrackName(),Constants.TIMESTAMP,String.valueOf(scrobble.getTimestamp()),Constants.METHOD,Constants.TRACK_SCROBBLE_METHOD);
  lastFmApiClient.getLastFmApiService().scrobbleTrack(Constants.TRACK_SCROBBLE_METHOD,scrobble.getArtistName(),scrobble.getTrackName(),Config.API_KEY,apiSig,scrobble.getTimestamp(),App.getSharedPreferences().getString(Constants.USER_SESSION_KEY,"String_Node_Str"),Config.FORMAT).observeOn(AndroidSchedulers.mainThread()).subscribeOn(Schedulers.io()).subscribe(new Observer<Response>(){
    @Override public void onSubscribe(    Disposable d){
      compositeDisposable.add(d);
    }
    @Override public void onNext(    Response response){
      if (response != null) {
        if (response.getError() == null) {
          AppLog.log(TAG,String.format("String_Node_Str",scrobble.getArtistName(),scrobble.getTrackName()));
        }
 else {
          handleErrorResponse(response,scrobble);
        }
      }
    }
    @Override public void onError(    Throwable e){
      storeInDb(scrobble);
      AppLog.log(TAG,e.getMessage());
    }
    @Override public void onComplete(){
      resetPenalty();
      if (nowPlaying != null) {
        nowPlaying.setTrackStartTime(System.currentTimeMillis());
      }
      compositeDisposable.clear();
    }
  }
);
}
Program: 40419
Project: 40419
Buggy source:
@Override public void onNotificationRemoved(StatusBarNotification sbn){
  if (sbn.getPackageName().equals(currentPlayingControllerPackageName)) {
    Notificator.cancelNotification(this);
  }
}

Fixed version (ground truth):
@Override public void onNotificationRemoved(StatusBarNotification sbn){
  if (currentPlayingControllerPackageName == null) {
    return;
  }
  if (sbn.getPackageName().equals(currentPlayingControllerPackageName)) {
    Notificator.cancelNotification(this);
  }
}
Program: 40420
Project: 40420
Buggy source:
private void openProfile(){
  String username=App.getSharedPreferences().getString(Constants.USERNAME,"String_Node_Str");
  if (username.isEmpty() || username == "String_Node_Str") {
    alertDialogBuilder.setCancelable(true);
    alertDialogBuilder.setTitle(activity.getString(R.string.note)).setMessage(activity.getString(R.string.log_in_to_use_feature)).setNeutralButton(activity.getString(R.string.dialog_action_dismiss),(dialog,which) -> {
      dialog.dismiss();
    }
);
    alertDialogBuilder.create().show();
    return;
  }
  activity.startActivity(new Intent(activity,Profile.class));
}

Fixed version (ground truth):
private void openProfile(){
  String username=App.getSharedPreferences().getString(Constants.USERNAME,"String_Node_Str");
  if (username.isEmpty() || username == "String_Node_Str") {
    alertDialogBuilder.setCancelable(true);
    alertDialogBuilder.setTitle(activity.getString(R.string.note)).setMessage(activity.getString(R.string.log_in_to_use_feature)).setNeutralButton(activity.getString(R.string.dialog_action_dismiss),(dialog,which) -> {
      dialog.dismiss();
    }
);
    if (!activity.isFinishing()) {
      alertDialogBuilder.create().show();
    }
    return;
  }
  activity.startActivity(new Intent(activity,Profile.class));
}
Program: 40421
Project: 40421
Buggy source:
private void openAbout(){
  View layout=activity.getLayoutInflater().inflate(R.layout.about_layout,null);
  TextView aboutMessage=layout.findViewById(R.id.about_message);
  SpannableString s=new SpannableString(String.format(activity.getString(R.string.about_message),Constants.APP_VESRION));
  Linkify.addLinks(s,Linkify.WEB_URLS);
  aboutMessage.setMovementMethod(LinkMovementMethod.getInstance());
  aboutMessage.setText(s);
  alertDialogBuilder.setTitle(R.string.about);
  alertDialogBuilder.setView(layout).setCancelable(true).setIcon(android.R.drawable.ic_dialog_info).setPositiveButton(R.string.dialog_action_dismiss,null).create().show();
}

Fixed version (ground truth):
private void openAbout(){
  View layout=activity.getLayoutInflater().inflate(R.layout.about_layout,null);
  TextView aboutMessage=layout.findViewById(R.id.about_message);
  SpannableString s=new SpannableString(String.format(activity.getString(R.string.about_message),Constants.APP_VESRION));
  Linkify.addLinks(s,Linkify.WEB_URLS);
  aboutMessage.setMovementMethod(LinkMovementMethod.getInstance());
  aboutMessage.setText(s);
  alertDialogBuilder.setTitle(R.string.about);
  if (!activity.isFinishing()) {
    alertDialogBuilder.setView(layout).setCancelable(true).setIcon(android.R.drawable.ic_dialog_info).setPositiveButton(R.string.dialog_action_dismiss,null).create().show();
  }
}
Program: 40422
Project: 40422
Buggy source:
@Provides @Singleton GsonConverterFactory provideGsonConverterFactory(){
  Gson gson=new GsonBuilder().registerTypeAdapter(Album.class,new Album.DataStateDeserializer()).create();
  return GsonConverterFactory.create(gson);
}

Fixed version (ground truth):
@Provides @Singleton GsonConverterFactory provideGsonConverterFactory(){
  Gson gson=new GsonBuilder().registerTypeAdapter(Album.class,new Album.DataStateDeserializer()).registerTypeAdapter(Track.class,new Track.TrackDataStateDeserializer()).create();
  return GsonConverterFactory.create(gson);
}
Program: 40423
Project: 40423
Buggy source:
public void setStreamable(Streamable streamable){
  this.streamable=streamable;
}

Fixed version (ground truth):
public void setStreamable(Object streamable){
  this.streamable=streamable;
}
Program: 40424
Project: 40424
Buggy source:
public Streamable getStreamable(){
  return streamable;
}

Fixed version (ground truth):
public Object getStreamable(){
  return streamable;
}
Program: 40425
Project: 40425
Buggy source:
@Nullable @Override public View onCreateView(LayoutInflater inflater,@Nullable ViewGroup container,@Nullable Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.now_playing_fragment,container,false);
  ButterKnife.bind(this,view);
  nowPlayingFragmentPresenter.takeView(this);
  Scrobble nowPlaying=scrobbler.getNowPlaying();
  if (nowPlaying == null) {
    nowPlayingNothing.setVisibility(View.VISIBLE);
    HelperMethods.setLayoutChildrenVisibility(View.GONE,nowPlayingLayout);
  }
 else {
    HelperMethods.setLayoutChildrenVisibility(View.VISIBLE,nowPlayingLayout);
    nowPlayingNothing.setVisibility(View.INVISIBLE);
    if (nowPlaying.getAlbumArt() != null) {
      Glide.with(nowPlayingArtistImage.getContext()).load(HelperMethods.bitmapToByte(nowPlaying.getAlbumArt())).asBitmap().into(nowPlayingArtistImage);
    }
 else {
      Glide.with(nowPlayingArtistImage.getContext()).load(getResources().getIdentifier("String_Node_Str","String_Node_Str",this.getContext().getPackageName())).into(nowPlayingArtistImage);
    }
    nowPlayingArtist.setText(nowPlaying.getArtistName());
    nowPlayingTitle.setText(nowPlaying.getTrackName());
    nowPlayingAlbum.setText(nowPlaying.getAlbumName());
  }
  return view;
}

Fixed version (ground truth):
@Nullable @Override public View onCreateView(LayoutInflater inflater,@Nullable ViewGroup container,@Nullable Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.now_playing_fragment,container,false);
  ButterKnife.bind(this,view);
  nowPlayingFragmentPresenter.takeView(this);
  Scrobble nowPlaying=scrobbler.getNowPlaying();
  if (nowPlaying == null) {
    HelperMethods.setLayoutChildrenVisibility(View.GONE,nowPlayingLayout);
  }
 else {
    HelperMethods.setLayoutChildrenVisibility(View.VISIBLE,nowPlayingLayout);
    if (nowPlaying.getAlbumArt() != null) {
      Glide.with(nowPlayingArtistImage.getContext()).load(HelperMethods.bitmapToByte(nowPlaying.getAlbumArt())).asBitmap().into(nowPlayingArtistImage);
    }
 else {
      Glide.with(nowPlayingArtistImage.getContext()).load(getResources().getIdentifier("String_Node_Str","String_Node_Str",this.getContext().getPackageName())).into(nowPlayingArtistImage);
    }
    nowPlayingArtist.setText(nowPlaying.getArtistName());
    nowPlayingTitle.setText(nowPlaying.getTrackName());
    nowPlayingAlbum.setText(nowPlaying.getAlbumName());
  }
  nowPlayingFragmentPresenter.loadRecentScrobbles(recentTracks);
  return view;
}
Program: 40426
Project: 40426
Buggy source:
@Override public void onError(Throwable e){
  Log.d(NowPlayingFragmentPresenter.class.getSimpleName(),e.getMessage());
}

Fixed version (ground truth):
@Override public void onError(Throwable e){
  Log.d(TAG,e.getMessage());
}
Program: 40427
Project: 40427
Buggy source:
@Override public void onNext(Response response){
  Toast.makeText(nowPlayingFragment.getContext(),R.string.track_loved,Toast.LENGTH_SHORT).show();
}

Fixed version (ground truth):
@Override public void onNext(RecentTracksWrapper recentTracksWrapper){
  List<Track> result=recentTracksWrapper.getRecenttracks().getTrack();
  String[] trackNames=new String[result.size()];
  for (int i=0; i < result.size(); i++) {
    trackNames[i]=result.get(i).toString();
  }
  ArrayAdapter<String> arrayAdapter=new ArrayAdapter<>(nowPlayingFragment.getContext(),android.R.layout.simple_list_item_1,trackNames);
  listView.setAdapter(arrayAdapter);
}
Program: 40428
Project: 40428
Buggy source:
@Override public void onBindViewHolder(AbstractViewHolder holder,int position){
  if (artistList.isEmpty()) {
    return;
  }
  Artist artist=artistList.get(position);
  holder.getTitle().setText(artist.getName().toLowerCase());
  holder.getCount().setText(Constants.formatNumberWithSeperator(artist.getListeners()) + "String_Node_Str");
  Glide.with(mainActivity).load(artist.getImage().get(Constants.IMAGE_LARGE).getText()).into(holder.getThumbnail());
  ((ArtistViewHolder)holder).getOverflow().setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      holder.showPopupMenu(mainActivity,((ArtistViewHolder)holder).getOverflow());
    }
  }
);
  this.specificArtistSearchable.addOnArtistResultClickedListener(holder,artist.getName());
}

Fixed version (ground truth):
@Override public void onBindViewHolder(AbstractViewHolder holder,int position){
  if (artistList.isEmpty()) {
    return;
  }
  Artist artist=artistList.get(position);
  holder.getTitle().setText(artist.getName().toLowerCase());
  if (artist.getListeners() != null) {
    holder.getCount().setText(Constants.formatNumberWithSeperator(artist.getListeners()) + "String_Node_Str");
  }
  Glide.with(mainActivity).load(artist.getImage().get(Constants.IMAGE_LARGE).getText()).into(holder.getThumbnail());
  ((ArtistViewHolder)holder).getOverflow().setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      holder.showPopupMenu(mainActivity,((ArtistViewHolder)holder).getOverflow());
    }
  }
);
  this.specificArtistSearchable.addOnArtistResultClickedListener(holder,artist.getName());
  this.setIsFavorited(holder,Constants.FAVORITE_ARTISTS_KEY);
}
Program: 40429
Project: 40429
Buggy source:
@Override public boolean onMenuItemClick(MenuItem item){
  Set<String> stringSet=App.getSharedPreferences().getStringSet(key,new HashSet<>());
switch (item.getItemId()) {
case (R.id.action_add_favourite):
    stringSet.add(stringValue);
  App.getSharedPreferences().edit().putStringSet(key,stringSet).apply();
viewHolder.setIsFavorited(true);
return true;
case (R.id.action_remove_favorite):
stringSet.remove(stringValue);
App.getSharedPreferences().edit().putStringSet(key,stringSet).apply();
viewHolder.setIsFavorited(false);
return true;
default :
break;
}
return false;
}

Fixed version (ground truth):
@Override public boolean onMenuItemClick(MenuItem item){
  Set<String> stringSet=App.getSharedPreferences().getStringSet(key,new HashSet<>());
switch (item.getItemId()) {
case (R.id.action_add_favourite):
    stringSet.add(stringValue);
  App.getSharedPreferences().edit().putStringSet(key,stringSet).apply();
viewHolder.setIsFavorited(true);
return true;
case (R.id.action_remove_favorite):
Iterator<String> it=stringSet.iterator();
while (it.hasNext()) {
String entry=it.next();
if (entry.equals(stringValue)) {
it.remove();
break;
}
}
App.getSharedPreferences().edit().putStringSet(key,stringSet).apply();
viewHolder.setIsFavorited(false);
return true;
default :
break;
}
return false;
}
Program: 40430
Project: 40430
Buggy source:
private void initRecyclerView(){
  RecyclerView.LayoutManager layoutManager=null;
  if (Constants.isTablet(mainActivity)) {
    layoutManager=new GridLayoutManager(mainActivity,3);
    recyclerView.addItemDecoration(new FavoriteArtistFragment.GridSpacingItemDecoration(3,Constants.dpToPx(10,mainActivity),true));
  }
 else {
    layoutManager=new GridLayoutManager(mainActivity,2);
    recyclerView.addItemDecoration(new FavoriteArtistFragment.GridSpacingItemDecoration(2,Constants.dpToPx(10,mainActivity),true));
  }
  if (layoutManager == null) {
    return;
  }
  recyclerView.setItemAnimator(new DefaultItemAnimator());
  recyclerView.setLayoutManager(layoutManager);
}

Fixed version (ground truth):
private void initRecyclerView(){
  RecyclerView.LayoutManager layoutManager=null;
  if (Constants.isTablet(mainActivity)) {
    layoutManager=new GridLayoutManager(mainActivity,3);
    recyclerView.addItemDecoration(new FavoriteArtistFragment.GridSpacingItemDecoration(3,Constants.dpToPx(10,mainActivity),true));
  }
 else {
    layoutManager=new GridLayoutManager(mainActivity,2);
    recyclerView.addItemDecoration(new FavoriteArtistFragment.GridSpacingItemDecoration(2,Constants.dpToPx(10,mainActivity),true));
  }
  if (layoutManager == null) {
    return;
  }
  recyclerView.setItemAnimator(new DefaultItemAnimator());
  recyclerView.setLayoutManager(layoutManager);
  recyclerView.setAdapter(new ArtistAdapter(mainActivity,new ArrayList<>(),favoriteFragmentPresenter));
}
Program: 40431
Project: 40431
Buggy source:
@Nullable @Override public View onCreateView(LayoutInflater inflater,@Nullable ViewGroup container,@Nullable Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.artist_search_fragment,container,false);
  ButterKnife.bind(this,view);
  setHasOptionsMenu(true);
  initRecyclerView();
  this.favoriteFragmentPresenter.takeView(this);
  return view;
}

Fixed version (ground truth):
@Nullable @Override public View onCreateView(LayoutInflater inflater,@Nullable ViewGroup container,@Nullable Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.artist_search_fragment,container,false);
  ButterKnife.bind(this,view);
  setHasOptionsMenu(true);
  initRecyclerView();
  this.favoriteFragmentPresenter.takeView(this);
  this.favoriteFragmentPresenter.loadFavoriteArtists(App.getSharedPreferences().getStringSet(Constants.FAVORITE_ARTISTS_KEY,new HashSet<>()),mainActivity,recyclerView);
  return view;
}
Program: 40432
Project: 40432
Buggy source:
void loadFavoriteArtists(Set<String> favorites);

Fixed version (ground truth):
void loadFavoriteArtists(Set<String> favorites,MainViewFunctionable mainViewFunctionable,RecyclerView recyclerView);
Program: 40433
Project: 40433
Buggy source:
@Override public void addOnArtistResultClickedListener(ClickableArtistViewHolder viewHolder,String artistName){
  RxView.clicks(viewHolder.getThumbnail()).debounce(500,TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(click -> {
    this.showArtistDetailsIntent(artistName,mainActivity);
  }
);
}

Fixed version (ground truth):
@Override public void addOnArtistResultClickedListener(ClickableArtistViewHolder viewHolder,String artistName){
  RxView.clicks(viewHolder.getThumbnail()).debounce(DELAY_IN_MILLIS,TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(click -> {
    this.showArtistDetailsIntent(artistName,mainActivity);
  }
);
}
Program: 40434
Project: 40434
Buggy source:
@Override public void loadFavoriteArtists(Set<String> favorites){
}

Fixed version (ground truth):
@Override public void loadFavoriteArtists(Set<String> favorites,MainViewFunctionable mainViewFunctionable,RecyclerView recyclerView){
  recyclerView.setAdapter(new ArtistAdapter((Context)this.mainActivity,new ArrayList<>(),FavoriteArtistsFragmentPresenter.this));
  List<Observable<SpecificArtist>> observables=new ArrayList<>();
  for (  String favorite : favorites) {
    observables.add(lastFmApiClient.getLastFmApiService().getSpecificArtistInfo(favorite).subscribeOn(Schedulers.io()));
  }
  Observable.zip(observables,objects -> {
    List<Artist> result=new ArrayList<>();
    for (    Object object : objects) {
      result.add(((SpecificArtist)object).getArtist());
    }
    return result;
  }
).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<List<Artist>>(){
    @Override public void onSubscribe(    Disposable d){
      mainActivity.showProgressBar();
      compositeDisposable.add(d);
    }
    @Override public void onNext(    List<Artist> generalArtistSearch){
      for (      Artist artistSearch : generalArtistSearch) {
        ((ArtistAdapter)recyclerView.getAdapter()).addArtist(artistSearch);
      }
      recyclerView.getAdapter().notifyDataSetChanged();
    }
    @Override public void onError(    Throwable e){
      Log.e(this.getClass().getSimpleName(),e.getMessage());
    }
    @Override public void onComplete(){
      mainActivity.hideProgressBar();
      compositeDisposable.clear();
    }
  }
);
}
Program: 40435
Project: 40435
Buggy source:
private void showAlbumDetails(Album album){
  CoordinatorLayout mainLayout=(CoordinatorLayout)artistDetailsActivity.findViewById(R.id.detail_content);
  LayoutInflater inflater=LayoutInflater.from(artistDetailsActivity);
  View albumDetails=inflater.inflate(R.layout.album_popup_info,null);
  TextView tracks=albumDetails.findViewById(R.id.album_popup_tracks);
  TextView title=albumDetails.findViewById(R.id.album_popup_title);
  ImageView cover=albumDetails.findViewById(R.id.album_popup_thumbnail);
  StringBuilder sb=new StringBuilder();
  for (  Track track : album.getTracks().getTrack()) {
    sb.append(String.format("String_Node_Str",track.getName(),track.getDuration()));
  }
  tracks.setText(sb.toString());
  title.setText(album.getName());
  Glide.with(artistDetailsActivity).load(album.getImage().get(Constants.IMAGE_LARGE).getText()).into(cover);
  int width=LinearLayout.LayoutParams.WRAP_CONTENT;
  int height=LinearLayout.LayoutParams.WRAP_CONTENT;
  boolean focusable=true;
  final PopupWindow popupWindow=new PopupWindow(albumDetails,width,height,focusable);
  popupWindow.setAnimationStyle(android.R.style.Animation_Dialog);
  popupWindow.showAtLocation(mainLayout,Gravity.CENTER,0,0);
  albumDetails.setOnTouchListener(new View.OnTouchListener(){
    @Override public boolean onTouch(    View view,    MotionEvent motionEvent){
      popupWindow.dismiss();
      return true;
    }
  }
);
}

Fixed version (ground truth):
private void showAlbumDetails(Album album){
  CoordinatorLayout mainLayout=(CoordinatorLayout)artistDetailsActivity.findViewById(R.id.detail_content);
  LayoutInflater inflater=LayoutInflater.from(artistDetailsActivity);
  View albumDetails=inflater.inflate(R.layout.album_popup_info,null);
  TextView tracks=albumDetails.findViewById(R.id.album_popup_tracks);
  TextView title=albumDetails.findViewById(R.id.album_popup_title);
  ImageView cover=albumDetails.findViewById(R.id.album_popup_thumbnail);
  StringBuilder sb=new StringBuilder();
  for (  Track track : album.getTracks().getTrack()) {
    long millis=Long.parseLong(track.getDuration());
    String duration=String.format("String_Node_Str",TimeUnit.SECONDS.toMinutes(millis),TimeUnit.SECONDS.toSeconds(millis) - TimeUnit.MINUTES.toSeconds(TimeUnit.SECONDS.toMinutes(millis)));
    sb.append(String.format("String_Node_Str",track.getName(),duration));
  }
  tracks.setText(sb.toString());
  title.setText(album.getName());
  Glide.with(artistDetailsActivity).load(album.getImage().get(Constants.IMAGE_LARGE).getText()).into(cover);
  int width=LinearLayout.LayoutParams.WRAP_CONTENT;
  int height=LinearLayout.LayoutParams.WRAP_CONTENT;
  boolean focusable=true;
  final PopupWindow popupWindow=new PopupWindow(albumDetails,width,height,focusable);
  popupWindow.setAnimationStyle(android.R.style.Animation_Dialog);
  popupWindow.showAtLocation(mainLayout,Gravity.CENTER,0,0);
  albumDetails.setOnTouchListener(new View.OnTouchListener(){
    @Override public boolean onTouch(    View view,    MotionEvent motionEvent){
      popupWindow.dismiss();
      return true;
    }
  }
);
}
Program: 40436
Project: 40436
Buggy source:
@Override public void setClickListenerFetchEntireAlbumInfo(Album album,ArtistDetailsAlbumAdapter.MyViewHolder myViewHolder){
  final Album[] loadedAlbum=new Album[1];
  RxView.clicks(myViewHolder.thumbnail).debounce(DELAY_IN_MILLIS,TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(click -> {
    lastFmApiClient.getLastFmApiService().searchForSpecificAlbum(album.getName(),((Artist)album.getArtist()).getName()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).map(specificAlbum -> specificAlbum).subscribe(new Observer<SpecificAlbum>(){
      @Override public void onSubscribe(      Disposable d){
        artistDetailsActivity.showProgressBar();
        Constants.showTooltip(artistDetailsActivity,artistDetailsActivity.getBirdIcon(),FETCHING_ALBUM_TOOLTIP);
      }
      @Override public void onNext(      SpecificAlbum specificAlbum){
        Album fullAlbum=specificAlbum.getAlbum();
        loadedAlbum[0]=fullAlbum;
      }
      @Override public void onError(      Throwable e){
        Log.e(this.getClass().toString(),e.getMessage());
      }
      @Override public void onComplete(){
        artistDetailsActivity.hideProgressbar();
        showAlbumDetails(loadedAlbum[0]);
      }
    }
);
  }
);
}

Fixed version (ground truth):
@Override public void setClickListenerFetchEntireAlbumInfo(Album album,ArtistDetailsAlbumAdapter.MyViewHolder myViewHolder){
  final Album[] loadedAlbum=new Album[1];
  RxView.clicks(myViewHolder.thumbnail).debounce(DELAY_IN_MILLIS,TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(click -> {
    lastFmApiClient.getLastFmApiService().searchForSpecificAlbum(((Artist)album.getArtist()).getName(),album.getName()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).map(specificAlbum -> specificAlbum).subscribe(new Observer<SpecificAlbum>(){
      @Override public void onSubscribe(      Disposable d){
        artistDetailsActivity.showProgressBar();
        Constants.showTooltip(artistDetailsActivity,artistDetailsActivity.getBirdIcon(),FETCHING_ALBUM_TOOLTIP);
      }
      @Override public void onNext(      SpecificAlbum specificAlbum){
        Album fullAlbum=specificAlbum.getAlbum();
        loadedAlbum[0]=fullAlbum;
      }
      @Override public void onError(      Throwable e){
        Log.e(this.getClass().toString(),e.getMessage());
      }
      @Override public void onComplete(){
        artistDetailsActivity.hideProgressbar();
        showAlbumDetails(loadedAlbum[0]);
      }
    }
);
  }
);
}
Program: 40437
Project: 40437
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_image_detail);
  Toolbar toolbar=(Toolbar)findViewById(R.id.toolbar);
  setSupportActionBar(toolbar);
  ImageView imageView=findViewById(R.id.imv);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    imageView.setTransitionName(TRANSITION_NAME_IMAGE);
  }
  GlideLoader loader=new TransitionGlideLoader(this);
  loader.loadImage(URL,imageView);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_image_detail);
  Toolbar toolbar=(Toolbar)findViewById(R.id.toolbar);
  setSupportActionBar(toolbar);
  ImageView imageView=findViewById(R.id.imv);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    imageView.setTransitionName(TRANSITION_NAME_IMAGE);
  }
}