nus-yam/ex-repair huggingface dataset:
Program: 24316
Project: 24316
Buggy source:
@Override protected NavItem[] doInBackground(String... applicationFolder){
  String appFolder=applicationFolder[0];
  String append=File.separatorChar + ServiceUpdate.ITEM_LIST;
  String[][] content=Read.csvFile(Read.INDEX,appFolder,'f','t');
  String[] feedNames=content[0];
  String[] feedTags=content[1];
  int tagTotal=PagerAdapterFeeds.TAG_LIST.size();
  int feedTotal=feedNames.length;
  NavItem[] navItems=new NavItem[tagTotal];
  List<Collection<Long>> feedItems=new ArrayList<>(feedTotal);
  for (  String feedName : feedNames) {
    feedItems.add(Read.longSet(feedName + append,appFolder));
  }
  Collection<Long> itemsInTag=new HashSet<>(0);
  for (int i=0; tagTotal > i; i++) {
    String tag=PagerAdapterFeeds.TAG_LIST.get(i);
    for (int j=0; j < feedTotal; j++) {
      if (0 == i || feedTags[j].contains(tag)) {
        itemsInTag.addAll(feedItems.get(j));
      }
    }
    itemsInTag.removeAll(AdapterTags.READ_ITEM_TIMES);
    navItems[i]=new NavItem(tag,itemsInTag.size());
    itemsInTag.clear();
  }
  return navItems;
}

Fixed version (ground truth):
@Override protected NavItem[] doInBackground(String... applicationFolder){
  String appFolder=applicationFolder[0];
  String append=File.separatorChar + ServiceUpdate.ITEM_LIST;
  String[][] content=Read.csvFile(Read.INDEX,appFolder,'f','t');
  String[] feedNames=content[0];
  String[] feedTags=content[1];
  int tagTotal=PagerAdapterFeeds.TAG_LIST.size();
  int feedTotal=feedNames.length;
  NavItem[] navItems=new NavItem[tagTotal];
  List<Collection<Long>> feedItems=new ArrayList<>(feedTotal);
  for (  String feedName : feedNames) {
    feedItems.add(Read.longSet(feedName + append,appFolder));
  }
  Collection<Long> itemsInTag=Collections.synchronizedCollection(new HashSet<Long>(0));
  for (int i=0; tagTotal > i; i++) {
    String tag=PagerAdapterFeeds.TAG_LIST.get(i);
    for (int j=0; j < feedTotal; j++) {
      if (0 == i || feedTags[j].contains(tag)) {
        itemsInTag.addAll(feedItems.get(j));
      }
    }
    itemsInTag.removeAll(AdapterTags.READ_ITEM_TIMES);
    navItems[i]=new NavItem(tag,itemsInTag.size());
    itemsInTag.clear();
  }
  return navItems;
}
Program: 24317
Project: 24317
Buggy source:
float drawBase(Canvas canvas){
  float verticalPosition=getPaddingTop() + 20.0F;
  if (Utilities.isRtl(m_item.m_title.charAt(0))) {
    PAINTS[0].setTextAlign(Paint.Align.RIGHT);
    PAINTS[1].setTextAlign(Paint.Align.RIGHT);
    canvas.drawText(m_item.m_title,screen - getPaddingRight(),verticalPosition,PAINTS[0]);
    verticalPosition+=PAINTS[0].getTextSize();
    canvas.drawText(m_item.m_url,screen - getPaddingRight(),verticalPosition,PAINTS[1]);
    PAINTS[0].setTextAlign(Paint.Align.LEFT);
    PAINTS[1].setTextAlign(Paint.Align.LEFT);
  }
 else {
    canvas.drawText(m_item.m_title,getPaddingLeft(),verticalPosition,PAINTS[0]);
    verticalPosition+=PAINTS[0].getTextSize();
    canvas.drawText(m_item.m_url,getPaddingLeft(),verticalPosition,PAINTS[1]);
  }
  return verticalPosition + PAINTS[1].getTextSize();
}

Fixed version (ground truth):
float drawBase(Canvas canvas){
  float verticalPosition=getPaddingTop() + 20.0F;
  if (Utilities.isTextRtl(m_item.m_title)) {
    PAINTS[0].setTextAlign(Paint.Align.RIGHT);
    PAINTS[1].setTextAlign(Paint.Align.RIGHT);
    canvas.drawText(m_item.m_title,screen - getPaddingRight(),verticalPosition,PAINTS[0]);
    verticalPosition+=PAINTS[0].getTextSize();
    canvas.drawText(m_item.m_url,screen - getPaddingRight(),verticalPosition,PAINTS[1]);
    PAINTS[0].setTextAlign(Paint.Align.LEFT);
    PAINTS[1].setTextAlign(Paint.Align.LEFT);
  }
 else {
    canvas.drawText(m_item.m_title,getPaddingLeft(),verticalPosition,PAINTS[0]);
    verticalPosition+=PAINTS[0].getTextSize();
    canvas.drawText(m_item.m_url,getPaddingLeft(),verticalPosition,PAINTS[1]);
  }
  return verticalPosition + PAINTS[1].getTextSize();
}
Program: 24318
Project: 24318
Buggy source:
void drawDes(Canvas canvas,float verticalPosition){
  if (m_item.m_desLines[0].isEmpty()) {
    return;
  }
  float position=verticalPosition;
  boolean rtl=Utilities.isRtl(m_item.m_desLines[0].charAt(0));
  if (rtl) {
    PAINTS[2].setTextAlign(Paint.Align.RIGHT);
  }
  for (int i=0; 3 > i; i++) {
    canvas.drawText(m_item.m_desLines[i],rtl ? screen - getPaddingRight() : getPaddingLeft(),position,PAINTS[2]);
    position+=PAINTS[2].getTextSize();
  }
  PAINTS[2].setTextAlign(Paint.Align.LEFT);
}

Fixed version (ground truth):
void drawDes(Canvas canvas,float verticalPosition){
  if (m_item.m_desLines[0].isEmpty()) {
    return;
  }
  float position=verticalPosition;
  boolean rtl=Utilities.isTextRtl(m_item.m_desLines[0]);
  if (rtl) {
    PAINTS[2].setTextAlign(Paint.Align.RIGHT);
  }
  for (int i=0; 3 > i; i++) {
    canvas.drawText(m_item.m_desLines[i],rtl ? screen - getPaddingRight() : getPaddingLeft(),position,PAINTS[2]);
    position+=PAINTS[2].getTextSize();
  }
  PAINTS[2].setTextAlign(Paint.Align.LEFT);
}
Program: 24319
Project: 24319
Buggy source:
static Fragment newInstance(final Activity activity,final String applicationFolder){
  FragmentManage fragment=new FragmentManage(activity);
  BaseAdapter baseAdapter=new AdapterManageFragments(activity);
  fragment.m_listView.setAdapter(baseAdapter);
  fragment.m_listView.setId(LIST_VIEW_MANAGE);
  fragment.m_listView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      Dialog dialog=DialogEditFeed.newInstance(activity,position,applicationFolder);
      dialog.show();
    }
  }
);
  AlertDialog.Builder build=new AlertDialog.Builder(activity);
  ViewPager feedPager=(ViewPager)activity.findViewById(FragmentFeeds.VIEW_PAGER_ID);
  PagerAdapterFeeds pagerAdapterFeeds=(PagerAdapterFeeds)feedPager.getAdapter();
  ListView navigationDrawer=(ListView)activity.findViewById(R.id.navigation_drawer);
  BaseAdapter navigationAdapter=(BaseAdapter)navigationDrawer.getAdapter();
  fragment.m_listView.setOnItemLongClickListener(new OnLongClickManageFeedItem(fragment.m_listView,pagerAdapterFeeds,navigationAdapter,build,applicationFolder));
  AsyncManage.newInstance(baseAdapter,applicationFolder);
  return fragment;
}

Fixed version (ground truth):
static Fragment newInstance(){
  return new FragmentManage();
}
Program: 24320
Project: 24320
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  m_listView.setBackgroundColor(Color.WHITE);
  m_listView.setDivider(new ColorDrawable(Color.argb(255,237,237,237)));
  m_listView.setDividerHeight(2);
  return m_listView;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  final Activity activity=(Activity)container.getContext();
  final String applicationFolder=FeedsActivity.getApplicationFolder(activity);
  BaseAdapter baseAdapter=new AdapterManageFragments(activity);
  ListView listView=new ListView(activity);
  listView.setAdapter(baseAdapter);
  listView.setId(LIST_VIEW_MANAGE);
  listView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      Dialog dialog=DialogEditFeed.newInstance(activity,position,applicationFolder);
      dialog.show();
    }
  }
);
  AlertDialog.Builder build=new AlertDialog.Builder(activity);
  ViewPager feedPager=(ViewPager)activity.findViewById(FragmentFeeds.VIEW_PAGER_ID);
  PagerAdapterFeeds pagerAdapterFeeds=(PagerAdapterFeeds)feedPager.getAdapter();
  ListView navigationDrawer=(ListView)activity.findViewById(R.id.navigation_drawer);
  BaseAdapter navigationAdapter=(BaseAdapter)navigationDrawer.getAdapter();
  listView.setOnItemLongClickListener(new OnLongClickManageFeedItem(listView,pagerAdapterFeeds,navigationAdapter,build,applicationFolder));
  listView.setBackgroundColor(Color.WHITE);
  listView.setDivider(new ColorDrawable(Color.argb(255,237,237,237)));
  listView.setDividerHeight(2);
  AsyncManage.newInstance(baseAdapter,applicationFolder);
  return listView;
}
Program: 24321
Project: 24321
Buggy source:
@Override public void onItemClick(AdapterView parent,View view,int position,long id){
  m_drawerLayout.closeDrawers();
  boolean tagWasClicked=3 < position;
  boolean feedsWasClicked=0 == position;
  int currentPage=m_tagsViewPager.getCurrentItem();
  boolean clickedDifferentPage=currentPage != position;
  String feedTitle=m_navigationTitles[0];
  String selectedTitle=tagWasClicked ? feedTitle : m_navigationTitles[position];
  if (tagWasClicked && clickedDifferentPage) {
    m_tagsViewPager.setCurrentItem(position - 4);
  }
  m_actionBar.setTitle(selectedTitle);
  boolean updateSubTitle=feedsWasClicked || tagWasClicked;
  String subtitle=updateSubTitle ? "String_Node_Str" + m_navAdapter.getItem(currentPage) : null;
  m_actionBar.setSubtitle(subtitle);
  FragmentTransaction transaction=m_fragmentManager.beginTransaction();
  for (  String navigationTitle : m_navigationTitles) {
    Fragment frag=m_fragmentManager.findFragmentByTag(navigationTitle);
    if (null != frag) {
      transaction.hide(frag);
    }
  }
  Fragment selectedFragment=m_fragmentManager.findFragmentByTag(selectedTitle);
  if (null == selectedFragment) {
    Activity activity=(Activity)m_drawerLayout.getContext();
    String applicationFolder=FeedsActivity.getApplicationFolder(activity);
    Fragment fragment=1 == position ? FragmentManage.newInstance(activity,applicationFolder) : FragmentSettings.newInstance();
    transaction.add(R.id.content_frame,fragment,selectedTitle);
  }
 else {
    transaction.show(selectedFragment);
  }
  transaction.commit();
}

Fixed version (ground truth):
@Override public void onItemClick(AdapterView parent,View view,int position,long id){
  m_drawerLayout.closeDrawers();
  boolean tagWasClicked=3 < position;
  boolean feedsWasClicked=0 == position;
  int currentPage=m_tagsViewPager.getCurrentItem();
  boolean clickedDifferentPage=currentPage != position;
  String feedTitle=m_navigationTitles[0];
  String selectedTitle=tagWasClicked ? feedTitle : m_navigationTitles[position];
  if (tagWasClicked && clickedDifferentPage) {
    m_tagsViewPager.setCurrentItem(position - 4);
  }
  m_actionBar.setTitle(selectedTitle);
  boolean updateSubTitle=feedsWasClicked || tagWasClicked;
  String subtitle=updateSubTitle ? "String_Node_Str" + m_navAdapter.getItem(currentPage) : null;
  m_actionBar.setSubtitle(subtitle);
  FragmentTransaction transaction=m_fragmentManager.beginTransaction();
  for (  String navigationTitle : m_navigationTitles) {
    Fragment frag=m_fragmentManager.findFragmentByTag(navigationTitle);
    if (null != frag) {
      transaction.hide(frag);
    }
  }
  Fragment selectedFragment=m_fragmentManager.findFragmentByTag(selectedTitle);
  if (null == selectedFragment) {
    Fragment fragment=1 == position ? FragmentManage.newInstance() : FragmentSettings.newInstance();
    transaction.add(R.id.content_frame,fragment,selectedTitle);
  }
 else {
    transaction.show(selectedFragment);
  }
  transaction.commit();
}
Program: 24322
Project: 24322
Buggy source:
@Override public void onScrollStateChanged(AbsListView view,int scrollState){
  if (!touched && listview.getVisibility() == View.VISIBLE)   touched=true;
  if (listview.getChildAt(0).getTop() < sixteen && listview.getChildAt(0).getTop() >= eight)   read_items.add(content_links.get(content_links.size() - 1));
  if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_IDLE)   main.update_navigation_data(null,false);
}

Fixed version (ground truth):
@Override public void onScrollStateChanged(AbsListView view,int scrollState){
  if (listview.getChildAt(0).getTop() == eight) {
    utilities.log(main.storage,"String_Node_Str");
    read_items.add(content_links.get(content_links.size() - 1));
  }
  if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_IDLE)   main.update_navigation_data(null,false);
}
Program: 24324
Project: 24324
Buggy source:
private static void jump_to_latest_unread(){
  final int page_number=viewpager.getCurrentItem();
  int oldest_unread=-1;
  final String group_path=storage + GROUPS_DIRECTORY + current_groups.get(page_number)+ main.SEPAR;
  final String group_content_path=group_path + current_groups.get(page_number) + CONTENT_APPENDIX;
  if (!utilities.exists(group_content_path))   return;
  List<String> links=utilities.get_adapter_feeds_cards(fragment_manager,viewpager,page_number).content_links;
  final int size=links.size();
  for (int m=0; m < size; m++) {
    if (!adapter_feeds_cards.read_items.contains(links.get(m))) {
      oldest_unread=m;
      break;
    }
  }
  if (oldest_unread == 0)   oldest_unread=links.size();
  ListView lv=((ListFragment)fragment_manager.findFragmentByTag("String_Node_Str" + viewpager.getId() + "String_Node_Str"+ Integer.toString(page_number))).getListView();
  if (lv == null)   return;
  if (oldest_unread == links.size()) {
    lv.setSelection(links.size());
    return;
  }
  if (oldest_unread == -1)   oldest_unread++;
  final int position=links.size() - oldest_unread - 1;
  if (position >= 0)   lv.setSelection(position);
 else   lv.setSelection(0);
}

Fixed version (ground truth):
private static void jump_to_latest_unread(){
  final int page_number=viewpager.getCurrentItem();
  int oldest_unread=-1;
  final String group_path=storage + GROUPS_DIRECTORY + current_groups.get(page_number)+ main.SEPAR;
  final String group_content_path=group_path + current_groups.get(page_number) + CONTENT_APPENDIX;
  if (!utilities.exists(group_content_path))   return;
  List<String> links=utilities.get_adapter_feeds_cards(fragment_manager,viewpager,page_number).content_links;
  final int size=links.size();
  for (int m=0; m < size; m++) {
    if (!adapter_feeds_cards.read_items.contains(links.get(m))) {
      oldest_unread=m;
      break;
    }
  }
  if (oldest_unread == 0)   oldest_unread=links.size();
  ListView lv=((ListFragment)fragment_manager.findFragmentByTag("String_Node_Str" + viewpager.getId() + "String_Node_Str"+ Integer.toString(page_number))).getListView();
  if (lv == null)   return;
  if (oldest_unread == links.size()) {
    lv.setSelection(links.size());
    return;
  }
  if (oldest_unread == -1)   oldest_unread=links.size() - 1;
  final int position=links.size() - oldest_unread - 1;
  if (position >= 0)   lv.setSelection(position);
 else   lv.setSelection(0);
}
Program: 24325
Project: 24325
Buggy source:
private void remove_string_from_file(String file_path,String string,Boolean contains){
  final List<String> list=read_file_to_list(file_path);
  delete(file_path);
  try {
    final BufferedWriter out=new BufferedWriter(new FileWriter(file_path,true));
    for (    String item : list) {
      if (contains) {
        if (!item.contains(string))         out.write(item + "String_Node_Str");
      }
 else {
        if (!item.equals(string))         out.write(item + "String_Node_Str");
      }
    }
    out.close();
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
private static void remove_string_from_file(String file_path,String string,Boolean contains){
  final List<String> list=read_file_to_list(file_path);
  delete(file_path);
  try {
    final BufferedWriter out=new BufferedWriter(new FileWriter(file_path,true));
    for (    String item : list) {
      if (contains) {
        if (!item.contains(string))         out.write(item + "String_Node_Str");
      }
 else {
        if (!item.equals(string))         out.write(item + "String_Node_Str");
      }
    }
    out.close();
  }
 catch (  Exception e) {
  }
}
Program: 24326
Project: 24326
Buggy source:
private void set_refresh(final boolean mode){
  if (optionsMenu != null) {
    final MenuItem refreshItem=optionsMenu.findItem(R.id.refresh);
    if (refreshItem != null) {
      if (mode)       refreshItem.setActionView(R.layout.progress_circle);
 else       refreshItem.setActionView(null);
    }
 else     log("String_Node_Str");
  }
 else   log("String_Node_Str");
}

Fixed version (ground truth):
private static void set_refresh(final boolean mode){
  if (optionsMenu != null) {
    final MenuItem refreshItem=optionsMenu.findItem(R.id.refresh);
    if (refreshItem != null) {
      if (mode)       refreshItem.setActionView(R.layout.progress_circle);
 else       refreshItem.setActionView(null);
    }
 else     log("String_Node_Str");
  }
 else   log("String_Node_Str");
}
Program: 24327
Project: 24327
Buggy source:
private void update_manage_feeds(){
  if (feed_list_adapter != null) {
    feed_list_adapter.clear_list();
    final List<List<String>> content=read_csv_to_list(new String[]{storage + "String_Node_Str" + all_string+ "String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"});
    final List<String> feed_titles=content.get(0);
    final List<String> feed_urls=content.get(1);
    final List<String> feed_groups=content.get(2);
    final int size=feed_titles.size();
    for (int i=0; i < size; i++)     feed_list_adapter.add_list(feed_titles.get(i),feed_urls.get(i) + "String_Node_Str" + feed_groups.get(i)+ "String_Node_Str"+ Integer.toString(count_lines(storage + "String_Node_Str" + feed_titles.get(i)+ "String_Node_Str") - 1)+ "String_Node_Str");
    feed_list_adapter.notifyDataSetChanged();
  }
}

Fixed version (ground truth):
private static void update_manage_feeds(){
  if (feed_list_adapter != null) {
    feed_list_adapter.clear_list();
    final List<List<String>> content=read_csv_to_list(new String[]{storage + "String_Node_Str" + all_string+ "String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"});
    final List<String> feed_titles=content.get(0);
    final List<String> feed_urls=content.get(1);
    final List<String> feed_groups=content.get(2);
    final int size=feed_titles.size();
    for (int i=0; i < size; i++)     feed_list_adapter.add_list(feed_titles.get(i),feed_urls.get(i) + "String_Node_Str" + feed_groups.get(i)+ "String_Node_Str"+ Integer.toString(count_lines(storage + "String_Node_Str" + feed_titles.get(i)+ "String_Node_Str") - 1)+ "String_Node_Str");
    feed_list_adapter.notifyDataSetChanged();
  }
}
Program: 24328
Project: 24328
Buggy source:
@Override protected Long doInBackground(Void... hey){
}

Fixed version (ground truth):
@Override protected Long doInBackground(Void... hey){
  if (new_items.get(page_number)) {
    while (check_service_running()) {
      try {
        Thread.sleep(100);
      }
 catch (      Exception e) {
      }
    }
    log("String_Node_Str");
  }
  String group=current_groups.get(page_number);
  final String group_file_path=storage + "String_Node_Str" + group+ "String_Node_Str";
  final String group_content_path=group_file_path + "String_Node_Str";
  String thumbnail_path;
  if ((!exists(group_file_path)) || (!exists(group_content_path)))   return 0L;
  List<List<String>> contenter=read_csv_to_list(new String[]{group_content_path,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"});
  List<String> marker=contenter.get(0);
  List<String> titles=contenter.get(1);
  List<String> descriptions=contenter.get(2);
  List<String> links=contenter.get(3);
  List<String> images=contenter.get(4);
  List<String> widths=contenter.get(5);
  List<String> heights=contenter.get(6);
  if (links.get(0).length() < 1)   return 0L;
  Set<String> existing_items=new HashSet<String>();
  try {
    existing_items=new HashSet<String>(get_card_adapter(page_number).return_links());
  }
 catch (  Exception e) {
  }
  final int size=titles.size();
  int width, height;
  ssize=size;
  String image;
  String tag;
  while (lv == null) {
    try {
      Thread.sleep(50);
    }
 catch (    Exception e) {
    }
    if ((viewpager != null) && (l == null))     l=(fragment_card)fragment_manager.findFragmentByTag("String_Node_Str" + viewpager.getId() + "String_Node_Str"+ Integer.toString(page_number));
    if ((l != null) && (ith == null))     ith=((card_adapter)l.getListAdapter());
    if ((l != null) && (lv == null))     lv=l.getListView();
  }
  for (int m=0; m < size; m++) {
    thumbnail_path="String_Node_Str";
    width=0;
    height=0;
    image=images.get(m);
    if (!image.isEmpty()) {
      width=Integer.parseInt(widths.get(m));
      if (width > 32) {
        height=Integer.parseInt(heights.get(m));
        thumbnail_path=storage + "String_Node_Str" + image.substring(image.lastIndexOf("String_Node_Str") + 1,image.length());
      }
 else       width=0;
    }
    markerer=false;
    if (marker.get(m).equals("String_Node_Str")) {
      markerer=true;
      marker_position=0;
    }
    if (marker_position != -1)     marker_position++;
    if (existing_items.add(links.get(m)))     publishProgress(titles.get(m),descriptions.get(m),links.get(m),thumbnail_path,height,width,markerer);
  }
  new_items.set(page_number,false);
  return 0L;
}
Program: 24330
Project: 24330
Buggy source:
private void add_feed(String feed_name,String feed_url,String feed_group){
  append_string_to_file(storage + "String_Node_Str" + feed_group+ "String_Node_Str","String_Node_Str" + feed_name + "String_Node_Str"+ feed_url+ "String_Node_Str");
  append_string_to_file(storage + "String_Node_Str" + all_string+ "String_Node_Str","String_Node_Str" + feed_name + "String_Node_Str"+ feed_url+ "String_Node_Str"+ feed_group+ "String_Node_Str");
  update_manage_feeds();
  update_manage_groups();
}

Fixed version (ground truth):
private static void add_feed(String feed_name,String feed_url,String feed_group){
  append_string_to_file(storage + "String_Node_Str" + feed_group+ "String_Node_Str","String_Node_Str" + feed_name + "String_Node_Str"+ feed_url+ "String_Node_Str");
  append_string_to_file(storage + "String_Node_Str" + all_string+ "String_Node_Str","String_Node_Str" + feed_name + "String_Node_Str"+ feed_url+ "String_Node_Str"+ feed_group+ "String_Node_Str");
  update_manage_feeds();
  update_manage_groups();
}
Program: 24331
Project: 24331
Buggy source:
@Override public String getPageTitle(int position){
  if (position == 0)   return getString(R.string.groups_manage_sub);
 else   return getString(R.string.feeds_manage_sub);
}

Fixed version (ground truth):
@Override public String getPageTitle(int position){
  if (position == 0)   return activity_context.getString(R.string.groups_manage_sub);
 else   return activity_context.getString(R.string.feeds_manage_sub);
}
Program: 24332
Project: 24332
Buggy source:
private void add_group(String group_name){
  append_string_to_file(storage + "String_Node_Str",group_name + "String_Node_Str");
  update_groups();
}

Fixed version (ground truth):
private static void add_group(String group_name){
  append_string_to_file(storage + "String_Node_Str",group_name + "String_Node_Str");
  update_groups();
}
Program: 24333
Project: 24333
Buggy source:
private void update_group(int page_number){
  save_positions();
  set_refresh(true);
  Intent intent=new Intent(this,service_update.class);
  intent.putExtra("String_Node_Str",page_number);
  intent.putExtra("String_Node_Str",pref.getBoolean("String_Node_Str",false));
  startService(intent);
  if (page_number == 0) {
    for (int i=0; i < new_items.size(); i++)     new_items.set(i,true);
  }
 else {
    new_items.set(0,true);
    new_items.set(page_number,true);
  }
  new refresh_page(page_number).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}

Fixed version (ground truth):
private static void update_group(int page_number){
  save_positions();
  set_refresh(true);
  Intent intent=new Intent(activity_context,service_update.class);
  intent.putExtra("String_Node_Str",page_number);
  intent.putExtra("String_Node_Str",pref.getBoolean("String_Node_Str",false));
  activity_context.startService(intent);
  if (page_number == 0) {
    for (int i=0; i < new_items.size(); i++)     new_items.set(i,true);
  }
 else {
    new_items.set(0,true);
    new_items.set(page_number,true);
  }
  new refresh_page(page_number).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
Program: 24335
Project: 24335
Buggy source:
private card_adapter get_card_adapter(int page_index){
  return ((card_adapter)((fragment_card)fragment_manager.findFragmentByTag("String_Node_Str" + viewpager.getId() + "String_Node_Str"+ Integer.toString(page_index))).getListAdapter());
}

Fixed version (ground truth):
private static card_adapter get_card_adapter(int page_index){
  return ((card_adapter)((fragment_card)fragment_manager.findFragmentByTag("String_Node_Str" + viewpager.getId() + "String_Node_Str"+ Integer.toString(page_index))).getListAdapter());
}
Program: 24337
Project: 24337
Buggy source:
private boolean check_service_running(){
  ActivityManager manager=(ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
  for (  RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE))   if (service_update.class.getName().equals(service.service.getClassName()))   return true;
  return false;
}

Fixed version (ground truth):
private static boolean check_service_running(){
  ActivityManager manager=(ActivityManager)activity_context.getSystemService(Context.ACTIVITY_SERVICE);
  for (  RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE))   if (service_update.class.getName().equals(service.service.getClassName()))   return true;
  return false;
}
Program: 24338
Project: 24338
Buggy source:
private byte[] concat_byte_arrays(byte[] a,byte[] b){
  final int a_length=a.length;
  final int b_length=b.length;
  byte[] c=new byte[a_length + b_length];
  System.arraycopy(a,0,c,0,a_length);
  System.arraycopy(b,0,c,a_length,b_length);
  return c;
}

Fixed version (ground truth):
private static byte[] concat_byte_arrays(byte[] a,byte[] b){
  final int a_length=a.length;
  final int b_length=b.length;
  byte[] c=new byte[a_length + b_length];
  System.arraycopy(a,0,c,0,a_length);
  System.arraycopy(b,0,c,a_length,b_length);
  return c;
}
Program: 24339
Project: 24339
Buggy source:
private void update_manage_groups(){
  if (group_list_adapter != null) {
    String group, info;
    int content_size, number, j;
    List<String> content;
    group_list_adapter.clear_list();
    final int size=current_groups.size();
    for (int i=0; i < size; i++) {
      group=current_groups.get(i);
      content=read_csv_to_list(new String[]{storage + "String_Node_Str" + group+ "String_Node_Str","String_Node_Str"}).get(0);
      content_size=content.size();
      if (i == 0)       info=(size == 1) ? "String_Node_Str" : size + "String_Node_Str";
 else {
        info="String_Node_Str";
        number=3;
        if (content_size < 3)         number=content_size;
        for (j=0; j < number - 1; j++)         info+=content.get(j) + "String_Node_Str";
        info+=(content_size > 3) ? "String_Node_Str" : content.get(number - 1);
      }
      group_list_adapter.add_list(group,Integer.toString(content_size) + "String_Node_Str" + info);
    }
    group_list_adapter.notifyDataSetChanged();
  }
}

Fixed version (ground truth):
private static void update_manage_groups(){
  if (group_list_adapter != null) {
    String group, info;
    int content_size, number, j;
    List<String> content;
    group_list_adapter.clear_list();
    final int size=current_groups.size();
    for (int i=0; i < size; i++) {
      group=current_groups.get(i);
      content=read_csv_to_list(new String[]{storage + "String_Node_Str" + group+ "String_Node_Str","String_Node_Str"}).get(0);
      content_size=content.size();
      if (i == 0)       info=(size == 1) ? "String_Node_Str" : size + "String_Node_Str";
 else {
        info="String_Node_Str";
        number=3;
        if (content_size < 3)         number=content_size;
        for (j=0; j < number - 1; j++)         info+=content.get(j) + "String_Node_Str";
        info+=(content_size > 3) ? "String_Node_Str" : content.get(number - 1);
      }
      group_list_adapter.add_list(group,Integer.toString(content_size) + "String_Node_Str" + info);
    }
    group_list_adapter.notifyDataSetChanged();
  }
}
Program: 24342
Project: 24342
Buggy source:
private void perform_initial_operations(){
  storage=getExternalFilesDir(null).getAbsolutePath() + "String_Node_Str";
  delete(storage + "String_Node_Str");
  File folder_file;
  for (  String folder : folders) {
    folder_file=new File(storage.concat(folder));
    if (!folder_file.exists())     folder_file.mkdir();
  }
  feeds_string=getString(R.string.feeds_title);
  manage_string=getString(R.string.manage_title);
  settings_string=getString(R.string.settings_title);
  navigation_string=getString(R.string.navigation_title);
  all_string=getString(R.string.all_group);
  mTitle=feeds_string;
  pref=PreferenceManager.getDefaultSharedPreferences(this);
  application_context=getApplicationContext();
  activity_context=this;
}

Fixed version (ground truth):
private void perform_initial_operations(){
  storage=getExternalFilesDir(null).getAbsolutePath() + "String_Node_Str";
  delete(storage + "String_Node_Str");
  File folder_file;
  for (  String folder : folders) {
    folder_file=new File(storage.concat(folder));
    if (!folder_file.exists())     folder_file.mkdir();
  }
  feeds_string=getString(R.string.feeds_title);
  manage_string=getString(R.string.manage_title);
  settings_string=getString(R.string.settings_title);
  navigation_string=getString(R.string.navigation_title);
  all_string=getString(R.string.all_group);
  mTitle=feeds_string;
  pref=PreferenceManager.getDefaultSharedPreferences(this);
  application_context=getApplicationContext();
  activity_context=this;
  inf=getLayoutInflater();
}
Program: 24355
Project: 24355
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  ViewHolder holder;
  if (convertView == null) {
    convertView=inflater.inflate(R.layout.card_layout,parent,false);
    holder=new ViewHolder();
    holder.title_view=(TextView)convertView.findViewById(R.id.title);
    holder.time_view=(TextView)convertView.findViewById(R.id.time);
    holder.description_view=(TextView)convertView.findViewById(R.id.description);
    convertView.setTag(holder);
  }
 else   holder=(ViewHolder)convertView.getTag();
  holder.title_view.setText(content_titles.get(position));
  holder.time_view.setText(content_times.get(position));
  holder.description_view.setText(content_des.get(position));
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  ViewHolder holder;
  if (convertView == null) {
    convertView=inflater.inflate(R.layout.card_layout,parent,false);
    holder=new ViewHolder();
    holder.title_view=(TextView)convertView.findViewById(R.id.title);
    holder.time_view=(TextView)convertView.findViewById(R.id.time);
    holder.description_view=(TextView)convertView.findViewById(R.id.description);
    convertView.setTag(holder);
  }
 else   holder=(ViewHolder)convertView.getTag();
  holder.title_view.setText(content_titles.get(position));
  holder.time_view.setText(content_links.get(position));
  holder.description_view.setText(content_des.get(position));
  return convertView;
}
Program: 24356
Project: 24356
Buggy source:
public void add_list(List<String> new_titles,List<String> new_des,List<String> new_times){
  content_titles=new_titles;
  content_des=new_des;
  content_times=new_times;
}

Fixed version (ground truth):
public void add_list(List<String> new_titles,List<String> new_des,List<String> new_links){
  content_titles=new_titles;
  content_des=new_des;
  content_links=new_links;
}
Program: 24361
Project: 24361
Buggy source:
protected void onProgressUpdate(Integer... progress){
  ((card_adapter)((ArrayListFragment)getFragmentManager().findFragmentByTag("String_Node_Str" + viewPager.getId() + "String_Node_Str"+ Integer.toString(progress[0]))).getListAdapter()).notifyDataSetChanged();
}

Fixed version (ground truth):
protected void onProgressUpdate(Integer... progress){
  ((card_adapter)((ArrayListFragment)getFragmentManager().findFragmentByTag("String_Node_Str" + viewPager.getId() + "String_Node_Str"+ Integer.toString(progress[0]))).getListAdapter()).notifyDataSetChanged();
  ((card_adapter)((ArrayListFragment)getFragmentManager().findFragmentByTag("String_Node_Str" + viewPager.getId() + "String_Node_Str")).getListAdapter()).notifyDataSetChanged();
}
Program: 24362
Project: 24362
Buggy source:
@Override public void characters(char[] ac,int i,int j) throws SAXException {
  String tmpValue=new String(ac,i,j);
  boolean empty=true;
  if (tmpValue.length() > 0) {
    for (int k=0; i < tmpValue.length() - 1; i++) {
      if ((tmpValue.charAt(k) != ' ') && (tmpValue.charAt(k) != '\t')) {
        empty=false;
        break;
      }
    }
  }
  if (empty == false) {
    try {
      if (title_mode.equals("String_Node_Str")) {
        for (int l=0; l < content_titles.length; l++) {
          if (content_titles[l] == tmpValue) {
          }
 else {
            title_mode="String_Node_Str";
            if ((mode.equals("String_Node_Str")))             to_file(this.file + "String_Node_Str","String_Node_Str");
          }
        }
      }
      if (title_mode.equals("String_Node_Str")) {
        if (mode.equals("String_Node_Str"))         to_file(this.file + "String_Node_Str",tmpValue + "String_Node_Str");
        if (mode.equals("String_Node_Str"))         to_file(this.file + "String_Node_Str",tmpValue + "String_Node_Str");
      }
    }
 catch (    Exception e) {
    }
  }
}

Fixed version (ground truth):
@Override public void characters(char[] ac,int i,int j) throws SAXException {
  String content_string=new String(ac,i,j);
  boolean empty=true;
  if (content_string.length() > 0) {
    for (int k=0; i < content_string.length() - 1; i++) {
      if ((content_string.charAt(k) != ' ') && (content_string.charAt(k) != '\t')) {
        empty=false;
        break;
      }
    }
  }
  if (empty == false) {
    try {
      if ((check_existing == true) && (skip == false)) {
        boolean match=false;
        for (int l=0; l < content_titles.length; l++) {
          if (content_titles[l].equals(content_string)) {
            match=true;
            break;
          }
        }
        if (match == false) {
          check_existing=false;
          to_file(this.file + "String_Node_Str","String_Node_Str");
        }
        skip=true;
      }
      if (check_existing == false) {
        if (mode.equals("String_Node_Str"))         to_file(this.file + "String_Node_Str",content_string + "String_Node_Str");
        if (mode.equals("String_Node_Str"))         to_file(this.file + "String_Node_Str",content_string + "String_Node_Str");
      }
    }
 catch (    Exception e) {
    }
  }
}
Program: 24363
Project: 24363
Buggy source:
public parsered(String file_path){
  this.file=file_path;
  parse_local_xml(file_path);
}

Fixed version (ground truth):
public parsered(String file_path){
  this.file=file_path;
  content_titles=read_csv_to_array("String_Node_Str","String_Node_Str");
  parse_local_xml(file_path);
}
Program: 24364
Project: 24364
Buggy source:
@Override public void endElement(String uri,String localName,String qName) throws SAXException {
  try {
    if ((title_mode.equals("String_Node_Str")) || (qName.equals("String_Node_Str"))) {
      if (qName.equals("String_Node_Str")) {
        mode="String_Node_Str";
        title_mode="String_Node_Str";
        to_file(this.file + "String_Node_Str","String_Node_Str");
        content_titles=read_csv_to_array("String_Node_Str","String_Node_Str");
      }
 else       if (qName.equals("String_Node_Str")) {
        mode="String_Node_Str";
        to_file(this.file + "String_Node_Str","String_Node_Str");
      }
    }
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
@Override public void endElement(String uri,String localName,String qName) throws SAXException {
  try {
    if (qName.equals("String_Node_Str")) {
      mode="String_Node_Str";
      if (check_existing == true) {
        check_existing=false;
        skip=false;
      }
 else {
        content_titles=read_csv_to_array("String_Node_Str","String_Node_Str");
        to_file(this.file + "String_Node_Str","String_Node_Str");
      }
    }
 else     if (qName.equals("String_Node_Str")) {
      mode="String_Node_Str";
      to_file(this.file + "String_Node_Str","String_Node_Str");
    }
  }
 catch (  Exception e) {
  }
}
Program: 24365
Project: 24365
Buggy source:
@Override public void startElement(String uri,String localName,String qName,Attributes attributes) throws SAXException {
  try {
    if (qName.equals("String_Node_Str"))     mode="String_Node_Str";
 else     if (qName.equals("String_Node_Str"))     mode="String_Node_Str";
    if (qName.equals("String_Node_Str"))     title_mode="String_Node_Str";
 else {
      if ((mode.equals("String_Node_Str")) && (!(qName.equals("String_Node_Str"))))       to_file(this.file + "String_Node_Str",qName + "String_Node_Str");
 else       if ((mode.equals("String_Node_Str")) && (!(qName.equals("String_Node_Str"))) && (!(qName.equals("String_Node_Str")))&& (!(qName.equals("String_Node_Str"))))       to_file(this.file + "String_Node_Str",qName + "String_Node_Str");
    }
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
@Override public void startElement(String uri,String localName,String qName,Attributes attributes) throws SAXException {
  try {
    if (qName.equals("String_Node_Str"))     mode="String_Node_Str";
 else     if (qName.equals("String_Node_Str"))     mode="String_Node_Str";
    if (check_existing == false) {
      if ((qName == "String_Node_Str") && (mode.equals("String_Node_Str")))       check_existing=true;
 else {
        if ((mode.equals("String_Node_Str")) && (!(qName.equals("String_Node_Str"))) && (!qName.equals("String_Node_Str")))         to_file(this.file + "String_Node_Str",qName + "String_Node_Str");
 else         if ((mode.equals("String_Node_Str")) && (!(qName.equals("String_Node_Str"))) && (!(qName.equals("String_Node_Str")))&& (!(qName.equals("String_Node_Str"))))         to_file(this.file + "String_Node_Str",qName + "String_Node_Str");
      }
    }
  }
 catch (  Exception e) {
  }
}
Program: 24366
Project: 24366
Buggy source:
@Override public void run(){
  boolean was_interrupted=false;
  _is_playing=true;
  while (!was_interrupted) {
    try {
      getSamples(_samples,_buffer_size);
      if (_buffer.length < _buffer_size) {
        _buffer=new short[_buffer_size];
      }
      for (int i=0; i < _buffer_size; i++) {
        _buffer[i]=(short)(_samples[i] * Short.MAX_VALUE);
      }
      if (_track != null) {
        _track.write(_buffer,0,_buffer_size);
      }
    }
 catch (    Exception e) {
      was_interrupted=true;
      Log.e(TAG,LOGPREFIX + "String_Node_Str" + e.toString());
    }
    if (Thread.interrupted()) {
      was_interrupted=true;
    }
  }
  if (_track != null) {
    _track.release();
  }
  _is_playing=false;
}

Fixed version (ground truth):
@Override public void run(){
  boolean was_interrupted=false;
  _is_playing=true;
  while (!was_interrupted) {
    try {
      getSamples(_samples,_buffer_size);
      if (_buffer.length < _buffer_size) {
        _buffer=new short[_buffer_size];
      }
      for (int i=0; i < _buffer_size; i++) {
        _buffer[i]=(short)(_samples[i] * Short.MAX_VALUE);
      }
      if (_track != null) {
        _track.write(_buffer,0,_buffer_size);
      }
    }
 catch (    Exception e) {
      was_interrupted=true;
      Log.e(TAG,LOGPREFIX + "String_Node_Str" + e.toString());
    }
    if (Thread.interrupted()) {
      was_interrupted=true;
    }
  }
  _is_playing=false;
}
Program: 24367
Project: 24367
Buggy source:
public synchronized void stop(){
  if (_thread == null) {
    return;
  }
  _thread.interrupt();
  _is_playing=false;
  if (_track.getPlayState() == AudioTrack.PLAYSTATE_PLAYING) {
    _track.flush();
    _track.stop();
  }
  _track.release();
  _track=null;
  resetFlags();
}

Fixed version (ground truth):
/** 
 * Kill the thread, stop and release audio resources
 */
public synchronized void stop(){
  if (_thread == null) {
    return;
  }
  _thread.interrupt();
  _is_playing=false;
  if (_track.getPlayState() == AudioTrack.PLAYSTATE_PLAYING) {
    _track.pause();
    _track.flush();
  }
  _track.release();
  _track=null;
  resetFlags();
}
Program: 24368
Project: 24368
Buggy source:
public Association hasAndBelongsToMany(String name){
  Association assoc=new Association(relations,name,false,false);
  relations.put(name,assoc);
  return assoc;
}

Fixed version (ground truth):
public Association hasAndBelongsToMany(String name){
  return assoc(name,false,false);
}
Program: 24369
Project: 24369
Buggy source:
public Association hasOne(String name){
  Association assoc=new Association(relations,name,true,true);
  relations.put(name,assoc);
  return assoc;
}

Fixed version (ground truth):
public Association hasOne(String name){
  return assoc(name,true,true);
}
Program: 24370
Project: 24370
Buggy source:
public Association belongsTo(String name){
  Association assoc=new Association(relations,name,true,false);
  relations.put(name,assoc);
  return assoc;
}

Fixed version (ground truth):
public Association belongsTo(String name){
  return assoc(name,true,false);
}
Program: 24371
Project: 24371
Buggy source:
public Association hasMany(String name){
  Association assoc=new Association(relations,name,false,true);
  relations.put(name,assoc);
  return assoc;
}

Fixed version (ground truth):
public Association hasMany(String name){
  return assoc(name,false,true);
}
Program: 24372
Project: 24372
Buggy source:
public PreparedStatement prepare(String sql,Object[] params,int[] types){
  try {
    PreparedStatement call;
    if (sql.trim().startsWith("String_Node_Str")) {
      call=base.prepareStatement(sql,Statement.RETURN_GENERATED_KEYS);
    }
 else {
      call=base.prepareStatement(sql);
    }
    if (params != null && params.length > 0) {
      for (int i=0; i < params.length; i++) {
        if (params[i] != null) {
          call.setObject(i + 1,params[i]);
        }
 else {
          call.setNull(i + 1,types[i]);
        }
      }
    }
    return call;
  }
 catch (  SQLException e) {
    throw new SqlExecuteException(sql,e);
  }
}

Fixed version (ground truth):
public PreparedStatement prepare(String sql,Object[] params,int[] types){
  try {
    PreparedStatement call;
    if (sql.trim().toLowerCase().startsWith("String_Node_Str")) {
      call=base.prepareStatement(sql,Statement.RETURN_GENERATED_KEYS);
    }
 else {
      call=base.prepareStatement(sql);
    }
    if (params != null && params.length > 0) {
      for (int i=0; i < params.length; i++) {
        if (params[i] != null) {
          call.setObject(i + 1,params[i]);
        }
 else {
          call.setNull(i + 1,types[i]);
        }
      }
    }
    return call;
  }
 catch (  SQLException e) {
    throw new SqlExecuteException(sql,e);
  }
}
Program: 24373
Project: 24373
Buggy source:
public static String toHexString(byte[] coded,int offsetStart,int offsetEnd){
  if (coded == null) {
    return "String_Node_Str";
  }
  int len=coded.length - offsetEnd;
  StringBuilder result=new StringBuilder(len * 3);
  for (int i=offsetStart; i < len; i++) {
    int c=coded[i];
    if (c < 0) {
      c+=256;
    }
    int hex1=c & 0xF;
    int hex2=c >> 4;
    result.append(HEX_DIGIT[hex2]);
    result.append(HEX_DIGIT[hex1]);
    result.append(' ');
  }
  return result.toString();
}

Fixed version (ground truth):
public static String toHexString(byte[] coded,int offset,int length){
  if (coded == null) {
    return "String_Node_Str";
  }
  StringBuilder result=new StringBuilder(length * 3);
  for (int i=0; i < length; i++) {
    int c=coded[i + offset];
    if (c < 0) {
      c+=256;
    }
    int hex1=c & 0xF;
    int hex2=c >> 4;
    result.append(HEX_DIGIT[hex2]);
    result.append(HEX_DIGIT[hex1]);
    result.append(' ');
  }
  return result.toString();
}
Program: 24374
Project: 24374
Buggy source:
public static int convertToInt16(byte[] bytes){
  if (bytes.length >= 2) {
    return ((bytes[0] & 0xff) << 8) + ((bytes[1] & 0xff) << 0);
  }
  return 0;
}

Fixed version (ground truth):
public static int convertToInt16(byte[] bytes,boolean isLE){
  if (bytes.length >= 2) {
    if (isLE) {
      return ((bytes[1] & 0xff) << 8) + ((bytes[0] & 0xff) << 0);
    }
 else {
      return ((bytes[0] & 0xff) << 8) + ((bytes[1] & 0xff) << 0);
    }
  }
  return 0;
}
Program: 24375
Project: 24375
Buggy source:
public static int convertToInt32(byte[] bytes){
  if (bytes.length >= 4) {
    return (((bytes[0] & 0xff) << 24) + ((bytes[1] & 0xff) << 16) + ((bytes[2] & 0xff) << 8)+ ((bytes[3] & 0xff) << 0));
  }
  return 0;
}

Fixed version (ground truth):
public static int convertToInt32(byte[] bytes,boolean isLE){
  if (bytes.length >= 4) {
    if (isLE) {
      return (((bytes[3] & 0xff) << 24) + ((bytes[2] & 0xff) << 16) + ((bytes[1] & 0xff) << 8)+ ((bytes[0] & 0xff) << 0));
    }
 else {
      return (((bytes[0] & 0xff) << 24) + ((bytes[1] & 0xff) << 16) + ((bytes[2] & 0xff) << 8)+ ((bytes[3] & 0xff) << 0));
    }
  }
  return 0;
}
Program: 24376
Project: 24376
Buggy source:
/** 
 * <ʵ����> <������ϸ����>
 * @param clazz
 * @return
 * @see [�ࡢ��#��������#��Ա]
 */
public static <E>E newInstance(Class<E> clazz){
  try {
    Constructor<E> ctr=clazz.getConstructor();
    return ctr.newInstance();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * <ʵ����> <������ϸ����>
 * @param clazz
 * @return
 * @see [�ࡢ��#��������#��Ա]
 */
public static <E>E newInstance(Class<E> clazz){
  try {
    Constructor<E> ctr=clazz.getConstructor();
    ctr.setAccessible(true);
    return ctr.newInstance();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return null;
}
Program: 24377
Project: 24377
Buggy source:
/** 
 * Returns the number of remaining bytes that can be read (or skipped over) from this input stream. <p> The value returned is <code>count&nbsp;- pos</code>, which is the number of bytes remaining to be read from the input buffer.
 * @return the number of remaining bytes that can be read (or skipped over)from this input stream without blocking.
 */
public int available(){
  return count - pos;
}

Fixed version (ground truth):
/** 
 * Returns the number of remaining bytes that can be read (or skipped over) from this input stream. <p> The value returned is <code>count&nbsp;- pos</code>, which is the number of bytes remaining to be read from the input buffer.
 * @return the number of remaining bytes that can be read (or skipped over)from this input stream without blocking.
 */
public int available(){
  return count - pos + offsetStart;
}
Program: 24379
Project: 24379
Buggy source:
public void offset(int offstart,int offend){
  offsetStart+=offstart;
  offsetEnd+=offend;
  count-=offend;
}

Fixed version (ground truth):
public void offset(int offstart,int offend){
  offsetStart+=offstart;
  offsetEnd+=offend;
  count-=offend;
  count-=offstart;
}
Program: 24380
Project: 24380
Buggy source:
public void setCursor(int pos){
  this.pos=pos;
}

Fixed version (ground truth):
public void setCursor(int pos){
  this.pos=pos + offsetStart;
}
Program: 24381
Project: 24381
Buggy source:
@Override public String toString(){
  return StringHelper.buffer("String_Node_Str",pos,"String_Node_Str",count,']',ByteHelper.toHexString(buffer,offsetStart,offsetEnd));
}

Fixed version (ground truth):
@Override public String toString(){
  return StringHelper.buffer("String_Node_Str",pos,"String_Node_Str",count,']',ByteHelper.toHexString(buffer,offsetStart,count));
}
Program: 24382
Project: 24382
Buggy source:
@Override public String toString(){
  StringBuilder ret=new StringBuilder(64);
  if (head != null) {
    for (    ByteBuffer bytes : head) {
      ret.append(ByteHelper.toHexString(bytes.array()));
      ret.append("String_Node_Str");
    }
  }
  ret.append(ByteHelper.toHexString(buffer,0,buffer.length - count));
  if (tail != null) {
    for (    ByteBuffer bytes : tail) {
      ret.append("String_Node_Str");
      ret.append(ByteHelper.toHexString(bytes.array()));
    }
  }
  return ret.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  StringBuilder ret=new StringBuilder(64);
  if (head != null) {
    for (    ByteBuffer bytes : head) {
      ret.append(ByteHelper.toHexString(bytes.array()));
      ret.append("String_Node_Str");
    }
  }
  ret.append(ByteHelper.toHexString(buffer,0,count));
  if (tail != null) {
    for (    ByteBuffer bytes : tail) {
      ret.append("String_Node_Str");
      ret.append(ByteHelper.toHexString(bytes.array()));
    }
  }
  return ret.toString();
}