Program: 62941
Project: 62941
Buggy source:
/** 
 * Verifies current page with a reference page, i.e., finding the reference string in current page (so the reference does not have to be full page)<br /> This will reload the page from the given url up to two more times (that is, three times checking), depending on the variable  {@link #PAGE_VERIFY_RETRY}<br /> <br /> This method has minimal placeholder capability, matching {*} in the reference with anything in current page, trying to maximize the match. This method also replaces {version} into the value stored at Common.VERSION<br /> <br /> Example usage is to test sorting elements, say we want to test the order of two known elements, which should be independent in the presence of other elements. We can also ignore the rowID which maybe different under different number of elements.<br /> <br /> This method will try to display the difference between the expected and actual if the match fails.<br />
 * @param filepath
 * @param url
 * @throws Exception
 */
public void verifyCurrentPageHTMLWithRetry(String filepath,String url) throws Exception {
  String pageSrc=null;
  String inputStr=null;
  for (int i=0; i < PAGE_VERIFY_RETRY; i++) {
    pageSrc=getCurrentPageSource();
    inputStr=Common.readFile(filepath).replace("String_Node_Str",TestProperties.inst().TEAMMATES_VERSION);
    HtmlHelper.assertSameHtml(inputStr,pageSrc);
    if (HtmlHelper.assertSameHtml(inputStr,pageSrc)) {
      return;
    }
    if (i == PAGE_VERIFY_RETRY - 1)     break;
    System.out.println("String_Node_Str" + url);
    waitAWhile(1000);
    goToUrl(url);
  }
}

Fixed version (ground truth):
/** 
 * Verifies current page with a reference page, i.e., finding the reference string in current page (so the reference does not have to be full page)<br /> This will reload the page from the given url up to two more times (that is, three times checking), depending on the variable  {@link #PAGE_VERIFY_RETRY}<br /> <br /> This method has minimal placeholder capability, matching {*} in the reference with anything in current page, trying to maximize the match. This method also replaces {version} into the value stored at Common.VERSION<br /> <br /> Example usage is to test sorting elements, say we want to test the order of two known elements, which should be independent in the presence of other elements. We can also ignore the rowID which maybe different under different number of elements.<br /> <br /> This method will try to display the difference between the expected and actual if the match fails.<br />
 * @param filepath
 * @param url
 * @throws Exception
 */
public void verifyCurrentPageHTMLWithRetry(String filepath,String url) throws Exception {
  String actual=null;
  String expected=null;
  for (int i=0; i < PAGE_VERIFY_RETRY; i++) {
    actual=getCurrentPageSource();
    expected=Common.readFile(filepath).replace("String_Node_Str",TestProperties.inst().TEAMMATES_VERSION);
    HtmlHelper.assertSameHtml(actual,expected);
    if (HtmlHelper.assertSameHtml(actual,expected)) {
      return;
    }
    if (i == PAGE_VERIFY_RETRY - 1)     break;
    System.out.println("String_Node_Str" + url);
    waitAWhile(1000);
    goToUrl(url);
  }
}