Program: 86172
Project: 86172
Buggy source:
@Override public SearchRequestResult searchGetPage(int page) throws IOException, OpacErrorException, JSONException {
  if (searchResultDoc == null)   throw new NotReachableException();
  Document doc=searchResultDoc;
  if (doc.select("String_Node_Str").size() == 0) {
    String href=doc.select("String_Node_Str").first().attr("String_Node_Str");
    String url=href.replaceFirst("String_Node_Str","String_Node_Str" + page);
    Document doc2=Jsoup.parse(httpGet(url,getDefaultEncoding()));
    return parse_search(doc2,page);
  }
 else {
    Elements pageLinks=doc.select("String_Node_Str").first().select("String_Node_Str");
    int from=Integer.valueOf(pageLinks.first().text());
    int to=Integer.valueOf(pageLinks.last().text());
    Element linkToClick;
    boolean willBeCorrectPage;
    if (page < from) {
      linkToClick=pageLinks.first();
      willBeCorrectPage=false;
    }
 else     if (page > to) {
      linkToClick=pageLinks.last();
      willBeCorrectPage=false;
    }
 else {
      linkToClick=pageLinks.get(page - from);
      willBeCorrectPage=true;
    }
    if (linkToClick.tagName().equals("String_Node_Str")) {
      return parse_search(searchResultDoc,page);
    }
    Pattern pattern=Pattern.compile("String_Node_Str");
    Matcher matcher=pattern.matcher(linkToClick.attr("String_Node_Str"));
    if (!matcher.find())     throw new OpacErrorException(StringProvider.INTERNAL_ERROR);
    FormElement form=(FormElement)doc.select("String_Node_Str").first();
    HttpEntity data=formData(form,null).addTextBody("String_Node_Str",matcher.group(1)).addTextBody("String_Node_Str",matcher.group(2)).build();
    String postUrl=form.attr("String_Node_Str");
    String html=httpPost(postUrl,data,"String_Node_Str");
    if (willBeCorrectPage) {
      Document doc2=Jsoup.parse(html);
      doc2.setBaseUri(postUrl);
      return parse_search(doc2,page);
    }
 else {
      searchResultDoc=Jsoup.parse(html);
      searchResultDoc.setBaseUri(postUrl);
      return searchGetPage(page);
    }
  }
}

Fixed version (ground truth):
@Override public SearchRequestResult searchGetPage(int page) throws IOException, OpacErrorException, JSONException {
  if (searchResultDoc == null)   throw new NotReachableException();
  Document doc=searchResultDoc;
  if (doc.select("String_Node_Str").size() == 0) {
    if (doc.select("String_Node_Str").size() > 0) {
      String href=doc.select("String_Node_Str").first().attr("String_Node_Str");
      String url=href.replaceFirst("String_Node_Str","String_Node_Str" + page);
      Document doc2=Jsoup.parse(httpGet(url,getDefaultEncoding()));
      return parse_search(doc2,page);
    }
 else {
      int totalCount;
      try {
        totalCount=Integer.parseInt(doc.select("String_Node_Str").first().text());
      }
 catch (      Exception e) {
        totalCount=0;
      }
      return new SearchRequestResult(new ArrayList<SearchResult>(),0,totalCount);
    }
  }
 else {
    Elements pageLinks=doc.select("String_Node_Str").first().select("String_Node_Str");
    int from=Integer.valueOf(pageLinks.first().text());
    int to=Integer.valueOf(pageLinks.last().text());
    Element linkToClick;
    boolean willBeCorrectPage;
    if (page < from) {
      linkToClick=pageLinks.first();
      willBeCorrectPage=false;
    }
 else     if (page > to) {
      linkToClick=pageLinks.last();
      willBeCorrectPage=false;
    }
 else {
      linkToClick=pageLinks.get(page - from);
      willBeCorrectPage=true;
    }
    if (linkToClick.tagName().equals("String_Node_Str")) {
      return parse_search(searchResultDoc,page);
    }
    Pattern pattern=Pattern.compile("String_Node_Str");
    Matcher matcher=pattern.matcher(linkToClick.attr("String_Node_Str"));
    if (!matcher.find())     throw new OpacErrorException(StringProvider.INTERNAL_ERROR);
    FormElement form=(FormElement)doc.select("String_Node_Str").first();
    HttpEntity data=formData(form,null).addTextBody("String_Node_Str",matcher.group(1)).addTextBody("String_Node_Str",matcher.group(2)).build();
    String postUrl=form.attr("String_Node_Str");
    String html=httpPost(postUrl,data,"String_Node_Str");
    if (willBeCorrectPage) {
      Document doc2=Jsoup.parse(html);
      doc2.setBaseUri(postUrl);
      return parse_search(doc2,page);
    }
 else {
      searchResultDoc=Jsoup.parse(html);
      searchResultDoc.setBaseUri(postUrl);
      return searchGetPage(page);
    }
  }
}