Program: 86288
Project: 86288
Buggy source:
public void search(String query){
  LibraryListFragment fragment=new LocatedLibraryListFragment();
  Bundle args=new Bundle();
  args.putInt("String_Node_Str",LEVEL_LIBRARY);
  fragment.setArguments(args);
  Set<LibrarySearchResult> data=new HashSet<LibrarySearchResult>();
  query=query.toLowerCase(Locale.GERMAN);
  for (  Library lib : libraries) {
    int rank=0;
    if (lib.getCity().toLowerCase(Locale.GERMAN).contains(query))     rank+=3;
    if (lib.getTitle().toLowerCase(Locale.GERMAN).contains(query))     rank+=3;
    if (lib.getState().toLowerCase(Locale.GERMAN).contains(query))     rank+=2;
    if (lib.getCountry().toLowerCase(Locale.GERMAN).contains(query))     rank+=1;
    if (rank > 0) {
      data.add(new LibrarySearchResult(lib,rank));
    }
  }
  List<LibrarySearchResult> list=new ArrayList<LibrarySearchResult>(data);
  Collections.sort(list);
  List<Library> libraries=new ArrayList<Library>();
  for (  LibrarySearchResult sr : list) {
    libraries.add(sr.getLibrary());
  }
  LibraryAdapter adapter=new LibraryAdapter(this,R.layout.listitem_library,R.id.tvTitle,libraries);
  fragment.setListAdapter(adapter);
  if (findViewById(R.id.llFragments) != null) {
    fragment4=fragment;
    getSupportFragmentManager().beginTransaction().replace(R.id.container4,fragment4).commit();
  }
 else {
    this.fragment=fragment;
    getSupportFragmentManager().beginTransaction().replace(R.id.container,fragment).addToBackStack(null).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN).commit();
  }
  TextView tvLocateString=(TextView)findViewById(R.id.tvLocateString);
  ImageView ivLocationIcon=(ImageView)findViewById(R.id.ivLocationIcon);
  tvLocateString.setText(R.string.alphabetic_list);
  ivLocationIcon.setImageResource(R.drawable.ic_list);
}

Fixed version (ground truth):
public void search(String query){
  fragment=new LocatedLibraryListFragment();
  Bundle args=new Bundle();
  args.putInt("String_Node_Str",LEVEL_LIBRARY);
  fragment.setArguments(args);
  Set<LibrarySearchResult> data=new HashSet<LibrarySearchResult>();
  query=query.toLowerCase(Locale.GERMAN);
  for (  Library lib : libraries) {
    int rank=0;
    if (lib.getCity().toLowerCase(Locale.GERMAN).contains(query))     rank+=3;
    if (lib.getTitle().toLowerCase(Locale.GERMAN).contains(query))     rank+=3;
    if (lib.getState().toLowerCase(Locale.GERMAN).contains(query))     rank+=2;
    if (lib.getCountry().toLowerCase(Locale.GERMAN).contains(query))     rank+=1;
    if (rank > 0) {
      data.add(new LibrarySearchResult(lib,rank));
    }
  }
  List<LibrarySearchResult> list=new ArrayList<LibrarySearchResult>(data);
  Collections.sort(list);
  List<Library> libraries=new ArrayList<Library>();
  for (  LibrarySearchResult sr : list) {
    libraries.add(sr.getLibrary());
  }
  LibraryAdapter adapter=new LibraryAdapter(this,R.layout.listitem_library,R.id.tvTitle,libraries);
  fragment.setListAdapter(adapter);
  getSupportFragmentManager().beginTransaction().addToBackStack(null).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE).replace(R.id.container,fragment).commit();
  if (fragment2 != null)   getSupportFragmentManager().beginTransaction().detach(fragment2).commit();
  if (fragment3 != null)   getSupportFragmentManager().beginTransaction().detach(fragment3).commit();
  if (fragment4 != null)   getSupportFragmentManager().beginTransaction().detach(fragment4).commit();
  TextView tvLocateString=(TextView)findViewById(R.id.tvLocateString);
  ImageView ivLocationIcon=(ImageView)findViewById(R.id.ivLocationIcon);
  tvLocateString.setText(R.string.alphabetic_list);
  ivLocationIcon.setImageResource(R.drawable.ic_list);
}