Program: 73886
Project: 73886
Buggy source:
/** 
 * process tag function
 * @throws Exception
 */
protected void __process() throws Exception {
  if (viewer == null)   return;
  HttpServletRequest request=(HttpServletRequest)pageContext.getRequest();
  this.locale=BirtTagUtil.getLocale(request,viewer.getLocale());
  this.options=new InputOptions();
  options.setOption(InputOptions.OPT_REQUEST,request);
  options.setOption(InputOptions.OPT_LOCALE,this.locale);
  options.setOption(InputOptions.OPT_RTL,Boolean.valueOf(viewer.getRtl()));
  Collection paramDefList=viewer.getParameterDefList();
  if (paramDefList == null) {
    BirtReportServiceFactory.getReportService().setContext(pageContext.getServletContext(),options);
    IViewerReportDesignHandle designHandle=BirtTagUtil.getDesignHandle(request,viewer);
    viewer.setReportDesignHandle(designHandle);
    paramDefList=BirtReportServiceFactory.getReportService().getParameterDefinitions(designHandle,options,false);
    viewer.setParameterDefList(paramDefList);
  }
  this.paramDef=BirtUtility.findParameterDefinition(paramDefList,param.getName());
  if (paramDef == null)   return;
  String dataType=ParameterDataTypeConverter.ConvertDataType(paramDef.getDataType());
  this.pattern=param.getPattern();
  if (this.pattern == null)   this.pattern=paramDef.getPattern();
  if ("String_Node_Str".equalsIgnoreCase(param.getIsLocale()))   this.isLocale=true;
  if (param.getValue() != null) {
    if (param.getValue() instanceof String) {
      Object valueObj=DataUtil.validateWithPattern(param.getName(),dataType,this.pattern,(String)param.getValue(),locale,isLocale);
      if (this.paramDef.isMultiValue())       param.setValue(new Object[]{valueObj});
 else       param.setValue(valueObj);
    }
 else     if (this.paramDef.isMultiValue() && param.getValue() instanceof String[]) {
      String[] sValues=(String[])param.getValue();
      Object[] values=new Object[sValues.length];
      for (int i=0; i < sValues.length; i++) {
        Object valueObj=DataUtil.validateWithPattern(param.getName(),dataType,this.pattern,sValues[i],locale,isLocale);
        values[i]=valueObj;
      }
      param.setValue(values);
    }
  }
 else {
    Object defaultValue=BirtReportServiceFactory.getReportService().getParameterDefaultValue(viewer.getReportDesignHandle(),param.getName(),options);
    if (this.paramDef.isMultiValue())     param.setValue(new Object[]{defaultValue});
 else     param.setValue(defaultValue);
  }
  if (this.paramDef.isMultiValue()) {
    this.valueStringList=new ArrayList();
    Object[] values=(Object[])param.getValue();
    if (values != null) {
      for (int i=0; i < values.length; i++) {
        String value=DataUtil.getDisplayValue(values[i]);
        this.valueStringList.add(value);
      }
    }
  }
 else {
    this.valueString=DataUtil.getDisplayValue(param.getValue());
    if (this.valueString == null)     this.valueString="String_Node_Str";
  }
  this.displayTextString=param.getDisplayText();
  if (this.displayTextString == null) {
    Object obj=param.getValue();
    if (obj != null) {
      if (obj instanceof Object[]) {
        Object[] objs=(Object[])obj;
        if (objs.length > 0)         obj=objs[0];
 else         obj=null;
      }
      this.displayTextString=ParameterValidationUtil.getDisplayValue(dataType,this.pattern,obj,locale);
    }
  }
  if (this.displayTextString == null)   this.displayTextString="String_Node_Str";
  if (param.getTitle() == null)   param.setTitle(this.displayTextString);
  requesterTag.addParameter(param.getName(),param.getValue());
  if (paramDef.isHidden()) {
    __handleHidden();
  }
 else {
switch (paramDef.getControlType()) {
case IScalarParameterDefn.TEXT_BOX:
      __handleTextBox();
    break;
case IScalarParameterDefn.LIST_BOX:
  __handleListBox();
break;
case IScalarParameterDefn.RADIO_BUTTON:
__handleRadioButton();
break;
case IScalarParameterDefn.CHECK_BOX:
__handleCheckBox();
break;
default :
break;
}
}
}

Fixed version (ground truth):
/** 
 * process tag function
 * @throws Exception
 */
protected void __process() throws Exception {
  if (viewer == null)   return;
  HttpServletRequest request=(HttpServletRequest)pageContext.getRequest();
  this.locale=BirtTagUtil.getLocale(request,viewer.getLocale());
  this.options=new InputOptions();
  options.setOption(InputOptions.OPT_REQUEST,request);
  options.setOption(InputOptions.OPT_LOCALE,this.locale);
  options.setOption(InputOptions.OPT_RTL,Boolean.valueOf(viewer.getRtl()));
  Collection paramDefList=viewer.getParameterDefList();
  if (paramDefList == null) {
    BirtReportServiceFactory.getReportService().setContext(pageContext.getServletContext(),options);
    IViewerReportDesignHandle designHandle=BirtTagUtil.getDesignHandle(request,viewer);
    viewer.setReportDesignHandle(designHandle);
    paramDefList=BirtReportServiceFactory.getReportService().getParameterDefinitions(designHandle,options,false);
    viewer.setParameterDefList(paramDefList);
  }
  this.paramDef=BirtUtility.findParameterDefinition(paramDefList,param.getName());
  if (paramDef == null)   return;
  String dataType=ParameterDataTypeConverter.ConvertDataType(paramDef.getDataType());
  this.pattern=param.getPattern();
  if (this.pattern == null)   this.pattern=paramDef.getPattern();
  if ("String_Node_Str".equalsIgnoreCase(param.getIsLocale()))   this.isLocale=true;
 else   this.isLocale=false;
  if (param.getValue() != null) {
    if (param.getValue() instanceof String) {
      Object valueObj=DataUtil.validateWithPattern(param.getName(),dataType,this.pattern,(String)param.getValue(),locale,isLocale);
      if (this.paramDef.isMultiValue())       param.setValue(new Object[]{valueObj});
 else       param.setValue(valueObj);
    }
 else     if (this.paramDef.isMultiValue() && param.getValue() instanceof String[]) {
      String[] sValues=(String[])param.getValue();
      Object[] values=new Object[sValues.length];
      for (int i=0; i < sValues.length; i++) {
        Object valueObj=DataUtil.validateWithPattern(param.getName(),dataType,this.pattern,sValues[i],locale,isLocale);
        values[i]=valueObj;
      }
      param.setValue(values);
    }
  }
 else {
    Object defaultValue=BirtReportServiceFactory.getReportService().getParameterDefaultValue(viewer.getReportDesignHandle(),param.getName(),options);
    if (this.paramDef.isMultiValue())     param.setValue(new Object[]{defaultValue});
 else     param.setValue(defaultValue);
  }
  if (this.paramDef.isMultiValue()) {
    this.valueStringList=new ArrayList();
    Object[] values=(Object[])param.getValue();
    if (values != null) {
      for (int i=0; i < values.length; i++) {
        String value=DataUtil.getDisplayValue(values[i]);
        this.valueStringList.add(value);
      }
    }
  }
 else {
    this.valueString=DataUtil.getDisplayValue(param.getValue());
    if (this.valueString == null)     this.valueString="String_Node_Str";
  }
  this.displayTextString=param.getDisplayText();
  if (this.displayTextString == null) {
    Object obj=param.getValue();
    if (obj != null) {
      if (obj instanceof Object[]) {
        Object[] objs=(Object[])obj;
        if (objs.length > 0)         obj=objs[0];
 else         obj=null;
      }
      this.displayTextString=ParameterValidationUtil.getDisplayValue(dataType,this.pattern,obj,locale);
    }
  }
  if (this.displayTextString == null)   this.displayTextString="String_Node_Str";
  if (param.getTitle() == null)   param.setTitle(this.displayTextString);
  requesterTag.addParameter(param.getName(),param.getValue());
  if (paramDef.isHidden()) {
    __handleHidden();
  }
 else {
switch (paramDef.getControlType()) {
case IScalarParameterDefn.TEXT_BOX:
      __handleTextBox();
    break;
case IScalarParameterDefn.LIST_BOX:
  __handleListBox();
break;
case IScalarParameterDefn.RADIO_BUTTON:
__handleRadioButton();
break;
case IScalarParameterDefn.CHECK_BOX:
__handleCheckBox();
break;
default :
break;
}
}
}