Program: 86323
Project: 86323
Buggy source:
protected void reservationStart(){
  if (invalidated) {
    new RestoreSessionTask().execute(false);
  }
  if (app.getApi() instanceof EbookServiceApi) {
    SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(this);
    if (sp.getString("String_Node_Str","String_Node_Str").equals("String_Node_Str") && ((EbookServiceApi)app.getApi()).isEbook(item)) {
      AlertDialog.Builder builder=new AlertDialog.Builder(this);
      builder.setMessage(getString(R.string.opac_error_email)).setCancelable(false).setNegativeButton(R.string.dismiss,new DialogInterface.OnClickListener(){
        @Override public void onClick(        DialogInterface dialog,        int id){
          dialog.cancel();
        }
      }
).setPositiveButton(R.string.prefs,new DialogInterface.OnClickListener(){
        @Override public void onClick(        DialogInterface dialog,        int id){
          dialog.dismiss();
          app.toPrefs(SearchResultDetailsActivity.this);
        }
      }
);
      AlertDialog alert=builder.create();
      alert.show();
      return;
    }
  }
  AccountDataSource data=new AccountDataSource(this);
  data.open();
  final List<Account> accounts=data.getAccountsWithPassword(app.getLibrary().getIdent());
  data.close();
  if (accounts.size() == 0) {
    dialog_no_credentials();
    return;
  }
 else   if (accounts.size() > 1) {
    AlertDialog.Builder builder=new AlertDialog.Builder(this);
    LayoutInflater inflater=getLayoutInflater();
    View view=inflater.inflate(R.layout.simple_list_dialog,null);
    ListView lv=(ListView)view.findViewById(R.id.lvBibs);
    AccountListAdapter adapter=new AccountListAdapter(this,accounts);
    lv.setAdapter(adapter);
    lv.setOnItemClickListener(new OnItemClickListener(){
      @Override public void onItemClick(      AdapterView<?> parent,      View view,      int position,      long id){
        if (accounts.get(position).getId() != app.getAccount().getId() || account_switched) {
          app.setAccount(accounts.get(position).getId());
          dialog=ProgressDialog.show(SearchResultDetailsActivity.this,"String_Node_Str",getString(R.string.doing_res),true);
          dialog.show();
          new RestoreSessionTask().execute();
        }
 else {
          reservationDo();
        }
        adialog.dismiss();
      }
    }
);
    builder.setTitle(R.string.account_select).setView(view).setNegativeButton(R.string.cancel,new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int id){
        adialog.cancel();
      }
    }
).setNeutralButton(R.string.accounts_edit,new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int id){
        adialog.dismiss();
        Intent intent=new Intent(SearchResultDetailsActivity.this,AccountListActivity.class);
        startActivity(intent);
      }
    }
);
    adialog=builder.create();
    adialog.show();
  }
 else {
    reservationDo();
  }
}

Fixed version (ground truth):
protected void reservationStart(){
  if (invalidated) {
    new RestoreSessionTask().execute(false);
  }
  if (app.getApi() instanceof EbookServiceApi) {
    SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(this);
    if (sp.getString("String_Node_Str","String_Node_Str").equals("String_Node_Str") && ((EbookServiceApi)app.getApi()).isEbook(item)) {
      AlertDialog.Builder builder=new AlertDialog.Builder(this);
      builder.setMessage(getString(R.string.opac_error_email)).setCancelable(false).setNegativeButton(R.string.dismiss,new DialogInterface.OnClickListener(){
        @Override public void onClick(        DialogInterface dialog,        int id){
          dialog.cancel();
        }
      }
).setPositiveButton(R.string.prefs,new DialogInterface.OnClickListener(){
        @Override public void onClick(        DialogInterface dialog,        int id){
          dialog.dismiss();
          app.toPrefs(SearchResultDetailsActivity.this);
        }
      }
);
      AlertDialog alert=builder.create();
      alert.show();
      return;
    }
  }
  AccountDataSource data=new AccountDataSource(this);
  data.open();
  final List<Account> accounts=data.getAccountsWithPassword(app.getLibrary().getIdent());
  data.close();
  if (accounts.size() == 0) {
    dialog_no_credentials();
    return;
  }
 else   if (accounts.size() > 1) {
    AlertDialog.Builder builder=new AlertDialog.Builder(this);
    LayoutInflater inflater=getLayoutInflater();
    View view=inflater.inflate(R.layout.simple_list_dialog,null);
    ListView lv=(ListView)view.findViewById(R.id.lvBibs);
    AccountListAdapter adapter=new AccountListAdapter(this,accounts);
    lv.setAdapter(adapter);
    lv.setOnItemClickListener(new OnItemClickListener(){
      @Override public void onItemClick(      AdapterView<?> parent,      View view,      int position,      long id){
        if (accounts.get(position).getId() != app.getAccount().getId() || account_switched) {
          app.setAccount(accounts.get(position).getId());
          dialog=ProgressDialog.show(SearchResultDetailsActivity.this,"String_Node_Str",getString(R.string.doing_res),true);
          dialog.show();
          new RestoreSessionTask().execute(true);
        }
 else {
          reservationDo();
        }
        adialog.dismiss();
      }
    }
);
    builder.setTitle(R.string.account_select).setView(view).setNegativeButton(R.string.cancel,new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int id){
        adialog.cancel();
      }
    }
).setNeutralButton(R.string.accounts_edit,new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int id){
        adialog.dismiss();
        Intent intent=new Intent(SearchResultDetailsActivity.this,AccountListActivity.class);
        startActivity(intent);
      }
    }
);
    adialog=builder.create();
    adialog.show();
  }
 else {
    reservationDo();
  }
}