nus-yam/ex-repair huggingface dataset:
Program: 165288
Project: 165288
Buggy source:
public static UpdateReceiver updateRepoNow(String address,Context context){
  String title=context.getString(R.string.process_wait_title);
  String message=context.getString(R.string.process_update_msg);
  ProgressDialog dialog=ProgressDialog.show(context,title,message,true,true);
  dialog.setIcon(android.R.drawable.ic_dialog_info);
  dialog.setCanceledOnTouchOutside(false);
  Intent intent=new Intent(context,UpdateService.class);
  UpdateReceiver receiver=new UpdateReceiver(new Handler());
  receiver.setContext(context).setDialog(dialog);
  intent.putExtra(EXTRA_RECEIVER,receiver);
  if (!TextUtils.isEmpty(address)) {
    intent.putExtra(EXTRA_ADDRESS,address);
  }
  context.startService(intent);
  return receiver;
}

Fixed version (ground truth):
public static UpdateReceiver updateRepoNow(String address,Context context){
  Intent intent=new Intent(context,UpdateService.class);
  UpdateReceiver receiver=new UpdateReceiver(new Handler());
  receiver.showDialog(context);
  intent.putExtra(EXTRA_RECEIVER,receiver);
  if (!TextUtils.isEmpty(address)) {
    intent.putExtra(EXTRA_ADDRESS,address);
  }
  context.startService(intent);
  return receiver;
}
Program: 165289
Project: 165289
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setHasOptionsMenu(true);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setHasOptionsMenu(true);
  setRetainInstance(true);
}
Program: 165290
Project: 165290
Buggy source:
@Override public void onProgress(Event event){
  if (event.type.equals(UpdateService.EVENT_COMPLETE_WITH_CHANGES)) {
    repo=loadRepoDetails();
    updateView((ViewGroup)getView());
  }
}

Fixed version (ground truth):
@Override public void onProgress(Event event){
  if (event.type.equals(UpdateService.EVENT_COMPLETE_WITH_CHANGES)) {
    repo=loadRepoDetails();
    updateView((ViewGroup)getView());
  }
  if (event.type.equals(UpdateService.EVENT_FINISHED)) {
    updateHandler=null;
  }
}
Program: 165291
Project: 165291
Buggy source:
/** 
 * When an update is performed, notify the listener so that the repo list can be updated. We will perform the update ourselves though.
 */
private void performUpdate(){
  ContentValues values=new ContentValues(1);
  values.put(RepoProvider.DataColumns.IN_USE,1);
  RepoProvider.Helper.update(getActivity(),repo,values);
  UpdateService.updateRepoNow(repo.address,getActivity()).setListener(new ProgressListener(){
    @Override public void onProgress(    Event event){
      if (event.type.equals(UpdateService.EVENT_COMPLETE_WITH_CHANGES)) {
        repo=loadRepoDetails();
        updateView((ViewGroup)getView());
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * When an update is performed, notify the listener so that the repo list can be updated. We will perform the update ourselves though.
 */
private void performUpdate(){
  ContentValues values=new ContentValues(1);
  values.put(RepoProvider.DataColumns.IN_USE,1);
  RepoProvider.Helper.update(getActivity(),repo,values);
  updateHandler=UpdateService.updateRepoNow(repo.address,getActivity()).setListener(new ProgressListener(){
    @Override public void onProgress(    Event event){
      if (event.type.equals(UpdateService.EVENT_COMPLETE_WITH_CHANGES)) {
        repo=loadRepoDetails();
        updateView((ViewGroup)getView());
      }
      if (event.type.equals(UpdateService.EVENT_FINISHED)) {
        updateHandler=null;
      }
    }
  }
);
}
Program: 165292
Project: 165292
Buggy source:
@Override public void onAttach(Activity activity){
  super.onAttach(activity);
}

Fixed version (ground truth):
@Override public void onAttach(Activity activity){
  super.onAttach(activity);
  if (updateHandler != null) {
    updateHandler.showDialog(getActivity());
  }
}
Program: 165293
Project: 165293
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setHasOptionsMenu(true);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setRetainInstance(true);
  setHasOptionsMenu(true);
}
Program: 165294
Project: 165294
Buggy source:
@Override public void onProgress(Event event){
  if (event.type.equals(UpdateService.EVENT_COMPLETE_AND_SAME) || event.type.equals(UpdateService.EVENT_COMPLETE_WITH_CHANGES)) {
    changed=false;
  }
}

Fixed version (ground truth):
@Override public void onProgress(Event event){
  if (event.type.equals(UpdateService.EVENT_COMPLETE_AND_SAME) || event.type.equals(UpdateService.EVENT_COMPLETE_WITH_CHANGES)) {
    changed=false;
  }
  if (event.type.equals(UpdateService.EVENT_FINISHED)) {
    updateHandler=null;
  }
}
Program: 165295
Project: 165295
Buggy source:
private void updateRepos(){
  UpdateService.updateNow(getActivity()).setListener(new ProgressListener(){
    @Override public void onProgress(    Event event){
      if (event.type.equals(UpdateService.EVENT_COMPLETE_AND_SAME) || event.type.equals(UpdateService.EVENT_COMPLETE_WITH_CHANGES)) {
        changed=false;
      }
    }
  }
);
}

Fixed version (ground truth):
private void updateRepos(){
  updateHandler=UpdateService.updateNow(getActivity()).setListener(new ProgressListener(){
    @Override public void onProgress(    Event event){
      if (event.type.equals(UpdateService.EVENT_COMPLETE_AND_SAME) || event.type.equals(UpdateService.EVENT_COMPLETE_WITH_CHANGES)) {
        changed=false;
      }
      if (event.type.equals(UpdateService.EVENT_FINISHED)) {
        updateHandler=null;
      }
    }
  }
);
}
Program: 165296
Project: 165296
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  getListView().addHeaderView(createHeaderView(),null,false);
  repoAdapter=new RepoAdapter(getActivity(),null);
  repoAdapter.setEnabledListener(this);
  setListAdapter(repoAdapter);
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  if (getListAdapter() == null) {
    getListView().addHeaderView(createHeaderView(),null,false);
    repoAdapter=new RepoAdapter(getActivity(),null);
    repoAdapter.setEnabledListener(this);
    setListAdapter(repoAdapter);
  }
}
Program: 165297
Project: 165297
Buggy source:
@Override protected void onReceiveResult(int resultCode,Bundle resultData){
  String message=resultData.getString(UpdateService.RESULT_MESSAGE);
  boolean finished=false;
  if (resultCode == UpdateService.STATUS_ERROR) {
    forwardEvent(EVENT_ERROR);
    Toast.makeText(context,message,Toast.LENGTH_LONG).show();
    finished=true;
  }
 else   if (resultCode == UpdateService.STATUS_COMPLETE_WITH_CHANGES) {
    forwardEvent(EVENT_COMPLETE_WITH_CHANGES);
    finished=true;
  }
 else   if (resultCode == UpdateService.STATUS_COMPLETE_AND_SAME) {
    forwardEvent(EVENT_COMPLETE_AND_SAME);
    finished=true;
  }
 else   if (resultCode == UpdateService.STATUS_INFO) {
    forwardEvent(EVENT_INFO);
    dialog.setMessage(message);
  }
  if (finished && dialog.isShowing())   try {
    dialog.dismiss();
  }
 catch (  IllegalArgumentException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Override protected void onReceiveResult(int resultCode,Bundle resultData){
  String message=resultData.getString(UpdateService.RESULT_MESSAGE);
  boolean finished=false;
  if (resultCode == UpdateService.STATUS_ERROR) {
    forwardEvent(EVENT_ERROR);
    Toast.makeText(context,message,Toast.LENGTH_LONG).show();
    finished=true;
  }
 else   if (resultCode == UpdateService.STATUS_COMPLETE_WITH_CHANGES) {
    forwardEvent(EVENT_COMPLETE_WITH_CHANGES);
    finished=true;
  }
 else   if (resultCode == UpdateService.STATUS_COMPLETE_AND_SAME) {
    forwardEvent(EVENT_COMPLETE_AND_SAME);
    finished=true;
  }
 else   if (resultCode == UpdateService.STATUS_INFO) {
    forwardEvent(EVENT_INFO);
    if (dialog != null) {
      lastShownMessage=message;
      dialog.setMessage(message);
    }
  }
  if (finished) {
    forwardEvent(EVENT_FINISHED);
    if (dialog.isShowing()) {
      try {
        dialog.dismiss();
      }
 catch (      IllegalArgumentException e) {
        e.printStackTrace();
      }
    }
  }
}
Program: 165298
Project: 165298
Buggy source:
public static UpdateReceiver updateRepoNow(String address,Context context){
  String title=context.getString(R.string.process_wait_title);
  String message=context.getString(R.string.process_update_msg);
  ProgressDialog dialog=ProgressDialog.show(context,title,message,true,true);
  dialog.setIcon(android.R.drawable.ic_dialog_info);
  dialog.setCanceledOnTouchOutside(false);
  Intent intent=new Intent(context,UpdateService.class);
  UpdateReceiver receiver=new UpdateReceiver(new Handler());
  receiver.setContext(context).setDialog(dialog);
  intent.putExtra(EXTRA_RECEIVER,receiver);
  if (!TextUtils.isEmpty(address)) {
    intent.putExtra(EXTRA_ADDRESS,address);
  }
  context.startService(intent);
  return receiver;
}

Fixed version (ground truth):
public static UpdateReceiver updateRepoNow(String address,Context context){
  Intent intent=new Intent(context,UpdateService.class);
  UpdateReceiver receiver=new UpdateReceiver(new Handler());
  receiver.showDialog(context);
  intent.putExtra(EXTRA_RECEIVER,receiver);
  if (!TextUtils.isEmpty(address)) {
    intent.putExtra(EXTRA_ADDRESS,address);
  }
  context.startService(intent);
  return receiver;
}
Program: 165299
Project: 165299
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setHasOptionsMenu(true);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setHasOptionsMenu(true);
  setRetainInstance(true);
}
Program: 165300
Project: 165300
Buggy source:
@Override public void onProgress(Event event){
  if (event.type.equals(UpdateService.EVENT_COMPLETE_WITH_CHANGES)) {
    repo=loadRepoDetails();
    updateView((ViewGroup)getView());
  }
}

Fixed version (ground truth):
@Override public void onProgress(Event event){
  if (event.type.equals(UpdateService.EVENT_COMPLETE_WITH_CHANGES)) {
    repo=loadRepoDetails();
    updateView((ViewGroup)getView());
  }
  if (event.type.equals(UpdateService.EVENT_FINISHED)) {
    updateHandler=null;
  }
}
Program: 165301
Project: 165301
Buggy source:
/** 
 * When an update is performed, notify the listener so that the repo list can be updated. We will perform the update ourselves though.
 */
private void performUpdate(){
  ContentValues values=new ContentValues(1);
  values.put(RepoProvider.DataColumns.IN_USE,1);
  RepoProvider.Helper.update(getActivity(),repo,values);
  UpdateService.updateRepoNow(repo.address,getActivity()).setListener(new ProgressListener(){
    @Override public void onProgress(    Event event){
      if (event.type.equals(UpdateService.EVENT_COMPLETE_WITH_CHANGES)) {
        repo=loadRepoDetails();
        updateView((ViewGroup)getView());
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * When an update is performed, notify the listener so that the repo list can be updated. We will perform the update ourselves though.
 */
private void performUpdate(){
  ContentValues values=new ContentValues(1);
  values.put(RepoProvider.DataColumns.IN_USE,1);
  RepoProvider.Helper.update(getActivity(),repo,values);
  updateHandler=UpdateService.updateRepoNow(repo.address,getActivity()).setListener(new ProgressListener(){
    @Override public void onProgress(    Event event){
      if (event.type.equals(UpdateService.EVENT_COMPLETE_WITH_CHANGES)) {
        repo=loadRepoDetails();
        updateView((ViewGroup)getView());
      }
      if (event.type.equals(UpdateService.EVENT_FINISHED)) {
        updateHandler=null;
      }
    }
  }
);
}
Program: 165302
Project: 165302
Buggy source:
@Override public void onAttach(Activity activity){
  super.onAttach(activity);
}

Fixed version (ground truth):
@Override public void onAttach(Activity activity){
  super.onAttach(activity);
  if (updateHandler != null) {
    updateHandler.showDialog(getActivity());
  }
}
Program: 165303
Project: 165303
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setHasOptionsMenu(true);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setRetainInstance(true);
  setHasOptionsMenu(true);
}
Program: 165304
Project: 165304
Buggy source:
@Override public void onProgress(Event event){
  if (event.type.equals(UpdateService.EVENT_COMPLETE_AND_SAME) || event.type.equals(UpdateService.EVENT_COMPLETE_WITH_CHANGES)) {
    changed=false;
  }
}

Fixed version (ground truth):
@Override public void onProgress(Event event){
  if (event.type.equals(UpdateService.EVENT_COMPLETE_AND_SAME) || event.type.equals(UpdateService.EVENT_COMPLETE_WITH_CHANGES)) {
    changed=false;
  }
  if (event.type.equals(UpdateService.EVENT_FINISHED)) {
    updateHandler=null;
  }
}
Program: 165305
Project: 165305
Buggy source:
private void updateRepos(){
  UpdateService.updateNow(getActivity()).setListener(new ProgressListener(){
    @Override public void onProgress(    Event event){
      if (event.type.equals(UpdateService.EVENT_COMPLETE_AND_SAME) || event.type.equals(UpdateService.EVENT_COMPLETE_WITH_CHANGES)) {
        changed=false;
      }
    }
  }
);
}

Fixed version (ground truth):
private void updateRepos(){
  updateHandler=UpdateService.updateNow(getActivity()).setListener(new ProgressListener(){
    @Override public void onProgress(    Event event){
      if (event.type.equals(UpdateService.EVENT_COMPLETE_AND_SAME) || event.type.equals(UpdateService.EVENT_COMPLETE_WITH_CHANGES)) {
        changed=false;
      }
      if (event.type.equals(UpdateService.EVENT_FINISHED)) {
        updateHandler=null;
      }
    }
  }
);
}
Program: 165306
Project: 165306
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  getListView().addHeaderView(createHeaderView(),null,false);
  repoAdapter=new RepoAdapter(getActivity(),null);
  repoAdapter.setEnabledListener(this);
  setListAdapter(repoAdapter);
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  if (getListAdapter() == null) {
    getListView().addHeaderView(createHeaderView(),null,false);
    repoAdapter=new RepoAdapter(getActivity(),null);
    repoAdapter.setEnabledListener(this);
    setListAdapter(repoAdapter);
  }
}
Program: 165307
Project: 165307
Buggy source:
@Override protected void onNewIntent(Intent intent){
  addRepoFromIntent(intent);
}

Fixed version (ground truth):
@Override protected void onNewIntent(Intent intent){
  setIntent(intent);
}
Program: 165308
Project: 165308
Buggy source:
public static String calcFingerprint(byte[] key){
  String ret=null;
  try {
    MessageDigest digest=MessageDigest.getInstance("String_Node_Str");
    digest.update(key);
    byte[] fingerprint=digest.digest();
    Formatter formatter=new Formatter(new StringBuilder());
    for (int i=1; i < fingerprint.length; i++) {
      formatter.format("String_Node_Str",fingerprint[i]);
    }
    ret=formatter.toString();
    formatter.close();
  }
 catch (  Exception e) {
    Log.w("String_Node_Str","String_Node_Str" + Log.getStackTraceString(e));
  }
  return ret;
}

Fixed version (ground truth):
public static String calcFingerprint(byte[] key){
  String ret=null;
  try {
    MessageDigest digest=MessageDigest.getInstance("String_Node_Str");
    digest.update(key);
    byte[] fingerprint=digest.digest();
    Formatter formatter=new Formatter(new StringBuilder());
    for (int i=0; i < fingerprint.length; i++) {
      formatter.format("String_Node_Str",fingerprint[i]);
    }
    ret=formatter.toString();
    formatter.close();
  }
 catch (  Exception e) {
    Log.w("String_Node_Str","String_Node_Str" + Log.getStackTraceString(e));
  }
  return ret;
}
Program: 165309
Project: 165309
Buggy source:
public static String formatFingerprint(String fingerprint){
  if (fingerprint.length() != 62)   return "String_Node_Str";
  String displayFP=fingerprint.substring(0,2);
  for (int i=2; i < fingerprint.length(); i=i + 2)   displayFP+="String_Node_Str" + fingerprint.substring(i,i + 2);
  return displayFP;
}

Fixed version (ground truth):
public static String formatFingerprint(String fingerprint){
  if (fingerprint.length() != 64)   return "String_Node_Str";
  String displayFP=fingerprint.substring(0,2);
  for (int i=2; i < fingerprint.length(); i=i + 2)   displayFP+="String_Node_Str" + fingerprint.substring(i,i + 2);
  return displayFP;
}
Program: 165310
Project: 165310
Buggy source:
/** 
 * Add a fingerprint field to repos. For any field with a public key, calculate its fingerprint and save it to the database.
 */
private void addFingerprintToRepo(SQLiteDatabase db,int oldVersion){
  if (oldVersion < 29) {
    if (!columnExists(db,TABLE_REPO,"String_Node_Str"))     db.execSQL("String_Node_Str" + TABLE_REPO + "String_Node_Str");
    List<Repo> oldrepos=new ArrayList<Repo>();
    Cursor cursor=db.query(TABLE_REPO,new String[]{"String_Node_Str","String_Node_Str"},null,null,null,null,null);
    if (cursor != null) {
      if (cursor.getCount() > 0) {
        cursor.moveToFirst();
        while (!cursor.isAfterLast()) {
          Repo repo=new Repo();
          repo.address=cursor.getString(0);
          repo.pubkey=cursor.getString(1);
          oldrepos.add(repo);
          cursor.moveToNext();
        }
      }
      cursor.close();
    }
    for (    Repo repo : oldrepos) {
      ContentValues values=new ContentValues();
      values.put("String_Node_Str",Utils.calcFingerprint(repo.pubkey));
      db.update(TABLE_REPO,values,"String_Node_Str",new String[]{repo.address});
    }
  }
}

Fixed version (ground truth):
/** 
 * Add a fingerprint field to repos. For any field with a public key, calculate its fingerprint and save it to the database.
 */
private void addFingerprintToRepo(SQLiteDatabase db,int oldVersion){
  if (oldVersion < 44) {
    if (!columnExists(db,TABLE_REPO,"String_Node_Str"))     db.execSQL("String_Node_Str" + TABLE_REPO + "String_Node_Str");
    List<Repo> oldrepos=new ArrayList<Repo>();
    Cursor cursor=db.query(TABLE_REPO,new String[]{"String_Node_Str","String_Node_Str"},null,null,null,null,null);
    if (cursor != null) {
      if (cursor.getCount() > 0) {
        cursor.moveToFirst();
        while (!cursor.isAfterLast()) {
          Repo repo=new Repo();
          repo.address=cursor.getString(0);
          repo.pubkey=cursor.getString(1);
          oldrepos.add(repo);
          cursor.moveToNext();
        }
      }
      cursor.close();
    }
    for (    Repo repo : oldrepos) {
      ContentValues values=new ContentValues();
      values.put("String_Node_Str",Utils.calcFingerprint(repo.pubkey));
      db.update(TABLE_REPO,values,"String_Node_Str",new String[]{repo.address});
    }
  }
}
Program: 165311
Project: 165311
Buggy source:
@Override public void onItemSelected(AdapterView<?> parent,View view,int pos,long id){
  setCurrentCategory(categories.get(pos));
}

Fixed version (ground truth):
@Override public void onItemSelected(AdapterView<?> parent,View view,int pos,long id){
  getListView().setSelection(0);
  setCurrentCategory(categories.get(pos));
}
Program: 165312
Project: 165312
Buggy source:
private Spinner createCategorySpinner(){
  final List<String> categories=AppProvider.Helper.categories(getActivity());
  categorySpinner=new Spinner(getActivity());
  categorySpinner.setId(R.id.categorySpinner);
  ArrayAdapter<String> adapter=new ArrayAdapter<String>(getActivity(),android.R.layout.simple_spinner_item,categories);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  categorySpinner.setAdapter(adapter);
  getActivity().getContentResolver().registerContentObserver(AppProvider.getContentUri(),false,new CategoryObserver(adapter));
  categorySpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int pos,    long id){
      setCurrentCategory(categories.get(pos));
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
      setCurrentCategory(null);
    }
  }
);
  return categorySpinner;
}

Fixed version (ground truth):
private Spinner createCategorySpinner(){
  final List<String> categories=AppProvider.Helper.categories(getActivity());
  categorySpinner=new Spinner(getActivity());
  categorySpinner.setId(R.id.categorySpinner);
  ArrayAdapter<String> adapter=new ArrayAdapter<String>(getActivity(),android.R.layout.simple_spinner_item,categories);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  categorySpinner.setAdapter(adapter);
  getActivity().getContentResolver().registerContentObserver(AppProvider.getContentUri(),false,new CategoryObserver(adapter));
  categorySpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int pos,    long id){
      getListView().setSelection(0);
      setCurrentCategory(categories.get(pos));
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
      setCurrentCategory(null);
    }
  }
);
  return categorySpinner;
}
Program: 165313
Project: 165313
Buggy source:
private void setCurrentCategory(String category){
  currentCategory=category;
  Log.d("String_Node_Str","String_Node_Str" + currentCategory + "String_Node_Str");
  getLoaderManager().restartLoader(0,null,AvailableAppsFragment.this);
  getListView().setSelection(0);
}

Fixed version (ground truth):
private void setCurrentCategory(String category){
  currentCategory=category;
  Log.d("String_Node_Str","String_Node_Str" + currentCategory + "String_Node_Str");
  getLoaderManager().restartLoader(0,null,AvailableAppsFragment.this);
}
Program: 165315
Project: 165315
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  ((FDroidApp)getApplication()).applyTheme(this);
  if (savedInstanceState == null) {
    listFragment=new RepoListFragment();
    getSupportFragmentManager().beginTransaction().add(android.R.id.content,listFragment).commit();
  }
  ActionBarCompat.create(this).setDisplayHomeAsUpEnabled(true);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  ((FDroidApp)getApplication()).applyTheme(this);
  if (savedInstanceState == null) {
    setContentView(new LinearLayout(this));
    listFragment=new RepoListFragment();
    getSupportFragmentManager().beginTransaction().add(android.R.id.content,listFragment).commit();
  }
  ActionBarCompat.create(this).setDisplayHomeAsUpEnabled(true);
}
Program: 165316
Project: 165316
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  ((FDroidApp)getApplication()).applyTheme(this);
  super.onCreate(savedInstanceState);
  ActionBarCompat.create(this).setDisplayHomeAsUpEnabled(true);
  setContentView(R.layout.searchresults);
  setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  ((FDroidApp)getApplication()).applyTheme(this);
  super.onCreate(savedInstanceState);
  setContentView(R.layout.searchresults);
  ActionBarCompat.create(this).setDisplayHomeAsUpEnabled(true);
  setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
}
Program: 165317
Project: 165317
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  ((FDroidApp)getApplication()).applyTheme(this);
  super.onCreate(savedInstanceState);
  long repoId=getIntent().getLongExtra(RepoDetailsFragment.ARG_REPO_ID,0);
  if (savedInstanceState == null) {
    RepoDetailsFragment fragment=new RepoDetailsFragment();
    fragment.setArguments(getIntent().getExtras());
    getSupportFragmentManager().beginTransaction().add(android.R.id.content,fragment).commit();
  }
  String[] projection=new String[]{RepoProvider.DataColumns.NAME,RepoProvider.DataColumns.ADDRESS,RepoProvider.DataColumns.FINGERPRINT};
  repo=RepoProvider.Helper.findById(this,repoId,projection);
  ActionBarCompat.create(this).setDisplayHomeAsUpEnabled(true);
  setTitle(repo.getName());
  wifiManager=(WifiManager)getSystemService(WIFI_SERVICE);
  if (Build.VERSION.SDK_INT >= 14)   setNfc();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  ((FDroidApp)getApplication()).applyTheme(this);
  super.onCreate(savedInstanceState);
  long repoId=getIntent().getLongExtra(RepoDetailsFragment.ARG_REPO_ID,0);
  if (savedInstanceState == null) {
    setContentView(new LinearLayout(this));
    RepoDetailsFragment fragment=new RepoDetailsFragment();
    fragment.setArguments(getIntent().getExtras());
    getSupportFragmentManager().beginTransaction().add(android.R.id.content,fragment).commit();
  }
  String[] projection=new String[]{RepoProvider.DataColumns.NAME,RepoProvider.DataColumns.ADDRESS,RepoProvider.DataColumns.FINGERPRINT};
  repo=RepoProvider.Helper.findById(this,repoId,projection);
  ActionBarCompat.create(this).setDisplayHomeAsUpEnabled(true);
  setTitle(repo.getName());
  wifiManager=(WifiManager)getSystemService(WIFI_SERVICE);
  if (Build.VERSION.SDK_INT >= 14)   setNfc();
}
Program: 165318
Project: 165318
Buggy source:
/** 
 * Add a name and description to the repo table, and updates the two default repos with values from strings.xml.
 */
private void addNameAndDescriptionToRepo(SQLiteDatabase db,int oldVersion){
  if (oldVersion < 21) {
    if (!columnExists(db,TABLE_REPO,"String_Node_Str"))     db.execSQL("String_Node_Str" + TABLE_REPO + "String_Node_Str");
    if (!columnExists(db,TABLE_REPO,"String_Node_Str"))     db.execSQL("String_Node_Str" + TABLE_REPO + "String_Node_Str");
    ContentValues values=new ContentValues();
    values.put("String_Node_Str",context.getString(R.string.default_repo_name));
    values.put("String_Node_Str",context.getString(R.string.default_repo_description));
    db.update(TABLE_REPO,values,"String_Node_Str",new String[]{context.getString(R.string.default_repo_address)});
    values.clear();
    values.put("String_Node_Str",context.getString(R.string.default_repo_name2));
    values.put("String_Node_Str",context.getString(R.string.default_repo_description2));
    db.update(TABLE_REPO,values,"String_Node_Str",new String[]{context.getString(R.string.default_repo_address2)});
  }
}

Fixed version (ground truth):
/** 
 * Add a name and description to the repo table, and updates the two default repos with values from strings.xml.
 */
private void addNameAndDescriptionToRepo(SQLiteDatabase db,int oldVersion){
  boolean nameExists=columnExists(db,TABLE_REPO,"String_Node_Str");
  boolean descriptionExists=columnExists(db,TABLE_REPO,"String_Node_Str");
  if (oldVersion < 21 && !(nameExists && descriptionExists)) {
    if (!nameExists)     db.execSQL("String_Node_Str" + TABLE_REPO + "String_Node_Str");
    if (!descriptionExists)     db.execSQL("String_Node_Str" + TABLE_REPO + "String_Node_Str");
    ContentValues values=new ContentValues();
    values.put("String_Node_Str",context.getString(R.string.default_repo_name));
    values.put("String_Node_Str",context.getString(R.string.default_repo_description));
    db.update(TABLE_REPO,values,"String_Node_Str",new String[]{context.getString(R.string.default_repo_address)});
    values.clear();
    values.put("String_Node_Str",context.getString(R.string.default_repo_name2));
    values.put("String_Node_Str",context.getString(R.string.default_repo_description2));
    db.update(TABLE_REPO,values,"String_Node_Str",new String[]{context.getString(R.string.default_repo_address2)});
  }
}
Program: 165319
Project: 165319
Buggy source:
private void addMaxAgeToRepo(SQLiteDatabase db,int oldVersion){
  if (oldVersion < 30) {
    db.execSQL("String_Node_Str" + TABLE_REPO + "String_Node_Str");
  }
}

Fixed version (ground truth):
private void addMaxAgeToRepo(SQLiteDatabase db,int oldVersion){
  if (oldVersion < 30 && !columnExists(db,TABLE_REPO,"String_Node_Str")) {
    db.execSQL("String_Node_Str" + TABLE_REPO + "String_Node_Str");
  }
}
Program: 165320
Project: 165320
Buggy source:
private void renameRepoId(SQLiteDatabase db,int oldVersion){
  if (oldVersion < 36) {
    Log.d("String_Node_Str","String_Node_Str" + TABLE_REPO + "String_Node_Str");
    db.beginTransaction();
    try {
      String tempTableName=TABLE_REPO + "String_Node_Str";
      db.execSQL("String_Node_Str" + TABLE_REPO + "String_Node_Str"+ tempTableName+ "String_Node_Str");
      String createTableDdl="String_Node_Str" + TABLE_REPO + "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"+ "String_Node_Str";
      db.execSQL(createTableDdl);
      String nonIdFields="String_Node_Str" + "String_Node_Str";
      String insertSql="String_Node_Str" + TABLE_REPO + "String_Node_Str"+ nonIdFields+ "String_Node_Str"+ "String_Node_Str"+ nonIdFields+ "String_Node_Str"+ tempTableName+ "String_Node_Str";
      db.execSQL(insertSql);
      db.execSQL("String_Node_Str" + tempTableName + "String_Node_Str");
      db.setTransactionSuccessful();
    }
 catch (    Exception e) {
      Log.e("String_Node_Str","String_Node_Str" + e.getMessage());
    }
    db.endTransaction();
  }
}

Fixed version (ground truth):
private void renameRepoId(SQLiteDatabase db,int oldVersion){
  if (oldVersion < 36 && !columnExists(db,TABLE_REPO,"String_Node_Str")) {
    Log.d("String_Node_Str","String_Node_Str" + TABLE_REPO + "String_Node_Str");
    db.beginTransaction();
    try {
      String tempTableName=TABLE_REPO + "String_Node_Str";
      db.execSQL("String_Node_Str" + TABLE_REPO + "String_Node_Str"+ tempTableName+ "String_Node_Str");
      String createTableDdl="String_Node_Str" + TABLE_REPO + "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"+ "String_Node_Str";
      db.execSQL(createTableDdl);
      String nonIdFields="String_Node_Str" + "String_Node_Str";
      String insertSql="String_Node_Str" + TABLE_REPO + "String_Node_Str"+ nonIdFields+ "String_Node_Str"+ "String_Node_Str"+ nonIdFields+ "String_Node_Str"+ tempTableName+ "String_Node_Str";
      db.execSQL(insertSql);
      db.execSQL("String_Node_Str" + tempTableName + "String_Node_Str");
      db.setTransactionSuccessful();
    }
 catch (    Exception e) {
      Log.e("String_Node_Str","String_Node_Str" + e.getMessage());
    }
    db.endTransaction();
  }
}
Program: 165321
Project: 165321
Buggy source:
private void updateOrInsertApks(List<Apk> apksToUpdate,int totalApksAppsCount,int currentCount){
  ArrayList<ContentProviderOperation> operations=new ArrayList<ContentProviderOperation>();
  List<Apk> knownApks=getKnownApks(apksToUpdate);
  for (  Apk apk : apksToUpdate) {
    boolean known=false;
    for (    Apk knownApk : knownApks) {
      if (knownApk.id.equals(apk.id) && knownApk.version.equals(knownApk.version)) {
        known=true;
        break;
      }
    }
    if (known) {
      operations.add(updateExistingApk(apk));
    }
 else {
      operations.add(insertNewApk(apk));
      knownApks.add(apk);
    }
  }
  Log.d("String_Node_Str","String_Node_Str" + operations.size() + "String_Node_Str");
  try {
    executeBatchWithStatus(ApkProvider.getAuthority(),operations,currentCount,totalApksAppsCount);
  }
 catch (  RemoteException e) {
    Log.e("String_Node_Str",e.getMessage());
  }
catch (  OperationApplicationException e) {
    Log.e("String_Node_Str",e.getMessage());
  }
}

Fixed version (ground truth):
private void updateOrInsertApks(List<Apk> apksToUpdate,int totalApksAppsCount,int currentCount){
  ArrayList<ContentProviderOperation> operations=new ArrayList<ContentProviderOperation>();
  List<Apk> knownApks=getKnownApks(apksToUpdate);
  for (  Apk apk : apksToUpdate) {
    boolean known=false;
    for (    Apk knownApk : knownApks) {
      if (knownApk.id.equals(apk.id) && knownApk.vercode == apk.vercode) {
        known=true;
        break;
      }
    }
    if (known) {
      operations.add(updateExistingApk(apk));
    }
 else {
      operations.add(insertNewApk(apk));
      knownApks.add(apk);
    }
  }
  Log.d("String_Node_Str","String_Node_Str" + operations.size() + "String_Node_Str");
  try {
    executeBatchWithStatus(ApkProvider.getAuthority(),operations,currentCount,totalApksAppsCount);
  }
 catch (  RemoteException e) {
    Log.e("String_Node_Str",e.getMessage());
  }
catch (  OperationApplicationException e) {
    Log.e("String_Node_Str",e.getMessage());
  }
}
Program: 165322
Project: 165322
Buggy source:
@Override public void finish(){
  Intent ret=new Intent();
  if (listFragment != null && listFragment.hasChanged()) {
    Log.i("String_Node_Str","String_Node_Str");
    ret.putExtra(REQUEST_UPDATE,true);
  }
  setResult(Activity.RESULT_OK,ret);
  super.finish();
}

Fixed version (ground truth):
@Override public void finish(){
  Intent ret=new Intent();
  markChangedIfRequired(ret);
  setResult(Activity.RESULT_OK,ret);
  super.finish();
}
Program: 165323
Project: 165323
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case android.R.id.home:
    NavUtils.navigateUpFromSameTask(this);
  return true;
}
return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case android.R.id.home:
    Intent destIntent=new Intent(this,FDroid.class);
  markChangedIfRequired(destIntent);
setResult(RESULT_OK,destIntent);
NavUtils.navigateUpTo(this,destIntent);
return true;
}
return super.onOptionsItemSelected(item);
}
Program: 165324
Project: 165324
Buggy source:
/** 
 * Thanks to http://stackoverflow.com/a/767910
 */
public static int countSubstringOccurrence(String toSearch,String substring){
  int count=0;
  int index=0;
  while (true) {
    index=toSearch.indexOf(substring,index);
    if (index == -1) {
      break;
    }
    count++;
    index+=substring.length();
  }
  return count;
}

Fixed version (ground truth):
public static int countSubstringOccurrence(File file,String substring) throws IOException {
  int count=0;
  FileReader input=null;
  try {
    int currentSubstringIndex=0;
    char[] buffer=new char[4096];
    input=new FileReader(file);
    int numRead=input.read(buffer);
    while (numRead != -1) {
      for (      char c : buffer) {
        if (c == substring.charAt(currentSubstringIndex)) {
          currentSubstringIndex++;
          if (currentSubstringIndex == substring.length()) {
            count++;
            currentSubstringIndex=0;
          }
        }
 else {
          currentSubstringIndex=0;
        }
      }
      numRead=input.read(buffer);
    }
  }
  finally {
    closeQuietly(input);
  }
  return count;
}
Program: 165325
Project: 165325
Buggy source:
@Override public View getView(int position,View view,ViewGroup parent){
  final DB.Repo repository=repositories.get(position);
  CompoundButton switchView;
  if (view == null) {
    view=activity.getLayoutInflater().inflate(R.layout.repo_item,null);
    switchView=addSwitchToView(view);
  }
 else {
    switchView=(CompoundButton)view.findViewById(SWITCH_ID);
  }
  switchView.setChecked(repository.inuse);
  switchView.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    CompoundButton buttonView,    boolean isChecked){
      activity.setRepoEnabled(repository,isChecked);
    }
  }
);
  TextView nameView=(TextView)view.findViewById(R.id.repo_name);
  nameView.setText(repository.getName());
  RelativeLayout.LayoutParams nameViewLayout=(RelativeLayout.LayoutParams)nameView.getLayoutParams();
  nameViewLayout.addRule(RelativeLayout.LEFT_OF,switchView.getId());
  View signedView=view.findViewById(R.id.repo_unsigned);
  if (repository.isSigned()) {
    signedView.setVisibility(View.INVISIBLE);
  }
 else {
    signedView.setVisibility(View.VISIBLE);
  }
  return view;
}

Fixed version (ground truth):
@Override public View getView(int position,View view,ViewGroup parent){
  final DB.Repo repository=repositories.get(position);
  CompoundButton switchView;
  if (view == null) {
    view=activity.getLayoutInflater().inflate(R.layout.repo_item,null);
    switchView=addSwitchToView(view);
  }
 else {
    switchView=(CompoundButton)view.findViewById(SWITCH_ID);
    switchView.setOnCheckedChangeListener(null);
  }
  switchView.setChecked(repository.inuse);
  switchView.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    CompoundButton buttonView,    boolean isChecked){
      activity.setRepoEnabled(repository,isChecked);
    }
  }
);
  TextView nameView=(TextView)view.findViewById(R.id.repo_name);
  nameView.setText(repository.getName());
  RelativeLayout.LayoutParams nameViewLayout=(RelativeLayout.LayoutParams)nameView.getLayoutParams();
  nameViewLayout.addRule(RelativeLayout.LEFT_OF,switchView.getId());
  View signedView=view.findViewById(R.id.repo_unsigned);
  if (repository.isSigned()) {
    signedView.setVisibility(View.INVISIBLE);
  }
 else {
    signedView.setVisibility(View.VISIBLE);
  }
  return view;
}
Program: 165326
Project: 165326
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case LAUNCH:
    launchApk(app.id);
  return true;
case SHARE:
shareApp(app);
return true;
case INSTALL:
curapk=app.getCurrentVersion();
if (curapk != null) install();
return true;
case UNINSTALL:
removeApk(app.id);
return true;
case IGNOREALL:
app.ignoreAllUpdates^=true;
item.setChecked(app.ignoreAllUpdates);
ignoreAllToggled^=true;
return true;
case IGNORETHIS:
app.ignoreThisUpdate^=true;
item.setChecked(app.ignoreThisUpdate);
ignoreThisToggled^=true;
return true;
case WEBSITE:
tryOpenUri(app.detail_webURL);
return true;
case ISSUES:
tryOpenUri(app.detail_trackerURL);
return true;
case SOURCE:
tryOpenUri(app.detail_sourceURL);
return true;
case BITCOIN:
tryOpenUri("String_Node_Str" + app.detail_bitcoinAddr);
return true;
case LITECOIN:
tryOpenUri("String_Node_Str" + app.detail_litecoinAddr);
return true;
case FLATTR:
tryOpenUri("String_Node_Str" + app.detail_flattrID);
return true;
case DONATE_URL:
tryOpenUri(app.detail_donateURL);
return true;
}
return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case android.R.id.home:
    NavUtils.navigateUpFromSameTask(this);
  return true;
case LAUNCH:
launchApk(app.id);
return true;
case SHARE:
shareApp(app);
return true;
case INSTALL:
curapk=app.getCurrentVersion();
if (curapk != null) install();
return true;
case UNINSTALL:
removeApk(app.id);
return true;
case IGNOREALL:
app.ignoreAllUpdates^=true;
item.setChecked(app.ignoreAllUpdates);
ignoreAllToggled^=true;
return true;
case IGNORETHIS:
app.ignoreThisUpdate^=true;
item.setChecked(app.ignoreThisUpdate);
ignoreThisToggled^=true;
return true;
case WEBSITE:
tryOpenUri(app.detail_webURL);
return true;
case ISSUES:
tryOpenUri(app.detail_trackerURL);
return true;
case SOURCE:
tryOpenUri(app.detail_sourceURL);
return true;
case BITCOIN:
tryOpenUri("String_Node_Str" + app.detail_bitcoinAddr);
return true;
case LITECOIN:
tryOpenUri("String_Node_Str" + app.detail_litecoinAddr);
return true;
case FLATTR:
tryOpenUri("String_Node_Str" + app.detail_flattrID);
return true;
case DONATE_URL:
tryOpenUri(app.detail_donateURL);
return true;
}
return super.onOptionsItemSelected(item);
}
Program: 165327
Project: 165327
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.repolist);
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(getBaseContext());
  TextView tv_lastCheck=(TextView)findViewById(R.id.lastUpdateCheck);
  long lastUpdate=prefs.getLong("String_Node_Str",0);
  String s_lastUpdateCheck="String_Node_Str";
  if (lastUpdate == 0) {
    s_lastUpdateCheck=getString(R.string.never);
  }
 else {
    Date d=new Date(lastUpdate);
    s_lastUpdateCheck=DateFormat.getDateFormat(this).format(d) + "String_Node_Str" + DateFormat.getTimeFormat(this).format(d);
  }
  tv_lastCheck.setText(getString(R.string.last_update_check,s_lastUpdateCheck));
  reposToRemove=new ArrayList<String>();
  reposToDisable=new ArrayList<String>();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  ActionBarCompat abCompat=ActionBarCompat.create(this);
  abCompat.setDisplayHomeAsUpEnabled(true);
  setContentView(R.layout.repolist);
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(getBaseContext());
  TextView tv_lastCheck=(TextView)findViewById(R.id.lastUpdateCheck);
  long lastUpdate=prefs.getLong("String_Node_Str",0);
  String s_lastUpdateCheck="String_Node_Str";
  if (lastUpdate == 0) {
    s_lastUpdateCheck=getString(R.string.never);
  }
 else {
    Date d=new Date(lastUpdate);
    s_lastUpdateCheck=DateFormat.getDateFormat(this).format(d) + "String_Node_Str" + DateFormat.getTimeFormat(this).format(d);
  }
  tv_lastCheck.setText(getString(R.string.last_update_check,s_lastUpdateCheck));
  reposToRemove=new ArrayList<String>();
  reposToDisable=new ArrayList<String>();
}
Program: 165328
Project: 165328
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case SEARCH:
    onSearchRequested();
  return true;
}
return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case android.R.id.home:
    NavUtils.navigateUpFromSameTask(this);
  return true;
case SEARCH:
onSearchRequested();
return true;
}
return super.onOptionsItemSelected(item);
}
Program: 165329
Project: 165329
Buggy source:
public int getNumUpdates(List<DB.App> apps){
  int count=0;
  for (  DB.App app : apps) {
    if (!app.toUpdate)     count++;
  }
  return count;
}

Fixed version (ground truth):
public int getNumUpdates(List<DB.App> apps){
  int count=0;
  for (  DB.App app : apps) {
    if (app.toUpdate)     count++;
  }
  return count;
}
Program: 165331
Project: 165331
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (Utils.hasApi(11)) {
    getActionBar().setDisplayShowTitleEnabled(false);
    getActionBar().setDisplayHomeAsUpEnabled(true);
  }
  setContentView(R.layout.appdetails);
  Intent i=getIntent();
  appid="String_Node_Str";
  Uri data=getIntent().getData();
  if (data != null) {
    if (data.isHierarchical())     appid=data.getQueryParameter("String_Node_Str");
 else     appid=data.getEncodedSchemeSpecificPart();
    Log.d("String_Node_Str","String_Node_Str" + appid + "String_Node_Str");
  }
 else   if (!i.hasExtra("String_Node_Str")) {
    Log.d("String_Node_Str","String_Node_Str");
  }
 else {
    appid=i.getStringExtra("String_Node_Str");
  }
  headerView=new LinearLayout(this);
  ListView lv=(ListView)findViewById(android.R.id.list);
  lv.addHeaderView(headerView);
  ApkListAdapter la=new ApkListAdapter(this,null);
  setListAdapter(la);
  mPm=getPackageManager();
  AppDetails old=(AppDetails)getLastNonConfigurationInstance();
  if (old != null) {
    copyState(old);
  }
 else {
    if (!reset()) {
      finish();
      return;
    }
    resetRequired=false;
  }
  startViews();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  ActionBarCompat abCompat=ActionBarCompat.create(this);
  abCompat.setDisplayHomeAsUpEnabled(true);
  abCompat.setDisplayShowTitleEnabled(false);
  setContentView(R.layout.appdetails);
  Intent i=getIntent();
  appid="String_Node_Str";
  Uri data=getIntent().getData();
  if (data != null) {
    if (data.isHierarchical())     appid=data.getQueryParameter("String_Node_Str");
 else     appid=data.getEncodedSchemeSpecificPart();
    Log.d("String_Node_Str","String_Node_Str" + appid + "String_Node_Str");
  }
 else   if (!i.hasExtra("String_Node_Str")) {
    Log.d("String_Node_Str","String_Node_Str");
  }
 else {
    appid=i.getStringExtra("String_Node_Str");
  }
  headerView=new LinearLayout(this);
  ListView lv=(ListView)findViewById(android.R.id.list);
  lv.addHeaderView(headerView);
  ApkListAdapter la=new ApkListAdapter(this,null);
  setListAdapter(la);
  mPm=getPackageManager();
  AppDetails old=(AppDetails)getLastNonConfigurationInstance();
  if (old != null) {
    copyState(old);
  }
 else {
    if (!reset()) {
      finish();
      return;
    }
    resetRequired=false;
  }
  startViews();
}
Program: 165332
Project: 165332
Buggy source:
public static File getDataPath(Context ctx){
  File f;
  if (Utils.hasApi(8)) {
    f=ctx.getExternalCacheDir();
  }
 else {
    f=new File(Environment.getExternalStorageDirectory(),"String_Node_Str");
    if (f != null) {
      if (!f.exists())       f.mkdirs();
    }
  }
  return f;
}

Fixed version (ground truth):
/** 
 * Get the local storage (cache) path. This will also create it if it doesn't exist. It can return null if it's currently unavailable.
 */
public static File getDataPath(Context ctx){
  return ContextCompat.create(ctx).getExternalCacheDir();
}
Program: 165333
Project: 165333
Buggy source:
public boolean isCompatible(Apk apk){
  if (apk.minSdkVersion > Utils.getApi())   return false;
  if (apk.features != null) {
    for (    String feat : apk.features) {
      if (ignoreTouchscreen && feat.equals("String_Node_Str")) {
      }
 else       if (!features.contains(feat)) {
        Log.d("String_Node_Str",apk.id + "String_Node_Str" + feat);
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean isCompatible(Apk apk){
  if (!hasApi(apk.minSdkVersion))   return false;
  if (apk.features != null) {
    for (    String feat : apk.features) {
      if (ignoreTouchscreen && feat.equals("String_Node_Str")) {
      }
 else       if (!features.contains(feat)) {
        Log.d("String_Node_Str",apk.id + "String_Node_Str" + feat);
        return false;
      }
    }
  }
  return true;
}
Program: 165334
Project: 165334
Buggy source:
public static CompatibilityChecker getChecker(Context ctx){
  CompatibilityChecker checker;
  if (Utils.hasApi(5))   checker=new EclairChecker(ctx);
 else   checker=new BasicChecker();
  Log.d("String_Node_Str","String_Node_Str" + Utils.getApi() + "String_Node_Str"+ checker.getClass().getName());
  return checker;
}

Fixed version (ground truth):
public static CompatibilityChecker getChecker(Context ctx){
  CompatibilityChecker checker;
  if (hasApi(5))   checker=new EclairChecker(ctx);
 else   checker=new BasicChecker();
  Log.d("String_Node_Str","String_Node_Str" + getApi() + "String_Node_Str"+ checker.getClass().getName());
  return checker;
}
Program: 165335
Project: 165335
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (Utils.hasApi(11))   getActionBar().setDisplayHomeAsUpEnabled(true);
  addPreferencesFromResource(R.xml.preferences);
  for (  String prefkey : new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"}) {
    Preference pref=findPreference(prefkey);
    pref.setOnPreferenceClickListener(this);
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  ActionBarCompat.create(this).setDisplayHomeAsUpEnabled(true);
  addPreferencesFromResource(R.xml.preferences);
  for (  String prefkey : new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"}) {
    Preference pref=findPreference(prefkey);
    pref.setOnPreferenceClickListener(this);
  }
}