Program: 77874
Project: 77874
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) {
      Iterator parameters=parameterList.iterator();
      while (parameters != null && parameters.hasNext()) {
        Object parameterHandle=parameters.next();
        if (parameterHandle instanceof ScalarParameterHandle) {
          ScalarParameterHandle scalarParameterHandle=(ScalarParameterHandle)parameterHandle;
          if (scalarParameterHandle.getName() != null)           this.configMap.put(scalarParameterHandle.getName(),null);
        }
      }
      Iterator configVars=handle.configVariablesIterator();
      while (configVars != null && configVars.hasNext()) {
        ConfigVariableHandle configVar=(ConfigVariableHandle)configVars.next();
        if (configVar != null && configVar.getName() != null) {
          String paramName=getParameterName(configVar.getName());
          String paramValue=configVar.getValue();
          ScalarParameterHandle parameter=(ScalarParameterHandle)findParameter(paramName);
          if (paramValue != null && parameter != null) {
            try {
              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) {
      Iterator parameters=parameterList.iterator();
      while (parameters != null && parameters.hasNext()) {
        Object parameterHandle=parameters.next();
        if (parameterHandle instanceof ScalarParameterHandle) {
          ScalarParameterHandle scalarParameterHandle=(ScalarParameterHandle)parameterHandle;
          if (scalarParameterHandle.getName() != null)           this.configMap.put(scalarParameterHandle.getName(),null);
        }
      }
      Iterator configVars=handle.configVariablesIterator();
      while (configVars != null && configVars.hasNext()) {
        ConfigVariableHandle configVar=(ConfigVariableHandle)configVars.next();
        if (configVar != null && configVar.getName() != null) {
          String paramName=getParameterName(configVar.getName());
          String paramValue=configVar.getValue();
          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) {
    }
  }
}