Program: 76778
Project: 76778
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) || !allowPageBreak) {
      uri=IBirtConstants.VIEWER_RUN;
    }
  }
  if (contextRoot != null)   uri="String_Node_Str" + contextRoot + "String_Node_Str"+ uri;
  if (format != null) {
    uri+="String_Node_Str" + ParameterAccessor.PARAM_FORMAT + "String_Node_Str"+ 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"+ reportDesign;
  if (reportDocument != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_REPORT_DOCUMENT + "String_Node_Str"+ reportDocument;
  if (reportletId != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_INSTANCEID + "String_Node_Str"+ reportletId;
  if (allowPageBreak && id != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_ID + "String_Node_Str"+ id;
  if (allowPageBreak && title != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_TITLE + "String_Node_Str"+ title;
  if (allowPageBreak && showTitle != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_SHOW_TITLE + "String_Node_Str"+ showTitle;
  if (bookmark != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_BOOKMARK + "String_Node_Str"+ bookmark;
  if (!isCustom && pattern != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_SERVLET_PATTERN + "String_Node_Str"+ pattern;
  if (!isCustom && target != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_TARGET + "String_Node_Str"+ target;
  if (locale != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_LOCALE + "String_Node_Str"+ locale;
  if (svg != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_SVG + "String_Node_Str"+ svg;
  if (rtl != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_RTL + "String_Node_Str"+ rtl;
  if (allowMasterPage != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_MASTERPAGE + "String_Node_Str"+ allowMasterPage;
  if (resourceFolder != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_RESOURCE_FOLDER + "String_Node_Str"+ 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"+ forceOverwriteDocument;
  if (forceParameterPrompting != null)   uri+="String_Node_Str" + "String_Node_Str" + forceParameterPrompting;
  if (showToolBar != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_TOOLBAR + "String_Node_Str"+ showToolBar;
  if (showNavigationBar != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_NAVIGATIONBAR + "String_Node_Str"+ showNavigationBar;
  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;
  if (uri == null) {
    uri=IBirtConstants.VIEWER_FRAMESET;
    if ((reportDocument != null && reportletId != null) || !allowPageBreak) {
      uri=IBirtConstants.VIEWER_RUN;
    }
  }
  if (contextRoot != null)   uri="String_Node_Str" + contextRoot + "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 (allowPageBreak && id != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_ID + "String_Node_Str"+ urlParamValueEncode(id);
  if (allowPageBreak && title != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_TITLE + "String_Node_Str"+ urlParamValueEncode(title);
  if (allowPageBreak && showTitle != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_SHOW_TITLE + "String_Node_Str"+ urlParamValueEncode(showTitle);
  if (bookmark != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_BOOKMARK + "String_Node_Str"+ urlParamValueEncode(bookmark);
  if (!isCustom && pattern != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_SERVLET_PATTERN + "String_Node_Str"+ urlParamValueEncode(pattern);
  if (!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 (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 (forceParameterPrompting != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_PARAMETER_PROMPTING + urlParamValueEncode(forceParameterPrompting);
  if (showToolBar != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_TOOLBAR + "String_Node_Str"+ urlParamValueEncode(showToolBar);
  if (showNavigationBar != null)   uri+="String_Node_Str" + ParameterAccessor.PARAM_NAVIGATIONBAR + "String_Node_Str"+ urlParamValueEncode(showNavigationBar);
  return uri;
}