Program: 74584
Project: 74584
Buggy source:
/** 
 * Initial the parameters class. Web.xml is in UTF-8 format. No need to do encoding convertion.
 * @param context Servlet Context
 */
public synchronized static void initParameters(ServletContext context){
  if (isInitContext)   return;
  boolean isDesigner=false;
  if ("String_Node_Str".equalsIgnoreCase(System.getProperty(IBirtConstants.SYS_PROP_BIRT_ISDESIGNER)))   isDesigner=true;
  String workingPath="String_Node_Str" + IBirtConstants.SYS_PROP_WORKING_PATH + "String_Node_Str";
  workingFolder=processWorkingFolder(context,context.getInitParameter(INIT_PARAM_WORKING_DIR));
  String initDocumentFolder=context.getInitParameter(INIT_PARAM_DOCUMENT_FOLDER);
  if (isDesigner && initDocumentFolder == null)   initDocumentFolder=workingPath + IBirtConstants.DEFAULT_DOCUMENT_FOLDER;
  documentFolder=processRealPath(context,initDocumentFolder,IBirtConstants.DEFAULT_DOCUMENT_FOLDER,true);
  String initImageFolder=context.getInitParameter(ParameterAccessor.INIT_PARAM_IMAGE_DIR);
  if (isDesigner && initImageFolder == null)   initImageFolder=workingPath + IBirtConstants.DEFAULT_IMAGE_FOLDER;
  imageFolder=processRealPath(context,initImageFolder,IBirtConstants.DEFAULT_IMAGE_FOLDER,true);
  String initLogFolder=context.getInitParameter(ParameterAccessor.INIT_PARAM_LOG_DIR);
  if (isDesigner && initLogFolder == null)   initLogFolder=workingPath + IBirtConstants.DEFAULT_LOGS_FOLDER;
  logFolder=processRealPath(context,initLogFolder,IBirtConstants.DEFAULT_LOGS_FOLDER,true);
  logLevel=context.getInitParameter(ParameterAccessor.INIT_PARAM_LOG_LEVEL);
  if (logLevel == null)   logLevel=IBirtConstants.DEFAULT_LOGS_LEVEL;
  String initScriptlibFolder=context.getInitParameter(ParameterAccessor.INIT_PARAM_SCRIPTLIB_DIR);
  if (isDesigner && initScriptlibFolder == null)   initScriptlibFolder=workingPath + IBirtConstants.DEFAULT_SCRIPTLIB_FOLDER;
  scriptLibDir=processRealPath(context,initScriptlibFolder,IBirtConstants.DEFAULT_SCRIPTLIB_FOLDER,false);
  webAppLocale=getLocaleFromString(context.getInitParameter(INIT_PARAM_LOCALE));
  if (webAppLocale == null)   webAppLocale=Locale.getDefault();
  isWorkingFolderAccessOnly=Boolean.valueOf(context.getInitParameter(INIT_PARAM_WORKING_FOLDER_ACCESS_ONLY)).booleanValue();
  String s_maxRows=context.getInitParameter(INIT_PARAM_VIEWER_MAXROWS);
  try {
    maxRows=Integer.valueOf(s_maxRows).intValue();
  }
 catch (  NumberFormatException e) {
    maxRows=-1;
  }
  String s_maxLevels=context.getInitParameter(INIT_PARAM_VIEWER_MAXCUBELEVELS);
  try {
    maxCubeLevels=Integer.valueOf(s_maxLevels).intValue();
  }
 catch (  NumberFormatException e) {
    maxCubeLevels=-1;
  }
  String s_cubeMemSize=context.getInitParameter(INIT_PARAM_VIEWER_CUBEMEMSIZE);
  try {
    cubeMemorySize=Integer.valueOf(s_cubeMemSize).intValue();
  }
 catch (  NumberFormatException e) {
    cubeMemorySize=0;
  }
  birtResourceFolder=processRealPath(context,context.getInitParameter(INIT_PARAM_BIRT_RESOURCE_PATH),null,false);
  String s_overwrite=DataUtil.trimString(context.getInitParameter(INIT_PARAM_OVERWRITE_DOCUMENT));
  if ("String_Node_Str".equalsIgnoreCase(s_overwrite)) {
    isOverWrite=true;
  }
 else {
    isOverWrite=false;
  }
  initProps=initViewerProps(context,initProps);
  if (loggers == null) {
    loggers=new HashMap();
  }
  for (Iterator i=initProps.keySet().iterator(); i.hasNext(); ) {
    String name=(String)i.next();
    if (name.startsWith("String_Node_Str")) {
      String loggerName=name.replaceFirst("String_Node_Str","String_Node_Str");
      String levelName=(String)initProps.get(name);
      loggers.put(loggerName,levelName);
      i.remove();
    }
  }
  String flag=DataUtil.trimString(context.getInitParameter(INIT_PARAM_PRINT_SERVERSIDE));
  if (IBirtConstants.VAR_ON.equalsIgnoreCase(flag)) {
    isSupportedPrintOnServer=true;
  }
 else   if (IBirtConstants.VAR_OFF.equalsIgnoreCase(flag)) {
    isSupportedPrintOnServer=false;
  }
  String s_agentstyle=context.getInitParameter(INIT_PARAM_AGENTSTYLE_ENGINE);
  if ("String_Node_Str".equalsIgnoreCase(s_agentstyle)) {
    isAgentStyle=true;
  }
 else {
    isAgentStyle=false;
  }
  clearTempFiles();
  isInitContext=true;
}

Fixed version (ground truth):
/** 
 * Initial the parameters class. Web.xml is in UTF-8 format. No need to do encoding convertion.
 * @param context Servlet Context
 */
public synchronized static void initParameters(ServletContext context){
  if (isInitContext)   return;
  boolean isDesigner=false;
  if ("String_Node_Str".equalsIgnoreCase(System.getProperty(IBirtConstants.SYS_PROP_BIRT_ISDESIGNER)))   isDesigner=true;
  String workingPath="String_Node_Str" + IBirtConstants.SYS_PROP_WORKING_PATH + "String_Node_Str";
  workingFolder=processWorkingFolder(context,context.getInitParameter(INIT_PARAM_WORKING_DIR));
  String initDocumentFolder=context.getInitParameter(INIT_PARAM_DOCUMENT_FOLDER);
  if (isDesigner && initDocumentFolder == null)   initDocumentFolder=workingPath + IBirtConstants.DEFAULT_DOCUMENT_FOLDER;
  documentFolder=processRealPath(context,initDocumentFolder,IBirtConstants.DEFAULT_DOCUMENT_FOLDER,true);
  String initImageFolder=context.getInitParameter(ParameterAccessor.INIT_PARAM_IMAGE_DIR);
  if (isDesigner && initImageFolder == null)   initImageFolder=workingPath + IBirtConstants.DEFAULT_IMAGE_FOLDER;
  imageFolder=processRealPath(context,initImageFolder,IBirtConstants.DEFAULT_IMAGE_FOLDER,true);
  String initLogFolder=context.getInitParameter(ParameterAccessor.INIT_PARAM_LOG_DIR);
  if (isDesigner && initLogFolder == null)   initLogFolder=workingPath + IBirtConstants.DEFAULT_LOGS_FOLDER;
  logFolder=processRealPath(context,initLogFolder,IBirtConstants.DEFAULT_LOGS_FOLDER,true);
  logLevel=context.getInitParameter(ParameterAccessor.INIT_PARAM_LOG_LEVEL);
  if (logLevel == null)   logLevel=IBirtConstants.DEFAULT_LOGS_LEVEL;
  String initScriptlibFolder=context.getInitParameter(ParameterAccessor.INIT_PARAM_SCRIPTLIB_DIR);
  if (isDesigner && initScriptlibFolder == null)   initScriptlibFolder=workingPath + IBirtConstants.DEFAULT_SCRIPTLIB_FOLDER;
  scriptLibDir=processRealPath(context,initScriptlibFolder,IBirtConstants.DEFAULT_SCRIPTLIB_FOLDER,false);
  webAppLocale=getLocaleFromString(context.getInitParameter(INIT_PARAM_LOCALE));
  if (webAppLocale == null)   webAppLocale=Locale.getDefault();
  isWorkingFolderAccessOnly=Boolean.valueOf(context.getInitParameter(INIT_PARAM_WORKING_FOLDER_ACCESS_ONLY)).booleanValue();
  String s_maxRows=context.getInitParameter(INIT_PARAM_VIEWER_MAXROWS);
  try {
    maxRows=Integer.valueOf(s_maxRows).intValue();
  }
 catch (  NumberFormatException e) {
    maxRows=-1;
  }
  String s_maxLevels=context.getInitParameter(INIT_PARAM_VIEWER_MAXCUBELEVELS);
  try {
    maxCubeLevels=Integer.valueOf(s_maxLevels).intValue();
  }
 catch (  NumberFormatException e) {
    maxCubeLevels=-1;
  }
  String s_cubeMemSize=context.getInitParameter(INIT_PARAM_VIEWER_CUBEMEMSIZE);
  try {
    cubeMemorySize=Integer.valueOf(s_cubeMemSize).intValue();
  }
 catch (  NumberFormatException e) {
    cubeMemorySize=0;
  }
  birtResourceFolder=processRealPath(context,context.getInitParameter(INIT_PARAM_BIRT_RESOURCE_PATH),null,false);
  String s_overwrite=DataUtil.trimString(context.getInitParameter(INIT_PARAM_OVERWRITE_DOCUMENT));
  if ("String_Node_Str".equalsIgnoreCase(s_overwrite)) {
    isOverWrite=true;
  }
 else {
    isOverWrite=false;
  }
  initProps=initViewerProps(context,initProps);
  if (loggers == null) {
    loggers=new HashMap();
  }
  for (Iterator i=initProps.keySet().iterator(); i.hasNext(); ) {
    String name=(String)i.next();
    if (name.startsWith("String_Node_Str")) {
      String loggerName=name.replaceFirst("String_Node_Str","String_Node_Str");
      String levelName=(String)initProps.get(name);
      loggers.put(loggerName,levelName);
      i.remove();
    }
  }
  String flag=DataUtil.trimString(context.getInitParameter(INIT_PARAM_PRINT_SERVERSIDE));
  if (IBirtConstants.VAR_ON.equalsIgnoreCase(flag)) {
    isSupportedPrintOnServer=true;
  }
 else   if (IBirtConstants.VAR_OFF.equalsIgnoreCase(flag)) {
    isSupportedPrintOnServer=false;
  }
  String s_agentstyle=context.getInitParameter(INIT_PARAM_AGENTSTYLE_ENGINE);
  if ("String_Node_Str".equalsIgnoreCase(s_agentstyle))   isAgentStyle=true;
  if (s_agentstyle == null && isDesigner)   isAgentStyle=true;
  clearTempFiles();
  isInitContext=true;
}