nus-yam/ex-repair huggingface dataset:
Program: 86281
Project: 86281
Buggy source:
@Override public SearchRequestResult searchGetPage(int page) throws IOException, NotReachableException, OpacErrorException {
  List<NameValuePair> params=new ArrayList<NameValuePair>();
  params.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
  params.add(new BasicNameValuePair("String_Node_Str",encode(query,"String_Node_Str","String_Node_Str","String_Node_Str")));
  params.add(new BasicNameValuePair("String_Node_Str",String.valueOf(page - 1)));
  params.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
  String text=encode(params,"String_Node_Str","String_Node_Str");
  Log.d("String_Node_Str",text);
  String base64=Base64.encodeToString(text.getBytes("String_Node_Str"),Base64.NO_WRAP);
  Log.d("String_Node_Str",opac_url + "String_Node_Str" + base64);
  String html=httpGet(opac_url + "String_Node_Str" + base64,getDefaultEncoding(),false);
  return parse_search(html,page);
}

Fixed version (ground truth):
@Override public SearchRequestResult searchGetPage(int page) throws IOException, NotReachableException, OpacErrorException {
  List<NameValuePair> params=new ArrayList<NameValuePair>();
  params.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
  params.add(new BasicNameValuePair("String_Node_Str",encode(query,"String_Node_Str","String_Node_Str","String_Node_Str")));
  params.add(new BasicNameValuePair("String_Node_Str",String.valueOf(page - 1)));
  params.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
  String text=encode(params,"String_Node_Str","String_Node_Str");
  Log.d("String_Node_Str",text);
  String base64=URLEncoder.encode(Base64.encodeToString(text.getBytes("String_Node_Str"),Base64.NO_WRAP),"String_Node_Str");
  Log.d("String_Node_Str",opac_url + "String_Node_Str" + base64);
  String html=httpGet(opac_url + "String_Node_Str" + base64,getDefaultEncoding(),false);
  return parse_search(html,page);
}
Program: 86284
Project: 86284
Buggy source:
@Override protected void onPostCreate(Bundle savedInstanceState){
  super.onPostCreate(savedInstanceState);
  if (hasDrawer)   drawerToggle.syncState();
}

Fixed version (ground truth):
@Override protected void onPostCreate(Bundle savedInstanceState){
  super.onPostCreate(savedInstanceState);
  setSupportProgressBarIndeterminateVisibility(false);
  if (hasDrawer)   drawerToggle.syncState();
}
Program: 86285
Project: 86285
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  supportRequestWindowFeature(android.view.Window.FEATURE_INDETERMINATE_PROGRESS);
  super.onCreate(savedInstanceState);
  try {
    setSupportProgressBarIndeterminateVisibility(false);
  }
 catch (  Exception e) {
  }
  setContentView(getContentView());
  app=(OpacClient)getApplication();
  aData=new AccountDataSource(this);
  setupDrawer();
  if (savedInstanceState != null) {
    setTwoPane(savedInstanceState.getBoolean("String_Node_Str"));
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  supportRequestWindowFeature(android.view.Window.FEATURE_INDETERMINATE_PROGRESS);
  super.onCreate(savedInstanceState);
  setContentView(getContentView());
  app=(OpacClient)getApplication();
  aData=new AccountDataSource(this);
  setupDrawer();
  if (savedInstanceState != null) {
    setTwoPane(savedInstanceState.getBoolean("String_Node_Str"));
  }
}
Program: 86286
Project: 86286
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
  super.onCreate(savedInstanceState);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  if (savedInstanceState == null)   setup();
  if (findViewById(R.id.searchresult_detail_container) != null) {
    mTwoPane=true;
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  if (savedInstanceState == null)   setup();
  if (findViewById(R.id.searchresult_detail_container) != null) {
    mTwoPane=true;
  }
}
Program: 86289
Project: 86289
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
  super.onCreate(savedInstanceState);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  listFragment=SearchResultListFragment.getInstance(getIntent().getBundleExtra("String_Node_Str"));
  getSupportFragmentManager().beginTransaction().replace(R.id.searchresult_list_container,listFragment).commit();
  if (findViewById(R.id.searchresult_detail_container) != null) {
    mTwoPane=true;
    listFragment.setActivateOnItemClick(true);
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
  super.onCreate(savedInstanceState);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  listFragment=SearchResultListFragment.getInstance(getIntent().getBundleExtra("String_Node_Str"));
  getSupportFragmentManager().beginTransaction().replace(R.id.searchresult_list_container,listFragment).commit();
  if (findViewById(R.id.searchresult_detail_container) != null) {
    mTwoPane=true;
  }
}
Program: 86291
Project: 86291
Buggy source:
public void showListCities(String country,String state){
  LibraryListFragment fragment=new LibraryListFragment();
  Bundle args=new Bundle();
  args.putInt("String_Node_Str",LEVEL_CITY);
  args.putString("String_Node_Str",country);
  args.putString("String_Node_Str",state);
  fragment.setArguments(args);
  Set<String> data=new HashSet<String>();
  for (  Library lib : libraries) {
    if (country.equals(lib.getCountry()) && state.equals(lib.getState()) && !data.contains(lib.getCity())) {
      data.add(lib.getCity());
    }
  }
  List<String> list=new ArrayList<String>(data);
  if (data.size() == 1 && list.get(0).equals(state)) {
    showListLibraries(country,state,list.get(0));
  }
  Collections.sort(list);
  ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,R.layout.listitem_simple,R.id.text1,list);
  fragment.setListAdapter(adapter);
  if (findViewById(R.id.llFragments) != null) {
    fragment3=fragment;
    getSupportFragmentManager().beginTransaction().replace(R.id.container3,fragment3).commit();
    if (fragment4 != null)     getSupportFragmentManager().beginTransaction().detach(fragment4).commit();
  }
 else   if (data.size() > 1) {
    this.fragment=fragment;
    getSupportFragmentManager().beginTransaction().replace(R.id.container,fragment).addToBackStack(null).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN).commit();
  }
}

Fixed version (ground truth):
public void showListCities(String country,String state){
  LibraryListFragment fragment=new LibraryListFragment();
  Bundle args=new Bundle();
  args.putInt("String_Node_Str",LEVEL_CITY);
  args.putString("String_Node_Str",country);
  args.putString("String_Node_Str",state);
  fragment.setArguments(args);
  Set<String> data=new HashSet<String>();
  for (  Library lib : libraries) {
    if (country.equals(lib.getCountry()) && state.equals(lib.getState()) && !data.contains(lib.getCity())) {
      data.add(lib.getCity());
    }
  }
  List<String> list=new ArrayList<String>(data);
  if (data.size() == 1 && list.get(0).equals(state)) {
    showListLibraries(country,state,list.get(0));
  }
  Collections.sort(list);
  ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,R.layout.listitem_simple,R.id.text1,list);
  fragment.setListAdapter(adapter);
  if (findViewById(R.id.llFragments) != null) {
    fragment3=fragment;
    getSupportFragmentManager().beginTransaction().replace(R.id.container3,fragment3).commit();
    if (fragment4 != null)     getSupportFragmentManager().beginTransaction().detach(fragment4).commit();
  }
 else   if (data.size() > 1 || !list.get(0).equals(state)) {
    this.fragment=fragment;
    getSupportFragmentManager().beginTransaction().replace(R.id.container,fragment).addToBackStack(null).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN).commit();
  }
}
Program: 86292
Project: 86292
Buggy source:
@Override public CancelResult cancel(String media,Account account,int useraction,String selection) throws IOException, OpacErrorException {
  List<NameValuePair> params=new ArrayList<NameValuePair>();
  params.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
  params.add(new BasicNameValuePair("String_Node_Str",account.getName()));
  params.add(new BasicNameValuePair("String_Node_Str",pwEncoded));
  params.add(new BasicNameValuePair("String_Node_Str",media));
  String html=httpPost(https_url + "String_Node_Str" + db+ "String_Node_Str",new UrlEncodedFormEntity(params,"String_Node_Str"),getDefaultEncoding());
  Document doc=Jsoup.parse(html);
  if (doc.select("String_Node_Str").text().contains("String_Node_Str")) {
    return new CancelResult(MultiStepResult.Status.OK);
  }
 else   if (doc.select("String_Node_Str").text().contains("String_Node_Str")) {
    try {
      account(account);
      return cancel(media,account,useraction,selection);
    }
 catch (    JSONException e) {
      throw new OpacErrorException("String_Node_Str");
    }
  }
 else {
    throw new OpacErrorException("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public CancelResult cancel(String media,Account account,int useraction,String selection) throws IOException, OpacErrorException {
  List<NameValuePair> params=new ArrayList<NameValuePair>();
  params.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
  params.add(new BasicNameValuePair("String_Node_Str",account.getName()));
  params.add(new BasicNameValuePair("String_Node_Str",pwEncoded));
  params.add(new BasicNameValuePair("String_Node_Str",media));
  String html=httpPost(https_url + "String_Node_Str" + db+ "String_Node_Str",new UrlEncodedFormEntity(params,getDefaultEncoding()),getDefaultEncoding());
  Document doc=Jsoup.parse(html);
  if (doc.select("String_Node_Str").text().contains("String_Node_Str")) {
    return new CancelResult(MultiStepResult.Status.OK);
  }
 else   if (doc.select("String_Node_Str").text().contains("String_Node_Str")) {
    try {
      account(account);
      return cancel(media,account,useraction,selection);
    }
 catch (    JSONException e) {
      throw new OpacErrorException("String_Node_Str");
    }
  }
 else {
    throw new OpacErrorException("String_Node_Str");
  }
}
Program: 86293
Project: 86293
Buggy source:
@Override public SearchRequestResult searchGetPage(int page) throws IOException, NotReachableException, OpacErrorException {
  if (!initialised)   start();
  String html=httpGet(opac_url + "String_Node_Str" + db+ "String_Node_Str"+ searchSet+ "String_Node_Str"+ (((page - 1) * resultcount) + 1),ENCODING,false,cookieStore);
  return parse_search(html,page);
}

Fixed version (ground truth):
@Override public SearchRequestResult searchGetPage(int page) throws IOException, NotReachableException, OpacErrorException {
  if (!initialised)   start();
  String html=httpGet(opac_url + "String_Node_Str" + db+ "String_Node_Str"+ searchSet+ "String_Node_Str"+ (((page - 1) * resultcount) + 1),getDefaultEncoding(),false,cookieStore);
  return parse_search(html,page);
}
Program: 86294
Project: 86294
Buggy source:
@Override protected String getDefaultEncoding(){
  try {
    if (data.has("String_Node_Str"))     return data.getString("String_Node_Str");
  }
 catch (  JSONException e) {
    e.printStackTrace();
  }
  return super.getDefaultEncoding();
}

Fixed version (ground truth):
@Override protected String getDefaultEncoding(){
  try {
    if (data.has("String_Node_Str"))     return data.getString("String_Node_Str");
  }
 catch (  JSONException e) {
    e.printStackTrace();
  }
  return "String_Node_Str";
}
Program: 86297
Project: 86297
Buggy source:
@Override public DetailledItem getResultById(String id,String homebranch) throws IOException, NotReachableException {
  if (id == null && reusehtml != null) {
    return parse_result(reusehtml);
  }
  String html=httpGet(id,ENCODING);
  return parse_result(html);
}

Fixed version (ground truth):
@Override public DetailledItem getResultById(String id,String homebranch) throws IOException, NotReachableException {
  if (id == null && reusehtml != null) {
    return parse_result(reusehtml);
  }
  String html=httpGet(id,getDefaultEncoding());
  return parse_result(html);
}
Program: 86298
Project: 86298
Buggy source:
@Override public DetailledItem getResult(int position) throws IOException {
  String html=httpGet(opac_url + "String_Node_Str" + db+ "String_Node_Str"+ searchSet+ "String_Node_Str"+ (position + 1),ENCODING,false,cookieStore);
  return parse_result(html);
}

Fixed version (ground truth):
@Override public DetailledItem getResult(int position) throws IOException {
  String html=httpGet(opac_url + "String_Node_Str" + db+ "String_Node_Str"+ searchSet+ "String_Node_Str"+ (position + 1),getDefaultEncoding(),false,cookieStore);
  return parse_result(html);
}
Program: 86299
Project: 86299
Buggy source:
@Override public ProlongResult prolong(String media,Account account,int useraction,String Selection) throws IOException {
  List<NameValuePair> params=new ArrayList<NameValuePair>();
  params.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
  params.add(new BasicNameValuePair("String_Node_Str",account.getName()));
  params.add(new BasicNameValuePair("String_Node_Str",pwEncoded));
  params.add(new BasicNameValuePair("String_Node_Str",media));
  String html=httpPost(https_url + "String_Node_Str" + db+ "String_Node_Str",new UrlEncodedFormEntity(params,"String_Node_Str"),getDefaultEncoding());
  Document doc=Jsoup.parse(html);
  if (doc.select("String_Node_Str").text().contains("String_Node_Str")) {
    return new ProlongResult(MultiStepResult.Status.OK);
  }
 else   if (doc.select("String_Node_Str").text().contains("String_Node_Str")) {
    try {
      account(account);
      return prolong(media,account,useraction,Selection);
    }
 catch (    JSONException e) {
      return new ProlongResult(MultiStepResult.Status.ERROR);
    }
catch (    OpacErrorException e) {
      return new ProlongResult(MultiStepResult.Status.ERROR,e.getMessage());
    }
  }
 else {
    ProlongResult res=new ProlongResult(MultiStepResult.Status.ERROR);
    res.setMessage(doc.select("String_Node_Str").text());
    return res;
  }
}

Fixed version (ground truth):
@Override public ProlongResult prolong(String media,Account account,int useraction,String Selection) throws IOException {
  List<NameValuePair> params=new ArrayList<NameValuePair>();
  params.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
  params.add(new BasicNameValuePair("String_Node_Str",account.getName()));
  params.add(new BasicNameValuePair("String_Node_Str",pwEncoded));
  params.add(new BasicNameValuePair("String_Node_Str",media));
  String html=httpPost(https_url + "String_Node_Str" + db+ "String_Node_Str",new UrlEncodedFormEntity(params,getDefaultEncoding()),getDefaultEncoding());
  Document doc=Jsoup.parse(html);
  if (doc.select("String_Node_Str").text().contains("String_Node_Str")) {
    return new ProlongResult(MultiStepResult.Status.OK);
  }
 else   if (doc.select("String_Node_Str").text().contains("String_Node_Str")) {
    try {
      account(account);
      return prolong(media,account,useraction,Selection);
    }
 catch (    JSONException e) {
      return new ProlongResult(MultiStepResult.Status.ERROR);
    }
catch (    OpacErrorException e) {
      return new ProlongResult(MultiStepResult.Status.ERROR,e.getMessage());
    }
  }
 else {
    ProlongResult res=new ProlongResult(MultiStepResult.Status.ERROR);
    res.setMessage(doc.select("String_Node_Str").text());
    return res;
  }
}
Program: 86301
Project: 86301
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
  super.onCreate(savedInstanceState);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  listFragment=(SearchResultListFragment)getSupportFragmentManager().findFragmentById(R.id.searchresult_list);
  if (findViewById(R.id.searchresult_detail_container) != null) {
    mTwoPane=true;
    listFragment.setActivateOnItemClick(true);
  }
  if (savedInstanceState == null) {
    page=1;
    performsearch();
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
  super.onCreate(savedInstanceState);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  listFragment=(SearchResultListFragment)getSupportFragmentManager().findFragmentById(R.id.searchresult_list);
  if (findViewById(R.id.searchresult_detail_container) != null) {
    mTwoPane=true;
    listFragment.setActivateOnItemClick(true);
  }
  if (savedInstanceState == null) {
    performsearch();
  }
}
Program: 86302
Project: 86302
Buggy source:
/** 
 * Callback method from   {@link SearchResultListFragment.Callbacks}indicating that the item with the given ID was selected.
 */
@Override public void onItemSelected(int nr,String id,boolean otherPage){
  if ((app.getApi().getSupportFlags() & OpacApi.SUPPORT_FLAG_ENDLESS_SCROLLING) == 0 && otherPage) {
    new ReloadOldPageTask().execute(app,page,nr,id);
  }
 else {
    showDetail(nr,id);
  }
}

Fixed version (ground truth):
/** 
 * Callback method from   {@link SearchResultListFragment.Callbacks}indicating that the item with the given ID was selected.
 */
@Override public void onItemSelected(int nr,String id,int pageToLoad){
  if ((app.getApi().getSupportFlags() & OpacApi.SUPPORT_FLAG_ENDLESS_SCROLLING) == 0 && pageToLoad != listFragment.getLastLoadedPage()) {
    new ReloadOldPageTask().execute(app,pageToLoad,nr,id);
  }
 else {
    showDetail(nr,id);
  }
}
Program: 86303
Project: 86303
Buggy source:
protected void loaded(){
  try {
    listFragment.setListShown(true);
    listFragment.setSearchResult(searchresult,page == 1);
  }
 catch (  IllegalStateException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
protected void loaded(){
  try {
    listFragment.setListShown(true);
    listFragment.setSearchResult(searchresult);
  }
 catch (  IllegalStateException e) {
    e.printStackTrace();
  }
}
Program: 86304
Project: 86304
Buggy source:
@Override protected SearchRequestResult doInBackground(Object... arg0){
  nr=(Integer)arg0[2];
  id=(String)arg0[3];
  return super.doInBackground(arg0);
}

Fixed version (ground truth):
@Override protected SearchRequestResult doInBackground(Object... arg0){
  page=(Integer)arg0[1];
  nr=(Integer)arg0[2];
  id=(String)arg0[3];
  OpacClient app=(OpacClient)arg0[0];
  try {
    SearchRequestResult res=app.getApi().searchGetPage(page);
    return res;
  }
 catch (  java.net.UnknownHostException e) {
    exception=e;
    e.printStackTrace();
  }
catch (  java.net.SocketException e) {
    exception=e;
  }
catch (  OpacErrorException e) {
    exception=e;
  }
catch (  Exception e) {
    exception=e;
    ACRA.getErrorReporter().handleException(e);
  }
  return null;
}
Program: 86305
Project: 86305
Buggy source:
@Override protected void onPostExecute(SearchRequestResult result){
  setProgressBarIndeterminateVisibility(false);
  if (result == null) {
    if (exception instanceof OpacErrorException) {
      if (exception.getMessage().equals("String_Node_Str")) {
        Intent intent=new Intent(SearchResultListActivity.this,SearchResultDetailActivity.class);
        intent.putExtra(SearchResultDetailFragment.ARG_ITEM_ID,(String)null);
        startActivity(intent);
        finish();
        return;
      }
      listFragment.showConnectivityError(exception.getMessage());
    }
 else     if (exception instanceof NotReachableException)     listFragment.showConnectivityError(getResources().getString(R.string.connection_error_detail_nre));
 else     listFragment.showConnectivityError();
  }
 else {
    showDetail(nr,id);
  }
}

Fixed version (ground truth):
@Override protected void onPostExecute(SearchRequestResult result){
  setProgressBarIndeterminateVisibility(false);
  if (result == null) {
    if (exception instanceof OpacErrorException) {
      listFragment.showConnectivityError(exception.getMessage());
    }
 else     if (exception instanceof NotReachableException)     listFragment.showConnectivityError(getResources().getString(R.string.connection_error_detail_nre));
 else     listFragment.showConnectivityError();
  }
 else {
    listFragment.setLastLoadedPage(page);
    showDetail(nr,id);
  }
}
Program: 86306
Project: 86306
Buggy source:
public void performsearch(){
  if (page == 1) {
    st=new SearchStartTask();
    st.execute(app,getIntent().getBundleExtra("String_Node_Str"));
  }
 else {
    sst=new SearchPageTask();
    sst.execute(app,page);
  }
}

Fixed version (ground truth):
public void performsearch(){
  st=new SearchStartTask();
  st.execute(app,getIntent().getBundleExtra("String_Node_Str"));
}
Program: 86307
Project: 86307
Buggy source:
@Override public void onListItemClick(ListView listView,View view,int position,long id){
  super.onListItemClick(listView,view,position,id);
  mCallbacks.onItemSelected(searchresult.getResults().get(position).getNr(),searchresult.getResults().get(position).getId(),searchresult.getResults().get(position).getPage() != adapter.getPage());
}

Fixed version (ground truth):
@Override public void onListItemClick(ListView listView,View view,int position,long id){
  super.onListItemClick(listView,view,position,id);
  mCallbacks.onItemSelected(searchresult.getResults().get(position).getNr(),searchresult.getResults().get(position).getId(),searchresult.getResults().get(position).getPage());
}
Program: 86308
Project: 86308
Buggy source:
@Override public List<SearchResult> onLoadMore(int page) throws Exception {
  SearchRequestResult res=app.getApi().searchGetPage(page);
  return res.getResults();
}

Fixed version (ground truth):
@Override public List<SearchResult> onLoadMore(int page) throws Exception {
  SearchRequestResult res=app.getApi().searchGetPage(page);
  setLastLoadedPage(page);
  return res.getResults();
}
Program: 86309
Project: 86309
Buggy source:
@Override public void onItemSelected(int nr,String id,boolean otherPage){
}

Fixed version (ground truth):
@Override public void onItemSelected(int nr,String id,int pageToLoad){
}
Program: 86310
Project: 86310
Buggy source:
public void setSearchResult(SearchRequestResult searchresult,boolean clear){
  for (  SearchResult result : searchresult.getResults()) {
    result.setPage(searchresult.getPage_index());
  }
  if (searchresult.getTotal_result_count() >= 0)   getSupportActionBar().setSubtitle(getString(R.string.result_number,searchresult.getTotal_result_count()));
  if (searchresult.getResults().size() == 0 && searchresult.getTotal_result_count() == 0) {
    setEmptyText(getString(R.string.no_results));
  }
  this.searchresult=searchresult;
  adapter=new ResultsAdapterEndless(getActivity(),searchresult,new OnLoadMoreListener(){
    @Override public List<SearchResult> onLoadMore(    int page) throws Exception {
      SearchRequestResult res=app.getApi().searchGetPage(page);
      return res.getResults();
    }
  }
);
  setListAdapter(adapter);
  getListView().setTextFilterEnabled(true);
  setListShown(true);
}

Fixed version (ground truth):
public void setSearchResult(SearchRequestResult searchresult){
  for (  SearchResult result : searchresult.getResults()) {
    result.setPage(searchresult.getPage_index());
  }
  if (searchresult.getTotal_result_count() >= 0)   getSupportActionBar().setSubtitle(getString(R.string.result_number,searchresult.getTotal_result_count()));
  if (searchresult.getResults().size() == 0 && searchresult.getTotal_result_count() == 0) {
    setEmptyText(getString(R.string.no_results));
  }
  this.searchresult=searchresult;
  adapter=new ResultsAdapterEndless(getActivity(),searchresult,new OnLoadMoreListener(){
    @Override public List<SearchResult> onLoadMore(    int page) throws Exception {
      SearchRequestResult res=app.getApi().searchGetPage(page);
      setLastLoadedPage(page);
      return res.getResults();
    }
  }
);
  setListAdapter(adapter);
  getListView().setTextFilterEnabled(true);
  setListShown(true);
}
Program: 86312
Project: 86312
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  view=inflater.inflate(R.layout.fragment_account,container,false);
  app=(OpacClient)getActivity().getApplication();
  account=app.getAccount();
  if (getActivity().getIntent().getExtras() != null) {
    if (getActivity().getIntent().getExtras().containsKey("String_Node_Str")) {
      AccountDataSource adata=new AccountDataSource(getActivity());
      adata.open();
      Bundle notif=getActivity().getIntent().getExtras().getBundle("String_Node_Str");
      Set<String> keys=notif.keySet();
      for (      String key : keys) {
        long[] val=notif.getLongArray(key);
        adata.notificationSave(val[0],val[1]);
      }
      adata.close();
      if (getActivity().getIntent().getExtras().getLong("String_Node_Str") != app.getAccount().getId()) {
        app.setAccount(getActivity().getIntent().getExtras().getLong("String_Node_Str"));
        accountSelected(app.getAccount());
      }
      NotificationManager nMgr=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
      nMgr.cancel(OpacClient.NOTIF_ID);
    }
  }
  setHasOptionsMenu(true);
  accountSelected(app.getAccount());
  final Handler handler=new Handler();
  handler.post(new Runnable(){
    @Override public void run(){
      refreshage();
      handler.postDelayed(this,60000);
    }
  }
);
  return view;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  view=inflater.inflate(R.layout.fragment_account,container,false);
  app=(OpacClient)getActivity().getApplication();
  account=app.getAccount();
  if (getActivity().getIntent().getExtras() != null) {
    if (getActivity().getIntent().getExtras().containsKey("String_Node_Str")) {
      AccountDataSource adata=new AccountDataSource(getActivity());
      adata.open();
      Bundle notif=getActivity().getIntent().getExtras().getBundle("String_Node_Str");
      Set<String> keys=notif.keySet();
      for (      String key : keys) {
        long[] val=notif.getLongArray(key);
        adata.notificationSave(val[0],val[1]);
      }
      adata.close();
      if (getActivity().getIntent().getExtras().getLong("String_Node_Str") != app.getAccount().getId()) {
        app.setAccount(getActivity().getIntent().getExtras().getLong("String_Node_Str"));
        ((OpacActivity)getActivity()).accountSelected(app.getAccount());
      }
      NotificationManager nMgr=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
      nMgr.cancel(OpacClient.NOTIF_ID);
    }
  }
  setHasOptionsMenu(true);
  accountSelected(app.getAccount());
  final Handler handler=new Handler();
  handler.post(new Runnable(){
    @Override public void run(){
      refreshage();
      handler.postDelayed(this,60000);
    }
  }
);
  return view;
}
Program: 86313
Project: 86313
Buggy source:
public void showConnectivityError(){
  ProgressBar progress=(ProgressBar)view.findViewById(R.id.progress);
  FrameLayout errorView=(FrameLayout)view.findViewById(R.id.error_view);
  errorView.removeAllViews();
  View connError=getActivity().getLayoutInflater().inflate(R.layout.error_connectivity,errorView);
  ((Button)connError.findViewById(R.id.btRetry)).setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      reload();
    }
  }
);
  progress.startAnimation(AnimationUtils.loadAnimation(getActivity(),R.anim.fade_out));
  connError.startAnimation(AnimationUtils.loadAnimation(getActivity(),R.anim.fade_in));
  progress.setVisibility(View.GONE);
  connError.setVisibility(View.VISIBLE);
}

Fixed version (ground truth):
public void showConnectivityError(){
  ProgressBar progress=(ProgressBar)view.findViewById(R.id.progress);
  final FrameLayout errorView=(FrameLayout)view.findViewById(R.id.error_view);
  errorView.removeAllViews();
  View connError=getActivity().getLayoutInflater().inflate(R.layout.error_connectivity,errorView);
  ((Button)connError.findViewById(R.id.btRetry)).setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      errorView.removeAllViews();
      reload();
    }
  }
);
  progress.startAnimation(AnimationUtils.loadAnimation(getActivity(),R.anim.fade_out));
  connError.startAnimation(AnimationUtils.loadAnimation(getActivity(),R.anim.fade_in));
  progress.setVisibility(View.GONE);
  connError.setVisibility(View.VISIBLE);
}
Program: 86315
Project: 86315
Buggy source:
public void reservationDo(int useraction,String selection){
  if (dialog == null) {
    dialog=ProgressDialog.show(getActivity(),"String_Node_Str",getString(R.string.doing_res),true);
    dialog.show();
  }
 else   if (!dialog.isShowing()) {
    dialog=ProgressDialog.show(getActivity(),"String_Node_Str",getString(R.string.doing_res),true);
    dialog.show();
  }
  rt=new ResTask();
  if (app.getApi() instanceof EbookServiceApi) {
    SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(getActivity());
    if (((EbookServiceApi)app.getApi()).isEbook(item) && selection == null) {
      rt.execute(app,item.getReservation_info(),0,sp.getString("String_Node_Str","String_Node_Str"));
      return;
    }
  }
  rt.execute(app,item,useraction,selection);
}

Fixed version (ground truth):
public void reservationDo(int useraction,String selection){
  if (dialog == null) {
    dialog=ProgressDialog.show(getActivity(),"String_Node_Str",getString(R.string.doing_res),true);
    dialog.show();
  }
 else   if (!dialog.isShowing()) {
    dialog=ProgressDialog.show(getActivity(),"String_Node_Str",getString(R.string.doing_res),true);
    dialog.show();
  }
  rt=new ResTask();
  if (app.getApi() instanceof EbookServiceApi) {
    SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(getActivity());
    if (((EbookServiceApi)app.getApi()).isEbook(item) && selection == null) {
      rt.execute(app,item,0,sp.getString("String_Node_Str","String_Node_Str"));
      return;
    }
  }
  rt.execute(app,item,useraction,selection);
}
Program: 86321
Project: 86321
Buggy source:
@Override public AccountData account(Account account) throws IOException, JSONException {
  List<NameValuePair> params=new ArrayList<NameValuePair>();
  params.add(new BasicNameValuePair("String_Node_Str",account.getName()));
  params.add(new BasicNameValuePair("String_Node_Str",account.getPassword()));
  params.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
  String html=httpPost(opac_url + "String_Node_Str",new UrlEncodedFormEntity(params,"String_Node_Str"));
  Document doc=Jsoup.parse(html);
  AccountData res=null;
  if (doc.select("String_Node_Str").size() > 0) {
    List<ContentValues> medien=new ArrayList<ContentValues>();
    parse_medialist(medien,doc,1);
    List<ContentValues> reserved=new ArrayList<ContentValues>();
    parse_reslist(reserved,doc,1);
    res=new AccountData(account.getId());
    res.setLent(medien);
    res.setReservations(reserved);
  }
 else   if (doc.select("String_Node_Str").size() > 0) {
    if (doc.select("String_Node_Str").text().trim().contains("String_Node_Str")) {
      last_error="String_Node_Str";
      return null;
    }
 else {
      last_error="String_Node_Str" + doc.select("String_Node_Str").text().trim() + "String_Node_Str";
      return null;
    }
  }
 else {
    last_error="String_Node_Str";
  }
  return res;
}

Fixed version (ground truth):
@Override public AccountData account(Account account) throws IOException, JSONException {
  List<NameValuePair> params=new ArrayList<NameValuePair>();
  params.add(new BasicNameValuePair("String_Node_Str",account.getName()));
  params.add(new BasicNameValuePair("String_Node_Str",account.getPassword()));
  params.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
  String html=httpPost(opac_url + "String_Node_Str",new UrlEncodedFormEntity(params,"String_Node_Str"));
  Document doc=Jsoup.parse(html);
  Log.d("String_Node_Str",html);
  Log.d("String_Node_Str",doc.select("String_Node_Str").text().trim());
  AccountData res=new AccountData(account.getId());
  List<ContentValues> medien=new ArrayList<ContentValues>();
  List<ContentValues> reserved=new ArrayList<ContentValues>();
  if (doc.select("String_Node_Str").size() > 0) {
    parse_medialist(medien,doc,1);
  }
  if (doc.select("String_Node_Str").size() > 0) {
    parse_reslist(reserved,doc,1);
  }
  res.setLent(medien);
  res.setReservations(reserved);
  if (medien.isEmpty() && reserved.isEmpty()) {
    if (doc.select("String_Node_Str").size() > 0) {
      if (doc.select("String_Node_Str").text().trim().contains("String_Node_Str")) {
      }
 else       if (doc.select("String_Node_Str").text().trim().contains("String_Node_Str")) {
        last_error="String_Node_Str";
        return null;
      }
 else {
        last_error="String_Node_Str" + doc.select("String_Node_Str").text().trim() + "String_Node_Str";
        return null;
      }
    }
 else {
      last_error="String_Node_Str";
      return null;
    }
  }
  return res;
}
Program: 86322
Project: 86322
Buggy source:
protected void parse_medialist(List<ContentValues> medien,Document doc,int offset) throws ClientProtocolException, IOException {
  Elements copytrs=doc.select("String_Node_Str").first().select("String_Node_Str");
  doc.setBaseUri(opac_url);
  SimpleDateFormat sdf=new SimpleDateFormat("String_Node_Str");
  int trs=copytrs.size();
  if (trs < 2)   return;
  assert(trs > 0);
  for (int i=1; i < trs; i++) {
    Element tr=copytrs.get(i);
    ContentValues e=new ContentValues();
    e.put(AccountData.KEY_LENT_TITLE,tr.child(0).text().trim().replace("String_Node_Str","String_Node_Str"));
    e.put(AccountData.KEY_LENT_AUTHOR,tr.child(1).text().trim().replace("String_Node_Str","String_Node_Str"));
    e.put(AccountData.KEY_LENT_STATUS,tr.child(3).text().trim().replace("String_Node_Str","String_Node_Str") + "String_Node_Str");
    e.put(AccountData.KEY_LENT_DEADLINE,tr.child(4).text().trim().replace("String_Node_Str","String_Node_Str"));
    try {
      e.put(AccountData.KEY_LENT_DEADLINE_TIMESTAMP,sdf.parse(e.getAsString(AccountData.KEY_LENT_DEADLINE)).getTime());
    }
 catch (    ParseException e1) {
      e1.printStackTrace();
    }
    e.put(AccountData.KEY_LENT_LINK,tr.child(5).select("String_Node_Str").attr("String_Node_Str"));
    medien.add(e);
  }
  assert(medien.size() == trs - 1);
}

Fixed version (ground truth):
protected void parse_medialist(List<ContentValues> medien,Document doc,int offset) throws ClientProtocolException, IOException {
  Elements copytrs=doc.select("String_Node_Str");
  doc.setBaseUri(opac_url);
  SimpleDateFormat sdf=new SimpleDateFormat("String_Node_Str");
  int trs=copytrs.size();
  if (trs < 2)   return;
  assert(trs > 0);
  for (int i=1; i < trs; i++) {
    Element tr=copytrs.get(i);
    ContentValues e=new ContentValues();
    e.put(AccountData.KEY_LENT_TITLE,tr.child(0).text().trim().replace("String_Node_Str","String_Node_Str"));
    e.put(AccountData.KEY_LENT_AUTHOR,tr.child(1).text().trim().replace("String_Node_Str","String_Node_Str"));
    e.put(AccountData.KEY_LENT_STATUS,tr.child(3).text().trim().replace("String_Node_Str","String_Node_Str") + "String_Node_Str");
    e.put(AccountData.KEY_LENT_DEADLINE,tr.child(4).text().trim().replace("String_Node_Str","String_Node_Str"));
    try {
      e.put(AccountData.KEY_LENT_DEADLINE_TIMESTAMP,sdf.parse(e.getAsString(AccountData.KEY_LENT_DEADLINE)).getTime());
    }
 catch (    ParseException e1) {
      e1.printStackTrace();
    }
    e.put(AccountData.KEY_LENT_LINK,tr.child(5).select("String_Node_Str").attr("String_Node_Str"));
    medien.add(e);
  }
  assert(medien.size() == trs - 1);
}
Program: 86324
Project: 86324
Buggy source:
@Override public ProlongResult prolong(String a,Account account,int useraction,String Selection) throws IOException {
  if (a.startsWith("String_Node_Str")) {
    last_error=a.substring(1);
    return new ProlongResult(MultiStepResult.Status.ERROR);
  }
  String[] parts=a.split("String_Node_Str");
  String offset=parts[0];
  String query=parts[1];
  if (!initialised)   start();
  if (System.currentTimeMillis() - logged_in > SESSION_LIFETIME || logged_in_as == null) {
    try {
      account(account);
    }
 catch (    JSONException e) {
      e.printStackTrace();
      return new ProlongResult(MultiStepResult.Status.ERROR);
    }
  }
 else   if (logged_in_as.getId() != account.getId()) {
    try {
      account(account);
    }
 catch (    JSONException e) {
      e.printStackTrace();
      return new ProlongResult(MultiStepResult.Status.ERROR);
    }
  }
  httpGet(opac_url + "String_Node_Str",ENCODING);
  if (offset != "String_Node_Str")   httpGet(opac_url + "String_Node_Str" + offset,ENCODING);
  String html=httpGet(opac_url + "String_Node_Str" + query,ENCODING);
  Document doc=Jsoup.parse(html);
  if (doc.getElementsByClass("String_Node_Str").size() == 1) {
    last_error=doc.getElementsByClass("String_Node_Str").text();
    return new ProlongResult(MultiStepResult.Status.ERROR);
  }
  return new ProlongResult(MultiStepResult.Status.OK);
}

Fixed version (ground truth):
@Override public ProlongResult prolong(String a,Account account,int useraction,String Selection) throws IOException {
  if (a.startsWith("String_Node_Str")) {
    last_error=a.substring(1);
    return new ProlongResult(MultiStepResult.Status.ERROR);
  }
  String[] parts=a.split("String_Node_Str");
  String offset=parts[0];
  String query=parts[1];
  if (!initialised)   start();
  if (System.currentTimeMillis() - logged_in > SESSION_LIFETIME || logged_in_as == null) {
    try {
      account(account);
    }
 catch (    JSONException e) {
      e.printStackTrace();
      return new ProlongResult(MultiStepResult.Status.ERROR);
    }
  }
 else   if (logged_in_as.getId() != account.getId()) {
    try {
      account(account);
    }
 catch (    JSONException e) {
      e.printStackTrace();
      return new ProlongResult(MultiStepResult.Status.ERROR);
    }
  }
  httpGet(opac_url + "String_Node_Str",ENCODING);
  if (offset != "String_Node_Str")   httpGet(opac_url + "String_Node_Str" + offset,ENCODING);
  String html=httpGet(opac_url + "String_Node_Str" + query,ENCODING);
  Document doc=Jsoup.parse(html);
  if (doc.select("String_Node_Str").size() > 0) {
    last_error=doc.select("String_Node_Str").first().text();
    return new ProlongResult(MultiStepResult.Status.ERROR);
  }
  return new ProlongResult(MultiStepResult.Status.OK);
}
Program: 86325
Project: 86325
Buggy source:
public List<Library> getLibraries() throws IOException, JSONException {
  AssetManager assets=getAssets();
  String[] files=assets.list(ASSETS_BIBSDIR);
  int num=files.length;
  List<Library> libs=new ArrayList<Library>();
  StringBuilder builder=null;
  BufferedReader reader=null;
  InputStream fis=null;
  String line=null;
  String json=null;
  for (int i=0; i < num; i++) {
    builder=new StringBuilder();
    fis=assets.open(ASSETS_BIBSDIR + "String_Node_Str" + files[i]);
    reader=new BufferedReader(new InputStreamReader(fis,"String_Node_Str"));
    while ((line=reader.readLine()) != null) {
      builder.append(line);
    }
    fis.close();
    json=builder.toString();
    libs.add(Library.fromJSON(files[i].replace("String_Node_Str","String_Node_Str"),new JSONObject(json)));
  }
  return libs;
}

Fixed version (ground truth):
public List<Library> getLibraries() throws IOException {
  AssetManager assets=getAssets();
  String[] files=assets.list(ASSETS_BIBSDIR);
  int num=files.length;
  List<Library> libs=new ArrayList<Library>();
  StringBuilder builder=null;
  BufferedReader reader=null;
  InputStream fis=null;
  String line=null;
  String json=null;
  for (int i=0; i < num; i++) {
    builder=new StringBuilder();
    fis=assets.open(ASSETS_BIBSDIR + "String_Node_Str" + files[i]);
    reader=new BufferedReader(new InputStreamReader(fis,"String_Node_Str"));
    while ((line=reader.readLine()) != null) {
      builder.append(line);
    }
    fis.close();
    json=builder.toString();
    try {
      Library lib=Library.fromJSON(files[i].replace("String_Node_Str","String_Node_Str"),new JSONObject(json));
      libs.add(lib);
    }
 catch (    JSONException e) {
      Log.w("String_Node_Str","String_Node_Str" + files[i]);
      e.printStackTrace();
    }
  }
  return libs;
}
Program: 86330
Project: 86330
Buggy source:
@Override public void onUpgrade(SQLiteDatabase db,int oldVersion,int newVersion){
  if (oldVersion < 2) {
    db.execSQL("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    db.execSQL("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  }
  if (oldVersion < 3) {
    db.execSQL("String_Node_Str");
  }
  if (oldVersion == 3) {
    db.execSQL("String_Node_Str");
  }
  if (oldVersion < 7) {
    db.execSQL("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void onUpgrade(SQLiteDatabase db,int oldVersion,int newVersion){
  if (oldVersion < 2) {
    db.execSQL("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    db.execSQL("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  }
  if (oldVersion < 3) {
    db.execSQL("String_Node_Str");
  }
  if (oldVersion == 3) {
    db.execSQL("String_Node_Str");
  }
  if (oldVersion < 7) {
    try {
      db.execSQL("String_Node_Str");
    }
 catch (    SQLiteException sqle) {
      sqle.printStackTrace();
    }
  }
}
Program: 86333
Project: 86333
Buggy source:
public void reservationDo(int useraction,String selection){
  dialog=ProgressDialog.show(SearchResultDetailsActivity.this,"String_Node_Str",getString(R.string.doing_res),true);
  dialog.show();
  rt=new ResTask();
  rt.execute(app,item.getReservation_info(),useraction,selection);
}

Fixed version (ground truth):
public void reservationDo(int useraction,String selection){
  if (dialog == null) {
    dialog=ProgressDialog.show(SearchResultDetailsActivity.this,"String_Node_Str",getString(R.string.doing_res),true);
    dialog.show();
  }
 else   if (!dialog.isShowing()) {
    dialog=ProgressDialog.show(SearchResultDetailsActivity.this,"String_Node_Str",getString(R.string.doing_res),true);
    dialog.show();
  }
  rt=new ResTask();
  rt.execute(app,item.getReservation_info(),useraction,selection);
}
Program: 86335
Project: 86335
Buggy source:
/** 
 * Set date of last caching
 * @return Password
 */
public long getCached(){
  return cached;
}

Fixed version (ground truth):
/** 
 * Set date of last caching
 * @return Timestamp in milliseconds
 */
public long getCached(){
  return cached;
}
Program: 86336
Project: 86336
Buggy source:
/** 
 * Get date of last caching
 * @param password Password
 */
public void setCached(long cached){
  this.cached=cached;
}

Fixed version (ground truth):
/** 
 * Set date of last caching
 * @param cached Timestamp in milliseconds (use <code>System.currentTimeMillis</code>)
 */
public void setCached(long cached){
  this.cached=cached;
}
Program: 86337
Project: 86337
Buggy source:
/** 
 * Add an entry to the database.
 * @param type The type of information. Can be one of the <code>META_TYPE_</code> constants but also a string specific to your OpacApi implementation.
 * @param library The library identification string this entry should be associated with, see {@link de.geeksfactory.opacclient.objects.Library#getIdent()}
 * @param key The key the information is stored with, for example the ID of a branch.
 * @param value The value to be stored, for example the name of a branch
 * @return
 */
public long addMeta(String type,String library,String key,String value);

Fixed version (ground truth):
/** 
 * Add an entry to the database.
 * @param type The type of information. Can be one of the <code>META_TYPE_</code> constants but also a string specific to your OpacApi implementation.
 * @param library The library identification string this entry should be associated with, see {@link de.geeksfactory.opacclient.objects.Library#getIdent()}
 * @param key The key the information is stored with, for example the ID of a branch.
 * @param value The value to be stored, for example the name of a branch
 * @return dataset ID
 */
public long addMeta(String type,String library,String key,String value);
Program: 86340
Project: 86340
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.loading);
  ((TextView)findViewById(R.id.tvLoading)).setText(R.string.loading_details);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  id=getIntent().getStringExtra("String_Node_Str");
  if (getIntent().getIntExtra("String_Node_Str",-1) != -1) {
    ft=new FetchTask();
    ft.execute(app,getIntent().getIntExtra("String_Node_Str",0));
  }
 else {
    fst=new FetchSubTask();
    fst.execute(app,id);
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.loading);
  ((TextView)findViewById(R.id.tvLoading)).setText(R.string.loading_details);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  if (getIntent().hasExtra("String_Node_Str") && !getIntent().getStringExtra("String_Node_Str").equals("String_Node_Str"))   id=getIntent().getStringExtra("String_Node_Str");
  if (getIntent().getIntExtra("String_Node_Str",-1) != -1) {
    ft=new FetchTask();
    ft.execute(app,getIntent().getIntExtra("String_Node_Str",0));
  }
 else {
    fst=new FetchSubTask();
    fst.execute(app,id);
  }
}
Program: 86341
Project: 86341
Buggy source:
@Override public boolean onCreateOptionsMenu(Menu menu){
  MenuInflater mi=new MenuInflater(this);
  mi.inflate(R.menu.search_result_details_activity,menu);
  String bib=app.getLibrary().getIdent();
  StarDataSource data=new StarDataSource(this);
  data.open();
  if (item != null) {
    if (id == null || id.equals("String_Node_Str")) {
      if (data.isStarredTitle(bib,title)) {
        menu.findItem(R.id.action_star).setIcon(R.drawable.ic_ab_star_1);
      }
    }
 else {
      if (data.isStarred(bib,id)) {
        menu.findItem(R.id.action_star).setIcon(R.drawable.ic_ab_star_1);
      }
    }
  }
  data.close();
  return super.onCreateOptionsMenu(menu);
}

Fixed version (ground truth):
@Override public boolean onCreateOptionsMenu(Menu menu){
  MenuInflater mi=new MenuInflater(this);
  mi.inflate(R.menu.search_result_details_activity,menu);
  Log.i("String_Node_Str","String_Node_Str" + item + "String_Node_Str"+ id);
  String bib=app.getLibrary().getIdent();
  StarDataSource data=new StarDataSource(this);
  data.open();
  if ((id == null || id.equals("String_Node_Str")) && item != null) {
    if (data.isStarredTitle(bib,title)) {
      menu.findItem(R.id.action_star).setIcon(R.drawable.ic_ab_star_1);
    }
  }
 else {
    if (data.isStarred(bib,id)) {
      menu.findItem(R.id.action_star).setIcon(R.drawable.ic_ab_star_1);
    }
  }
  data.close();
  return super.onCreateOptionsMenu(menu);
}
Program: 86342
Project: 86342
Buggy source:
public Account getAccount(){
  if (account != null) {
    if (sp.getLong(PREF_SELECTED_ACCOUNT,0) == account.getId()) {
      return account;
    }
  }
  AccountDataSource data=new AccountDataSource(this);
  data.open();
  Account acc=data.getAccount(sp.getLong(PREF_SELECTED_ACCOUNT,0));
  data.close();
  return acc;
}

Fixed version (ground truth):
public Account getAccount(){
  if (account != null) {
    if (sp.getLong(PREF_SELECTED_ACCOUNT,0) == account.getId()) {
      return account;
    }
  }
  AccountDataSource data=new AccountDataSource(this);
  data.open();
  account=data.getAccount(sp.getLong(PREF_SELECTED_ACCOUNT,0));
  data.close();
  return account;
}
Program: 86343
Project: 86343
Buggy source:
public void setAccount(long id){
  sp.edit().putLong(OpacClient.PREF_SELECTED_ACCOUNT,id).commit();
}

Fixed version (ground truth):
public void setAccount(long id){
  sp.edit().putLong(OpacClient.PREF_SELECTED_ACCOUNT,id).commit();
  account=null;
  api=null;
}