nus-yam/ex-repair huggingface dataset:
Program: 161446
Project: 161446
Buggy source:
/** 
 * Get the cloud factory. Most applications will never need this method, but provided here to cover corner cases. Implementation note: This roundabout way of implementation is required to ensure that a CloudFoundry bean if created in some other configuration is available, we should use that.
 * @return
 */
protected CloudFactory cloudFactory(){
  if (cloudFactory == null) {
    cloudFactory=beanFactory.getBean(CloudFactory.class);
    if (cloudFactory == null) {
      cloudFactory=new CloudFactory();
      ((SingletonBeanRegistry)beanFactory).registerSingleton(CLOUD_FACTORY_BEAN_NAME,cloudFactory);
    }
  }
  return cloudFactory;
}

Fixed version (ground truth):
/** 
 * Get the cloud factory. Most applications will never need this method, but provided here to cover corner cases. Implementation note: This roundabout way of implementation is required to ensure that a CloudFoundry bean if created in some other configuration is available, we should use that.
 * @return
 */
protected CloudFactory cloudFactory(){
  if (cloudFactory == null) {
    try {
      cloudFactory=beanFactory.getBean(CloudFactory.class);
    }
 catch (    NoSuchBeanDefinitionException ex) {
      cloudFactory=new CloudFactory();
      ((SingletonBeanRegistry)beanFactory).registerSingleton(CLOUD_FACTORY_BEAN_NAME,cloudFactory);
    }
  }
  return cloudFactory;
}
Program: 161447
Project: 161447
Buggy source:
public static synchronized TcaDb getInstance(Context context){
  if (instance == null || !instance.isOpen()) {
    instance=Room.databaseBuilder(context.getApplicationContext(),TcaDb.class,Const.DATABASE_NAME).allowMainThreadQueries().addMigrations(migrations).fallbackToDestructiveMigration().build();
  }
  return instance;
}

Fixed version (ground truth):
public static synchronized TcaDb getInstance(Context context){
  if (instance == null) {
    instance=Room.databaseBuilder(context.getApplicationContext(),TcaDb.class,Const.DATABASE_NAME).allowMainThreadQueries().addMigrations(migrations).fallbackToDestructiveMigration().build();
  }
  return instance;
}
Program: 161448
Project: 161448
Buggy source:
private static void addStationResult(Collection<StationResult> results,JSONObject point) throws JSONException {
  String name=point.getString("String_Node_Str");
  String id=point.getJSONObject("String_Node_Str").getString("String_Node_Str");
  int quality=point.getInt("String_Node_Str");
  results.add(new StationResult(name,id,quality));
}

Fixed version (ground truth):
private static void addStationResult(Collection<StationResult> results,JSONObject point) throws JSONException {
  String name=point.getString("String_Node_Str");
  String id=point.getJSONObject("String_Node_Str").getString("String_Node_Str");
  int quality=(point.has("String_Node_Str")) ? point.getInt("String_Node_Str") : 0;
  results.add(new StationResult(name,id,quality));
}
Program: 161449
Project: 161449
Buggy source:
@GET(API_KINOS + "String_Node_Str") Observable<List<Kino>> getKinos(@Path("String_Node_Str") String lastId);

Fixed version (ground truth):
@GET(API_KINOS + "String_Node_Str") Flowable<List<Kino>> getKinos(@Path("String_Node_Str") String lastId);
Program: 161450
Project: 161450
Buggy source:
public Observable<List<Kino>> getKinos(String lastId){
  return service.getKinos(lastId);
}

Fixed version (ground truth):
public Flowable<List<Kino>> getKinos(String lastId){
  return service.getKinos(lastId);
}
Program: 161451
Project: 161451
Buggy source:
protected void initFilterCheckboxes(){
  boolean settings=Utils.getSettingBool(this,Const.CALENDAR_FILTER_FIT_SCREEN,false);
  menuItemFilterFitScreen.setChecked(settings);
  applyFilterFitScreen(settings);
  settings=Utils.getSettingBool(this,Const.CALENDAR_FILTER_CANCELED,true);
  menuItemFilterCanceled.setChecked(settings);
  applyFilterCanceled(settings);
  int savedMin=Integer.parseInt(Utils.getSetting(this,Const.CALENDAR_FILTER_HOUR_LIMIT_MIN,Const.CALENDAR_FILTER_HOUR_LIMIT_MIN_DEFAULT));
  int savedMax=Integer.parseInt(Utils.getSetting(this,Const.CALENDAR_FILTER_HOUR_LIMIT_MAX,Const.CALENDAR_FILTER_HOUR_LIMIT_MAX_DEFAULT));
  applyFilterLimitHours(savedMin,savedMax);
}

Fixed version (ground truth):
protected void initFilterCheckboxes(){
  boolean settings=Utils.getSettingBool(this,Const.CALENDAR_FILTER_CANCELED,true);
  menuItemFilterCanceled.setChecked(settings);
  applyFilterCanceled(settings);
  int savedMin=Integer.parseInt(Utils.getSetting(this,Const.CALENDAR_FILTER_HOUR_LIMIT_MIN,Const.CALENDAR_FILTER_HOUR_LIMIT_MIN_DEFAULT));
  int savedMax=Integer.parseInt(Utils.getSetting(this,Const.CALENDAR_FILTER_HOUR_LIMIT_MAX,Const.CALENDAR_FILTER_HOUR_LIMIT_MAX_DEFAULT));
  applyFilterLimitHours(savedMin,savedMax);
}
Program: 161452
Project: 161452
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  int i=item.getItemId();
switch (i) {
case R.id.action_switch_view_mode:
    mWeekMode=!mWeekMode;
  Utils.setSetting(this,Const.CALENDAR_WEEK_MODE,mWeekMode);
this.refreshWeekView();
return true;
case R.id.action_export_calendar:
exportCalendarToGoogle();
Utils.setSetting(this,Const.SYNC_CALENDAR,true);
supportInvalidateOptionsMenu();
return true;
case R.id.action_delete_calendar:
deleteCalendarFromGoogle();
return true;
case R.id.action_create_event:
startActivity(new Intent(this,CreateEventActivity.class));
return true;
case R.id.action_calendar_filter_canceled:
item.setChecked(!item.isChecked());
applyFilterCanceled(item.isChecked());
return true;
case R.id.action_calendar_filter_fit_screen:
item.setChecked(!item.isChecked());
applyFilterFitScreen(item.isChecked());
return true;
case R.id.action_calendar_filter_hour_limit:
showHourLimitFilterDialog();
return true;
case R.id.action_update_calendar:
requestFetch(true);
refreshWeekView();
return true;
default :
isFetched=false;
return super.onOptionsItemSelected(item);
}
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  int i=item.getItemId();
switch (i) {
case R.id.action_switch_view_mode:
    mWeekMode=!mWeekMode;
  Utils.setSetting(this,Const.CALENDAR_WEEK_MODE,mWeekMode);
this.refreshWeekView();
return true;
case R.id.action_export_calendar:
exportCalendarToGoogle();
Utils.setSetting(this,Const.SYNC_CALENDAR,true);
supportInvalidateOptionsMenu();
return true;
case R.id.action_delete_calendar:
deleteCalendarFromGoogle();
return true;
case R.id.action_create_event:
startActivity(new Intent(this,CreateEventActivity.class));
return true;
case R.id.action_calendar_filter_canceled:
item.setChecked(!item.isChecked());
applyFilterCanceled(item.isChecked());
return true;
case R.id.action_calendar_filter_hour_limit:
showHourLimitFilterDialog();
return true;
case R.id.action_update_calendar:
requestFetch(true);
refreshWeekView();
return true;
default :
isFetched=false;
return super.onOptionsItemSelected(item);
}
}
Program: 161453
Project: 161453
Buggy source:
protected void applyFilterLimitHours(int min,int max){
  Utils.setSetting(this,Const.CALENDAR_FILTER_HOUR_LIMIT_MIN,Integer.toString(min));
  Utils.setSetting(this,Const.CALENDAR_FILTER_HOUR_LIMIT_MAX,Integer.toString(max));
  mWeekView.setMinTime(min);
  mWeekView.setMaxTime(max);
  if (Utils.getSettingBool(this,Const.CALENDAR_FILTER_FIT_SCREEN,false)) {
    mWeekView.setHourHeight(calcHourHeightToFit(min,max));
  }
  applyFilterFitScreen(Utils.getSettingBool(this,Const.CALENDAR_FILTER_FIT_SCREEN,false));
}

Fixed version (ground truth):
protected void applyFilterLimitHours(int min,int max){
  int oldMax=Integer.parseInt(Utils.getSetting(this,Const.CALENDAR_FILTER_HOUR_LIMIT_MAX,"String_Node_Str"));
  Utils.setSetting(this,Const.CALENDAR_FILTER_HOUR_LIMIT_MIN,Integer.toString(min));
  Utils.setSetting(this,Const.CALENDAR_FILTER_HOUR_LIMIT_MAX,Integer.toString(max));
  if (min > oldMax) {
    mWeekView.setMaxTime(max);
    mWeekView.setMinTime(min);
  }
 else {
    mWeekView.setMinTime(min);
    mWeekView.setMaxTime(max);
  }
}
Program: 161454
Project: 161454
Buggy source:
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  getMenuInflater().inflate(R.menu.menu_sync_calendar,menu);
  menuItemSwitchView=menu.findItem(R.id.action_switch_view_mode);
  menuItemFilterCanceled=menu.findItem(R.id.action_calendar_filter_canceled);
  menuItemFilterFitScreen=menu.findItem(R.id.action_calendar_filter_fit_screen);
  this.refreshWeekView();
  initFilterCheckboxes();
  return true;
}

Fixed version (ground truth):
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  getMenuInflater().inflate(R.menu.menu_sync_calendar,menu);
  menuItemSwitchView=menu.findItem(R.id.action_switch_view_mode);
  menuItemFilterCanceled=menu.findItem(R.id.action_calendar_filter_canceled);
  this.refreshWeekView();
  initFilterCheckboxes();
  return true;
}
Program: 161455
Project: 161455
Buggy source:
@Override public View getDropDownView(int position,View convertView,@NonNull ViewGroup parent){
  View v=LayoutInflater.from(parent.getContext()).inflate(R.layout.simple_spinner_dropdown_item_actionbar,parent,false);
  StudyRoomGroup studyRoomGroup=getItem(position);
  TextView name=v.findViewById(android.R.id.text1);
  TextView details=v.findViewById(android.R.id.text2);
  if (studyRoomGroup != null) {
    name.setText(studyRoomGroup.getName());
    details.setText(studyRoomGroup.getDetails());
  }
  return v;
}

Fixed version (ground truth):
@Override public View getDropDownView(int position,View convertView,@NonNull ViewGroup parent){
  View v=inflater.inflate(R.layout.simple_spinner_dropdown_item_actionbar,parent,false);
  StudyRoomGroup studyRoomGroup=getItem(position);
  TextView nameTextView=v.findViewById(android.R.id.text1);
  TextView detailsTextView=v.findViewById(android.R.id.text2);
  if (studyRoomGroup != null) {
    String name=studyRoomGroup.getName();
    String details=studyRoomGroup.getDetails();
    nameTextView.setText(name);
    detailsTextView.setText(details);
    if (details.isEmpty()) {
      detailsTextView.setVisibility(View.GONE);
    }
  }
  return v;
}
Program: 161456
Project: 161456
Buggy source:
private Spinner getStudyRoomGroupsSpinner(){
  SpinnerAdapter adapterCafeterias=new ArrayAdapter<StudyRoomGroup>(this,R.layout.simple_spinner_item_actionbar,android.R.id.text1,mStudyRoomGroupList){
    @Override public View getDropDownView(    int position,    View convertView,    @NonNull ViewGroup parent){
      View v=LayoutInflater.from(parent.getContext()).inflate(R.layout.simple_spinner_dropdown_item_actionbar,parent,false);
      StudyRoomGroup studyRoomGroup=getItem(position);
      TextView name=v.findViewById(android.R.id.text1);
      TextView details=v.findViewById(android.R.id.text2);
      if (studyRoomGroup != null) {
        name.setText(studyRoomGroup.getName());
        details.setText(studyRoomGroup.getDetails());
      }
      return v;
    }
  }
;
  Spinner spinner=findViewById(R.id.spinnerToolbar);
  spinner.setAdapter(adapterCafeterias);
  spinner.setOnItemSelectedListener(this);
  return spinner;
}

Fixed version (ground truth):
private Spinner getStudyRoomGroupsSpinner(){
  SpinnerAdapter adapterCafeterias=new ArrayAdapter<StudyRoomGroup>(this,R.layout.simple_spinner_item_actionbar,android.R.id.text1,mStudyRoomGroupList){
    final LayoutInflater inflater=LayoutInflater.from(getContext());
    @Override public View getDropDownView(    int position,    View convertView,    @NonNull ViewGroup parent){
      View v=inflater.inflate(R.layout.simple_spinner_dropdown_item_actionbar,parent,false);
      StudyRoomGroup studyRoomGroup=getItem(position);
      TextView nameTextView=v.findViewById(android.R.id.text1);
      TextView detailsTextView=v.findViewById(android.R.id.text2);
      if (studyRoomGroup != null) {
        String name=studyRoomGroup.getName();
        String details=studyRoomGroup.getDetails();
        nameTextView.setText(name);
        detailsTextView.setText(details);
        if (details.isEmpty()) {
          detailsTextView.setVisibility(View.GONE);
        }
      }
      return v;
    }
  }
;
  Spinner spinner=findViewById(R.id.spinnerToolbar);
  spinner.setAdapter(adapterCafeterias);
  spinner.setOnItemSelectedListener(this);
  return spinner;
}
Program: 161457
Project: 161457
Buggy source:
@Override protected Notification fillNotification(NotificationCompat.Builder notificationBuilder){
  NewsSourcesDao newsSourcesDao=TcaDb.getInstance(getContext()).newsSourcesDao();
  NewsSources newsSource=newsSourcesDao.getNewsSource(Integer.parseInt(mNews.getSrc()));
  notificationBuilder.setContentTitle(getContext().getString(R.string.news));
  notificationBuilder.setContentText(mNews.getTitle());
  notificationBuilder.setContentInfo(newsSource.getTitle());
  notificationBuilder.setTicker(mNews.getTitle());
  notificationBuilder.setSmallIcon(R.drawable.ic_notification);
  try {
    Bitmap bgImg=Picasso.get().load(mNews.getImage()).get();
    notificationBuilder.extend(new NotificationCompat.WearableExtender().setBackground(bgImg));
  }
 catch (  IOException e) {
  }
  return notificationBuilder.build();
}

Fixed version (ground truth):
@Override protected Notification fillNotification(NotificationCompat.Builder notificationBuilder){
  NewsSourcesDao newsSourcesDao=TcaDb.getInstance(getContext()).newsSourcesDao();
  NewsSources newsSource=newsSourcesDao.getNewsSource(Integer.parseInt(mNews.getSrc()));
  notificationBuilder.setContentTitle(getContext().getString(R.string.news));
  notificationBuilder.setContentText(mNews.getTitle());
  notificationBuilder.setContentInfo(newsSource.getTitle());
  notificationBuilder.setTicker(mNews.getTitle());
  notificationBuilder.setSmallIcon(R.drawable.ic_notification);
  try {
    if (!mNews.getImage().isEmpty()) {
      Bitmap bgImg=Picasso.get().load(mNews.getImage()).get();
      notificationBuilder.extend(new NotificationCompat.WearableExtender().setBackground(bgImg));
    }
  }
 catch (  IOException e) {
  }
  return notificationBuilder.build();
}
Program: 161458
Project: 161458
Buggy source:
private void updateImageView(){
  String imageURL=Utils.getSetting(context,Const.NEWS_ALERT_IMAGE,"String_Node_Str");
  Picasso.get().load(imageURL).into(imageView,new Callback(){
    @Override public void onSuccess(){
      progress.setVisibility(View.GONE);
    }
    @Override public void onError(    Exception e){
      discardCard();
    }
  }
);
}

Fixed version (ground truth):
private void updateImageView(){
  String imageURL=Utils.getSetting(context,Const.NEWS_ALERT_IMAGE,"String_Node_Str");
  if (imageURL.isEmpty() || imageView == null) {
    return;
  }
  Picasso.get().load(imageURL).into(imageView,new Callback(){
    @Override public void onSuccess(){
      progress.setVisibility(View.GONE);
    }
    @Override public void onError(    Exception e){
      discardCard();
    }
  }
);
}
Program: 161459
Project: 161459
Buggy source:
private void populateNewsSources(){
  PreferenceCategory newsSourcesPreference=(PreferenceCategory)findPreference("String_Node_Str");
  NewsController newsController=new NewsController(mContext);
  List<NewsSources> newsSources=newsController.getNewsSources();
  final NetUtils net=new NetUtils(mContext);
  for (  NewsSources newsSource : newsSources) {
    final CheckBoxPreference pref=new CheckBoxPreference(mContext);
    pref.setKey("String_Node_Str" + newsSource.getId());
    pref.setDefaultValue(true);
    final String url=newsSource.getIcon();
    if (!url.trim().isEmpty()) {
      new Thread(() -> {
        try {
          Bitmap bmp=Picasso.get().load(url).get();
          mContext.runOnUiThread(() -> {
            pref.setIcon(new BitmapDrawable(getResources(),bmp));
          }
);
        }
 catch (        IOException e) {
        }
      }
).start();
    }
    pref.setTitle(newsSource.getTitle());
    if (newsSourcesPreference != null) {
      newsSourcesPreference.addPreference(pref);
    }
  }
}

Fixed version (ground truth):
private void populateNewsSources(){
  PreferenceCategory newsSourcesPreference=(PreferenceCategory)findPreference("String_Node_Str");
  NewsController newsController=new NewsController(mContext);
  List<NewsSources> newsSources=newsController.getNewsSources();
  final NetUtils net=new NetUtils(mContext);
  for (  NewsSources newsSource : newsSources) {
    final CheckBoxPreference pref=new CheckBoxPreference(mContext);
    pref.setKey("String_Node_Str" + newsSource.getId());
    pref.setDefaultValue(true);
    final String url=newsSource.getIcon();
    if (!url.trim().isEmpty()) {
      new Thread(() -> {
        try {
          Bitmap bmp=Picasso.get().load(url).get();
          mContext.runOnUiThread(() -> {
            if (isAdded()) {
              pref.setIcon(new BitmapDrawable(getResources(),bmp));
            }
          }
);
        }
 catch (        IOException e) {
        }
      }
).start();
    }
    pref.setTitle(newsSource.getTitle());
    if (newsSourcesPreference != null) {
      newsSourcesPreference.addPreference(pref);
    }
  }
}
Program: 161460
Project: 161460
Buggy source:
private void populateNewsSources(){
  PreferenceCategory newsSourcesPreference=(PreferenceCategory)findPreference("String_Node_Str");
  NewsController newsController=new NewsController(mContext);
  List<NewsSources> newsSources=newsController.getNewsSources();
  final NetUtils net=new NetUtils(mContext);
  for (  NewsSources newsSource : newsSources) {
    final CheckBoxPreference pref=new CheckBoxPreference(mContext);
    pref.setKey("String_Node_Str" + newsSource.getId());
    pref.setDefaultValue(true);
    final String url=newsSource.getIcon();
    if (!url.trim().isEmpty()) {
      new Thread(() -> {
        try {
          Bitmap bmp=Picasso.get().load(url).get();
          mContext.runOnUiThread(() -> {
            pref.setIcon(new BitmapDrawable(getResources(),bmp));
          }
);
        }
 catch (        IOException e) {
        }
      }
).start();
    }
    pref.setTitle(newsSource.getTitle());
    if (newsSourcesPreference != null) {
      newsSourcesPreference.addPreference(pref);
    }
  }
}

Fixed version (ground truth):
private void populateNewsSources(){
  PreferenceCategory newsSourcesPreference=(PreferenceCategory)findPreference("String_Node_Str");
  NewsController newsController=new NewsController(mContext);
  List<NewsSources> newsSources=newsController.getNewsSources();
  final NetUtils net=new NetUtils(mContext);
  for (  NewsSources newsSource : newsSources) {
    final CheckBoxPreference pref=new CheckBoxPreference(mContext);
    pref.setKey("String_Node_Str" + newsSource.getId());
    pref.setDefaultValue(true);
    final String url=newsSource.getIcon();
    if (!url.trim().isEmpty()) {
      new Thread(() -> {
        try {
          Bitmap bmp=Picasso.get().load(url).get();
          mContext.runOnUiThread(() -> {
            if (isAdded()) {
              pref.setIcon(new BitmapDrawable(getResources(),bmp));
            }
          }
);
        }
 catch (        IOException e) {
        }
      }
).start();
    }
    pref.setTitle(newsSource.getTitle());
    if (newsSourcesPreference != null) {
      newsSourcesPreference.addPreference(pref);
    }
  }
}
Program: 161461
Project: 161461
Buggy source:
/** 
 * Check Calendar permission for Android 6.0
 * @param id the request id
 * @return If the calendar permission was granted
 */
private boolean isPermissionGranted(int id){
  if (ContextCompat.checkSelfPermission(this,Manifest.permission.READ_CALENDAR) == PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(this,Manifest.permission.WRITE_CALENDAR) == PackageManager.PERMISSION_GRANTED) {
    return true;
  }
 else {
    if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.READ_CALENDAR) || ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.WRITE_CALENDAR)) {
      new AlertDialog.Builder(this).setMessage(getString(R.string.permission_calendar_explanation)).setPositiveButton(R.string.ok,(dialog,id1) -> ActivityCompat.requestPermissions(CalendarActivity.this,PERMISSIONS_CALENDAR,id1)).show();
    }
 else {
      ActivityCompat.requestPermissions(this,PERMISSIONS_CALENDAR,id);
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Check Calendar permission for Android 6.0
 * @param id the request id
 * @return If the calendar permission was granted
 */
private boolean isPermissionGranted(int id){
  if (ContextCompat.checkSelfPermission(this,Manifest.permission.READ_CALENDAR) == PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(this,Manifest.permission.WRITE_CALENDAR) == PackageManager.PERMISSION_GRANTED) {
    return true;
  }
 else {
    if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.READ_CALENDAR) || ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.WRITE_CALENDAR)) {
      new AlertDialog.Builder(this).setMessage(getString(R.string.permission_calendar_explanation)).setPositiveButton(R.string.ok,(dialog,id1) -> ActivityCompat.requestPermissions(CalendarActivity.this,PERMISSIONS_CALENDAR,id)).show();
    }
 else {
      ActivityCompat.requestPermissions(this,PERMISSIONS_CALENDAR,id);
    }
  }
  return false;
}
Program: 161462
Project: 161462
Buggy source:
/** 
 * Check Calendar permission for Android 6.0
 * @param id the request id
 * @return If the calendar permission was granted
 */
private boolean isPermissionGranted(int id){
  if (ContextCompat.checkSelfPermission(this,Manifest.permission.READ_CALENDAR) == PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(this,Manifest.permission.WRITE_CALENDAR) == PackageManager.PERMISSION_GRANTED) {
    return true;
  }
 else {
    if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.READ_CALENDAR) || ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.WRITE_CALENDAR)) {
      new AlertDialog.Builder(this).setMessage(getString(R.string.permission_calendar_explanation)).setPositiveButton(R.string.ok,(dialog,id1) -> ActivityCompat.requestPermissions(CalendarActivity.this,PERMISSIONS_CALENDAR,id1)).show();
    }
 else {
      ActivityCompat.requestPermissions(this,PERMISSIONS_CALENDAR,id);
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Check Calendar permission for Android 6.0
 * @param id the request id
 * @return If the calendar permission was granted
 */
private boolean isPermissionGranted(int id){
  if (ContextCompat.checkSelfPermission(this,Manifest.permission.READ_CALENDAR) == PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(this,Manifest.permission.WRITE_CALENDAR) == PackageManager.PERMISSION_GRANTED) {
    return true;
  }
 else {
    if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.READ_CALENDAR) || ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.WRITE_CALENDAR)) {
      new AlertDialog.Builder(this).setMessage(getString(R.string.permission_calendar_explanation)).setPositiveButton(R.string.ok,(dialog,id1) -> ActivityCompat.requestPermissions(CalendarActivity.this,PERMISSIONS_CALENDAR,id)).show();
    }
 else {
      ActivityCompat.requestPermissions(this,PERMISSIONS_CALENDAR,id);
    }
  }
  return false;
}
Program: 161463
Project: 161463
Buggy source:
/** 
 * Returns the name of the station that is nearby and/or set by the user
 * @return Name of the station or null if the user is not near any campus
 */
@Nullable public StationResult getStation(){
  int campus=getCurrentCampus();
  if (campus == -1) {
    return null;
  }
  final StationResult defaultVal=DEFAULT_CAMPUS_STATION[campus];
  final String campusSetting="String_Node_Str" + CAMPUS_SHORT[campus];
  String station=Utils.getSetting(mContext,campusSetting,"String_Node_Str");
  if (!"String_Node_Str".equals(station)) {
    for (    StationResult s : DEFAULT_CAMPUS_STATION) {
      if (s.getStation().equals(station)) {
        return s;
      }
    }
  }
  return defaultVal;
}

Fixed version (ground truth):
/** 
 * Returns the name of the station that is nearby and/or set by the user
 * @return Name of the station or null if the user is not near any campus
 */
@Nullable public StationResult getStation(){
  int campus=getCurrentCampus();
  if (campus == -1) {
    return null;
  }
  final String campusSetting="String_Node_Str" + CAMPUS_SHORT[campus];
  String station=Utils.getSetting(mContext,campusSetting,"String_Node_Str");
  if (!"String_Node_Str".equals(station)) {
    for (    StationResult s : DEFAULT_CAMPUS_STATION) {
      if (s.getStation().equals(station)) {
        return s;
      }
    }
  }
  return DEFAULT_CAMPUS_STATION[campus];
}
Program: 161464
Project: 161464
Buggy source:
public void setStation(StationResult station){
  this.mStationNameIDPair=new Pair<>(station.getStation(),station.getId());
}

Fixed version (ground truth):
public void setStation(StationResult station){
  setStation(new Pair<>(station.getStation(),station.getId()));
}
Program: 161465
Project: 161465
Buggy source:
/** 
 * Loads older chat messages from the server and sets the adapter accordingly
 */
private void getNextHistoryFromServer(final boolean newMsg){
  loadingMore=true;
  new Thread(() -> {
    ChatVerification verification;
    try {
      verification=ChatVerification.Companion.getChatVerification(ChatActivity.this,currentChatMember);
    }
 catch (    NoPrivateKey noPrivateKey) {
      return;
    }
    if (chatHistoryAdapter == null || chatHistoryAdapter.getCount() == 0 || newMsg) {
      chatMessageViewModel.getNewMessages(currentChatRoom.getId(),verification);
    }
 else {
      long id=chatHistoryAdapter.getItemId(0);
      chatMessageViewModel.getMessages(currentChatRoom.getId(),id,verification);
    }
    final List<ChatMessage> msgs=chatMessageViewModel.getAllChatMessagesList(currentChatRoom.getId());
    runOnUiThread(() -> {
      if (chatHistoryAdapter == null) {
        chatHistoryAdapter=new ChatHistoryAdapter(ChatActivity.this,msgs,currentChatMember);
        lvMessageHistory.setAdapter(chatHistoryAdapter);
      }
 else {
        chatHistoryAdapter.updateHistory(chatMessageViewModel.getAllChatMessagesList(currentChatRoom.getId()));
      }
      if ((msgs.size() != 0 && msgs.get(0).getPrevious() == 0) || chatHistoryAdapter.getCount() == 0) {
        lvMessageHistory.removeHeaderView(bar);
      }
 else {
        loadingMore=false;
      }
    }
);
  }
).start();
}

Fixed version (ground truth):
/** 
 * Loads older chat messages from the server and sets the adapter accordingly
 */
private void getNextHistoryFromServer(final boolean newMsg){
  loadingMore=true;
  new Thread(() -> {
    ChatVerification verification;
    try {
      verification=ChatVerification.Companion.getChatVerification(ChatActivity.this,currentChatMember);
    }
 catch (    NoPrivateKey noPrivateKey) {
      return;
    }
    if (chatHistoryAdapter == null || chatHistoryAdapter.getCount() == 0 || newMsg) {
      chatMessageViewModel.getNewMessages(currentChatRoom.getId(),verification);
    }
 else {
      long id=chatHistoryAdapter.getItemId(0);
      chatMessageViewModel.getMessages(currentChatRoom.getId(),id,verification);
    }
    final List<ChatMessage> msgs=chatMessageViewModel.getAllChatMessagesList(currentChatRoom.getId());
    runOnUiThread(() -> {
      if (chatHistoryAdapter == null) {
        chatHistoryAdapter=new ChatHistoryAdapter(ChatActivity.this,msgs,currentChatMember);
        lvMessageHistory.setAdapter(chatHistoryAdapter);
        chatHistoryAdapter.notifyDataSetChanged();
      }
 else {
        chatHistoryAdapter.updateHistory(chatMessageViewModel.getAllChatMessagesList(currentChatRoom.getId()));
      }
      if ((msgs.size() != 0 && msgs.get(0).getPrevious() == 0) || chatHistoryAdapter.getCount() == 0) {
        lvMessageHistory.removeHeaderView(bar);
      }
 else {
        loadingMore=false;
      }
    }
);
  }
).start();
}
Program: 161466
Project: 161466
Buggy source:
private void handleRoomBroadcast(GCMChat extras){
  if (!(extras.getRoom() == currentChatRoom.getId() && chatHistoryAdapter != null)) {
    return;
  }
  if (extras.getMember() == currentChatMember.getId()) {
    chatHistoryAdapter.setUnsentMessages(chatMessageViewModel.getAllUnsentFromCurrentRoomList());
  }
 else   if (extras.getMessage() == -1) {
    AudioManager am=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
    if (am.getRingerMode() == AudioManager.RINGER_MODE_NORMAL) {
      MediaPlayer mediaPlayer=MediaPlayer.create(ChatActivity.this,R.raw.message);
      mediaPlayer.start();
    }
 else     if (am.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE) {
      Vibrator v=(Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
      vibrate(v);
    }
  }
  chatHistoryAdapter.updateHistory(chatMessageViewModel.getAllChatMessagesList(currentChatRoom.getId()));
  chatMessageViewModel.markAsRead(currentChatRoom.getId());
}

Fixed version (ground truth):
private void handleRoomBroadcast(GCMChat extras){
  if (!(extras.getRoom() == currentChatRoom.getId() && chatHistoryAdapter != null)) {
    return;
  }
  if (extras.getMember() == currentChatMember.getId()) {
    chatHistoryAdapter.setUnsentMessages(chatMessageViewModel.getAllUnsentFromCurrentRoomList());
  }
 else   if (extras.getMessage() == -1) {
    AudioManager am=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
    if (am.getRingerMode() == AudioManager.RINGER_MODE_NORMAL) {
      MediaPlayer mediaPlayer=MediaPlayer.create(ChatActivity.this,R.raw.message);
      mediaPlayer.start();
    }
 else     if (am.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE) {
      Vibrator v=(Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
      vibrate(v);
    }
  }
  chatMessageViewModel.markAsRead(currentChatRoom.getId());
  chatHistoryAdapter.updateHistory(chatMessageViewModel.getAllChatMessagesList(currentChatRoom.getId()));
}
Program: 161467
Project: 161467
Buggy source:
public Observable<List<ChatMessage>> getMessages(int roomId,long messageId,@Body ChatVerification verification) throws IOException {
  return service.getMessages(roomId,messageId,verification);
}

Fixed version (ground truth):
public Observable<List<ChatMessage>> getMessages(int roomId,long messageId,@Body ChatVerification verification){
  return service.getMessages(roomId,messageId,verification);
}
Program: 161468
Project: 161468
Buggy source:
public Observable<List<ChatMessage>> getNewMessages(int roomId,@Body ChatVerification verification) throws IOException {
  return service.getNewMessages(roomId,verification);
}

Fixed version (ground truth):
public Observable<List<ChatMessage>> getNewMessages(int roomId,@Body ChatVerification verification){
  return service.getNewMessages(roomId,verification);
}
Program: 161469
Project: 161469
Buggy source:
public Observable<ChatMessage> sendMessage(int roomId,ChatMessage chatMessageCreate) throws IOException {
  return service.sendMessage(roomId,chatMessageCreate);
}

Fixed version (ground truth):
public Observable<ChatMessage> sendMessage(int roomId,ChatMessage chatMessageCreate){
  return service.sendMessage(roomId,chatMessageCreate);
}
Program: 161470
Project: 161470
Buggy source:
public Observable<ChatMessage> updateMessage(int roomId,ChatMessage message) throws IOException {
  return service.updateMessage(roomId,message.getId(),message);
}

Fixed version (ground truth):
public Observable<ChatMessage> updateMessage(int roomId,ChatMessage message){
  return service.updateMessage(roomId,message.getId(),message);
}
Program: 161471
Project: 161471
Buggy source:
public Chat(String payload,Context context,int notfication){
  super(context,1,notfication,true);
  if (payload == null) {
    throw new IllegalArgumentException();
  }
  this.extras=new Gson().fromJson(payload,GCMChat.class);
  try {
    this.prepare();
  }
 catch (  IOException e) {
    Utils.log(e);
  }
  TcaDb tcaDb=TcaDb.getInstance(context);
  chatMessageDao=tcaDb.chatMessageDao();
}

Fixed version (ground truth):
public Chat(String payload,Context context,int notfication){
  super(context,1,notfication,true);
  if (payload == null) {
    throw new IllegalArgumentException();
  }
  this.extras=new Gson().fromJson(payload,GCMChat.class);
  try {
    this.prepare();
  }
 catch (  IOException e) {
    Utils.log(e);
  }
}
Program: 161472
Project: 161472
Buggy source:
public static void bindNewsView(NetUtils net,RecyclerView.ViewHolder newsViewHolder,Cursor cursor){
  NewsViewHolder holder=(NewsViewHolder)newsViewHolder;
  String imgUrl=cursor.getString(4);
  if (imgUrl == null || imgUrl.isEmpty() || imgUrl.equals("String_Node_Str")) {
    holder.img.setVisibility(View.GONE);
  }
 else {
    holder.img.setVisibility(View.VISIBLE);
    net.loadAndSetImage(imgUrl,holder.img);
  }
  String title=cursor.getString(2);
  if (cursor.getInt(1) == 2) {
    title=COMPILE.matcher(title).replaceAll("String_Node_Str");
  }
  holder.title.setText(title);
  String date=cursor.getString(5);
  Date d=Utils.getISODateTime(date);
  DateFormat sdf=DateFormat.getDateInstance();
  holder.srcDate.setText(sdf.format(d));
  holder.srcTitle.setText(cursor.getString(8));
  String icon=cursor.getString(7);
  if (icon.isEmpty() || "String_Node_Str".equals(icon)) {
    holder.srcIcon.setImageResource(R.drawable.ic_comment);
  }
 else {
    net.loadAndSetImage(icon,holder.srcIcon);
  }
}

Fixed version (ground truth):
public static void bindNewsView(NetUtils net,RecyclerView.ViewHolder newsViewHolder,Cursor cursor){
  NewsViewHolder holder=(NewsViewHolder)newsViewHolder;
  String imgUrl=cursor.getString(4);
  if (imgUrl == null || imgUrl.isEmpty() || imgUrl.equals("String_Node_Str")) {
    holder.img.setVisibility(View.GONE);
  }
 else {
    holder.img.setVisibility(View.VISIBLE);
    net.loadAndSetImage(imgUrl,holder.img);
  }
  String title=cursor.getString(2);
  if (cursor.getInt(1) == 2) {
    title=COMPILE.matcher(title).replaceAll("String_Node_Str");
  }
  holder.title.setText(title);
  String date=cursor.getString(5);
  Date d=Utils.getDateTime(date);
  DateFormat sdf=DateFormat.getDateInstance();
  holder.srcDate.setText(sdf.format(d));
  holder.srcTitle.setText(cursor.getString(8));
  String icon=cursor.getString(7);
  if (icon.isEmpty() || "String_Node_Str".equals(icon)) {
    holder.srcIcon.setImageResource(R.drawable.ic_comment);
  }
 else {
    net.loadAndSetImage(icon,holder.srcIcon);
  }
}
Program: 161473
Project: 161473
Buggy source:
private static Calendar getEventStartFromCursor(Cursor cEvents){
  String eventStart=cEvents.getString(5);
  Calendar result=Calendar.getInstance();
  result.setTime(Utils.getISODateTime(eventStart));
  return result;
}

Fixed version (ground truth):
private static Calendar getEventStartFromCursor(Cursor cEvents){
  String eventStart=cEvents.getString(5);
  Calendar result=Calendar.getInstance();
  result.setTime(Utils.getDateTime(eventStart));
  return result;
}
Program: 161474
Project: 161474
Buggy source:
private static Calendar getEventEndFromCursor(Cursor cEvents){
  String eventEnd=cEvents.getString(6);
  Calendar result=Calendar.getInstance();
  result.setTime(Utils.getISODateTime(eventEnd));
  return result;
}

Fixed version (ground truth):
private static Calendar getEventEndFromCursor(Cursor cEvents){
  String eventEnd=cEvents.getString(6);
  Calendar result=Calendar.getInstance();
  result.setTime(Utils.getDateTime(eventEnd));
  return result;
}
Program: 161475
Project: 161475
Buggy source:
public void setLectures(Cursor cur){
  do {
    CalendarItem item=new CalendarItem();
    item.start=Utils.getISODateTime(cur.getString(1));
    item.end=Utils.getISODateTime(cur.getString(2));
    item.title=cur.getString(0);
    item.title=item.title.replaceAll("String_Node_Str","String_Node_Str");
    item.title=item.title.replaceAll("String_Node_Str","String_Node_Str");
    item.title=item.title.replaceAll("String_Node_Str","String_Node_Str");
    item.title=item.title.trim();
    item.location=cur.getString(3);
    if (item.location != null) {
      item.location=item.location.replaceAll("String_Node_Str","String_Node_Str").trim();
    }
    lectures.add(item);
  }
 while (cur.moveToNext());
  cur.close();
}

Fixed version (ground truth):
public void setLectures(Cursor cur){
  do {
    CalendarItem item=new CalendarItem();
    item.start=Utils.getDateTime(cur.getString(1));
    item.end=Utils.getDateTime(cur.getString(2));
    item.title=cur.getString(0);
    item.title=item.title.replaceAll("String_Node_Str","String_Node_Str");
    item.title=item.title.replaceAll("String_Node_Str","String_Node_Str");
    item.title=item.title.replaceAll("String_Node_Str","String_Node_Str");
    item.title=item.title.trim();
    item.location=cur.getString(3);
    if (item.location != null) {
      item.location=item.location.replaceAll("String_Node_Str","String_Node_Str").trim();
    }
    lectures.add(item);
  }
 while (cur.moveToNext());
  cur.close();
}
Program: 161476
Project: 161476
Buggy source:
@TypeConverter public static Date fromIso(String str){
  return Utils.getISODateTime(str);
}

Fixed version (ground truth):
@TypeConverter public static Date fromIso(String str){
  return Utils.getDateTime(str);
}
Program: 161477
Project: 161477
Buggy source:
private List<WeekViewEvent> fetchEventList(String roomId,String startDate,String endDate){
  List<WeekViewEvent> events=new ArrayList<>();
  try {
    Optional<List<RoomFinderSchedule>> result=Optional.of(TUMCabeClient.getInstance(context).fetchSchedule(roomId,startDate,endDate));
    List<RoomFinderSchedule> schedules=result.get();
    for (    RoomFinderSchedule schedule : schedules) {
      Calendar startCal=Calendar.getInstance();
      startCal.setTime(Utils.getISODateTime(schedule.getStart()));
      Calendar endCal=Calendar.getInstance();
      endCal.setTime(Utils.getISODateTime(schedule.getEnd()));
      IntegratedCalendarEvent calendarEvent=new IntegratedCalendarEvent(schedule.getEvent_id(),schedule.getTitle(),startCal,endCal,"String_Node_Str",IntegratedCalendarEvent.getDisplayColorFromColor(0xff28921f));
      events.add(calendarEvent);
    }
    return events;
  }
 catch (  IOException|NullPointerException e) {
    Utils.log(e);
  }
  return events;
}

Fixed version (ground truth):
private List<WeekViewEvent> fetchEventList(String roomId,String startDate,String endDate){
  List<WeekViewEvent> events=new ArrayList<>();
  try {
    Optional<List<RoomFinderSchedule>> result=Optional.of(TUMCabeClient.getInstance(context).fetchSchedule(roomId,startDate,endDate));
    List<RoomFinderSchedule> schedules=result.get();
    for (    RoomFinderSchedule schedule : schedules) {
      Calendar startCal=Calendar.getInstance();
      startCal.setTime(Utils.getDateTime(schedule.getStart()));
      Calendar endCal=Calendar.getInstance();
      endCal.setTime(Utils.getDateTime(schedule.getEnd()));
      IntegratedCalendarEvent calendarEvent=new IntegratedCalendarEvent(schedule.getEvent_id(),schedule.getTitle(),startCal,endCal,"String_Node_Str",IntegratedCalendarEvent.getDisplayColorFromColor(0xff28921f));
      events.add(calendarEvent);
    }
    return events;
  }
 catch (  IOException|NullPointerException e) {
    Utils.log(e);
  }
  return events;
}
Program: 161479
Project: 161479
Buggy source:
public static ChatMessage toObject(Cursor cursor){
  SimpleDateFormat formatter=new SimpleDateFormat("String_Node_Str",Locale.ENGLISH);
  int id=cursor.getInt(COL_ID);
  String text=cursor.getString(COL_TEXT);
  String time=formatter.format(Utils.getISODateTime(cursor.getString(COL_TIMESTAMP)));
  int previous=cursor.getInt(COL_PREVIOUS);
  ChatMember member=new Gson().fromJson(cursor.getString(COL_MEMBER),ChatMember.class);
  ChatMessage msg=new ChatMessage(id,text,member,time,previous);
  msg.setSignature(cursor.getString(COL_SIGNATURE));
  msg.setRoom(cursor.getInt(COL_ROOM));
  msg.setRead(cursor.getInt(COL_READ) == 1);
  msg.setStatus(cursor.getInt(COL_SENDING));
  return msg;
}

Fixed version (ground truth):
public static ChatMessage toObject(Cursor cursor){
  SimpleDateFormat formatter=new SimpleDateFormat("String_Node_Str",Locale.ENGLISH);
  int id=cursor.getInt(COL_ID);
  String text=cursor.getString(COL_TEXT);
  String time=formatter.format(Utils.getDateTime(cursor.getString(COL_TIMESTAMP)));
  int previous=cursor.getInt(COL_PREVIOUS);
  ChatMember member=new Gson().fromJson(cursor.getString(COL_MEMBER),ChatMember.class);
  ChatMessage msg=new ChatMessage(id,text,member,time,previous);
  msg.setSignature(cursor.getString(COL_SIGNATURE));
  msg.setRoom(cursor.getInt(COL_ROOM));
  msg.setRead(cursor.getInt(COL_READ) == 1);
  msg.setStatus(cursor.getInt(COL_SENDING));
  return msg;
}
Program: 161480
Project: 161480
Buggy source:
/** 
 * Convert JSON object to Kino
 * @param json JsonObject from external
 * @return Kino
 * @throws JSONException
 */
private static Kino getFromJson(JSONObject json) throws JSONException {
  String id=json.getString(Const.JSON_KINO);
  String title=json.getString(Const.JSON_TITLE);
  String year=json.getString(Const.JSON_YEAR);
  String runtime=json.getString(Const.JSON_RUNTIME);
  String genre=json.getString(Const.JSON_GENRE);
  String director=json.getString(Const.JSON_DIRECTOR);
  String actors=json.getString(Const.JSON_ACTORS);
  String rating=json.getString(Const.JSON_RATING);
  String description=json.getString(Const.JSON_DESCRIPTION).replaceAll("String_Node_Str","String_Node_Str").trim();
  String cover=json.getString(Const.JSON_COVER);
  String trailer=json.getString(Const.JSON_TRAILER);
  Date date=Utils.getISODateTime(json.getString(Const.JSON_DATE));
  Date created=Utils.getISODateTime(json.getString(Const.JSON_CREATED));
  String link=json.getString(Const.JSON_LINK);
  return new Kino(id,title,year,runtime,genre,director,actors,rating,description,cover,trailer,date,created,link);
}

Fixed version (ground truth):
/** 
 * Convert JSON object to Kino
 * @param json JsonObject from external
 * @return Kino
 * @throws JSONException
 */
private static Kino getFromJson(JSONObject json) throws JSONException {
  String id=json.getString(Const.JSON_KINO);
  String title=json.getString(Const.JSON_TITLE);
  String year=json.getString(Const.JSON_YEAR);
  String runtime=json.getString(Const.JSON_RUNTIME);
  String genre=json.getString(Const.JSON_GENRE);
  String director=json.getString(Const.JSON_DIRECTOR);
  String actors=json.getString(Const.JSON_ACTORS);
  String rating=json.getString(Const.JSON_RATING);
  String description=json.getString(Const.JSON_DESCRIPTION).replaceAll("String_Node_Str","String_Node_Str").trim();
  String cover=json.getString(Const.JSON_COVER);
  String trailer=json.getString(Const.JSON_TRAILER);
  Date date=Utils.getDateTime(json.getString(Const.JSON_DATE));
  Date created=Utils.getDateTime(json.getString(Const.JSON_CREATED));
  String link=json.getString(Const.JSON_LINK);
  return new Kino(id,title,year,runtime,genre,director,actors,rating,description,cover,trailer,date,created,link);
}
Program: 161481
Project: 161481
Buggy source:
/** 
 * Convert JSON object to News and download news image
 * @param json see above
 * @return News
 * @throws JSONException if the json is invalid
 */
private static News getFromJson(JSONObject json) throws JSONException {
  String id=json.getString(Const.JSON_NEWS);
  String src=json.getString(Const.JSON_SRC);
  String title=json.getString(Const.JSON_TITLE);
  String link=json.getString(Const.JSON_LINK);
  String image=json.getString(Const.JSON_IMAGE);
  Date date=Utils.getISODateTime(json.getString(Const.JSON_DATE));
  Date created=Utils.getISODateTime(json.getString(Const.JSON_CREATED));
  return new News(id,title,link,src,image,date,created);
}

Fixed version (ground truth):
/** 
 * Convert JSON object to News and download news image
 * @param json see above
 * @return News
 * @throws JSONException if the json is invalid
 */
private static News getFromJson(JSONObject json) throws JSONException {
  String id=json.getString(Const.JSON_NEWS);
  String src=json.getString(Const.JSON_SRC);
  String title=json.getString(Const.JSON_TITLE);
  String link=json.getString(Const.JSON_LINK);
  String image=json.getString(Const.JSON_IMAGE);
  Date date=Utils.getDateTime(json.getString(Const.JSON_DATE));
  Date created=Utils.getDateTime(json.getString(Const.JSON_CREATED));
  return new News(id,title,link,src,image,date,created);
}
Program: 161482
Project: 161482
Buggy source:
@Override public View onCreateView(@NonNull LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View rootView=inflater.inflate(R.layout.fragment_item_detail,container,false);
  RecyclerView recyclerView;
  LinearLayoutManager layoutManager;
  try (Cursor studyRoomCursor=new StudyRoomGroupManager(getActivity()).getStudyRoomsFromDb(mStudyRoomGroupId)){
    recyclerView=rootView.findViewById(R.id.fragment_item_detail_recyclerview);
    recyclerView.setAdapter(new StudyRoomAdapter(studyRoomCursor));
  }
   layoutManager=new LinearLayoutManager(getContext());
  layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
  recyclerView.setLayoutManager(layoutManager);
  recyclerView.setHasFixedSize(true);
  return rootView;
}

Fixed version (ground truth):
@Override public View onCreateView(@NonNull LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View rootView=inflater.inflate(R.layout.fragment_item_detail,container,false);
  Cursor studyRoomCursor=new StudyRoomGroupManager(getActivity()).getStudyRoomsFromDb(mStudyRoomGroupId);
  RecyclerView recyclerView=rootView.findViewById(R.id.fragment_item_detail_recyclerview);
  recyclerView.setAdapter(new StudyRoomAdapter(studyRoomCursor));
  LinearLayoutManager layoutManager=new LinearLayoutManager(getContext());
  layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
  recyclerView.setLayoutManager(layoutManager);
  recyclerView.setHasFixedSize(true);
  return rootView;
}
Program: 161483
Project: 161483
Buggy source:
public String addLock(String url,String data){
  reqStatus r=this.getLock(url);
  int lockTime=TumManager.DEFAULT_LOCK;
  if (r != null) {
    lockTime=r.lockedFor * 2;
    if (lockTime > TumManager.MAX_AGE) {
      lockTime=TumManager.MAX_AGE;
    }
  }
  String msg="String_Node_Str";
  try {
    Error res=new Persister().read(Error.class,data);
    msg=res.getMessage();
  }
 catch (  Exception e) {
    Utils.log(e);
  }
  db.execSQL("String_Node_Str",new String[]{url,msg,String.valueOf(lockTime)});
  return msg;
}

Fixed version (ground truth):
public String addLock(String url,String data){
  reqStatus r=this.getLock(url);
  int lockTime=TumManager.DEFAULT_LOCK;
  if (r != null) {
    lockTime=r.lockedFor * 2;
    if (lockTime > TumManager.MAX_AGE) {
      lockTime=TumManager.MAX_AGE;
    }
  }
  String msg="String_Node_Str";
  try {
    if (data.contains(TUMOnlineRequest.NO_ENTRIES)) {
      return data;
    }
    Error res=new Persister().read(Error.class,data);
    msg=res.getMessage();
  }
 catch (  Exception e) {
    Utils.log(e);
  }
  db.execSQL("String_Node_Str",new String[]{url,msg,String.valueOf(lockTime)});
  return msg;
}