Program: 72441
Project: 72441
Buggy source:
/** 
 * Build URL for bookmark.
 * @param action
 * @param context
 * @return the bookmark url
 */
protected String buildBookmarkAction(IAction action,IReportContext context){
  if (action == null || context == null)   return null;
  String baseURL=null;
  Object renderContext=getRenderContext(context);
  if (renderContext instanceof HTMLRenderContext) {
    baseURL=((HTMLRenderContext)renderContext).getBaseURL();
  }
  if (renderContext instanceof PDFRenderContext) {
    baseURL=((PDFRenderContext)renderContext).getBaseURL();
  }
  if (baseURL == null)   baseURL=IBirtConstants.VIEWER_PREVIEW;
  ;
  boolean isExtractPattern=isContainExtractInfo(action);
  if (isExtractPattern)   baseURL=createBaseURLWithExtractPattern(baseURL);
  String bookmark=action.getBookmark();
  if (baseURL.lastIndexOf(IBirtConstants.SERVLET_PATH_FRAMESET) > 0 || baseURL.lastIndexOf(IBirtConstants.SERVLET_PATH_RUN) > 0) {
    String func="String_Node_Str" + ParameterAccessor.htmlEncode(bookmark) + "String_Node_Str";
    return "String_Node_Str" + func + "String_Node_Str"+ func+ "String_Node_Str";
  }
  StringBuffer link=new StringBuffer();
  boolean realBookmark=false;
  if (this.document != null) {
    long pageNumber=this.document.getPageNumber(action.getBookmark());
    realBookmark=(pageNumber == this.page && !isEmbeddable);
  }
  try {
    bookmark=URLEncoder.encode(bookmark,ParameterAccessor.UTF_8_ENCODE);
  }
 catch (  UnsupportedEncodingException e) {
  }
  link.append(baseURL);
  link.append(ParameterAccessor.QUERY_CHAR);
  if (isContainExtractInfo(action)) {
    try {
      link.append(action.getActionString());
      link.append(ParameterAccessor.PARAMETER_SEPARATOR);
    }
 catch (    Exception e) {
    }
  }
  if (document != null) {
    link.append(ParameterAccessor.PARAM_REPORT_DOCUMENT);
    link.append(ParameterAccessor.EQUALS_OPERATOR);
    String documentName=document.getName();
    try {
      documentName=URLEncoder.encode(documentName,ParameterAccessor.UTF_8_ENCODE);
    }
 catch (    UnsupportedEncodingException e) {
    }
    link.append(documentName);
  }
 else   if (action.getReportName() != null && action.getReportName().length() > 0) {
    link.append(ParameterAccessor.PARAM_REPORT);
    link.append(ParameterAccessor.EQUALS_OPERATOR);
    String reportName=getReportName(context,action);
    try {
      reportName=URLEncoder.encode(reportName,ParameterAccessor.UTF_8_ENCODE);
    }
 catch (    UnsupportedEncodingException e) {
    }
    link.append(reportName);
  }
 else {
    return "String_Node_Str" + action.getActionString();
  }
  if (locale != null) {
    link.append(ParameterAccessor.getQueryParameterString(ParameterAccessor.PARAM_LOCALE,locale.toString()));
  }
  if (isRtl) {
    link.append(ParameterAccessor.getQueryParameterString(ParameterAccessor.PARAM_RTL,String.valueOf(isRtl)));
  }
  if (svg != null) {
    link.append(ParameterAccessor.getQueryParameterString(ParameterAccessor.PARAM_SVG,String.valueOf(svg.booleanValue())));
  }
  if (isDesigner != null) {
    link.append(ParameterAccessor.getQueryParameterString(ParameterAccessor.PARAM_DESIGNER,String.valueOf(isDesigner)));
  }
  link.append(ParameterAccessor.getQueryParameterString(ParameterAccessor.PARAM_MASTERPAGE,String.valueOf(this.isMasterPageContent)));
  try {
    if (resourceFolder != null) {
      String res=URLEncoder.encode(resourceFolder,ParameterAccessor.UTF_8_ENCODE);
      link.append(ParameterAccessor.getQueryParameterString(ParameterAccessor.PARAM_RESOURCE_FOLDER,res));
    }
  }
 catch (  UnsupportedEncodingException e) {
  }
  if (realBookmark) {
    link.append("String_Node_Str");
    link.append(bookmark);
  }
 else {
    link.append(ParameterAccessor.getQueryParameterString(ParameterAccessor.PARAM_BOOKMARK,bookmark));
    if (!action.isBookmark())     link.append(ParameterAccessor.getQueryParameterString(ParameterAccessor.PARAM_ISTOC,"String_Node_Str"));
  }
  return link.toString();
}

Fixed version (ground truth):
/** 
 * Build URL for bookmark.
 * @param action
 * @param context
 * @return the bookmark url
 */
protected String buildBookmarkAction(IAction action,IReportContext context){
  if (action == null || context == null)   return null;
  String baseURL=null;
  Object renderContext=getRenderContext(context);
  if (renderContext instanceof HTMLRenderContext) {
    baseURL=((HTMLRenderContext)renderContext).getBaseURL();
  }
  if (renderContext instanceof PDFRenderContext) {
    baseURL=((PDFRenderContext)renderContext).getBaseURL();
  }
  if (baseURL == null)   baseURL=IBirtConstants.VIEWER_PREVIEW;
  ;
  boolean isExtractPattern=isContainExtractInfo(action);
  if (isExtractPattern)   baseURL=createBaseURLWithExtractPattern(baseURL);
  String bookmark=action.getBookmark();
  if (baseURL.lastIndexOf(IBirtConstants.SERVLET_PATH_FRAMESET) > 0 || baseURL.lastIndexOf(IBirtConstants.SERVLET_PATH_RUN) > 0) {
    String func="String_Node_Str" + ParameterAccessor.htmlEncode(bookmark) + "String_Node_Str";
    return "String_Node_Str" + func + "String_Node_Str"+ func+ "String_Node_Str";
  }
  StringBuffer link=new StringBuffer();
  boolean realBookmark=false;
  if (this.document != null) {
    long pageNumber=this.document.getPageNumber(action.getBookmark());
    realBookmark=(pageNumber == this.page && !isEmbeddable);
  }
  try {
    bookmark=URLEncoder.encode(bookmark,ParameterAccessor.UTF_8_ENCODE);
  }
 catch (  UnsupportedEncodingException e) {
  }
  link.append(baseURL);
  link.append(ParameterAccessor.QUERY_CHAR);
  if (isContainExtractInfo(action)) {
    try {
      link.append(action.getActionString());
      link.append(ParameterAccessor.PARAMETER_SEPARATOR);
    }
 catch (    Exception e) {
    }
  }
  if (document != null) {
    link.append(ParameterAccessor.PARAM_REPORT_DOCUMENT);
    link.append(ParameterAccessor.EQUALS_OPERATOR);
    String documentName=document.getName();
    try {
      documentName=URLEncoder.encode(documentName,ParameterAccessor.UTF_8_ENCODE);
    }
 catch (    UnsupportedEncodingException e) {
    }
    link.append(documentName);
  }
 else   if (action.getReportName() != null && action.getReportName().length() > 0) {
    link.append(ParameterAccessor.PARAM_REPORT);
    link.append(ParameterAccessor.EQUALS_OPERATOR);
    String reportName=getReportName(context,action);
    try {
      reportName=URLEncoder.encode(reportName,ParameterAccessor.UTF_8_ENCODE);
    }
 catch (    UnsupportedEncodingException e) {
    }
    link.append(reportName);
  }
 else {
    return "String_Node_Str" + action.getActionString();
  }
  if (locale != null) {
    link.append(ParameterAccessor.getQueryParameterString(ParameterAccessor.PARAM_LOCALE,locale.toString()));
  }
  if (isRtl) {
    link.append(ParameterAccessor.getQueryParameterString(ParameterAccessor.PARAM_RTL,String.valueOf(isRtl)));
  }
  if (svg != null) {
    link.append(ParameterAccessor.getQueryParameterString(ParameterAccessor.PARAM_SVG,String.valueOf(svg.booleanValue())));
  }
  if (isDesigner != null) {
    link.append(ParameterAccessor.getQueryParameterString(ParameterAccessor.PARAM_DESIGNER,String.valueOf(isDesigner)));
  }
  if (pageOverflow != null) {
    link.append(ParameterAccessor.getQueryParameterString(ParameterAccessor.PARAM_PAGE_OVERFLOW,pageOverflow));
  }
  link.append(ParameterAccessor.getQueryParameterString(ParameterAccessor.PARAM_MASTERPAGE,String.valueOf(this.isMasterPageContent)));
  try {
    if (resourceFolder != null) {
      String res=URLEncoder.encode(resourceFolder,ParameterAccessor.UTF_8_ENCODE);
      link.append(ParameterAccessor.getQueryParameterString(ParameterAccessor.PARAM_RESOURCE_FOLDER,res));
    }
  }
 catch (  UnsupportedEncodingException e) {
  }
  if (realBookmark) {
    link.append("String_Node_Str");
    link.append(bookmark);
  }
 else {
    link.append(ParameterAccessor.getQueryParameterString(ParameterAccessor.PARAM_BOOKMARK,bookmark));
    if (!action.isBookmark())     link.append(ParameterAccessor.getQueryParameterString(ParameterAccessor.PARAM_ISTOC,"String_Node_Str"));
  }
  return link.toString();
}