nus-yam/ex-repair huggingface dataset:
Program: 77946
Project: 77946
Buggy source:
/** 
 * get parsed parameters.
 * @param design IViewerReportDesignHandle
 * @param parameterList Collection
 * @param request HttpServletRequest
 * @param options InputOptions
 * @return Map
 */
protected Map getParsedParameters(IViewerReportDesignHandle design,Collection parameterList,HttpServletRequest request,InputOptions options) throws ReportServiceException {
}

Fixed version (ground truth):
/** 
 * get parsed parameters.
 * @param design IViewerReportDesignHandle
 * @param parameterList Collection
 * @param request HttpServletRequest
 * @param options InputOptions
 * @return Map
 */
protected Map getParsedParameters(IViewerReportDesignHandle design,Collection parameterList,HttpServletRequest request,InputOptions options) throws ReportServiceException {
  Map params=new HashMap();
  if (parameterList == null || this.parametersAsString == null)   return params;
  for (Iterator iter=parameterList.iterator(); iter.hasNext(); ) {
    ScalarParameterHandle parameter=null;
    Object parameterObj=iter.next();
    if (parameterObj instanceof ScalarParameterHandle) {
      parameter=(ScalarParameterHandle)parameterObj;
    }
    if (parameter == null)     continue;
    String paramName=parameter.getName();
    Object paramValueObj=this.parametersAsString.get(paramName);
    if (paramValueObj != null) {
      try {
        paramValueObj=ParameterValidationUtil.validate(parameter.getDataType(),parameter.getPattern(),paramValueObj.toString(),locale);
        params.put(paramName,paramValueObj);
      }
 catch (      ValidationValueException e) {
        if (ParameterAccessor.SERVLET_PATH_RUN.equalsIgnoreCase(request.getServletPath())) {
          this.exception=e;
          break;
        }
      }
    }
 else {
      params.put(paramName,null);
    }
  }
  return params;
}
Program: 77947
Project: 77947
Buggy source:
/** 
 * get parameter object.
 * @param request HttpServletRequest
 * @param parameter ScalarParameterHandle
 * @return
 */
protected String getParamValueAsString(HttpServletRequest request,ScalarParameterHandle parameter){
  String paramName=parameter.getName();
  String paramValue=null;
  if (ParameterAccessor.isReportParameterExist(request,paramName)) {
    paramValue=ParameterAccessor.getReportParameter(request,paramName,null);
  }
  if (paramValue != null)   return paramValue;
  Object paramValueObj=null;
  if (isDesigner && (IBirtConstants.SERVLET_PATH_RUN.equalsIgnoreCase(request.getServletPath()) || IBirtConstants.SERVLET_PATH_PARAMETER.equalsIgnoreCase(request.getServletPath())) && this.configMap != null && this.configMap.containsKey(paramName)) {
    paramValueObj=this.configMap.get(paramName);
  }
 else   if (this.parameterMap != null && this.parameterMap.containsKey(paramName)) {
    paramValueObj=this.parameterMap.get(paramName);
    paramValueObj=ParameterValidationUtil.getDisplayValue(null,parameter.getPattern(),paramValueObj,locale);
  }
  if (paramValueObj != null)   paramValue=paramValueObj.toString();
  return paramValue;
}

Fixed version (ground truth):
/** 
 * get parameter object.
 * @param request HttpServletRequest
 * @param parameter ScalarParameterHandle
 * @return
 */
protected String getParamValueAsString(HttpServletRequest request,ScalarParameterHandle parameter){
  String paramName=parameter.getName();
  String paramValue=null;
  if (ParameterAccessor.isReportParameterExist(request,paramName)) {
    paramValue=ParameterAccessor.getReportParameter(request,paramName,null);
  }
  if (paramValue != null)   return paramValue;
  Object paramValueObj=null;
  if (this.isDesigner && (IBirtConstants.SERVLET_PATH_RUN.equalsIgnoreCase(request.getServletPath()) || IBirtConstants.SERVLET_PATH_PARAMETER.equalsIgnoreCase(request.getServletPath())) && this.configMap != null && this.configMap.containsKey(paramName)) {
    paramValueObj=this.configMap.get(paramName);
  }
 else   if (this.parameterMap != null && this.parameterMap.containsKey(paramName)) {
    paramValueObj=this.parameterMap.get(paramName);
    paramValueObj=ParameterValidationUtil.getDisplayValue(null,parameter.getPattern(),paramValueObj,locale);
  }
  if (paramValueObj != null)   paramValue=paramValueObj.toString();
  return paramValue;
}
Program: 77948
Project: 77948
Buggy source:
/** 
 * Parse report object and get the parameter default values
 * @param design IViewerReportDesignHandle
 * @param paramName String
 * @param options InputOptionsF
 * @return String
 */
protected String getParameterDefaultValues(IViewerReportDesignHandle design,String paramName,InputOptions options) throws ReportServiceException {
}

Fixed version (ground truth):
/** 
 * Parse report object and get the parameter default values
 * @param design IViewerReportDesignHandle
 * @param paramName String
 * @param options InputOptionsF
 * @return String
 */
protected String getParameterDefaultValues(IViewerReportDesignHandle design,String paramName,InputOptions options) throws ReportServiceException {
  if (design == null)   return null;
  String defalutValue=null;
  Object defaultValueObj=null;
  try {
    defaultValueObj=this.getReportService().getParameterDefaultValue(design,paramName,options);
  }
 catch (  ReportServiceException e) {
    e.printStackTrace();
  }
  ScalarParameterHandle parameter=(ScalarParameterHandle)findParameter(paramName);
  if (defaultValueObj != null && parameter != null) {
    defalutValue=ParameterValidationUtil.getDisplayValue(null,parameter.getPattern(),defaultValueObj,locale);
  }
  if (defalutValue == null && parameter != null) {
    defalutValue=parameter.getDefaultValue();
  }
  return defalutValue;
}
Program: 77950
Project: 77950
Buggy source:
/** 
 * Popup the builder for Data element
 */
public void performDirectEdit(){
  DataItemHandle handle=(DataItemHandle)getModel();
  handle.getModuleHandle().getCommandStack().startTrans(null);
  ColumnBindingDialog dialog=new ColumnBindingDialog(true);
  dialog.setInput(handle);
  if (dialog.open() == Dialog.OK) {
    handle.getModuleHandle().getCommandStack().commit();
    refreshVisuals();
  }
 else {
    handle.getModuleHandle().getCommandStack().rollbackAll();
  }
}

Fixed version (ground truth):
/** 
 * Popup the builder for Data element
 */
public void performDirectEdit(){
  DataItemHandle handle=(DataItemHandle)getModel();
  handle.getModuleHandle().getCommandStack().startTrans(null);
  ColumnBindingDialog dialog=new ColumnBindingDialog(true);
  dialog.setInput(handle);
  dialog.setGroupList(DEUtil.getGroups(handle));
  if (dialog.open() == Dialog.OK) {
    handle.getModuleHandle().getCommandStack().commit();
    refreshVisuals();
  }
 else {
    handle.getModuleHandle().getCommandStack().rollbackAll();
  }
}
Program: 77951
Project: 77951
Buggy source:
/** 
 * Creates builder for given element
 * @param handle
 * @return
 */
public Object createBuilder(DesignElementHandle handle){
  if (handle instanceof TextItemHandle) {
    return new TextEditor(UIUtil.getDefaultShell(),TextEditor.DLG_TITLE_NEW,(TextItemHandle)handle);
  }
  if (handle instanceof TextDataHandle) {
    ExpressionBuilder dialog=new ExpressionBuilder(UIUtil.getDefaultShell(),((TextDataHandle)handle).getValueExpr());
    dialog.setExpressionProvier(new ExpressionProvider(handle));
    return (dialog);
  }
  if (handle instanceof DataItemHandle) {
    ColumnBindingDialog dialog=new ColumnBindingDialog(true);
    dialog.setInput((ReportItemHandle)handle);
    return (dialog);
  }
  if (handle instanceof ImageHandle) {
    ImageBuilder dialog=new ImageBuilder(UIUtil.getDefaultShell(),ImageBuilder.DLG_TITLE_NEW);
    dialog.setInput(handle);
    return dialog;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Creates builder for given element
 * @param handle
 * @return
 */
public Object createBuilder(DesignElementHandle handle){
  if (handle instanceof TextItemHandle) {
    return new TextEditor(UIUtil.getDefaultShell(),TextEditor.DLG_TITLE_NEW,(TextItemHandle)handle);
  }
  if (handle instanceof TextDataHandle) {
    ExpressionBuilder dialog=new ExpressionBuilder(UIUtil.getDefaultShell(),((TextDataHandle)handle).getValueExpr());
    dialog.setExpressionProvier(new ExpressionProvider(handle));
    return (dialog);
  }
  if (handle instanceof DataItemHandle) {
    ColumnBindingDialog dialog=new ColumnBindingDialog(true);
    dialog.setInput((ReportItemHandle)handle);
    dialog.setGroupList(DEUtil.getGroups(handle));
    return (dialog);
  }
  if (handle instanceof ImageHandle) {
    ImageBuilder dialog=new ImageBuilder(UIUtil.getDefaultShell(),ImageBuilder.DLG_TITLE_NEW);
    dialog.setInput(handle);
    return dialog;
  }
  return null;
}
Program: 77953
Project: 77953
Buggy source:
private boolean performTransferPlaceHolder(TemplateElementHandle handle){
  DesignElementHandle copiedHandle=handle.getDefaultElement().copy().getHandle(SessionHandleAdapter.getInstance().getReportDesignHandle().getModule());
  try {
    ((TemplateReportItemHandle)handle).transformToReportItem((ReportItemHandle)copiedHandle);
  }
 catch (  SemanticException e) {
    ExceptionHandler.handle(e);
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean performTransferPlaceHolder(TemplateElementHandle handle){
  DesignElementHandle copiedHandle=handle.getDefaultElement().copyForTemplate().getHandle(SessionHandleAdapter.getInstance().getReportDesignHandle().getModule());
  try {
    ((TemplateReportItemHandle)handle).transformToReportItem((ReportItemHandle)copiedHandle);
  }
 catch (  SemanticException e) {
    ExceptionHandler.handle(e);
    return false;
  }
  return true;
}
Program: 77954
Project: 77954
Buggy source:
/** 
 * Transforms the current template report item to the given real report item.
 * @param reportItemHandle the real report item handle to replace this template report item
 * @throws SemanticException if this template report item has no template definition or some containing contexts don't match
 */
public void transformToReportItem(ReportItemHandle reportItemHandle) throws SemanticException {
  if (getRoot() == null)   throw new TemplateException(getElement(),TemplateException.DESIGN_EXCEPTION_CREATE_TEMPLATE_ELEMENT_FORBIDDEN);
  TemplateCommand cmd=new TemplateCommand(getModule(),getContainer().getElement());
  cmd.transformToReportItem((TemplateReportItem)getElement(),(ReportItem)reportItemHandle.getElement(),getElement().getContainerSlot());
}

Fixed version (ground truth):
/** 
 * Transforms the current template report item to the given real report item.
 * @param reportItemHandle the real report item handle to replace this template report item
 * @throws SemanticException if this template report item has no template definition or some containing contexts don't match
 */
public void transformToReportItem(ReportItemHandle reportItemHandle) throws SemanticException {
  if (getRoot() == null)   throw new TemplateException(getElement(),TemplateException.DESIGN_EXCEPTION_CREATE_TEMPLATE_ELEMENT_FORBIDDEN);
  module.makeUniqueName(reportItemHandle.element);
  TemplateCommand cmd=new TemplateCommand(getModule(),getContainer().getElement());
  cmd.transformToReportItem((TemplateReportItem)getElement(),(ReportItem)reportItemHandle.getElement(),getElement().getContainerSlot());
}
Program: 77955
Project: 77955
Buggy source:
/** 
 * Sets the operator of this filter condition. The allowed values are defined in  {@link org.eclipse.birt.report.model.api.elements.DesignChoiceConstants}, and they are: <ul> <li><code>FILTER_OPERATOR_EQ</code> <li><code>FILTER_OPERATOR_NE</code> <li><code>FILTER_OPERATOR_LT</code> <li><code>FILTER_OPERATOR_LE</code> <li><code>FILTER_OPERATOR_GE</code> <li><code>FILTER_OPERATOR_GT</code> <li><code>FILTER_OPERATOR_BETWEEN</code> <li><code>FILTER_OPERATOR_NOT_BETWEEN</code> <li><code>FILTER_OPERATOR_NULL</code> <li><code>FILTER_OPERATOR_NOT_NULL</code> <li><code>FILTER_OPERATOR_TRUE</code> <li><code>FILTER_OPERATOR_FALSE</code> <li><code>FILTER_OPERATOR_LIKE</code> <li><code>FILTER_OPERATOR_TOP_N</code> <li><code>FILTER_OPERATOR_BOTTOM_N</code> <li><code>FILTER_OPERATOR_TOP_PERCENT</code> <li><code>FILTER_OPERATOR_BOTTOM_PERCENT</code> <li><code>FILTER_OPERATOR_ANY</code> </ul>
 * @param operator the operator to set
 * @throws SemanticException if operator is not in the choice list.
 */
public void setOperator(String operator) throws SemanticException {
  setProperty(FilterCondition.OPERATOR_MEMBER,operator);
}

Fixed version (ground truth):
/** 
 * Sets the operator of this filter condition. The allowed values are defined in  {@link org.eclipse.birt.report.model.api.elements.DesignChoiceConstants}, and they are: <ul> <li><code>FILTER_OPERATOR_EQ</code> <li><code>FILTER_OPERATOR_NE</code> <li><code>FILTER_OPERATOR_LT</code> <li><code>FILTER_OPERATOR_LE</code> <li><code>FILTER_OPERATOR_GE</code> <li><code>FILTER_OPERATOR_GT</code> <li><code>FILTER_OPERATOR_BETWEEN</code> <li><code>FILTER_OPERATOR_NOT_BETWEEN</code> <li><code>FILTER_OPERATOR_NULL</code> <li><code>FILTER_OPERATOR_NOT_NULL</code> <li><code>FILTER_OPERATOR_TRUE</code> <li><code>FILTER_OPERATOR_FALSE</code> <li><code>FILTER_OPERATOR_LIKE</code> <li><code>FILTER_OPERATOR_TOP_N</code> <li><code>FILTER_OPERATOR_BOTTOM_N</code> <li><code>FILTER_OPERATOR_TOP_PERCENT</code> <li><code>FILTER_OPERATOR_BOTTOM_PERCENT</code> <li><code>FILTER_OPERATOR_ANY</code> </ul>
 * @param operator the operator to set
 * @throws SemanticException if operator is not in the choice list.
 */
public void setOperator(String operator) throws SemanticException {
  ActivityStack stack=getModule().getActivityStack();
  stack.startTrans();
  try {
    setProperty(FilterCondition.OPERATOR_MEMBER,operator);
    int level=OperatorUtil.computeFilterOperatorLevel(operator);
switch (level) {
case OperatorUtil.OPERATOR_LEVEL_ONE:
      setValue2(null);
    break;
case OperatorUtil.OPERATOR_LEVEL_TWO:
  break;
case OperatorUtil.OPERATOR_LEVEL_ZERO:
setValue2(null);
setValue1(null);
break;
case OperatorUtil.OPERATOR_LEVEL_NOT_EXIST:
break;
}
}
 catch (SemanticException e) {
stack.rollback();
throw e;
}
stack.commit();
}
Program: 77956
Project: 77956
Buggy source:
/** 
 * Sets the operator. The allowed values are defined in  {@link org.eclipse.birt.report.model.api.elements.DesignChoiceConstants}, and they are: <ul> <li>MAP_OPERATOR_EQ <li>MAP_OPERATOR_NE <li>MAP_OPERATOR_LT <li>MAP_OPERATOR_LE <li>MAP_OPERATOR_GE <li>MAP_OPERATOR_GT <li>MAP_OPERATOR_BETWEEN <li>MAP_OPERATOR_NOT_BETWEEN <li>MAP_OPERATOR_NULL <li>MAP_OPERATOR_NOT_NULL <li>MAP_OPERATOR_TRUE <li>MAP_OPERATOR_FALSE <li>MAP_OPERATOR_LIKE <li>MAP_OPERATOR_ANY </ul>
 * @param operator the operator to set
 * @throws SemanticException if operator is not in the choice list.
 */
public void setOperator(String operator) throws SemanticException {
  setProperty(StyleRule.OPERATOR_MEMBER,operator);
}

Fixed version (ground truth):
/** 
 * Sets the operator. The allowed values are defined in  {@link org.eclipse.birt.report.model.api.elements.DesignChoiceConstants}, and they are: <ul> <li>MAP_OPERATOR_EQ <li>MAP_OPERATOR_NE <li>MAP_OPERATOR_LT <li>MAP_OPERATOR_LE <li>MAP_OPERATOR_GE <li>MAP_OPERATOR_GT <li>MAP_OPERATOR_BETWEEN <li>MAP_OPERATOR_NOT_BETWEEN <li>MAP_OPERATOR_NULL <li>MAP_OPERATOR_NOT_NULL <li>MAP_OPERATOR_TRUE <li>MAP_OPERATOR_FALSE <li>MAP_OPERATOR_LIKE <li>MAP_OPERATOR_ANY </ul>
 * @param operator the operator to set
 * @throws SemanticException if operator is not in the choice list.
 */
public void setOperator(String operator) throws SemanticException {
  ActivityStack stack=getModule().getActivityStack();
  stack.startTrans();
  try {
    setProperty(StyleRule.OPERATOR_MEMBER,operator);
    int level=OperatorUtil.computeStyleRuleOperatorLevel(operator);
switch (level) {
case OperatorUtil.OPERATOR_LEVEL_ONE:
      setValue2(null);
    break;
case OperatorUtil.OPERATOR_LEVEL_TWO:
  break;
case OperatorUtil.OPERATOR_LEVEL_ZERO:
setValue2(null);
setValue1(null);
break;
case OperatorUtil.OPERATOR_LEVEL_NOT_EXIST:
break;
}
}
 catch (SemanticException e) {
stack.rollback();
throw e;
}
stack.commit();
}
Program: 77957
Project: 77957
Buggy source:
public void end() throws SAXException {
  makeTestExpressionCompatible();
  Set elements=handler.tempValue.keySet();
  ContainerSlot groups=element.getSlot(ListingElement.GROUP_SLOT);
  for (int i=0; i < groups.getCount(); i++) {
    GroupElement group=(GroupElement)groups.getContent(i);
    handler.getModule().getNameManager().makeUniqueName(group);
    String groupName=(String)group.getLocalProperty(handler.getModule(),GroupElement.GROUP_NAME_PROP);
    if (!elements.contains(group))     continue;
    List columns=(List)handler.tempValue.get(group);
    if (columns == null || columns.isEmpty())     continue;
    List tmpList=(List)element.getLocalProperty(handler.module,ListingElement.BOUND_DATA_COLUMNS_PROP);
    if (tmpList == null) {
      tmpList=new ArrayList();
      element.setProperty(ListingElement.BOUND_DATA_COLUMNS_PROP,tmpList);
    }
    for (int j=0; j < columns.size(); j++) {
      ComputedColumn column=(ComputedColumn)columns.get(j);
      column.setAggregrateOn(groupName);
      ComputedColumn foundColumn=checkMatchedBoundColumnForGroup(tmpList,column.getExpression(),column.getAggregrateOn());
      if (foundColumn == null || !foundColumn.getName().equals(column.getName())) {
        String newName=getUniqueBoundColumnNameForGroup(tmpList,column);
        column.setName(newName);
        tmpList.add(column);
      }
    }
    reCheckResultSetColumnName(group,tmpList);
  }
  super.end();
}

Fixed version (ground truth):
public void end() throws SAXException {
  makeTestExpressionCompatible();
  Set elements=handler.tempValue.keySet();
  ContainerSlot groups=element.getSlot(ListingElement.GROUP_SLOT);
  for (int i=0; i < groups.getCount(); i++) {
    GroupElement group=(GroupElement)groups.getContent(i);
    handler.getModule().getNameManager().makeUniqueName(group);
    String groupName=(String)group.getLocalProperty(handler.getModule(),GroupElement.GROUP_NAME_PROP);
    if (!elements.contains(group))     continue;
    if (StringUtil.compareVersion(handler.getVersion(),"String_Node_Str") >= 0) {
      continue;
    }
    List columns=(List)handler.tempValue.get(group);
    if (columns == null || columns.isEmpty())     continue;
    List tmpList=(List)element.getLocalProperty(handler.module,ListingElement.BOUND_DATA_COLUMNS_PROP);
    if (tmpList == null) {
      tmpList=new ArrayList();
      element.setProperty(ListingElement.BOUND_DATA_COLUMNS_PROP,tmpList);
    }
    if (StringUtil.compareVersion(handler.getVersion(),"String_Node_Str") <= 0) {
      addCachedListWithAggregateOnToListing(columns,tmpList,group,groupName);
      continue;
    }
    addCachedListToListing(columns,tmpList,group,groupName);
  }
  super.end();
}
Program: 77958
Project: 77958
Buggy source:
/** 
 * Returns all visible column bindings for the given element
 * @param handle the handle of the element
 * @return the list of all visible column bindings.The list order is fromthe top to the given element
 */
public static List getVisiableColumnBindingsList(DesignElementHandle handle,boolean includeSelf){
  List bindingList=new ArrayList();
  if (includeSelf) {
    Iterator iterator=getBindingColumnIterator(handle);
    while (iterator.hasNext()) {
      bindingList.add(iterator.next());
    }
  }
  ReportItemHandle holder=getBindingHolder(handle);
  if (holder != null) {
    if (holder instanceof ListingHandle && ((ListingHandle)holder).getDetail() == handle.getContainerSlotHandle()) {
      SlotHandle groupSlotHandle=((ListingHandle)holder).getGroups();
      for (Iterator iter=groupSlotHandle.iterator(); iter.hasNext(); ) {
        GroupHandle group=(GroupHandle)iter.next();
        for (Iterator columnIter=group.columnBindingsIterator(); columnIter.hasNext(); ) {
          bindingList.add(columnIter.next());
        }
      }
    }
    for (DesignElementHandle elementHandle=handle.getContainer(); elementHandle != holder.getContainer(); elementHandle=elementHandle.getContainer()) {
      List subBindingList=new ArrayList();
      Iterator iterator=getBindingColumnIterator(elementHandle);
      while (iterator.hasNext()) {
        subBindingList.add(iterator.next());
      }
      bindingList.addAll(0,subBindingList);
    }
  }
  return bindingList;
}

Fixed version (ground truth):
/** 
 * Returns all visible column bindings for the given element
 * @param handle the handle of the element
 * @return the list of all visible column bindings.The list order is fromthe top to the given element
 */
public static List getVisiableColumnBindingsList(DesignElementHandle handle,boolean includeSelf){
  List bindingList=new ArrayList();
  if (includeSelf) {
    Iterator iterator=getBindingColumnIterator(handle);
    while (iterator.hasNext()) {
      bindingList.add(iterator.next());
    }
  }
  ReportItemHandle holder=getBindingHolder(handle);
  if (holder != null) {
    for (DesignElementHandle elementHandle=handle.getContainer(); elementHandle != holder.getContainer(); elementHandle=elementHandle.getContainer()) {
      List subBindingList=new ArrayList();
      Iterator iterator=getBindingColumnIterator(elementHandle);
      while (iterator.hasNext()) {
        subBindingList.add(iterator.next());
      }
      bindingList.addAll(0,subBindingList);
    }
  }
  return bindingList;
}
Program: 77959
Project: 77959
Buggy source:
/** 
 * Returns the element handle which can save binding columns the given element
 * @param handle the handle of the element which needs binding columns
 * @return the holder for the element,or itself if no holder available
 */
public static ReportItemHandle getBindingHolder(DesignElementHandle handle){
  if (handle instanceof ReportElementHandle) {
    if (handle instanceof ListingHandle) {
      return (ReportItemHandle)handle;
    }
    if (handle instanceof ReportItemHandle) {
      if (((ReportItemHandle)handle).getDataSet() != null && ((ReportItemHandle)handle).columnBindingsIterator().hasNext()) {
        return (ReportItemHandle)handle;
      }
    }
    ReportItemHandle result=getBindingHolder(handle.getContainer());
    if (result == null && handle instanceof ReportItemHandle) {
      result=(ReportItemHandle)handle;
    }
    return result;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the element handle which can save binding columns the given element
 * @param handle the handle of the element which needs binding columns
 * @return the holder for the element,or itself if no holder available
 */
public static ReportItemHandle getBindingHolder(DesignElementHandle handle){
  if (handle instanceof ReportElementHandle) {
    if (handle instanceof ListingHandle) {
      return (ReportItemHandle)handle;
    }
    if (handle instanceof ReportItemHandle) {
      if (((ReportItemHandle)handle).getDataSet() != null || ((ReportItemHandle)handle).columnBindingsIterator().hasNext()) {
        return (ReportItemHandle)handle;
      }
    }
    ReportItemHandle result=getBindingHolder(handle.getContainer());
    if (result == null && handle instanceof ReportItemHandle) {
      result=(ReportItemHandle)handle;
    }
    return result;
  }
  return null;
}
Program: 77960
Project: 77960
Buggy source:
public void widgetSelected(SelectionEvent event){
  String value=combo.getText();
  if (value.equals(NONE)) {
    value=null;
  }
  if (canChangeDataSet(value)) {
    try {
      startTrans("String_Node_Str");
      DataSetHandle dataSet=null;
      if (value != null) {
        dataSet=SessionHandleAdapter.getInstance().getReportDesignHandle().findDataSet(value);
      }
      inputElement.setDataSet(dataSet);
      generateBindingColumns();
      getPropertyHandle().setStringValue(null);
      commit();
    }
 catch (    SemanticException e) {
      rollback();
      ExceptionHandler.handle(e);
    }
  }
 else {
    combo.setText(getDataSetName());
  }
}

Fixed version (ground truth):
public void widgetSelected(SelectionEvent event){
  String value=combo.getText();
  if (value.equals(NONE)) {
    value=null;
  }
  int rCode=canChangeDataSet(value);
  if (rCode == 2) {
    combo.setText(getDataSetName());
  }
 else {
    try {
      DataSetHandle dataSet=null;
      if (value != null) {
        dataSet=inputElement.getModuleHandle().findDataSet(value);
      }
      inputElement.setDataSet(dataSet);
      getParameterBindingPropertyHandle().clearValue();
      if (rCode == 0) {
        inputElement.getColumnBindings().clearValue();
      }
      generateBindingColumns();
    }
 catch (    SemanticException e) {
      ExceptionHandler.handle(e);
    }
  }
}
Program: 77962
Project: 77962
Buggy source:
private boolean canChangeDataSet(String newName){
  String currentDataSetName=getDataSetName();
  if (NONE.equals(currentDataSetName)) {
    return true;
  }
 else   if (!currentDataSetName.equals(newName)) {
    return MessageDialog.openQuestion(null,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
  }
  return false;
}

Fixed version (ground truth):
private int canChangeDataSet(String newName){
  String currentDataSetName=getDataSetName();
  if (NONE.equals(currentDataSetName) && !inputElement.columnBindingsIterator().hasNext()) {
    return 0;
  }
 else   if (currentDataSetName.equals(newName)) {
    return 2;
  }
  MessageDialog prefDialog=new MessageDialog(UIUtil.getDefaultShell(),Messages.getString("String_Node_Str"),null,Messages.getString("String_Node_Str"),MessageDialog.INFORMATION,new String[]{IDialogConstants.YES_LABEL,IDialogConstants.NO_LABEL,IDialogConstants.CANCEL_LABEL},0);
  return prefDialog.open();
}
Program: 77963
Project: 77963
Buggy source:
protected void __initParameters(HttpServletRequest request) throws Exception {
  this.reportDesignHandle=getDesignHandle(request);
  InputOptions options=new InputOptions();
  options.setOption(InputOptions.OPT_REQUEST,request);
  options.setOption(InputOptions.OPT_LOCALE,locale);
  options.setOption(InputOptions.OPT_RTL,new Boolean(rtl));
  Collection parameterList=getParameterList();
  if (isDesigner)   parseConfigVars(request);
  this.parametersAsString=getParsedParametersAsString(parameterList,request,options);
  this.parameters=(HashMap)getParsedParameters(this.reportDesignHandle,parameterList,request,options);
  Collection parameterDefList=this.getReportService().getParameterDefinitions(reportDesignHandle,options,false);
  this.missingParameter=validateParameters(parameterDefList,this.parametersAsString);
}

Fixed version (ground truth):
protected void __initParameters(HttpServletRequest request) throws Exception {
  this.reportDesignHandle=getDesignHandle(request);
  InputOptions options=new InputOptions();
  options.setOption(InputOptions.OPT_REQUEST,request);
  options.setOption(InputOptions.OPT_LOCALE,locale);
  options.setOption(InputOptions.OPT_RTL,new Boolean(rtl));
  Collection parameterList=getParameterList();
  if (isDesigner)   parseConfigVars(request,parameterList);
  this.parametersAsString=getParsedParametersAsString(parameterList,request,options);
  this.parameters=(HashMap)getParsedParameters(this.reportDesignHandle,parameterList,request,options);
  Collection parameterDefList=this.getReportService().getParameterDefinitions(reportDesignHandle,options,false);
  this.missingParameter=validateParameters(parameterDefList,this.parametersAsString);
}
Program: 77964
Project: 77964
Buggy source:
/** 
 * parse paramenters from config file.
 * @param request HttpServletRequest
 * @return
 */
protected void parseConfigVars(HttpServletRequest request){
}

Fixed version (ground truth):
/** 
 * parse paramenters from config file.
 * @param request HttpServletRequest
 * @return
 */
protected void parseConfigVars(HttpServletRequest request,Collection parameterList){
}
Program: 77965
Project: 77965
Buggy source:
private List doValidate(Module module,ExtendedItem toValidate){
  List list=new ArrayList();
  if (toValidate.getExtendedElement() == null) {
    try {
      toValidate.initializeReportItem(module);
    }
 catch (    ExtendedElementException e) {
      return list;
    }
  }
  List exceptions=toValidate.getExtendedElement().validate();
  if (exceptions != null)   list.addAll(exceptions);
  return list;
}

Fixed version (ground truth):
private List doValidate(Module module,ExtendedItem toValidate){
  List list=new ArrayList();
  if (toValidate.getExtendedElement() == null) {
    if (!((module instanceof Library) && ((Library)module).getHost() != null)) {
      try {
        toValidate.initializeReportItem(module);
      }
 catch (      ExtendedElementException e) {
        return list;
      }
    }
  }
  if (toValidate.getExtendedElement() != null) {
    List exceptions=toValidate.getExtendedElement().validate();
    if (exceptions != null)     list.addAll(exceptions);
  }
  return list;
}
Program: 77966
Project: 77966
Buggy source:
/** 
 * Get parameter values from config file.
 * @return Map
 */
private Map getConfigVars(){
  HashMap configVars=new HashMap();
  String reportDesignName=this.getFileUri();
  String configFileName=reportDesignName.replaceFirst(SUFFIX_DESIGN_FILE,SUFFIX_DESIGN_CONFIG);
  ReportDesignHandle handle=null;
  try {
    SessionHandle sessionHandle=SessionHandleAdapter.getInstance().getSessionHandle();
    File configFile=new File(configFileName);
    if (configFile != null && configFile.exists() && configFile.isFile()) {
      handle=sessionHandle.openDesign(configFileName);
      if (handle != null) {
        Iterator it=handle.configVariablesIterator();
        while (it != null && it.hasNext()) {
          ConfigVariableHandle configVar=(ConfigVariableHandle)it.next();
          if (configVar != null && configVar.getName() != null) {
            String paramName=getParameterName(configVar.getName());
            if (paramName != null && paramName.length() > 0) {
              configVars.put(paramName,configVar.getValue());
            }
          }
        }
        handle.close();
      }
    }
  }
 catch (  DesignFileException e) {
    e.printStackTrace();
    try {
      if (handle != null) {
        handle.close();
      }
    }
 catch (    Exception e1) {
      e1.printStackTrace();
    }
  }
  return configVars;
}

Fixed version (ground truth):
/** 
 * Get parameter values from config file.
 * @return Map
 */
private Map getConfigVars(){
  HashMap configVars=new HashMap();
  String configFileName=getConfigFileName(this.getFileUri());
  if (configFileName == null)   return configVars;
  ReportDesignHandle handle=null;
  try {
    SessionHandle sessionHandle=SessionHandleAdapter.getInstance().getSessionHandle();
    File configFile=new File(configFileName);
    if (configFile != null && configFile.exists() && configFile.isFile()) {
      handle=sessionHandle.openDesign(configFileName);
      if (handle != null) {
        Iterator it=handle.configVariablesIterator();
        while (it != null && it.hasNext()) {
          ConfigVariableHandle configVar=(ConfigVariableHandle)it.next();
          if (configVar != null && configVar.getName() != null) {
            String paramName=getParameterName(configVar.getName());
            if (paramName != null && paramName.length() > 0) {
              configVars.put(paramName,configVar.getValue());
            }
          }
        }
        handle.close();
      }
    }
  }
 catch (  DesignFileException e) {
    e.printStackTrace();
    try {
      if (handle != null) {
        handle.close();
      }
    }
 catch (    Exception e1) {
      e1.printStackTrace();
    }
  }
  return configVars;
}
Program: 77967
Project: 77967
Buggy source:
/** 
 * get parameter object.
 * @param request HttpServletRequest
 * @param parameter ScalarParameterHandle
 * @return
 */
protected String getParamValueAsString(HttpServletRequest request,ScalarParameterHandle parameter){
  String paramName=parameter.getName();
  String paramValue=null;
  if (ParameterAccessor.isReportParameterExist(request,paramName)) {
    paramValue=ParameterAccessor.getReportParameter(request,paramName,null);
  }
  if (paramValue != null)   return paramValue;
  Object paramValueObj=null;
  if (isDesigner && IBirtConstants.SERVLET_PATH_RUN.equalsIgnoreCase(request.getServletPath()) && this.configMap != null && this.configMap.containsKey(paramName)) {
    paramValueObj=this.configMap.get(paramName);
  }
 else   if (this.parameterMap != null && this.parameterMap.containsKey(paramName)) {
    paramValueObj=this.parameterMap.get(paramName);
    paramValueObj=ParameterValidationUtil.getDisplayValue(null,parameter.getPattern(),paramValueObj,locale);
  }
  if (paramValueObj != null)   paramValue=paramValueObj.toString();
  return paramValue;
}

Fixed version (ground truth):
/** 
 * get parameter object.
 * @param request HttpServletRequest
 * @param parameter ScalarParameterHandle
 * @return
 */
protected String getParamValueAsString(HttpServletRequest request,ScalarParameterHandle parameter){
  String paramName=parameter.getName();
  String paramValue=null;
  if (ParameterAccessor.isReportParameterExist(request,paramName)) {
    paramValue=ParameterAccessor.getReportParameter(request,paramName,null);
  }
  if (paramValue != null)   return paramValue;
  Object paramValueObj=null;
  if (isDesigner && (IBirtConstants.SERVLET_PATH_RUN.equalsIgnoreCase(request.getServletPath()) || IBirtConstants.SERVLET_PATH_PARAMETER.equalsIgnoreCase(request.getServletPath())) && this.configMap != null && this.configMap.containsKey(paramName)) {
    paramValueObj=this.configMap.get(paramName);
  }
 else   if (this.parameterMap != null && this.parameterMap.containsKey(paramName)) {
    paramValueObj=this.parameterMap.get(paramName);
    paramValueObj=ParameterValidationUtil.getDisplayValue(null,parameter.getPattern(),paramValueObj,locale);
  }
  if (paramValueObj != null)   paramValue=paramValueObj.toString();
  return paramValue;
}
Program: 77968
Project: 77968
Buggy source:
public void end() throws SAXException {
  if (StringUtil.compareVersion(handler.getVersion(),"String_Node_Str") >= 0) {
    super.end();
    return;
  }
  try {
    element.initializeReportItem(handler.module);
  }
 catch (  ExtendedElementException e) {
    return;
  }
  Object reportItem=element.getExtendedElement();
  if (reportItem != null && reportItem instanceof ICompatibleReportItem) {
    List jsExprs=((ICompatibleReportItem)reportItem).getRowExpressions();
    Map updatedExprs=handleJavaExpression(jsExprs);
    ((ICompatibleReportItem)reportItem).updateRowExpressions(updatedExprs);
  }
  super.end();
}

Fixed version (ground truth):
public void end() throws SAXException {
  if (StringUtil.compareVersion(handler.getVersion(),"String_Node_Str") >= 0) {
    super.end();
    return;
  }
  try {
    element.initializeReportItem(handler.module);
  }
 catch (  ExtendedElementException e) {
    return;
  }
  Object reportItem=element.getExtendedElement();
  if (reportItem != null && reportItem instanceof ICompatibleReportItem) {
    List jsExprs=((ICompatibleReportItem)reportItem).getRowExpressions();
    Map updatedExprs=DataBoundColumnUtil.handleJavaExpression(jsExprs,element,handler.module,handler.tempValue);
    ((ICompatibleReportItem)reportItem).updateRowExpressions(updatedExprs);
  }
  super.end();
}
Program: 77969
Project: 77969
Buggy source:
public void end() throws SAXException {
  super.end();
  if (StringUtil.compareVersion(handler.getVersion(),"String_Node_Str") >= 0)   return;
  String content=(String)element.getLocalProperty(handler.getModule(),TextItem.CONTENT_PROP);
  if (StringUtil.isBlank(content))   return;
  List jsExprs=DataBoundColumnUtil.getExpressions(content,element,handler.getModule());
  updateExpressions(content,DataBoundColumnUtil.handleJavaExpression(jsExprs,element,handler.getModule()));
}

Fixed version (ground truth):
public void end() throws SAXException {
  super.end();
  if (StringUtil.compareVersion(handler.getVersion(),"String_Node_Str") >= 0)   return;
  String content=(String)element.getLocalProperty(handler.getModule(),TextItem.CONTENT_PROP);
  if (StringUtil.isBlank(content))   return;
  List jsExprs=DataBoundColumnUtil.getExpressions(content,element,handler.getModule());
  updateExpressions(content,DataBoundColumnUtil.handleJavaExpression(jsExprs,element,handler.getModule(),handler.tempValue));
}
Program: 77970
Project: 77970
Buggy source:
/** 
 * Creates bound columns for the text.
 * @param element the text
 * @param module the root of the text
 */
protected void dealText(TextItem element,Module module){
  dealReportItem(element,module);
  String content=(String)element.getLocalProperty(module,TextItem.CONTENT_PROP);
  if (StringUtil.isBlank(content))   return;
  List jsExprs=DataBoundColumnUtil.getExpressions(content,element,module);
  DataBoundColumnUtil.handleJavaExpression(jsExprs,element,module);
}

Fixed version (ground truth):
/** 
 * Creates bound columns for the text.
 * @param element the text
 * @param module the root of the text
 */
protected void dealText(TextItem element,Module module){
  dealReportItem(element,module);
  String content=(String)element.getLocalProperty(module,TextItem.CONTENT_PROP);
  if (StringUtil.isBlank(content))   return;
  List jsExprs=DataBoundColumnUtil.getExpressions(content,element,module);
  DataBoundColumnUtil.handleJavaExpression(jsExprs,element,module,null);
}
Program: 77971
Project: 77971
Buggy source:
/** 
 * Creates bound columns for extended item.
 * @param element the extended item
 * @param module the root of the report item
 */
protected void dealExtendedItem(ExtendedItem element,Module module){
  dealReportItem(element,module);
  List values=(List)element.getLocalProperty(module,ExtendedItem.FILTER_PROP);
  if (!(values == null || values.size() < 1)) {
    for (int i=0; i < values.size(); i++) {
      FilterCondition struct=(FilterCondition)values.get(i);
      handleBoundsForValue(element,module,struct.getExpr());
      handleBoundsForValue(element,module,struct.getValue1());
      handleBoundsForValue(element,module,struct.getValue2());
    }
  }
  Object reportItem=element.getExtendedElement();
  if (reportItem != null && reportItem instanceof ICompatibleReportItem) {
    List jsExprs=((ICompatibleReportItem)reportItem).getRowExpressions();
    for (int i=0; i < jsExprs.size(); i++)     handleBoundsForValue(element,module,(String)jsExprs.get(i));
    Map updatedExprs=DataBoundColumnUtil.handleJavaExpression(jsExprs,element,module);
    ((ICompatibleReportItem)reportItem).updateRowExpressions(updatedExprs);
  }
}

Fixed version (ground truth):
/** 
 * Creates bound columns for extended item.
 * @param element the extended item
 * @param module the root of the report item
 */
protected void dealExtendedItem(ExtendedItem element,Module module){
  dealReportItem(element,module);
  List values=(List)element.getLocalProperty(module,ExtendedItem.FILTER_PROP);
  if (!(values == null || values.size() < 1)) {
    for (int i=0; i < values.size(); i++) {
      FilterCondition struct=(FilterCondition)values.get(i);
      handleBoundsForValue(element,module,struct.getExpr());
      handleBoundsForValue(element,module,struct.getValue1());
      handleBoundsForValue(element,module,struct.getValue2());
    }
  }
  Object reportItem=element.getExtendedElement();
  if (reportItem != null && reportItem instanceof ICompatibleReportItem) {
    List jsExprs=((ICompatibleReportItem)reportItem).getRowExpressions();
    for (int i=0; i < jsExprs.size(); i++)     handleBoundsForValue(element,module,(String)jsExprs.get(i));
    Map updatedExprs=DataBoundColumnUtil.handleJavaExpression(jsExprs,element,module,null);
    ((ICompatibleReportItem)reportItem).updateRowExpressions(updatedExprs);
  }
}
Program: 77972
Project: 77972
Buggy source:
/** 
 * Initializes the report design when it is just created. <p> Set the value to the properties on repot design element which need the initialize valuel. All initialize operations will not go into the command stack and can not be undo redo.
 * @param properties the property name value pairs.Those properties in the map are which need to be initialized.
 * @throws SemanticException SemamticException will throw out when the give properties map contians invlid property name or property value.
 * @deprecated
 */
public void initializeModule(Map properties) throws SemanticException {
  if (isInitialized)   return;
  String name=null;
  Object value=null;
  Module module=(Module)getElement();
  Set propNames=properties.keySet();
  Iterator itre=propNames.iterator();
  while (itre.hasNext()) {
    name=(String)itre.next();
    value=PropertyValueValidationUtil.validateProperty(this,name,properties.get(name));
    module.setProperty(name,value);
  }
  isInitialized=true;
}

Fixed version (ground truth):
/** 
 * Initializes the report design when it is just created. <p> Set the value to the properties on repot design element which need the initialize valuel. All initialize operations will not go into the command stack and can not be undo redo.
 * @param properties the property name value pairs.Those properties in the map are which need to be initialized.
 * @throws SemanticException SemamticException will throw out when the give properties map contians invlid property name or property value.
 * @deprecated
 */
public void initializeModule(Map properties) throws SemanticException {
  if (isInitialized)   return;
  String name=null;
  Object value=null;
  Module root=(Module)getElement();
  Set propNames=properties.keySet();
  Iterator itre=propNames.iterator();
  while (itre.hasNext()) {
    name=(String)itre.next();
    value=PropertyValueValidationUtil.validateProperty(this,name,properties.get(name));
    root.setProperty(name,value);
  }
  isInitialized=true;
}
Program: 77973
Project: 77973
Buggy source:
/** 
 * Especially used for sub query
 * @param resultCache
 * @param odiAdpater
 * @param query
 * @param startIndex
 * @param endIndex
 * @param rsMeta
 * @param sortSpec
 * @throws DataException
 */
private void initInstance2(CacheRequest cacheRequest,ResultSetCache resultCache,OdiAdapter odiAdpater,int startIndex,int endIndex,IResultClass rsMeta) throws DataException {
  int length=endIndex - startIndex;
  if (cacheRequest.getMaxRow() == 0 || length <= cacheRequest.getMaxRow())   cacheRequest.setMaxRow(length);
  int oldIndex=resultCache.getCurrentIndex();
  resultCache.moveTo(startIndex - 1);
  initInstance(cacheRequest,odiAdpater,rsMeta);
  resultCache.moveTo(oldIndex);
}

Fixed version (ground truth):
/** 
 * Especially used for sub query
 * @param resultCache
 * @param odiAdpater
 * @param query
 * @param startIndex
 * @param endIndex
 * @param rsMeta
 * @param sortSpec
 * @throws DataException
 */
private void initInstance2(CacheRequest cacheRequest,ResultSetCache resultCache,OdiAdapter odiAdpater,int startIndex,int endIndex,IResultClass rsMeta) throws DataException {
  int length=endIndex - startIndex;
  if (cacheRequest.getMaxRow() <= 0 || length <= cacheRequest.getMaxRow())   cacheRequest.setMaxRow(length);
  int oldIndex=resultCache.getCurrentIndex();
  resultCache.moveTo(startIndex - 1);
  initInstance(cacheRequest,odiAdpater,rsMeta);
  resultCache.moveTo(oldIndex);
}
Program: 77974
Project: 77974
Buggy source:
/** 
 * Sets the theme with the given element reference value. Call this method when the theme name or theme element has been validated. Otherwise, uses  {@link #setStyle(String)} or {@link #setStyleElement(Theme)}.
 * @param refValue the validated reference value
 * @throws StyleException if the style is not found.
 */
protected void setStyleRefValue(ElementRefValue refValue) throws StyleException {
  if (refValue == null && element.getStyle() == null)   return;
  doSetStyleRefValue(refValue);
}

Fixed version (ground truth):
/** 
 * Sets the theme with the given element reference value. Call this method when the theme name or theme element has been validated. Otherwise, uses  {@link #setStyle(String)} or {@link #setStyleElement(Theme)}.
 * @param refValue the validated reference value
 * @throws StyleException if the style is not found.
 */
protected void setStyleRefValue(ElementRefValue refValue) throws StyleException {
  if (refValue == null) {
    if ((element instanceof StyledElement) && (((StyledElement)element).getStyleName() == null)) {
      return;
    }
  }
  doSetStyleRefValue(refValue);
}
Program: 77975
Project: 77975
Buggy source:
/** 
 * Returns the localized text for the label. If the localized text for the text resource key is found, it will be returned. Otherwise, the static text will be returned.
 * @return the localized text for the label
 */
public String getDisplayText(){
  String textKey=getStringProperty(Label.TEXT_ID_PROP);
  if (!StringUtil.isBlank(textKey)) {
    String localizedText=getModule().getMessage(textKey);
    if (!StringUtil.isBlank(localizedText))     return localizedText;
  }
  return getStringProperty(Label.TEXT_PROP);
}

Fixed version (ground truth):
/** 
 * Returns the localized text for the label. If the localized text for the text resource key is found, it will be returned. Otherwise, the static text will be returned.
 * @return the localized text for the label
 */
public String getDisplayText(){
  return getExternalizedValue(Label.TEXT_ID_PROP,Label.TEXT_PROP);
}
Program: 77976
Project: 77976
Buggy source:
/** 
 * Returns the localized description for the module. If the localized description for the description resource key is found, it will be returned. Otherwise, the static description will be returned.
 * @return the localized description for the module
 */
public String getDisplayDescription(){
  String textKey=getStringProperty(Module.DESCRIPTION_ID_PROP);
  if (!StringUtil.isBlank(textKey)) {
    String localizedText=getModule().getMessage(textKey);
    if (!StringUtil.isBlank(localizedText))     return localizedText;
  }
  return getStringProperty(Module.DESCRIPTION_PROP);
}

Fixed version (ground truth):
/** 
 * Returns the localized description for the module. If the localized description for the description resource key is found, it will be returned. Otherwise, the static description will be returned.
 * @return the localized description for the module
 */
public String getDisplayDescription(){
  return getExternalizedValue(Module.DESCRIPTION_ID_PROP,Module.DESCRIPTION_PROP);
}
Program: 77977
Project: 77977
Buggy source:
/** 
 * Returns the localized text for prompt text. If the localized text for the text resource key is found, it will be returned. Otherwise, the static text will be returned.
 * @return the localized text for the prompt text
 */
public String getDisplayPromptText(){
  String textKey=getStringProperty(IScalarParameterModel.PROMPT_TEXT_ID_PROP);
  if (!StringUtil.isBlank(textKey)) {
    String localizedText=getModule().getMessage(textKey);
    if (!StringUtil.isBlank(localizedText))     return localizedText;
  }
  return getStringProperty(IScalarParameterModel.PROMPT_TEXT_PROP);
}

Fixed version (ground truth):
/** 
 * Returns the localized text for prompt text. If the localized text for the text resource key is found, it will be returned. Otherwise, the static text will be returned.
 * @return the localized text for the prompt text
 */
public String getDisplayPromptText(){
  return getExternalizedValue(IScalarParameterModel.PROMPT_TEXT_ID_PROP,IScalarParameterModel.PROMPT_TEXT_PROP);
}
Program: 77978
Project: 77978
Buggy source:
/** 
 * Returns the localized description for the template parameter definition. If the localized description for the description resource key is found, it will be returned. Otherwise, the static description will be returned.
 * @return the localized description for the template parameter definition
 */
public String getDisplayDescription(){
  String textKey=getStringProperty(ITemplateParameterDefinitionModel.DESCRIPTION_ID_PROP);
  if (!StringUtil.isBlank(textKey)) {
    String localizedText=getModule().getMessage(textKey);
    if (!StringUtil.isBlank(localizedText))     return localizedText;
  }
  return getDescription();
}

Fixed version (ground truth):
/** 
 * Returns the localized description for the template parameter definition. If the localized description for the description resource key is found, it will be returned. Otherwise, the static description will be returned.
 * @return the localized description for the template parameter definition
 */
public String getDisplayDescription(){
  return getExternalizedValue(ITemplateParameterDefinitionModel.DESCRIPTION_ID_PROP,ITemplateParameterDefinitionModel.DESCRIPTION_PROP);
}