Program: 86264
Project: 86264
Buggy source:
@Override public ReservationResult reservation(DetailledItem item,Account acc,int useraction,String selection) throws IOException {
  String reservation_info=item.getReservation_info();
  String branch_inputfield="String_Node_Str";
  Document doc=null;
  if (useraction == MultiStepResult.ACTION_CONFIRMATION) {
    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(opac_url + "String_Node_Str",new UrlEncodedFormEntity(nameValuePairs),getDefaultEncoding());
    return new ReservationResult(MultiStepResult.Status.OK);
  }
 else   if (selection == null || useraction == 0) {
    String html=httpGet(opac_url + "String_Node_Str" + reservation_info,getDefaultEncoding());
    doc=Jsoup.parse(html);
    if (doc.select("String_Node_Str").size() > 0) {
      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()));
      if (data.has("String_Node_Str")) {
        try {
          nameValuePairs.add(new BasicNameValuePair("String_Node_Str",data.getString("String_Node_Str")));
        }
 catch (        JSONException e) {
          e.printStackTrace();
        }
      }
      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"));
      html=httpPost(opac_url + "String_Node_Str",new UrlEncodedFormEntity(nameValuePairs),getDefaultEncoding());
      doc=Jsoup.parse(html);
    }
    if (doc.select("String_Node_Str" + branch_inputfield + "String_Node_Str").size() == 0) {
      if (doc.select("String_Node_Str").size() > 0) {
        branch_inputfield="String_Node_Str";
      }
    }
    if (doc.select("String_Node_Str" + branch_inputfield + "String_Node_Str").size() > 0) {
      List<Map<String,String>> branches=new ArrayList<Map<String,String>>();
      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;
        }
        Map<String,String> selopt=new HashMap<String,String>();
        selopt.put("String_Node_Str",key);
        selopt.put("String_Node_Str",value);
        branches.add(selopt);
      }
      ReservationResult result=new ReservationResult(MultiStepResult.Status.SELECTION_NEEDED);
      result.setActionIdentifier(ReservationResult.ACTION_BRANCH);
      result.setSelection(branches);
      return result;
    }
  }
 else   if (useraction == ReservationResult.ACTION_BRANCH) {
    List<NameValuePair> nameValuePairs=new ArrayList<NameValuePair>(2);
    nameValuePairs.add(new BasicNameValuePair(branch_inputfield,selection));
    nameValuePairs.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
    nameValuePairs.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
    String html=httpPost(opac_url + "String_Node_Str",new UrlEncodedFormEntity(nameValuePairs),getDefaultEncoding());
    doc=Jsoup.parse(html);
  }
  if (doc == null)   return new ReservationResult(MultiStepResult.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[]>();
      if (doc.getElementsByClass("String_Node_Str").size() == 1) {
        details.add(new String[]{doc.getElementsByClass("String_Node_Str").get(0).text().trim()});
      }
      Pattern p=Pattern.compile("String_Node_Str",Pattern.MULTILINE);
      for (      Element div : doc.select("String_Node_Str")) {
        for (        String text : Jsoup.parse(div.html().replaceAll("String_Node_Str","String_Node_Str")).text().split("String_Node_Str")) {
          if (p.matcher(text).find() && !text.contains("String_Node_Str") && text.contains("String_Node_Str")) {
            details.add(new String[]{text.trim()});
          }
        }
      }
      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(MultiStepResult.Status.CONFIRMATION_NEEDED);
      result.setDetails(details);
      return result;
    }
  }
  if (doc.getElementsByClass("String_Node_Str").size() == 1) {
    return new ReservationResult(MultiStepResult.Status.ERROR,doc.getElementsByClass("String_Node_Str").get(0).text());
  }
  return new ReservationResult(MultiStepResult.Status.ERROR,stringProvider.getString(StringProvider.UNKNOWN_ERROR));
}

Fixed version (ground truth):
@Override public ReservationResult reservation(DetailledItem item,Account acc,int useraction,String selection) throws IOException {
  String reservation_info=item.getReservation_info();
  Document doc=null;
  if (useraction == MultiStepResult.ACTION_CONFIRMATION) {
    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(opac_url + "String_Node_Str",new UrlEncodedFormEntity(nameValuePairs),getDefaultEncoding());
    return new ReservationResult(MultiStepResult.Status.OK);
  }
 else   if (selection == null || useraction == 0) {
    String html=httpGet(opac_url + "String_Node_Str" + reservation_info,getDefaultEncoding());
    doc=Jsoup.parse(html);
    if (doc.select("String_Node_Str").size() > 0) {
      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()));
      if (data.has("String_Node_Str")) {
        try {
          nameValuePairs.add(new BasicNameValuePair("String_Node_Str",data.getString("String_Node_Str")));
        }
 catch (        JSONException e) {
          e.printStackTrace();
        }
      }
      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"));
      html=httpPost(opac_url + "String_Node_Str",new UrlEncodedFormEntity(nameValuePairs),getDefaultEncoding());
      doc=Jsoup.parse(html);
    }
    if (doc.select("String_Node_Str" + branch_inputfield + "String_Node_Str").size() == 0) {
      if (doc.select("String_Node_Str").size() > 0) {
        branch_inputfield="String_Node_Str";
      }
    }
    if (doc.select("String_Node_Str" + branch_inputfield + "String_Node_Str").size() > 0) {
      List<Map<String,String>> branches=new ArrayList<Map<String,String>>();
      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;
        }
        Map<String,String> selopt=new HashMap<String,String>();
        selopt.put("String_Node_Str",key);
        selopt.put("String_Node_Str",value);
        branches.add(selopt);
      }
      _res_target=doc.select("String_Node_Str").attr("String_Node_Str");
      ReservationResult result=new ReservationResult(MultiStepResult.Status.SELECTION_NEEDED);
      result.setActionIdentifier(ReservationResult.ACTION_BRANCH);
      result.setSelection(branches);
      return result;
    }
  }
 else   if (useraction == ReservationResult.ACTION_BRANCH) {
    List<NameValuePair> nameValuePairs=new ArrayList<NameValuePair>(2);
    nameValuePairs.add(new BasicNameValuePair(branch_inputfield,selection));
    nameValuePairs.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
    nameValuePairs.add(new BasicNameValuePair("String_Node_Str",_res_target));
    String html=httpPost(opac_url + "String_Node_Str",new UrlEncodedFormEntity(nameValuePairs),getDefaultEncoding());
    doc=Jsoup.parse(html);
  }
  if (doc == null)   return new ReservationResult(MultiStepResult.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[]>();
      if (doc.getElementsByClass("String_Node_Str").size() == 1) {
        details.add(new String[]{doc.getElementsByClass("String_Node_Str").get(0).text().trim()});
      }
      Pattern p=Pattern.compile("String_Node_Str",Pattern.MULTILINE);
      for (      Element div : doc.select("String_Node_Str")) {
        for (        String text : Jsoup.parse(div.html().replaceAll("String_Node_Str","String_Node_Str")).text().split("String_Node_Str")) {
          if (p.matcher(text).find() && !text.contains("String_Node_Str") && text.contains("String_Node_Str")) {
            details.add(new String[]{text.trim()});
          }
        }
      }
      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(MultiStepResult.Status.CONFIRMATION_NEEDED);
      result.setDetails(details);
      return result;
    }
  }
  if (doc.getElementsByClass("String_Node_Str").size() == 1) {
    return new ReservationResult(MultiStepResult.Status.ERROR,doc.getElementsByClass("String_Node_Str").get(0).text());
  }
  return new ReservationResult(MultiStepResult.Status.ERROR,stringProvider.getString(StringProvider.UNKNOWN_ERROR));
}