Program: 68398
Project: 68398
Buggy source:
public void visitReportDesign(ReportDesignHandle handle){
  this.defaultScriptLanguage="String_Node_Str";
  Map<String,Expression> userProperties=createUserProperties(handle);
  if (userProperties != null && !userProperties.isEmpty()) {
    report.setUserProperties(userProperties);
  }
  ULocale locale=handle.getLocale();
  if (locale != null)   report.setLocale(locale.toString());
  createReportDefaultStyles(handle);
  List<VariableElementHandle> varElements=handle.getPageVariables();
  Collection<PageVariableDesign> varDesigns=report.getPageVariables();
  for (  VariableElementHandle varElement : varElements) {
    String scope=varElement.getType();
    String name=varElement.getVariableName();
    ExpressionHandle exprHandle=varElement.getExpressionProperty(VariableElementHandle.VALUE_PROP);
    Expression defaultValue=createExpression(exprHandle);
    PageVariableDesign pv=new PageVariableDesign(name,scope);
    pv.setDefaultValue(defaultValue);
    varDesigns.add(pv);
  }
  String onPageEnd=handle.getOnPageEnd();
  Expression.Script onPageEndScript=createScript(onPageEnd);
  if (onPageEndScript != null) {
    String scriptId=ModuleUtil.getScriptUID(handle.getPropertyHandle(IReportDesignModel.ON_PAGE_END_METHOD));
    onPageEndScript.setFileName(scriptId);
    report.setOnPageEnd(onPageEndScript);
  }
  String onPageStart=handle.getOnPageStart();
  Expression.Script onPageStartScript=createScript(onPageStart);
  if (onPageStartScript != null) {
    String scriptId=ModuleUtil.getScriptUID(handle.getPropertyHandle(IReportDesignModel.ON_PAGE_START_METHOD));
    onPageStartScript.setFileName(scriptId);
    report.setOnPageStart(onPageStartScript);
  }
  PageSetupDesign pageSetup=new PageSetupDesign();
  SlotHandle pageSlot=handle.getMasterPages();
  for (int i=0; i < pageSlot.getCount(); i++) {
    apply(pageSlot.get(i));
    if (currentElement != null) {
      pageSetup.addMasterPage((MasterPageDesign)currentElement);
    }
  }
  if (pageSlot.getCount() < 1) {
    MasterPageDesign masterPage=new SimpleMasterPageDesign();
    masterPage.setID(generateUniqueID());
    masterPage.setName(DEFAULT_MASTERPAGE_NAME);
    masterPage.setPageType(DesignChoiceConstants.PAGE_SIZE_US_LETTER);
    masterPage.setOrientation(DesignChoiceConstants.PAGE_ORIENTATION_AUTO);
    DimensionType width=new DimensionType(DEFAULT_MASTERPAGE_WIDTH,DimensionType.UNITS_IN);
    DimensionType height=new DimensionType(DEFAULT_MASTERPAGE_HEIGHT,DimensionType.UNITS_IN);
    masterPage.setPageSize(width,height);
    DimensionType top=new DimensionType(DEFAULT_MASTERPAGE_TOP_MARGIN,DimensionType.UNITS_IN);
    DimensionType left=new DimensionType(DEFAULT_MASTERPAGE_LEFT_MARGIN,DimensionType.UNITS_IN);
    DimensionType bottom=new DimensionType(DEFAULT_MASTERPAGE_BOTTOM_MARGIN,DimensionType.UNITS_IN);
    DimensionType right=new DimensionType(DEFAULT_MASTERPAGE_RIGHT_MARGIN,DimensionType.UNITS_IN);
    masterPage.setMargin(top,left,bottom,right);
    pageSetup.addMasterPage(masterPage);
  }
  report.setPageSetup(pageSetup);
  SlotHandle bodySlot=handle.getBody();
  for (int i=0; i < bodySlot.getCount(); i++) {
    apply(bodySlot.get(i));
    if (currentElement != null) {
      report.addContent((ReportItemDesign)currentElement);
    }
  }
}

Fixed version (ground truth):
public void visitReportDesign(ReportDesignHandle handle){
  this.defaultScriptLanguage="String_Node_Str";
  Map<String,Expression> userProperties=createUserProperties(handle);
  if (userProperties != null && !userProperties.isEmpty()) {
    report.setUserProperties(userProperties);
  }
  ULocale locale=handle.getLocale();
  if (locale != null)   report.setLocale(locale.toString());
  createReportDefaultStyles(handle);
  List<VariableElementHandle> varElements=handle.getPageVariables();
  Collection<PageVariableDesign> varDesigns=report.getPageVariables();
  for (  VariableElementHandle varElement : varElements) {
    String scope=varElement.getType();
    String name=varElement.getVariableName();
    ExpressionHandle exprHandle=varElement.getExpressionProperty(VariableElementHandle.VALUE_PROP);
    Expression defaultValue=createExpression(exprHandle);
    PageVariableDesign pv=new PageVariableDesign(name,scope);
    pv.setDefaultValue(defaultValue);
    varDesigns.add(pv);
  }
  String onPageEnd=handle.getOnPageEnd();
  Expression.Script onPageEndScript=createScript(onPageEnd);
  if (onPageEndScript != null) {
    String scriptId=ModuleUtil.getScriptUID(handle.getPropertyHandle(IReportDesignModel.ON_PAGE_END_METHOD));
    onPageEndScript.setFileName(scriptId);
    report.setOnPageEnd(onPageEndScript);
  }
  String onPageStart=handle.getOnPageStart();
  Expression.Script onPageStartScript=createScript(onPageStart);
  if (onPageStartScript != null) {
    String scriptId=ModuleUtil.getScriptUID(handle.getPropertyHandle(IReportDesignModel.ON_PAGE_START_METHOD));
    onPageStartScript.setFileName(scriptId);
    report.setOnPageStart(onPageStartScript);
  }
  PageSetupDesign pageSetup=new PageSetupDesign();
  SlotHandle pageSlot=handle.getMasterPages();
  for (int i=0; i < pageSlot.getCount(); i++) {
    apply(pageSlot.get(i));
    if (currentElement != null) {
      pageSetup.addMasterPage((MasterPageDesign)currentElement);
    }
  }
  if (pageSlot.getCount() < 1) {
    MasterPageDesign masterPage=new SimpleMasterPageDesign();
    masterPage.setID(generateUniqueID());
    masterPage.setName(DEFAULT_MASTERPAGE_NAME);
    masterPage.setPageType(DesignChoiceConstants.PAGE_SIZE_US_LETTER);
    masterPage.setOrientation(DesignChoiceConstants.PAGE_ORIENTATION_AUTO);
    DimensionType width=new DimensionType(DEFAULT_MASTERPAGE_WIDTH,DimensionType.UNITS_IN);
    DimensionType height=new DimensionType(DEFAULT_MASTERPAGE_HEIGHT,DimensionType.UNITS_IN);
    masterPage.setPageSize(width,height);
    DimensionType top=new DimensionType(DEFAULT_MASTERPAGE_TOP_MARGIN,DimensionType.UNITS_IN);
    DimensionType left=new DimensionType(DEFAULT_MASTERPAGE_LEFT_MARGIN,DimensionType.UNITS_IN);
    DimensionType bottom=new DimensionType(DEFAULT_MASTERPAGE_BOTTOM_MARGIN,DimensionType.UNITS_IN);
    DimensionType right=new DimensionType(DEFAULT_MASTERPAGE_RIGHT_MARGIN,DimensionType.UNITS_IN);
    masterPage.setMargin(top,left,bottom,right);
    setupElementIDMap(masterPage);
    pageSetup.addMasterPage(masterPage);
  }
  report.setPageSetup(pageSetup);
  SlotHandle bodySlot=handle.getBody();
  for (int i=0; i < bodySlot.getCount(); i++) {
    apply(bodySlot.get(i));
    if (currentElement != null) {
      report.addContent((ReportItemDesign)currentElement);
    }
  }
}