Program: 77457
Project: 77457
Buggy source:
/** 
 * parse paramenters from config file.
 * @param request HttpServletRequest
 * @return
 */
protected void parseConfigVars(HttpServletRequest request,Collection parameterList){
  this.configMap=new HashMap();
  String reportConfigName=ParameterAccessor.getConfigFileName(this.reportDesignName);
  if (reportConfigName == null)   return;
  SessionHandle sessionHandle=DesignEngine.newSession(ULocale.US);
  ReportDesignHandle handle=null;
  try {
    handle=sessionHandle.openDesign(reportConfigName);
    if (handle != null) {
      String displayTextParam=null;
      Iterator configVars=handle.configVariablesIterator();
      while (configVars != null && configVars.hasNext()) {
        ConfigVariableHandle configVar=(ConfigVariableHandle)configVars.next();
        if (configVar != null && configVar.getName() != null) {
          String paramName=configVar.getName();
          String paramValue=configVar.getValue();
          if (paramName.equalsIgnoreCase(ParameterAccessor.PARAM_ISNULL) && paramValue != null) {
            String nullParamName=getParameterName(paramValue);
            if (nullParamName != null)             this.configMap.put(nullParamName,null);
            continue;
          }
 else           if ((displayTextParam=ParameterAccessor.isDisplayText(paramName)) != null) {
            paramName=getParameterName(displayTextParam);
            if (paramName != null) {
              if (this.displayTexts == null)               this.displayTexts=new HashMap();
              this.displayTexts.put(paramName,paramValue);
            }
            continue;
          }
          paramName=getParameterName(paramName);
          ScalarParameterHandle parameter=(ScalarParameterHandle)findParameter(paramName);
          if (paramValue != null && parameter != null) {
            try {
              if (!DesignChoiceConstants.PARAM_TYPE_STRING.equalsIgnoreCase(parameter.getDataType())) {
                Object paramValueObj=ParameterValidationUtil.validate(parameter.getDataType(),parameter.getPattern(),paramValue,ULocale.US);
                paramValue=ParameterValidationUtil.getDisplayValue(parameter.getDataType(),parameter.getPattern(),paramValueObj,locale);
              }
            }
 catch (            Exception err) {
              paramValue=configVar.getValue();
            }
            this.configMap.put(paramName,paramValue);
          }
        }
      }
      handle.close();
    }
  }
 catch (  Exception e) {
    try {
      if (handle != null)       handle.close();
    }
 catch (    Exception err) {
    }
  }
}

Fixed version (ground truth):
/** 
 * parse paramenters from config file.
 * @param request HttpServletRequest
 * @return
 */
protected void parseConfigVars(HttpServletRequest request,Collection parameterList){
  this.configMap=new HashMap();
  String reportConfigName=ParameterAccessor.getConfigFileName(this.reportDesignName);
  if (reportConfigName == null)   return;
  SessionHandle sessionHandle=DesignEngine.newSession(ULocale.US);
  ReportDesignHandle handle=null;
  try {
    handle=sessionHandle.openDesign(reportConfigName);
    if (handle != null) {
      String displayTextParam=null;
      Iterator configVars=handle.configVariablesIterator();
      while (configVars != null && configVars.hasNext()) {
        ConfigVariableHandle configVar=(ConfigVariableHandle)configVars.next();
        if (configVar != null && configVar.getName() != null) {
          String paramName=configVar.getName();
          String paramValue=configVar.getValue();
          if (paramName.equalsIgnoreCase(ParameterAccessor.PARAM_ISNULL) && paramValue != null) {
            String nullParamName=getParameterName(paramValue);
            if (nullParamName != null)             this.configMap.put(nullParamName,null);
            continue;
          }
 else           if ((displayTextParam=ParameterAccessor.isDisplayText(paramName)) != null) {
            paramName=getParameterName(displayTextParam);
            if (paramName != null) {
              if (this.displayTexts == null)               this.displayTexts=new HashMap();
              this.displayTexts.put(paramName,paramValue);
            }
            continue;
          }
          paramName=getParameterName(paramName);
          ScalarParameterHandle parameter=(ScalarParameterHandle)findParameter(paramName);
          if (paramValue != null && parameter != null) {
            String typeVarName=configVar.getName() + "String_Node_Str" + IBirtConstants.PROP_TYPE;
            ConfigVariable typeVar=handle.findConfigVariable(typeVarName);
            String dataType=null;
            if (typeVar != null)             dataType=typeVar.getValue();
            if (dataType == null || !dataType.equalsIgnoreCase(parameter.getDataType())) {
              continue;
            }
            try {
              if (!DesignChoiceConstants.PARAM_TYPE_STRING.equalsIgnoreCase(parameter.getDataType())) {
                Object paramValueObj=ParameterValidationUtil.validate(parameter.getDataType(),parameter.getPattern(),paramValue,ULocale.US);
                paramValue=ParameterValidationUtil.getDisplayValue(parameter.getDataType(),parameter.getPattern(),paramValueObj,locale);
              }
            }
 catch (            Exception err) {
              paramValue=configVar.getValue();
            }
            this.configMap.put(paramName,paramValue);
          }
        }
      }
      handle.close();
    }
  }
 catch (  Exception e) {
    try {
      if (handle != null)       handle.close();
    }
 catch (    Exception err) {
    }
  }
}