nus-yam/ex-repair huggingface dataset:
Program: 26076
Project: 26076
Buggy source:
/** 
 * Copy an array of elements using the elements' copy constructor
 * @param source The array to duplicate.
 * @param sourceOffset offset index in source where the region to be copied begins.
 * @param count of elements to copy.
 * @throws NoSuchMethodException if the element class does not have a copy constructor.
 */
public static <T>LongStructuredArray<T> copyInstance(StructuredArray<T> source,long sourceOffset,long count) throws NoSuchMethodException {
  if (source.getLength() < sourceOffset + count) {
    throw new ArrayIndexOutOfBoundsException("String_Node_Str" + source + "String_Node_Str"+ source.getLength()+ "String_Node_Str"+ sourceOffset+ "String_Node_Str"+ count+ "String_Node_Str");
  }
  @SuppressWarnings("String_Node_Str") final ElementConstructorGenerator<T> copyConstructorGenerator=(ElementConstructorGenerator<T>)new ElementCopyConstructorGenerator<T>(source.getElementClass(),source,sourceOffset);
  return new LongStructuredArray<T>(source.getLength(),source.getElementClass(),copyConstructorGenerator);
}

Fixed version (ground truth):
/** 
 * Copy an array of elements using the elements' copy constructor
 * @param source The array to duplicate.
 * @param sourceOffset offset index in source where the region to be copied begins.
 * @param count of elements to copy.
 * @throws NoSuchMethodException if the element class does not have a copy constructor.
 */
public static <T>LongStructuredArray<T> copyInstance(LongStructuredArray<T> source,long sourceOffset,long count) throws NoSuchMethodException {
  if (source.getLength() < sourceOffset + count) {
    throw new ArrayIndexOutOfBoundsException("String_Node_Str" + source + "String_Node_Str"+ source.getLength()+ "String_Node_Str"+ sourceOffset+ "String_Node_Str"+ count+ "String_Node_Str");
  }
  @SuppressWarnings("String_Node_Str") final ElementConstructorGenerator<T> copyConstructorGenerator=(ElementConstructorGenerator<T>)new ElementCopyConstructorGenerator<T>(source.getElementClass(),source,sourceOffset);
  return new LongStructuredArray<T>(count,source.getElementClass(),copyConstructorGenerator);
}
Program: 26077
Project: 26077
Buggy source:
@SuppressWarnings("String_Node_Str") protected AbstractStructuredArray(final Class<T> elementClass,final ElementConstructorGenerator<T> elementConstructorGenerator){
  if (null == elementClass) {
    throw new NullPointerException("String_Node_Str");
  }
  if (elementClass.getClass() != elementConstructorGenerator.getElementClass()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.elementClass=elementClass;
  final Field[] fields=removeStaticFields(elementClass.getDeclaredFields());
  for (  final Field field : fields) {
    field.setAccessible(true);
  }
  this.fields=fields;
  this.hasFinalFields=containsFinalQualifiedFields(fields);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") protected AbstractStructuredArray(final Class<T> elementClass,final ElementConstructorGenerator<T> elementConstructorGenerator){
  if (null == elementClass) {
    throw new NullPointerException("String_Node_Str");
  }
  if (elementClass != elementConstructorGenerator.getElementClass()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.elementClass=elementClass;
  final Field[] fields=removeStaticFields(elementClass.getDeclaredFields());
  for (  final Field field : fields) {
    field.setAccessible(true);
  }
  this.fields=fields;
  this.hasFinalFields=containsFinalQualifiedFields(fields);
}
Program: 26080
Project: 26080
Buggy source:
public static boolean setNumberPickerTextColor(NumberPicker numberPicker,int color){
  final int count=numberPicker.getChildCount();
  for (int i=0; i < count; i++) {
    View child=numberPicker.getChildAt(i);
    if (child instanceof EditText) {
      try {
        Field selectorWheelPaintField=numberPicker.getClass().getDeclaredField("String_Node_Str");
        selectorWheelPaintField.setAccessible(true);
        ((Paint)selectorWheelPaintField.get(numberPicker)).setColor(color);
        ((EditText)child).setTextColor(color);
        numberPicker.invalidate();
        return true;
      }
 catch (      NoSuchFieldException e) {
        Log.w("String_Node_Str",e);
      }
catch (      IllegalAccessException e) {
        Log.w("String_Node_Str",e);
      }
catch (      IllegalArgumentException e) {
        Log.w("String_Node_Str",e);
      }
    }
  }
  return false;
}

Fixed version (ground truth):
public static boolean setNumberPickerTextColor(NumberPicker numberPicker,int color){
  final int count=numberPicker.getChildCount();
  for (int i=0; i < count; i++) {
    View child=numberPicker.getChildAt(i);
    if (child instanceof EditText) {
      try {
        Field selectorWheelPaintField=numberPicker.getClass().getDeclaredField("String_Node_Str");
        selectorWheelPaintField.setAccessible(true);
        ((Paint)selectorWheelPaintField.get(numberPicker)).setColor(color);
        ((EditText)child).setTextColor(color);
        numberPicker.invalidate();
        return true;
      }
 catch (      NoSuchFieldException e) {
        Log.w("String_Node_Str",e);
      }
catch (      IllegalAccessException e) {
        Log.w("String_Node_Str",e);
      }
catch (      IllegalArgumentException e) {
        Log.w("String_Node_Str",e);
      }
    }
    try {
      Field f=NumberPicker.class.getDeclaredField("String_Node_Str");
      f.setAccessible(true);
      EditText inputText=(EditText)f.get(numberPicker);
      inputText.setFilters(new InputFilter[0]);
    }
 catch (    NoSuchFieldException e) {
      e.printStackTrace();
    }
catch (    IllegalAccessException e) {
      e.printStackTrace();
    }
  }
}
Program: 26081
Project: 26081
Buggy source:
@Override public void onScrolled(RecyclerView recyclerView,int dx,int dy){
  super.onScrolled(recyclerView,dx,dy);
  int adapterTotalItemCount=linearLayoutManager.getItemCount();
  int lastVisibleItem=linearLayoutManager.findLastVisibleItemPosition();
  if (!loading && adapterTotalItemCount <= (lastVisibleItem + visibleThreshold) && adapterTotalItemCount < totalItemCount) {
    Log.v(TAG,"String_Node_Str");
    recyclerView.post(new Runnable(){
      public void run(){
        lazyList.add(null);
        notifyItemInserted(lazyList.size() - 1);
        AsyncTaskHelper.StartAsyncTask(new LoadMoreItemsAsyncTask());
        loading=true;
      }
    }
);
  }
}

Fixed version (ground truth):
@Override public void onScrolled(RecyclerView recyclerView,int dx,int dy){
  super.onScrolled(recyclerView,dx,dy);
  int adapterTotalItemCount=linearLayoutManager.getItemCount();
  int lastVisibleItem=linearLayoutManager.findLastVisibleItemPosition();
  if (!loading && adapterTotalItemCount <= (lastVisibleItem + visibleThreshold) && adapterTotalItemCount < totalItemCount) {
    loading=true;
    Log.v(TAG,"String_Node_Str");
    recyclerView.post(new Runnable(){
      public void run(){
        lazyList.add(null);
        notifyItemInserted(lazyList.size() - 1);
        AsyncTaskHelper.StartAsyncTask(new LoadMoreItemsAsyncTask());
      }
    }
);
  }
}
Program: 26082
Project: 26082
Buggy source:
public void run(){
  lazyList.add(null);
  notifyItemInserted(lazyList.size() - 1);
  AsyncTaskHelper.StartAsyncTask(new LoadMoreItemsAsyncTask());
  loading=true;
}

Fixed version (ground truth):
public void run(){
  lazyList.add(null);
  notifyItemInserted(lazyList.size() - 1);
  AsyncTaskHelper.StartAsyncTask(new LoadMoreItemsAsyncTask());
}
Program: 26084
Project: 26084
Buggy source:
@SuppressWarnings("String_Node_Str") public static void updateAppWidget(Context context,AppWidgetManager appWidgetManager,int appWidgetId){
  RemoteViews rv=new RemoteViews(context.getPackageName(),R.layout.widget_layout);
  Intent intent=new Intent(context,WidgetService.class);
  intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,appWidgetId);
  rv.setRemoteAdapter(appWidgetId,R.id.list_view,intent);
  Intent onListClickIntent=new Intent(context,WidgetProvider.class);
  onListClickIntent.setAction(ACTION_LIST_CLICK);
  onListClickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,appWidgetId);
  onListClickIntent.setData(Uri.parse(onListClickIntent.toUri(Intent.URI_INTENT_SCHEME)));
  final PendingIntent onListClickPendingIntent=PendingIntent.getBroadcast(context,0,onListClickIntent,PendingIntent.FLAG_UPDATE_CURRENT);
  rv.setPendingIntentTemplate(R.id.list_view,onListClickPendingIntent);
  Intent intentToDoListAct=new Intent(context,NewsReaderListActivity.class);
  PendingIntent pendingIntent=PendingIntent.getActivity(context,0,intentToDoListAct,0);
  rv.setOnClickPendingIntent(R.id.tV_widget_header,pendingIntent);
  appWidgetManager.updateAppWidget(appWidgetId,rv);
  if (Constants.debugModeWidget)   Log.d(TAG,"String_Node_Str" + appWidgetId);
}

Fixed version (ground truth):
public static void updateAppWidget(Context context,AppWidgetManager appWidgetManager,int appWidgetId){
  RemoteViews rv=new RemoteViews(context.getPackageName(),R.layout.widget_layout);
  Intent intent=new Intent(context,WidgetService.class);
  intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,appWidgetId);
  rv.setRemoteAdapter(R.id.list_view,intent);
  Intent onListClickIntent=new Intent(context,WidgetProvider.class);
  onListClickIntent.setAction(ACTION_LIST_CLICK);
  onListClickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,appWidgetId);
  onListClickIntent.setData(Uri.parse(onListClickIntent.toUri(Intent.URI_INTENT_SCHEME)));
  final PendingIntent onListClickPendingIntent=PendingIntent.getBroadcast(context,0,onListClickIntent,PendingIntent.FLAG_UPDATE_CURRENT);
  rv.setPendingIntentTemplate(R.id.list_view,onListClickPendingIntent);
  Intent intentToDoListAct=new Intent(context,NewsReaderListActivity.class);
  PendingIntent pendingIntent=PendingIntent.getActivity(context,0,intentToDoListAct,0);
  rv.setOnClickPendingIntent(R.id.tV_widget_header,pendingIntent);
  appWidgetManager.updateAppWidget(appWidgetId,rv);
  if (Constants.debugModeWidget)   Log.d(TAG,"String_Node_Str" + appWidgetId);
}
Program: 26085
Project: 26085
Buggy source:
@Override public long getItemId(int position){
  Log.v(TAG,"String_Node_Str" + position);
  return (position);
}

Fixed version (ground truth):
@Override public long getItemId(int position){
  return (position);
}
Program: 26087
Project: 26087
Buggy source:
/** 
 * Input e.g. "6.0.4". Output [0] = 6, [1] = 4
 * @param appVersion
 * @return [0] = majorVersion, [1] = minorVersion
 */
public static int[] ExtractVersionNumberFromString(String appVersion){
  int majorVersion=0;
  int minorVersion=0;
  if (appVersion != null) {
    majorVersion=Integer.parseInt(appVersion.substring(0,1));
    appVersion=appVersion.substring(2);
    appVersion=appVersion.replace("String_Node_Str","String_Node_Str");
    minorVersion=Integer.parseInt(appVersion);
  }
  return new int[]{majorVersion,minorVersion};
}

Fixed version (ground truth):
/** 
 * @param appVersion e.g. "6.0.4".
 * @return e.g. [0] = 6, [1] = 0, [2] = 4
 */
public static int[] ExtractVersionNumberFromString(String appVersion){
  Pattern p=Pattern.compile("String_Node_Str");
  Matcher m=p.matcher(appVersion);
  int version[]=new int[]{0,0,0};
  if (m.matches()) {
    version[0]=Integer.parseInt(m.group(1));
    version[1]=Integer.parseInt(m.group(2));
    version[2]=Integer.parseInt(m.group(3));
  }
  return version;
}
Program: 26088
Project: 26088
Buggy source:
public static API GetRightApiForVersion(String appVersion,HttpUrl baseUrl){
  API api;
  int[] version=ExtractVersionNumberFromString(appVersion);
  int majorVersion=version[0];
  int minorVersion=version[1];
switch (majorVersion) {
case 1:
    if (minorVersion >= 101) {
      api=new APIv2(baseUrl);
    }
 else {
      api=new APIv1(baseUrl);
    }
  break;
case 2:
api=new APIv2(baseUrl);
break;
case 3:
api=new APIv2(baseUrl);
break;
case 4:
api=new APIv2(baseUrl);
break;
default :
api=new APIv2(baseUrl);
break;
}
return api;
}

Fixed version (ground truth):
public static API GetRightApiForVersion(String appVersion,HttpUrl baseUrl){
  API api;
  int[] version=ExtractVersionNumberFromString(appVersion);
  api=new APIv2(baseUrl);
  return api;
}
Program: 26089
Project: 26089
Buggy source:
private void NotifyDownloadFinished(){
  if (imageDownloadFinished != null)   imageDownloadFinished.DownloadFinished(ThreadId);
}

Fixed version (ground truth):
private void NotifyDownloadFinished(Bitmap bitmap){
  if (imageDownloadFinished != null)   imageDownloadFinished.DownloadFinished(ThreadId,bitmap);
}
Program: 26090
Project: 26090
Buggy source:
@Override public void onLoadingComplete(String imageUri,View view,Bitmap loadedImage){
  NotifyDownloadFinished();
}

Fixed version (ground truth):
@Override public void onLoadingComplete(String imageUri,View view,Bitmap loadedImage){
  NotifyDownloadFinished(loadedImage);
}
Program: 26091
Project: 26091
Buggy source:
@Override public void onLoadingCancelled(String imageUri,View view){
  NotifyDownloadFinished();
  Log.d(TAG,"String_Node_Str" + imageUri);
}

Fixed version (ground truth):
@Override public void onLoadingCancelled(String imageUri,View view){
  NotifyDownloadFinished(null);
  Log.d(TAG,"String_Node_Str" + imageUri);
}
Program: 26092
Project: 26092
Buggy source:
@Override public void onLoadingFailed(String imageUri,View view,FailReason failReason){
  NotifyDownloadFinished();
  Log.d(TAG,"String_Node_Str" + imageUri);
}

Fixed version (ground truth):
@Override public void onLoadingFailed(String imageUri,View view,FailReason failReason){
  NotifyDownloadFinished(null);
  Log.d(TAG,"String_Node_Str" + imageUri);
}
Program: 26093
Project: 26093
Buggy source:
public void PreCacheFavIcon(Feed feed){
  if (feed.getFaviconUrl() == null) {
    Log.v(TAG,"String_Node_Str" + feed.getFeedTitle());
    return;
  }
  GetImageThreaded giAsync=new GetImageThreaded(feed.getFaviconUrl(),favIconDownloadFinished,feed.getId());
  giAsync.start();
}

Fixed version (ground truth):
public void PreCacheFavIcon(Feed feed){
  if (feed.getFaviconUrl() == null) {
    Log.v(TAG,"String_Node_Str" + feed.getFeedTitle());
    return;
  }
  new GetImageThreaded(feed.getFaviconUrl(),favIconDownloadFinished,feed.getId()).start();
}
Program: 26094
Project: 26094
Buggy source:
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  final long highestItemIdBeforeSync=getIntent().getLongExtra("String_Node_Str",0);
  AlertDialog.Builder alertDialogBuilder=new AlertDialog.Builder(this);
  alertDialogBuilder.setTitle(getString(R.string.no_wifi_available));
  alertDialogBuilder.setMessage(getString(R.string.do_you_want_to_download_without_wifi)).setCancelable(true).setPositiveButton(getString(android.R.string.yes),new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int id){
      AsyncTask_GetItems.StartDownloadingImages(DownloadImagesActivity.this,highestItemIdBeforeSync,false);
      DownloadImagesActivity.this.finish();
    }
  }
).setNegativeButton(getString(android.R.string.no),new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int id){
      DownloadImagesActivity.this.finish();
    }
  }
);
  AlertDialog alertDialog=alertDialogBuilder.create();
  alertDialog.show();
}

Fixed version (ground truth):
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  final long highestItemIdBeforeSync=getIntent().getLongExtra("String_Node_Str",0);
  AlertDialog.Builder alertDialogBuilder=new AlertDialog.Builder(this);
  alertDialogBuilder.setTitle(getString(R.string.no_wifi_available));
  alertDialogBuilder.setMessage(getString(R.string.do_you_want_to_download_without_wifi)).setCancelable(true).setPositiveButton(getString(android.R.string.yes),new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int id){
      Intent service=new Intent(DownloadImagesActivity.this,DownloadImagesService.class);
      service.putExtra(DownloadImagesService.LAST_ITEM_ID,highestItemIdBeforeSync);
      service.putExtra(DownloadImagesService.DOWNLOAD_MODE_STRING,DownloadImagesService.DownloadMode.PICTURES_ONLY);
      DownloadImagesActivity.this.startService(service);
      DownloadImagesActivity.this.finish();
    }
  }
).setNegativeButton(getString(android.R.string.no),new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int id){
      DownloadImagesActivity.this.finish();
    }
  }
);
  AlertDialog alertDialog=alertDialogBuilder.create();
  alertDialog.show();
}
Program: 26096
Project: 26096
Buggy source:
@Override protected void onPostExecute(Exception ex){
  for (  OnAsyncTaskCompletedListener listenerInstance : listener) {
    if (listenerInstance != null)     listenerInstance.onAsyncTaskCompleted(ex);
  }
  if (ex == null && NetworkConnection.isNetworkAvailable(context)) {
    SharedPreferences mPrefs=PreferenceManager.getDefaultSharedPreferences(context);
    int syncStrategy=Integer.parseInt(mPrefs.getString(SettingsActivity.LV_CACHE_IMAGES_OFFLINE_STRING,"String_Node_Str"));
    boolean downloadImages=false;
switch (syncStrategy) {
case 0:
      break;
case 1:
    if (NetworkConnection.isWLANConnected(context))     downloadImages=true;
  break;
case 2:
downloadImages=true;
break;
case 3:
if (!NetworkConnection.isWLANConnected(context)) ShowDownloadImageWithoutWifiQuestion();
 else downloadImages=true;
break;
}
if (downloadImages) StartDownloadingImages(context,highestItemIdBeforeSync,false);
 else StartDownloadingImages(context,highestItemIdBeforeSync,true);
}
detach();
}

Fixed version (ground truth):
@Override protected void onPostExecute(Exception ex){
  for (  OnAsyncTaskCompletedListener listenerInstance : listener) {
    if (listenerInstance != null)     listenerInstance.onAsyncTaskCompleted(ex);
  }
  if (ex == null && NetworkConnection.isNetworkAvailable(context)) {
    SharedPreferences mPrefs=PreferenceManager.getDefaultSharedPreferences(context);
    int syncStrategy=Integer.parseInt(mPrefs.getString(SettingsActivity.LV_CACHE_IMAGES_OFFLINE_STRING,"String_Node_Str"));
    boolean downloadImages=false;
switch (syncStrategy) {
case 0:
      break;
case 1:
    if (NetworkConnection.isWLANConnected(context))     downloadImages=true;
  break;
case 2:
downloadImages=true;
break;
case 3:
if (!NetworkConnection.isWLANConnected(context)) ShowDownloadImageWithoutWifiQuestion();
 else downloadImages=true;
break;
}
if (downloadImages) {
Intent service=new Intent(context,DownloadImagesService.class);
service.putExtra(DownloadImagesService.LAST_ITEM_ID,highestItemIdBeforeSync);
service.putExtra(DownloadImagesService.DOWNLOAD_MODE_STRING,DownloadImagesService.DownloadMode.PICTURES_ONLY);
context.startService(service);
}
}
detach();
}
Program: 26097
Project: 26097
Buggy source:
@Override protected void onHandleIntent(Intent intent){
  boolean downloadFavIconsExclusive=intent.getBooleanExtra(DOWNLOAD_FAVICONS_EXCLUSIVE,false);
  DatabaseConnectionOrm dbConn=new DatabaseConnectionOrm(this);
  Notification notify=BuildNotification();
  List<Feed> feedList=dbConn.getListOfFeeds();
  FavIconHandler favIconHandler=new FavIconHandler(this);
  for (  Feed feed : feedList) {
    favIconHandler.PreCacheFavIcon(feed);
  }
  if (!downloadFavIconsExclusive) {
    long lastId=intent.getLongExtra(LAST_ITEM_ID,0);
    List<RssItem> rssItemList=dbConn.getAllItemsWithIdHigher(lastId);
    List<String> links=new ArrayList<>();
    for (    RssItem rssItem : rssItemList) {
      String body=rssItem.getBody();
      links.addAll(ImageHandler.getImageLinksFromText(body));
      if (links.size() > 10000) {
        notificationManager.notify(123,GetNotificationLimitImagesReached(10000));
        break;
      }
    }
    ((LazyList)rssItemList).close();
    maxCount=links.size();
    if (maxCount > 0) {
      notificationManager.notify(NOTIFICATION_ID,notify);
    }
    linksToImages.addAll(links);
    StartNextDownloadInQueue();
  }
}

Fixed version (ground truth):
@Override protected void onHandleIntent(Intent intent){
  DownloadMode downloadMode=(DownloadMode)intent.getSerializableExtra(DOWNLOAD_MODE_STRING);
  DatabaseConnectionOrm dbConn=new DatabaseConnectionOrm(this);
  Notification notify=BuildNotification();
  if (downloadMode.equals(DownloadMode.FAVICONS_ONLY)) {
    List<Feed> feedList=dbConn.getListOfFeeds();
    FavIconHandler favIconHandler=new FavIconHandler(this);
    for (    Feed feed : feedList) {
      favIconHandler.PreCacheFavIcon(feed);
    }
  }
 else   if (downloadMode.equals(DownloadMode.FAVICONS_AND_PICTURES) || downloadMode.equals(DownloadMode.PICTURES_ONLY)) {
    long lastId=intent.getLongExtra(LAST_ITEM_ID,0);
    List<RssItem> rssItemList=dbConn.getAllItemsWithIdHigher(lastId);
    List<String> links=new ArrayList<>();
    for (    RssItem rssItem : rssItemList) {
      String body=rssItem.getBody();
      links.addAll(ImageHandler.getImageLinksFromText(body));
      if (links.size() > 10000) {
        notificationManager.notify(123,GetNotificationLimitImagesReached(10000));
        break;
      }
    }
    ((LazyList)rssItemList).close();
    maxCount=links.size();
    if (maxCount > 0) {
      notificationManager.notify(NOTIFICATION_ID,notify);
    }
    linksToImages.addAll(links);
    StartNextDownloadInQueue();
  }
}
Program: 26100
Project: 26100
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mFeedId=getArguments().getLong("String_Node_Str");
  mDialogTitle=getArguments().getString("String_Node_Str");
  mDialogIconUrl=getArguments().getString("String_Node_Str");
  mDialogText=getArguments().getString("String_Node_Str");
  mMenuItems=new LinkedHashMap<>();
  mMenuItems.put(getString(R.string.action_feed_rename),new MenuAction(){
    @Override public void execute(){
      showRenameFeedView(mFeedId,mDialogTitle);
    }
  }
);
  mMenuItems.put(getString(R.string.action_feed_remove),new MenuAction(){
    @Override public void execute(){
      showRemoveFeedView(mFeedId);
    }
  }
);
  int style=DialogFragment.STYLE_NO_TITLE;
  int theme=ThemeChooser.isDarkTheme(getActivity()) ? R.style.Theme_Material_Dialog_Floating : R.style.Theme_Material_Light_Dialog_Floating;
  setStyle(style,theme);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mFeedId=getArguments().getLong("String_Node_Str");
  mDialogTitle=getArguments().getString("String_Node_Str");
  mDialogIconUrl=getArguments().getString("String_Node_Str");
  mDialogText=getArguments().getString("String_Node_Str");
  mMenuItems=new LinkedHashMap<>();
  mMenuItems.put(getString(R.string.action_feed_rename),new MenuAction(){
    @Override public void execute(){
      showRenameFeedView(mFeedId,mDialogTitle);
    }
  }
);
  mMenuItems.put(getString(R.string.action_feed_remove),new MenuAction(){
    @Override public void execute(){
      showRemoveFeedView(mFeedId);
    }
  }
);
  int style=DialogFragment.STYLE_NO_TITLE;
  int theme=ThemeChooser.isDarkTheme(getActivity()) ? R.style.FloatingDialog : R.style.FloatingDialogLight;
  setStyle(style,theme);
}
Program: 26101
Project: 26101
Buggy source:
@Override public void onInflate(Context context,AttributeSet attrs,Bundle savedInstanceState){
  super.onInflate(context,attrs,savedInstanceState);
  TypedArray a=context.obtainStyledAttributes(attrs,new int[]{R.attr.markasreadDrawable,R.attr.colorAccent});
  markAsReadDrawable=a.getDrawable(0);
  accentColor=ContextCompat.getColor(getContext(),R.color.owncloudBlueLight);
  a.recycle();
}

Fixed version (ground truth):
@Override public void onInflate(Context context,AttributeSet attrs,Bundle savedInstanceState){
  super.onInflate(context,attrs,savedInstanceState);
  TypedArray a=context.obtainStyledAttributes(attrs,new int[]{R.attr.markasreadDrawable,R.attr.colorAccent});
  markAsReadDrawable=a.getDrawable(0);
  accentColor=ContextCompat.getColor(context,R.color.owncloudBlueLight);
  a.recycle();
}
Program: 26102
Project: 26102
Buggy source:
@Override public void OnRefreshFinished(){
  pbLoading.setVisibility(View.GONE);
  if (layoutManagerSavedState != null) {
    recyclerView.getLayoutManager().onRestoreInstanceState(layoutManagerSavedState);
  }
}

Fixed version (ground truth):
@Override public void OnRefreshFinished(){
  pbLoading.setVisibility(View.GONE);
  if (layoutManagerSavedState != null) {
    recyclerView.getLayoutManager().onRestoreInstanceState(layoutManagerSavedState);
    layoutManagerSavedState=null;
  }
}
Program: 26103
Project: 26103
Buggy source:
public int getFirstVisibleScrollPosition(){
  LinearLayoutManager layoutManager=((LinearLayoutManager)recyclerView.getLayoutManager());
  int firstVisiblePosition=layoutManager.findFirstVisibleItemPosition();
  return firstVisiblePosition;
}

Fixed version (ground truth):
public int getFirstVisibleScrollPosition(){
  LinearLayoutManager layoutManager=((LinearLayoutManager)recyclerView.getLayoutManager());
  return layoutManager.findFirstVisibleItemPosition();
}
Program: 26104
Project: 26104
Buggy source:
/** 
 * Refreshes the current RSS-View
 */
public void RefreshCurrentRssView(){
  Log.v(TAG,"String_Node_Str");
  NewsListRecyclerAdapter nra=((NewsListRecyclerAdapter)recyclerView.getAdapter());
  nra.refreshAdapterDataAsync(new NewsListRecyclerAdapter.IOnRefreshFinished(){
    @Override public void OnRefreshFinished(){
      pbLoading.setVisibility(View.GONE);
      if (layoutManagerSavedState != null) {
        recyclerView.getLayoutManager().onRestoreInstanceState(layoutManagerSavedState);
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Refreshes the current RSS-View
 */
public void RefreshCurrentRssView(){
  Log.v(TAG,"String_Node_Str");
  NewsListRecyclerAdapter nra=((NewsListRecyclerAdapter)recyclerView.getAdapter());
  nra.refreshAdapterDataAsync(new NewsListRecyclerAdapter.IOnRefreshFinished(){
    @Override public void OnRefreshFinished(){
      pbLoading.setVisibility(View.GONE);
      if (layoutManagerSavedState != null) {
        recyclerView.getLayoutManager().onRestoreInstanceState(layoutManagerSavedState);
        layoutManagerSavedState=null;
      }
    }
  }
);
}
Program: 26105
Project: 26105
Buggy source:
@Override public void onInflate(Context context,AttributeSet attrs,Bundle savedInstanceState){
  super.onInflate(context,attrs,savedInstanceState);
  TypedArray a=context.obtainStyledAttributes(attrs,new int[]{R.attr.markasreadDrawable,R.attr.colorAccent});
  markAsReadDrawable=a.getDrawable(0);
  accentColor=a.getColor(1,context.getResources().getColor(R.color.owncloudBlueLight));
  a.recycle();
}

Fixed version (ground truth):
@Override public void onInflate(Context context,AttributeSet attrs,Bundle savedInstanceState){
  super.onInflate(context,attrs,savedInstanceState);
  TypedArray a=context.obtainStyledAttributes(attrs,new int[]{R.attr.markasreadDrawable,R.attr.colorAccent});
  markAsReadDrawable=a.getDrawable(0);
  accentColor=ContextCompat.getColor(getContext(),R.color.owncloudBlueLight);
  a.recycle();
}
Program: 26106
Project: 26106
Buggy source:
/** 
 * Convenient call for   {@link AbstractDao#update(Object)}. Entity must attached to an entity context. 
 */
public void update(){
  if (myDao == null) {
    throw new DaoException("String_Node_Str");
  }
  myDao.update(this);
}

Fixed version (ground truth):
/** 
 * Convenient call for   {@link de.greenrobot.dao.AbstractDao#update(Object)}. Entity must attached to an entity context.
 */
public void update(){
  if (myDao == null) {
    throw new DaoException("String_Node_Str");
  }
  myDao.update(this);
}
Program: 26107
Project: 26107
Buggy source:
/** 
 * Convenient call for   {@link AbstractDao#refresh(Object)}. Entity must attached to an entity context. 
 */
public void refresh(){
  if (myDao == null) {
    throw new DaoException("String_Node_Str");
  }
  myDao.refresh(this);
}

Fixed version (ground truth):
/** 
 * Convenient call for   {@link de.greenrobot.dao.AbstractDao#refresh(Object)}. Entity must attached to an entity context.
 */
public void refresh(){
  if (myDao == null) {
    throw new DaoException("String_Node_Str");
  }
  myDao.refresh(this);
}
Program: 26108
Project: 26108
Buggy source:
/** 
 * Convenient call for   {@link AbstractDao#delete(Object)}. Entity must attached to an entity context. 
 */
public void delete(){
  if (myDao == null) {
    throw new DaoException("String_Node_Str");
  }
  myDao.delete(this);
}

Fixed version (ground truth):
/** 
 * Convenient call for   {@link de.greenrobot.dao.AbstractDao#delete(Object)}. Entity must attached to an entity context.
 */
public void delete(){
  if (myDao == null) {
    throw new DaoException("String_Node_Str");
  }
  myDao.delete(this);
}
Program: 26109
Project: 26109
Buggy source:
/** 
 * Convenient call for   {@link AbstractDao#update(Object)}. Entity must attached to an entity context. 
 */
public void update(){
  if (myDao == null) {
    throw new DaoException("String_Node_Str");
  }
  myDao.update(this);
}

Fixed version (ground truth):
/** 
 * Convenient call for   {@link de.greenrobot.dao.AbstractDao#update(Object)}. Entity must attached to an entity context.
 */
public void update(){
  if (myDao == null) {
    throw new DaoException("String_Node_Str");
  }
  myDao.update(this);
}
Program: 26110
Project: 26110
Buggy source:
/** 
 * Convenient call for   {@link AbstractDao#refresh(Object)}. Entity must attached to an entity context. 
 */
public void refresh(){
  if (myDao == null) {
    throw new DaoException("String_Node_Str");
  }
  myDao.refresh(this);
}

Fixed version (ground truth):
/** 
 * Convenient call for   {@link de.greenrobot.dao.AbstractDao#refresh(Object)}. Entity must attached to an entity context.
 */
public void refresh(){
  if (myDao == null) {
    throw new DaoException("String_Node_Str");
  }
  myDao.refresh(this);
}
Program: 26111
Project: 26111
Buggy source:
/** 
 * Convenient call for   {@link AbstractDao#delete(Object)}. Entity must attached to an entity context. 
 */
public void delete(){
  if (myDao == null) {
    throw new DaoException("String_Node_Str");
  }
  myDao.delete(this);
}

Fixed version (ground truth):
/** 
 * Convenient call for   {@link de.greenrobot.dao.AbstractDao#delete(Object)}. Entity must attached to an entity context.
 */
public void delete(){
  if (myDao == null) {
    throw new DaoException("String_Node_Str");
  }
  myDao.delete(this);
}
Program: 26112
Project: 26112
Buggy source:
/** 
 * Convenient call for   {@link AbstractDao#update(Object)}. Entity must attached to an entity context. 
 */
public void update(){
  if (myDao == null) {
    throw new DaoException("String_Node_Str");
  }
  myDao.update(this);
}

Fixed version (ground truth):
/** 
 * Convenient call for   {@link de.greenrobot.dao.AbstractDao#update(Object)}. Entity must attached to an entity context.
 */
public void update(){
  if (myDao == null) {
    throw new DaoException("String_Node_Str");
  }
  myDao.update(this);
}
Program: 26113
Project: 26113
Buggy source:
/** 
 * Convenient call for   {@link AbstractDao#delete(Object)}. Entity must attached to an entity context. 
 */
public void delete(){
  if (myDao == null) {
    throw new DaoException("String_Node_Str");
  }
  myDao.delete(this);
}

Fixed version (ground truth):
/** 
 * Convenient call for   {@link de.greenrobot.dao.AbstractDao#delete(Object)}. Entity must attached to an entity context.
 */
public void delete(){
  if (myDao == null) {
    throw new DaoException("String_Node_Str");
  }
  myDao.delete(this);
}
Program: 26114
Project: 26114
Buggy source:
/** 
 * Convenient call for   {@link AbstractDao#refresh(Object)}. Entity must attached to an entity context. 
 */
public void refresh(){
  if (myDao == null) {
    throw new DaoException("String_Node_Str");
  }
  myDao.refresh(this);
}

Fixed version (ground truth):
/** 
 * Convenient call for   {@link de.greenrobot.dao.AbstractDao#refresh(Object)}. Entity must attached to an entity context.
 */
public void refresh(){
  if (myDao == null) {
    throw new DaoException("String_Node_Str");
  }
  myDao.refresh(this);
}
Program: 26115
Project: 26115
Buggy source:
/** 
 * Removes an Activity from the MTM display stack. Always call this function when the Activity added with
 * @see bindDisplayActivity is hidden.
 * @param act Activity to be unbound
 */
public void unbindDisplayActivity(Activity act){
  if (foregroundAct == act)   foregroundAct=null;
}

Fixed version (ground truth):
/** 
 * Removes an Activity from the MTM display stack. Always call this function when the Activity added with
 * @see #bindDisplayActivity is hidden.
 * @param act Activity to be unbound
 */
public void unbindDisplayActivity(Activity act){
  if (foregroundAct == act)   foregroundAct=null;
}
Program: 26116
Project: 26116
Buggy source:
@Override public void check(View view,NoMatchingViewException e){
  RecyclerView recyclerView=(RecyclerView)view;
  LinearLayoutManager layoutManager=((LinearLayoutManager)recyclerView.getLayoutManager());
  int firstVisiblePosition=layoutManager.findFirstVisibleItemPosition();
  if (firstVisiblePosition == mExpectedPos)   return;
 else   throw new RuntimeException("String_Node_Str" + mExpectedPos + "String_Node_Str"+ firstVisiblePosition);
}

Fixed version (ground truth):
@Override public void check(View view,NoMatchingViewException e){
  RecyclerView recyclerView=(RecyclerView)view;
  LinearLayoutManager layoutManager=((LinearLayoutManager)recyclerView.getLayoutManager());
  int firstVisiblePosition=layoutManager.findFirstVisibleItemPosition();
  if (firstVisiblePosition != mExpectedPos)   throw new RuntimeException("String_Node_Str" + mExpectedPos + "String_Node_Str"+ firstVisiblePosition);
}
Program: 26117
Project: 26117
Buggy source:
public boolean doesRssItemAlreadyExsists(long feedId){
  List<RssItem> feeds=daoSession.getRssItemDao().queryBuilder().where(RssItemDao.Properties.Id.eq(feedId)).list();
  return (feeds.size() <= 0) ? false : true;
}

Fixed version (ground truth):
public boolean doesRssItemAlreadyExsists(long feedId){
  List<RssItem> feeds=daoSession.getRssItemDao().queryBuilder().where(RssItemDao.Properties.Id.eq(feedId)).list();
  return feeds.size() > 0;
}
Program: 26119
Project: 26119
Buggy source:
@Override public boolean onKeyDown(int keyCode,KeyEvent event){
  SharedPreferences mPrefs=PreferenceManager.getDefaultSharedPreferences(this);
  if (mPrefs.getBoolean(SettingsActivity.CB_NAVIGATE_WITH_VOLUME_BUTTONS_STRING,false)) {
    if ((keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)) {
      if (currentPosition < rssItems.size() - 1) {
        mViewPager.setCurrentItem(currentPosition + 1,true);
        return true;
      }
    }
 else     if ((keyCode == KeyEvent.KEYCODE_VOLUME_UP)) {
      if (currentPosition > 0) {
        mViewPager.setCurrentItem(currentPosition - 1,true);
        return true;
      }
    }
  }
  if (keyCode == KeyEvent.KEYCODE_BACK) {
    NewsDetailFragment ndf=getNewsDetailFragmentAtPosition(currentPosition);
    if (ndf != null && ndf.mWebView != null) {
      if (ndf.urls.size() > 1) {
        ndf.urls.remove(0);
        ndf.mWebView.loadUrl(ndf.urls.get(0));
        return true;
      }
 else       if (ndf.urls.size() == 1) {
        ndf.urls.remove(0);
        ndf.startLoadRssItemToWebViewTask();
        Log.v(TAG,"String_Node_Str");
        return true;
      }
    }
  }
  return super.onKeyDown(keyCode,event);
}

Fixed version (ground truth):
@Override public boolean onKeyDown(int keyCode,KeyEvent event){
  SharedPreferences mPrefs=PreferenceManager.getDefaultSharedPreferences(this);
  if (mPrefs.getBoolean(SettingsActivity.CB_NAVIGATE_WITH_VOLUME_BUTTONS_STRING,false)) {
    if ((keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)) {
      if (currentPosition < rssItems.size() - 1) {
        mViewPager.setCurrentItem(currentPosition + 1,true);
      }
      return true;
    }
 else     if ((keyCode == KeyEvent.KEYCODE_VOLUME_UP)) {
      if (currentPosition > 0) {
        mViewPager.setCurrentItem(currentPosition - 1,true);
      }
      return true;
    }
  }
  if (keyCode == KeyEvent.KEYCODE_BACK) {
    NewsDetailFragment ndf=getNewsDetailFragmentAtPosition(currentPosition);
    if (ndf != null && ndf.mWebView != null) {
      if (ndf.urls.size() > 1) {
        ndf.urls.remove(0);
        ndf.mWebView.loadUrl(ndf.urls.get(0));
        return true;
      }
 else       if (ndf.urls.size() == 1) {
        ndf.urls.remove(0);
        ndf.startLoadRssItemToWebViewTask();
        Log.v(TAG,"String_Node_Str");
        return true;
      }
    }
  }
  return super.onKeyDown(keyCode,event);
}
Program: 26120
Project: 26120
Buggy source:
private boolean bindCustomTabsService(){
  if (mCustomTabsClient != null)   return true;
  String packageName=CustomTabActivityManager.getInstance().getPackageNameToUse(this);
  if (packageName == null)   return false;
  return CustomTabsClient.bindCustomTabsService(this,packageName,new CustomTabsServiceConnection(){
    @Override public void onCustomTabsServiceConnected(    ComponentName name,    CustomTabsClient client){
      mCustomTabsClient=client;
    }
    @Override public void onServiceDisconnected(    ComponentName name){
      mCustomTabsClient=null;
    }
  }
);
}

Fixed version (ground truth):
private boolean bindCustomTabsService(){
  if (mCustomTabsClient != null)   return true;
  String packageName=CustomTabActivityManager.getInstance().getPackageNameToUse(this);
  if (packageName == null)   return false;
  mCustomTabsConnection=new CustomTabsServiceConnection(){
    @Override public void onCustomTabsServiceConnected(    ComponentName name,    CustomTabsClient client){
      mCustomTabsClient=client;
    }
    @Override public void onServiceDisconnected(    ComponentName name){
      mCustomTabsClient=null;
    }
  }
;
  return CustomTabsClient.bindCustomTabsService(this,packageName,mCustomTabsConnection);
}
Program: 26121
Project: 26121
Buggy source:
@Override protected void onDestroy(){
  super.onDestroy();
}

Fixed version (ground truth):
@Override protected void onDestroy(){
  super.onDestroy();
  unbindCustomTabsService();
}
Program: 26122
Project: 26122
Buggy source:
private void DownloadMoreItems(){
  String username=PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("String_Node_Str","String_Node_Str");
  String password=PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("String_Node_Str","String_Node_Str");
  if (username != null) {
    NewsReaderDetailFragment ndf=getNewsReaderDetailFragment();
    OwnCloud_Reader.getInstance().Start_AsyncTask_GetOldItems(NewsReaderListActivity.this,onAsyncTaskComplete,ndf.getIdFeed(),ndf.getIdFolder());
    Toast.makeText(this,getString(R.string.toast_GettingMoreItems),Toast.LENGTH_SHORT).show();
  }
}

Fixed version (ground truth):
private void DownloadMoreItems(){
  String username=PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("String_Node_Str",null);
  if (username != null) {
    NewsReaderDetailFragment ndf=getNewsReaderDetailFragment();
    OwnCloud_Reader.getInstance().Start_AsyncTask_GetOldItems(NewsReaderListActivity.this,onAsyncTaskComplete,ndf.getIdFeed(),ndf.getIdFolder());
    Toast.makeText(this,getString(R.string.toast_GettingMoreItems),Toast.LENGTH_SHORT).show();
  }
}
Program: 26124
Project: 26124
Buggy source:
private void UpdateButtonLayoutWithHandler(){
  Handler refresh=new Handler(Looper.getMainLooper());
  refresh.post(new Runnable(){
    public void run(){
      UpdateButtonLayout();
      ;
    }
  }
);
}

Fixed version (ground truth):
private void UpdateButtonLayoutWithHandler(){
  Handler refresh=new Handler(Looper.getMainLooper());
  refresh.post(new Runnable(){
    public void run(){
      UpdateButtonLayout();
    }
  }
);
}
Program: 26125
Project: 26125
Buggy source:
@Override protected void onRestoreInstanceState(Bundle savedInstanceState){
  if (savedInstanceState != null) {
    restoreInstanceState(savedInstanceState);
  }
  super.onRestoreInstanceState(savedInstanceState);
}

Fixed version (ground truth):
@Override protected void onRestoreInstanceState(@NonNull Bundle savedInstanceState){
  restoreInstanceState(savedInstanceState);
  super.onRestoreInstanceState(savedInstanceState);
}
Program: 26127
Project: 26127
Buggy source:
@Override protected Integer doInBackground(Void... params){
  try {
    HttpJsonRequest.getInstance().setCredentials(username,password,oc_root_path);
    String _version=OwnCloudReaderMethods.GetVersionNumber(getActivity(),oc_root_path);
    if (_version != null) {
      _version=_version.replace("String_Node_Str","String_Node_Str");
      return Integer.parseInt(_version);
    }
  }
 catch (  Exception e) {
    if (e.getLocalizedMessage() != null)     exception_message=e.getLocalizedMessage();
 else     if (e instanceof NullPointerException)     exception_message=getString(R.string.login_dialog_text_something_went_wrong);
    return -1;
  }
  return 0;
}

Fixed version (ground truth):
@Override protected Integer doInBackground(Void... params){
  try {
    HttpJsonRequest.createNewInstance(getActivity()).setCredentials(username,password,oc_root_path);
    String _version=OwnCloudReaderMethods.GetVersionNumber(getActivity(),oc_root_path);
    if (_version != null) {
      _version=_version.replace("String_Node_Str","String_Node_Str");
      return Integer.parseInt(_version);
    }
  }
 catch (  Exception e) {
    if (e.getLocalizedMessage() != null)     exception_message=e.getLocalizedMessage();
 else     if (e instanceof NullPointerException)     exception_message=getString(R.string.login_dialog_text_something_went_wrong);
    return -1;
  }
  return 0;
}
Program: 26128
Project: 26128
Buggy source:
@Override protected Boolean doInBackground(Void... params){
  API api=new APIv2(NewFeedActivity.this);
  try {
    int status=HttpJsonRequest.getInstance().performCreateFeedRequest(api.getFeedUrl(),mUrlToFeed,mFolderId);
    if (status == 200) {
      return true;
    }
    Log.d("String_Node_Str","String_Node_Str" + status);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
  return false;
}

Fixed version (ground truth):
@Override protected Boolean doInBackground(Void... params){
  SharedPreferences mPrefs=PreferenceManager.getDefaultSharedPreferences(NewFeedActivity.this);
  String baseUrl=mPrefs.getString(SettingsActivity.EDT_OWNCLOUDROOTPATH_STRING,"String_Node_Str");
  API api=new APIv2(baseUrl);
  try {
    int status=HttpJsonRequest.getInstance().performCreateFeedRequest(api.getFeedUrl(),mUrlToFeed,mFolderId);
    if (status == 200) {
      return true;
    }
    Log.d("String_Node_Str","String_Node_Str" + status);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
  return false;
}
Program: 26129
Project: 26129
Buggy source:
protected HttpUrl getAPIUrl(String format,String... urlSegments){
  String oc_root_path=mPrefs.getString(SettingsActivity.EDT_OWNCLOUDROOTPATH_STRING,"String_Node_Str");
  HttpUrl basePath=HttpUrl.parse(oc_root_path);
  HttpUrl.Builder apiUrlBuilder=basePath.resolve(StringUtils.join(urlSegments,"String_Node_Str")).newBuilder();
  if (format != null)   apiUrlBuilder.addQueryParameter("String_Node_Str",format);
  return apiUrlBuilder.build();
}

Fixed version (ground truth):
protected HttpUrl getAPIUrl(String format,String... urlSegments){
  HttpUrl basePath=HttpUrl.parse(baseUrl);
  String url="String_Node_Str" + StringUtils.join(urlSegments,"String_Node_Str");
  HttpUrl.Builder apiUrlBuilder=basePath.resolve(url).newBuilder();
  if (format != null)   apiUrlBuilder.addQueryParameter("String_Node_Str",format);
  return apiUrlBuilder.build();
}
Program: 26130
Project: 26130
Buggy source:
public static API GetRightApiForVersion(String appVersion,Context context){
  API api;
  int majorVersion=0;
  int minorVersion=0;
  if (appVersion != null) {
    majorVersion=Integer.parseInt(appVersion.substring(0,1));
    appVersion=appVersion.substring(2);
    appVersion=appVersion.replace("String_Node_Str","String_Node_Str");
    minorVersion=Integer.parseInt(appVersion);
  }
switch (majorVersion) {
case 1:
    if (minorVersion >= 101) {
      api=new APIv2(context);
    }
 else {
      api=new APIv1(context);
    }
  break;
case 2:
api=new APIv2(context);
break;
case 3:
api=new APIv2(context);
break;
case 4:
api=new APIv2(context);
break;
default :
api=new APIv2(context);
break;
}
return api;
}

Fixed version (ground truth):
public static API GetRightApiForVersion(String appVersion,String baseUrl){
  API api;
  int majorVersion=0;
  int minorVersion=0;
  if (appVersion != null) {
    majorVersion=Integer.parseInt(appVersion.substring(0,1));
    appVersion=appVersion.substring(2);
    appVersion=appVersion.replace("String_Node_Str","String_Node_Str");
    minorVersion=Integer.parseInt(appVersion);
  }
switch (majorVersion) {
case 1:
    if (minorVersion >= 101) {
      api=new APIv2(baseUrl);
    }
 else {
      api=new APIv1(baseUrl);
    }
  break;
case 2:
api=new APIv2(baseUrl);
break;
case 3:
api=new APIv2(baseUrl);
break;
case 4:
api=new APIv2(baseUrl);
break;
default :
api=new APIv2(baseUrl);
break;
}
return api;
}
Program: 26131
Project: 26131
Buggy source:
public API(Context cont){
  mPrefs=PreferenceManager.getDefaultSharedPreferences(cont);
}

Fixed version (ground truth):
public API(String baseUrl){
  if (!baseUrl.endsWith("String_Node_Str"))   baseUrl=baseUrl + "String_Node_Str";
  this.baseUrl=baseUrl;
}
Program: 26132
Project: 26132
Buggy source:
@Override public boolean performAction(JSONObject jObj){
  this.version=jObj.optJSONObject("String_Node_Str").optJSONObject("String_Node_Str").optString("String_Node_Str");
  return true;
}

Fixed version (ground truth):
@Override public boolean performAction(JSONObject jObj){
  if (jObj.has("String_Node_Str")) {
    this.version=jObj.optJSONObject("String_Node_Str").optJSONObject("String_Node_Str").optString("String_Node_Str");
    return true;
  }
  return false;
}
Program: 26133
Project: 26133
Buggy source:
/** 
 * can parse json like {"items":[{"id":6782}]}
 * @param in
 * @param iJoBj
 * @return
 * @throws IOException
 * @throws JSONException
 */
public static int[] readJsonStreamV1(InputStream in,IHandleJsonObject iJoBj) throws IOException, JSONException {
  int count=0;
  int newItemsCount=0;
  JsonReader reader=new JsonReader(new InputStreamReader(in,"String_Node_Str"));
  reader.beginObject();
  reader.nextName();
  reader.beginObject();
  reader.nextName();
  getJSONObjectFromReader(reader);
  reader.nextName();
  reader.beginObject();
  reader.nextName();
  reader.beginArray();
  while (reader.hasNext()) {
    JSONObject e=getJSONObjectFromReader(reader);
    if (iJoBj.performAction(e))     newItemsCount++;
    count++;
  }
  if (iJoBj instanceof InsertItemIntoDatabase)   ((InsertItemIntoDatabase)iJoBj).performDatabaseBatchInsert();
  reader.close();
  return new int[]{count,newItemsCount};
}

Fixed version (ground truth):
/** 
 * can parse json like {"items":[{"id":6782}]}
 * @param in
 * @param iJoBj
 * @return new int[] { count, newItemsCount }
 * @throws IOException
 * @throws JSONException
 */
public static int[] readJsonStreamV1(InputStream in,IHandleJsonObject iJoBj) throws IOException, JSONException {
  int count=0;
  int newItemsCount=0;
  JsonReader reader=new JsonReader(new InputStreamReader(in,"String_Node_Str"));
  reader.beginObject();
  reader.nextName();
  reader.beginObject();
  reader.nextName();
  getJSONObjectFromReader(reader);
  reader.nextName();
  reader.beginObject();
  reader.nextName();
  reader.beginArray();
  while (reader.hasNext()) {
    JSONObject e=getJSONObjectFromReader(reader);
    if (iJoBj.performAction(e))     newItemsCount++;
    count++;
  }
  if (iJoBj instanceof InsertItemIntoDatabase)   ((InsertItemIntoDatabase)iJoBj).performDatabaseBatchInsert();
  reader.close();
  return new int[]{count,newItemsCount};
}