Program: 74359
Project: 74359
Buggy source:
/** 
 * Create the final URI string to preview report
 * @param iPattern
 * @return
 */
public String createURI(String iPattern){
  String uri=iPattern;
  if (uri == null)   uri=this.pattern;
  if (uri == null) {
    uri=IBirtConstants.VIEWER_FRAMESET;
    if (reportDocument != null && reportletId != null) {
      uri=IBirtConstants.VIEWER_RUN;
    }
  }
  boolean usingFrameset=IBirtConstants.VIEWER_FRAMESET.equalsIgnoreCase(uri);
  boolean usingParameter=IBirtConstants.VIEWER_PARAMETER.equalsIgnoreCase(uri);
  if (baseURL != null)   uri=baseURL + "String_Node_Str" + uri;
  if (format != null) {
    uri+="String_Node_Str" + ParameterAccessor.PARAM_FORMAT + "String_Node_Str"+ urlParamValueEncode(format);
  }
 else {
    uri+="String_Node_Str" + ParameterAccessor.PARAM_FORMAT + "String_Node_Str"+ ParameterAccessor.PARAM_FORMAT_HTML;
  }
  if (reportDesign != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_REPORT + "String_Node_Str"+ urlParamValueEncode(reportDesign);
  if (reportDocument != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_REPORT_DOCUMENT + "String_Node_Str"+ urlParamValueEncode(reportDocument);
  if (reportletId != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_INSTANCEID + "String_Node_Str"+ urlParamValueEncode(reportletId);
  if (usingFrameset && id != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_ID + "String_Node_Str"+ urlParamValueEncode(id);
  if (usingFrameset && title != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_TITLE + "String_Node_Str"+ urlParamValueEncode(title);
  if (usingFrameset && showTitle != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_SHOW_TITLE + "String_Node_Str"+ urlParamValueEncode(showTitle);
  if (usingParameter && !isCustom && pattern != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_SERVLET_PATTERN + "String_Node_Str"+ urlParamValueEncode(pattern);
  if (usingParameter && !isCustom && target != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_TARGET + "String_Node_Str"+ urlParamValueEncode(target);
  if (locale != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_LOCALE + "String_Node_Str"+ urlParamValueEncode(locale);
  if (svg != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_SVG + "String_Node_Str"+ urlParamValueEncode(svg);
  if (rtl != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_RTL + "String_Node_Str"+ urlParamValueEncode(rtl);
  if (pageNum > 0)   uri+="String_Node_Str" + ParameterAccessor.PARAM_PAGE + "String_Node_Str"+ pageNum;
  if (pageRange != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_PAGE_RANGE + "String_Node_Str"+ pageRange;
  if (allowMasterPage != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_MASTERPAGE + "String_Node_Str"+ urlParamValueEncode(allowMasterPage);
  if (resourceFolder != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_RESOURCE_FOLDER + "String_Node_Str"+ urlParamValueEncode(resourceFolder);
  if (maxRowsOfRecords >= 0)   uri+="String_Node_Str" + ParameterAccessor.PARAM_MAXROWS + "String_Node_Str"+ maxRowsOfRecords;
  if (forceOverwriteDocument != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_OVERWRITE + "String_Node_Str"+ urlParamValueEncode(forceOverwriteDocument);
  if (usingFrameset && showToolBar != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_TOOLBAR + "String_Node_Str"+ urlParamValueEncode(showToolBar);
  if (usingFrameset && showNavigationBar != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_NAVIGATIONBAR + "String_Node_Str"+ urlParamValueEncode(showNavigationBar);
  if (showParameterPage != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_PARAMETER_PAGE + "String_Node_Str"+ urlParamValueEncode(showParameterPage);
  if (bookmark != null) {
    if (IBirtConstants.VIEWER_PREVIEW.equalsIgnoreCase(iPattern)) {
      uri+="String_Node_Str" + urlParamValueEncode(bookmark);
    }
 else {
      uri+="String_Node_Str" + ParameterAccessor.PARAM_BOOKMARK + "String_Node_Str"+ urlParamValueEncode(bookmark);
    }
  }
  return uri;
}

Fixed version (ground truth):
/** 
 * Create the final URI string to preview report
 * @param iPattern
 * @return
 */
public String createURI(String iPattern){
  String uri=iPattern;
  if (uri == null)   uri=this.pattern;
  boolean renderReportlet=false;
  if (reportDocument != null && (reportletId != null || (bookmark != null && "String_Node_Str".equalsIgnoreCase(isReportlet))))   renderReportlet=true;
  if (uri == null) {
    uri=IBirtConstants.VIEWER_FRAMESET;
    if (renderReportlet)     uri=IBirtConstants.VIEWER_RUN;
  }
  boolean usingFrameset=IBirtConstants.VIEWER_FRAMESET.equalsIgnoreCase(uri);
  boolean usingParameter=IBirtConstants.VIEWER_PARAMETER.equalsIgnoreCase(uri);
  if (baseURL != null)   uri=baseURL + "String_Node_Str" + uri;
  if (format != null) {
    uri+="String_Node_Str" + ParameterAccessor.PARAM_FORMAT + "String_Node_Str"+ urlParamValueEncode(format);
  }
 else {
    uri+="String_Node_Str" + ParameterAccessor.PARAM_FORMAT + "String_Node_Str"+ ParameterAccessor.PARAM_FORMAT_HTML;
  }
  if (reportDesign != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_REPORT + "String_Node_Str"+ urlParamValueEncode(reportDesign);
  if (reportDocument != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_REPORT_DOCUMENT + "String_Node_Str"+ urlParamValueEncode(reportDocument);
  if (reportletId != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_INSTANCEID + "String_Node_Str"+ urlParamValueEncode(reportletId);
  if (usingFrameset && id != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_ID + "String_Node_Str"+ urlParamValueEncode(id);
  if (usingFrameset && title != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_TITLE + "String_Node_Str"+ urlParamValueEncode(title);
  if (usingFrameset && showTitle != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_SHOW_TITLE + "String_Node_Str"+ urlParamValueEncode(showTitle);
  if (usingParameter && !isCustom && pattern != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_SERVLET_PATTERN + "String_Node_Str"+ urlParamValueEncode(pattern);
  if (usingParameter && !isCustom && target != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_TARGET + "String_Node_Str"+ urlParamValueEncode(target);
  if (locale != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_LOCALE + "String_Node_Str"+ urlParamValueEncode(locale);
  if (svg != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_SVG + "String_Node_Str"+ urlParamValueEncode(svg);
  if (rtl != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_RTL + "String_Node_Str"+ urlParamValueEncode(rtl);
  if (pageNum > 0)   uri+="String_Node_Str" + ParameterAccessor.PARAM_PAGE + "String_Node_Str"+ pageNum;
  if (pageRange != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_PAGE_RANGE + "String_Node_Str"+ pageRange;
  if (allowMasterPage != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_MASTERPAGE + "String_Node_Str"+ urlParamValueEncode(allowMasterPage);
  if (resourceFolder != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_RESOURCE_FOLDER + "String_Node_Str"+ urlParamValueEncode(resourceFolder);
  if (maxRowsOfRecords >= 0)   uri+="String_Node_Str" + ParameterAccessor.PARAM_MAXROWS + "String_Node_Str"+ maxRowsOfRecords;
  if (forceOverwriteDocument != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_OVERWRITE + "String_Node_Str"+ urlParamValueEncode(forceOverwriteDocument);
  if (usingFrameset && showToolBar != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_TOOLBAR + "String_Node_Str"+ urlParamValueEncode(showToolBar);
  if (usingFrameset && showNavigationBar != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_NAVIGATIONBAR + "String_Node_Str"+ urlParamValueEncode(showNavigationBar);
  if (showParameterPage != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_PARAMETER_PAGE + "String_Node_Str"+ urlParamValueEncode(showParameterPage);
  if (bookmark != null) {
    if (IBirtConstants.VIEWER_PREVIEW.equalsIgnoreCase(iPattern) && !"String_Node_Str".equalsIgnoreCase(isReportlet)) {
      uri+="String_Node_Str" + urlParamValueEncode(bookmark);
    }
 else {
      uri+="String_Node_Str" + ParameterAccessor.PARAM_BOOKMARK + "String_Node_Str"+ urlParamValueEncode(bookmark);
    }
  }
  if (isReportlet != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_ISREPORTLET + "String_Node_Str"+ isReportlet;
  return uri;
}