Program: 86332
Project: 86332
Buggy source:
@Override public ReservationResult reservation(String reservation_info,Account acc,int useraction,String selection) throws IOException {
  final String branch_inputfield="String_Node_Str";
  HttpPost httppost;
  HttpGet httpget;
  HttpResponse response;
  Document doc=null;
  if (useraction == ReservationResult.ACTION_CONFIRMATION) {
    httppost=new HttpPost(opac_url + "String_Node_Str");
    List<NameValuePair> nameValuePairs=new ArrayList<NameValuePair>(2);
    nameValuePairs.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
    nameValuePairs.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
    httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
    response=ahc.execute(httppost);
    return new ReservationResult(Status.OK);
  }
 else   if (selection == null || useraction == 0) {
    httpget=new HttpGet(opac_url + "String_Node_Str" + reservation_info);
    response=ahc.execute(httpget);
    String html=convertStreamToString(response.getEntity().getContent());
    response.getEntity().consumeContent();
    doc=Jsoup.parse(html);
    if (doc.select("String_Node_Str").size() > 0) {
      httppost=new HttpPost(opac_url + "String_Node_Str");
      List<NameValuePair> nameValuePairs=new ArrayList<NameValuePair>(2);
      nameValuePairs.add(new BasicNameValuePair("String_Node_Str",acc.getName()));
      nameValuePairs.add(new BasicNameValuePair("String_Node_Str",acc.getPassword()));
      nameValuePairs.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
      nameValuePairs.add(new BasicNameValuePair("String_Node_Str",doc.select("String_Node_Str").val()));
      nameValuePairs.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
      httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
      response=ahc.execute(httppost);
      html=convertStreamToString(response.getEntity().getContent());
      doc=Jsoup.parse(html);
    }
    if (doc.select("String_Node_Str" + branch_inputfield + "String_Node_Str").size() > 0) {
      ContentValues branches=new ContentValues();
      for (      Element option : doc.select("String_Node_Str" + branch_inputfield + "String_Node_Str").first().children()) {
        String value=option.text().trim();
        String key;
        if (option.hasAttr("String_Node_Str")) {
          key=option.attr("String_Node_Str");
        }
 else {
          key=value;
        }
        branches.put(key,value);
      }
      ReservationResult result=new ReservationResult(Status.SELECTION_NEEDED);
      result.setActionIdentifier(ReservationResult.ACTION_BRANCH);
      result.setSelection(branches);
      return result;
    }
  }
 else   if (useraction == ReservationResult.ACTION_BRANCH) {
    httppost=new HttpPost(opac_url + "String_Node_Str");
    List<NameValuePair> nameValuePairs=new ArrayList<NameValuePair>(2);
    nameValuePairs.add(new BasicNameValuePair("String_Node_Str",selection));
    nameValuePairs.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
    nameValuePairs.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
    httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
    response=ahc.execute(httppost);
    String html=convertStreamToString(response.getEntity().getContent());
    doc=Jsoup.parse(html);
  }
  if (doc == null)   return new ReservationResult(Status.ERROR);
  if (doc.select("String_Node_Str").size() > 0) {
    if (doc.select("String_Node_Str").attr("String_Node_Str").equals("String_Node_Str")) {
      List<String[]> details=new ArrayList<String[]>();
      for (      Element row : doc.select("String_Node_Str")) {
        if (row.select("String_Node_Str").size() == 1 && row.select("String_Node_Str").size() == 1) {
          details.add(new String[]{row.select("String_Node_Str").text().trim(),row.select("String_Node_Str").text().trim()});
        }
      }
      ReservationResult result=new ReservationResult(Status.CONFIRMATION_NEEDED);
      result.setDetails(details);
      return result;
    }
  }
  return new ReservationResult(Status.ERROR);
}

Fixed version (ground truth):
@Override public ReservationResult reservation(String reservation_info,Account acc,int useraction,String selection) throws IOException {
  final String branch_inputfield="String_Node_Str";
  HttpPost httppost;
  HttpGet httpget;
  HttpResponse response;
  Document doc=null;
  if (useraction == ReservationResult.ACTION_CONFIRMATION) {
    httppost=new HttpPost(opac_url + "String_Node_Str");
    List<NameValuePair> nameValuePairs=new ArrayList<NameValuePair>(2);
    nameValuePairs.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
    nameValuePairs.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
    httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
    response=ahc.execute(httppost);
    return new ReservationResult(Status.OK);
  }
 else   if (selection == null || useraction == 0) {
    httpget=new HttpGet(opac_url + "String_Node_Str" + reservation_info);
    response=ahc.execute(httpget);
    String html=convertStreamToString(response.getEntity().getContent());
    response.getEntity().consumeContent();
    doc=Jsoup.parse(html);
    if (doc.select("String_Node_Str").size() > 0) {
      httppost=new HttpPost(opac_url + "String_Node_Str");
      List<NameValuePair> nameValuePairs=new ArrayList<NameValuePair>(2);
      nameValuePairs.add(new BasicNameValuePair("String_Node_Str",acc.getName()));
      nameValuePairs.add(new BasicNameValuePair("String_Node_Str",acc.getPassword()));
      nameValuePairs.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
      nameValuePairs.add(new BasicNameValuePair("String_Node_Str",doc.select("String_Node_Str").val()));
      nameValuePairs.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
      httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
      response=ahc.execute(httppost);
      html=convertStreamToString(response.getEntity().getContent());
      doc=Jsoup.parse(html);
    }
    if (doc.select("String_Node_Str" + branch_inputfield + "String_Node_Str").size() > 0) {
      ContentValues branches=new ContentValues();
      for (      Element option : doc.select("String_Node_Str" + branch_inputfield + "String_Node_Str").first().children()) {
        String value=option.text().trim();
        String key;
        if (option.hasAttr("String_Node_Str")) {
          key=option.attr("String_Node_Str");
        }
 else {
          key=value;
        }
        branches.put(key,value);
      }
      ReservationResult result=new ReservationResult(Status.SELECTION_NEEDED);
      result.setActionIdentifier(ReservationResult.ACTION_BRANCH);
      result.setSelection(branches);
      return result;
    }
  }
 else   if (useraction == ReservationResult.ACTION_BRANCH) {
    httppost=new HttpPost(opac_url + "String_Node_Str");
    List<NameValuePair> nameValuePairs=new ArrayList<NameValuePair>(2);
    nameValuePairs.add(new BasicNameValuePair("String_Node_Str",selection));
    nameValuePairs.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
    nameValuePairs.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
    httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
    response=ahc.execute(httppost);
    String html=convertStreamToString(response.getEntity().getContent());
    doc=Jsoup.parse(html);
  }
  if (doc == null)   return new ReservationResult(Status.ERROR);
  if (doc.select("String_Node_Str").size() > 0) {
    if (doc.select("String_Node_Str").attr("String_Node_Str").equals("String_Node_Str")) {
      List<String[]> details=new ArrayList<String[]>();
      for (      Element row : doc.select("String_Node_Str")) {
        if (row.select("String_Node_Str").size() == 1 && row.select("String_Node_Str").size() == 1) {
          details.add(new String[]{row.select("String_Node_Str").text().trim(),row.select("String_Node_Str").text().trim()});
        }
      }
      ReservationResult result=new ReservationResult(Status.CONFIRMATION_NEEDED);
      result.setDetails(details);
      return result;
    }
  }
  if (doc.getElementsByClass("String_Node_Str").size() == 1) {
    last_error=doc.getElementsByClass("String_Node_Str").get(0).text();
    return new ReservationResult(Status.ERROR);
  }
  return new ReservationResult(Status.ERROR);
}