Program: 29256
Project: 29256
Buggy source:
public void postConstruct(){
  LogManager manager=LogManager.getLogManager();
  String cname=getClass().getName();
  if (manager != null) {
    logFileProperty=manager.getProperty(cname + "String_Node_Str");
  }
  if (logFileProperty == null || logFileProperty.trim().equals("String_Node_Str")) {
    logFileProperty=env.getInstanceRoot().getAbsolutePath() + File.separator + LOGS_DIR+ File.separator+ logFileName;
  }
  String filename=TranslatedConfigView.getTranslatedValue(logFileProperty).toString();
  File serverLog=new File(filename);
  absoluteServerLogName=filename;
  if (!serverLog.isAbsolute()) {
    serverLog=new File(env.getDomainRoot(),filename);
    absoluteServerLogName=env.getDomainRoot() + File.separator + filename;
  }
  changeFileName(serverLog);
  FileInputStream fs=null;
  String strLine="String_Node_Str";
  int odlFormatter=0;
  int uflFormatter=0;
  int otherFormatter=0;
  boolean mustRotate=false;
  try {
    fs=new FileInputStream(serverLog);
    BufferedReader br=new BufferedReader(new InputStreamReader(fs));
    while ((strLine=br.readLine()) != null) {
      strLine=strLine.trim();
      if (!strLine.equals("String_Node_Str")) {
        if (strLine.startsWith("String_Node_Str") && strLine.endsWith("String_Node_Str") && countOccurrences(strLine,'[') > 4) {
          odlFormatter++;
        }
 else         if (strLine.startsWith("String_Node_Str") && strLine.endsWith("String_Node_Str") && countOccurrences(strLine,'|') > 4) {
          uflFormatter++;
        }
 else {
          otherFormatter++;
        }
        if (odlFormatter > 0 && uflFormatter > 0) {
          mustRotate=true;
          break;
        }
 else         if (uflFormatter > 0 && otherFormatter > 0) {
          mustRotate=true;
          break;
        }
 else         if (otherFormatter > 0 && odlFormatter > 0) {
          mustRotate=true;
          break;
        }
        if (odlFormatter > 2 || uflFormatter > 2 || odlFormatter > 2) {
          break;
        }
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  if (odlFormatter > 0) {
    currentgffileHandlerFormatter="String_Node_Str";
  }
 else   if (uflFormatter > 0) {
    currentgffileHandlerFormatter="String_Node_Str";
  }
  pump=new Thread(){
    public void run(){
      try {
        while (!done.isSignalled()) {
          log();
        }
      }
 catch (      RuntimeException e) {
      }
    }
  }
;
  pump.setDaemon(true);
  pump.start();
  LogRecord lr=new LogRecord(Level.INFO,"String_Node_Str" + Version.getFullVersion());
  lr.setThreadID((int)Thread.currentThread().getId());
  lr.setLoggerName(getClass().getName());
  EarlyLogHandler.earlyMessages.add(lr);
  lr=new LogRecord(Level.INFO,"String_Node_Str" + manager.getProperty(cname + "String_Node_Str"));
  lr.setThreadID((int)Thread.currentThread().getId());
  lr.setLoggerName(getClass().getName());
  EarlyLogHandler.earlyMessages.add(lr);
  String rotationOnDateChange=manager.getProperty(cname + "String_Node_Str");
  if (rotationOnDateChange != null && !("String_Node_Str").equals(rotationOnDateChange.trim()) && Boolean.parseBoolean(rotationOnDateChange)) {
    dayBasedFileRotation=true;
    Long rotationTimeLimitValue=0L;
    int MILLIS_IN_DAY=1000 * 60 * 60* 24;
    Date date=new Date();
    SimpleDateFormat dateFormat=new SimpleDateFormat("String_Node_Str");
    long systime=System.currentTimeMillis();
    String nextDate=dateFormat.format(date.getTime() + MILLIS_IN_DAY);
    Date nextDay=null;
    try {
      nextDay=dateFormat.parse(nextDate);
    }
 catch (    ParseException e) {
      nextDay=new Date();
      lr=new LogRecord(Level.WARNING,"String_Node_Str");
      lr.setThreadID((int)Thread.currentThread().getId());
      lr.setLoggerName(getClass().getName());
      EarlyLogHandler.earlyMessages.add(lr);
    }
    long nextsystime=nextDay.getTime();
    rotationTimeLimitValue=nextsystime - systime;
    Task rotationTask=new Task(){
      public Object run(){
        rotate();
        return null;
      }
    }
;
    LogRotationTimer.getInstance().startTimer(new LogRotationTimerTask(rotationTask,rotationTimeLimitValue / 60000));
    setLimitForRotation(0);
  }
 else {
    Long rotationTimeLimitValue=0L;
    try {
      rotationTimeLimitValue=Long.parseLong(manager.getProperty(cname + "String_Node_Str"));
    }
 catch (    NumberFormatException e) {
      lr=new LogRecord(Level.SEVERE,"String_Node_Str");
      lr.setThreadID((int)Thread.currentThread().getId());
      lr.setLoggerName(getClass().getName());
      EarlyLogHandler.earlyMessages.add(lr);
    }
    if (rotationTimeLimitValue != 0) {
      Task rotationTask=new Task(){
        public Object run(){
          rotate();
          return null;
        }
      }
;
      LogRotationTimer.getInstance().startTimer(new LogRotationTimerTask(rotationTask,rotationTimeLimitValue));
      setLimitForRotation(0);
    }
 else {
      Integer rotationLimitAttrValue=0;
      try {
        rotationLimitAttrValue=Integer.parseInt(manager.getProperty(cname + "String_Node_Str"));
      }
 catch (      NumberFormatException e) {
        lr=new LogRecord(Level.WARNING,"String_Node_Str");
        lr.setThreadID((int)Thread.currentThread().getId());
        lr.setLoggerName(getClass().getName());
        EarlyLogHandler.earlyMessages.add(lr);
      }
      setLimitForRotation(rotationLimitAttrValue);
    }
  }
  gffileHandlerFormatter=manager.getProperty(cname + "String_Node_Str");
  if (mustRotate) {
    rotate();
  }
 else   if (!currentgffileHandlerFormatter.equals("String_Node_Str") && gffileHandlerFormatter != null && !gffileHandlerFormatter.equals(currentgffileHandlerFormatter)) {
    rotate();
  }
  String ff=manager.getProperty(cname + "String_Node_Str");
  if (ff != null)   try {
    flushFrequency=Integer.parseInt(manager.getProperty(cname + "String_Node_Str"));
  }
 catch (  NumberFormatException e) {
    lr=new LogRecord(Level.WARNING,"String_Node_Str");
    lr.setThreadID((int)Thread.currentThread().getId());
    lr.setLoggerName(getClass().getName());
    EarlyLogHandler.earlyMessages.add(lr);
  }
  if (flushFrequency <= 0)   flushFrequency=1;
  String formatterName=manager.getProperty(cname + "String_Node_Str");
  if (formatterName == null || UniformLogFormatter.class.getName().equals(formatterName)) {
    UniformLogFormatter formatterClass=null;
    if (agent != null) {
      formatterClass=new UniformLogFormatter(new AgentFormatterDelegate(agent));
      setFormatter(formatterClass);
    }
 else {
      formatterClass=new UniformLogFormatter();
      setFormatter(formatterClass);
    }
    if (formatterClass != null) {
      recordBeginMarker=manager.getProperty(cname + "String_Node_Str");
      if (recordBeginMarker == null || ("String_Node_Str").equals(recordBeginMarker)) {
        recordBeginMarker=RECORD_BEGIN_MARKER;
      }
      recordEndMarker=manager.getProperty(cname + "String_Node_Str");
      if (recordEndMarker == null || ("String_Node_Str").equals(recordEndMarker)) {
        recordEndMarker=RECORD_END_MARKER;
      }
      recordFieldSeparator=manager.getProperty(cname + "String_Node_Str");
      if (recordFieldSeparator == null || ("String_Node_Str").equals(recordFieldSeparator) || recordFieldSeparator.length() > 1) {
        recordFieldSeparator=RECORD_FIELD_SEPARATOR;
      }
      recordDateFormat=manager.getProperty(cname + "String_Node_Str");
      if (recordDateFormat != null && !("String_Node_Str").equals(recordDateFormat)) {
        SimpleDateFormat sdf=new SimpleDateFormat(recordDateFormat);
        try {
          sdf.format(new Date());
        }
 catch (        Exception e) {
          recordDateFormat=RECORD_DATE_FORMAT;
        }
      }
 else {
        recordDateFormat=RECORD_DATE_FORMAT;
      }
      formatterClass.setRecordBeginMarker(recordBeginMarker);
      formatterClass.setRecordEndMarker(recordEndMarker);
      formatterClass.setRecordDateFormat(recordDateFormat);
      formatterClass.setRecordFieldSeparator(recordFieldSeparator);
    }
  }
 else   if (formatterName == null || ODLLogFormatter.class.getName().equals(formatterName)) {
    ODLLogFormatter formatterClass=null;
    if (agent != null) {
      formatterClass=new ODLLogFormatter(new AgentFormatterDelegate(agent));
      setFormatter(formatterClass);
    }
 else {
      formatterClass=new ODLLogFormatter();
      setFormatter(formatterClass);
    }
  }
 else {
    try {
      setFormatter((Formatter)this.getClass().getClassLoader().loadClass(formatterName).newInstance());
    }
 catch (    InstantiationException e) {
      lr=new LogRecord(Level.SEVERE,"String_Node_Str" + formatterName);
      lr.setThreadID((int)Thread.currentThread().getId());
      lr.setLoggerName(getClass().getName());
      EarlyLogHandler.earlyMessages.add(lr);
    }
catch (    IllegalAccessException e) {
      lr=new LogRecord(Level.SEVERE,"String_Node_Str" + formatterName);
      lr.setThreadID((int)Thread.currentThread().getId());
      lr.setLoggerName(getClass().getName());
      EarlyLogHandler.earlyMessages.add(lr);
    }
catch (    ClassNotFoundException e) {
      lr=new LogRecord(Level.SEVERE,"String_Node_Str" + formatterName);
      lr.setThreadID((int)Thread.currentThread().getId());
      lr.setLoggerName(getClass().getName());
      EarlyLogHandler.earlyMessages.add(lr);
    }
  }
  try {
    maxHistoryFiles=Integer.parseInt(manager.getProperty(cname + "String_Node_Str"));
  }
 catch (  NumberFormatException e) {
    lr=new LogRecord(Level.WARNING,"String_Node_Str");
    lr.setThreadID((int)Thread.currentThread().getId());
    lr.setLoggerName(getClass().getName());
    EarlyLogHandler.earlyMessages.add(lr);
  }
  if (maxHistoryFiles < 0)   maxHistoryFiles=10;
}

Fixed version (ground truth):
public void postConstruct(){
  LogManager manager=LogManager.getLogManager();
  String cname=getClass().getName();
  if (manager != null) {
    logFileProperty=manager.getProperty(cname + "String_Node_Str");
  }
  if (logFileProperty == null || logFileProperty.trim().equals("String_Node_Str")) {
    logFileProperty=env.getInstanceRoot().getAbsolutePath() + File.separator + LOGS_DIR+ File.separator+ logFileName;
  }
  String filename=TranslatedConfigView.getTranslatedValue(logFileProperty).toString();
  File serverLog=new File(filename);
  absoluteServerLogName=filename;
  if (!serverLog.isAbsolute()) {
    serverLog=new File(env.getDomainRoot(),filename);
    absoluteServerLogName=env.getDomainRoot() + File.separator + filename;
  }
  changeFileName(serverLog);
  FileInputStream fs=null;
  String strLine="String_Node_Str";
  int odlFormatter=0;
  int uflFormatter=0;
  int otherFormatter=0;
  boolean mustRotate=false;
  try {
    fs=new FileInputStream(serverLog);
    BufferedReader br=new BufferedReader(new InputStreamReader(fs));
    while ((strLine=br.readLine()) != null) {
      strLine=strLine.trim();
      if (!strLine.equals("String_Node_Str")) {
        if (strLine.startsWith("String_Node_Str") && strLine.endsWith("String_Node_Str") && countOccurrences(strLine,'[') > 4) {
          odlFormatter++;
        }
 else         if (strLine.startsWith("String_Node_Str") && strLine.endsWith("String_Node_Str") && countOccurrences(strLine,'|') > 4) {
          uflFormatter++;
        }
 else {
          otherFormatter++;
        }
        if (odlFormatter > 0 && uflFormatter > 0) {
          mustRotate=true;
          break;
        }
 else         if (uflFormatter > 0 && otherFormatter > 0) {
          mustRotate=true;
          break;
        }
 else         if (otherFormatter > 0 && odlFormatter > 0) {
          mustRotate=true;
          break;
        }
        if (odlFormatter > 2 || uflFormatter > 2 || odlFormatter > 2) {
          break;
        }
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  if (odlFormatter > 0) {
    currentgffileHandlerFormatter="String_Node_Str";
  }
 else   if (uflFormatter > 0) {
    currentgffileHandlerFormatter="String_Node_Str";
  }
  pump=new Thread(){
    public void run(){
      try {
        while (!done.isSignalled()) {
          log();
        }
      }
 catch (      RuntimeException e) {
      }
    }
  }
;
  pump.setDaemon(true);
  pump.start();
  LogRecord lr=new LogRecord(Level.INFO,"String_Node_Str" + Version.getFullVersion());
  lr.setThreadID((int)Thread.currentThread().getId());
  lr.setLoggerName(getClass().getName());
  EarlyLogHandler.earlyMessages.add(lr);
  lr=new LogRecord(Level.INFO,"String_Node_Str" + manager.getProperty(cname + "String_Node_Str"));
  lr.setThreadID((int)Thread.currentThread().getId());
  lr.setLoggerName(getClass().getName());
  EarlyLogHandler.earlyMessages.add(lr);
  String rotationOnDateChange=manager.getProperty(cname + "String_Node_Str");
  if (rotationOnDateChange != null && !("String_Node_Str").equals(rotationOnDateChange.trim()) && Boolean.parseBoolean(rotationOnDateChange)) {
    dayBasedFileRotation=true;
    Long rotationTimeLimitValue=0L;
    int MILLIS_IN_DAY=1000 * 60 * 60* 24;
    Date date=new Date();
    SimpleDateFormat dateFormat=new SimpleDateFormat("String_Node_Str");
    long systime=System.currentTimeMillis();
    String nextDate=dateFormat.format(date.getTime() + MILLIS_IN_DAY);
    Date nextDay=null;
    try {
      nextDay=dateFormat.parse(nextDate);
    }
 catch (    ParseException e) {
      nextDay=new Date();
      lr=new LogRecord(Level.WARNING,"String_Node_Str");
      lr.setThreadID((int)Thread.currentThread().getId());
      lr.setLoggerName(getClass().getName());
      EarlyLogHandler.earlyMessages.add(lr);
    }
    long nextsystime=nextDay.getTime();
    rotationTimeLimitValue=nextsystime - systime;
    Task rotationTask=new Task(){
      public Object run(){
        rotate();
        return null;
      }
    }
;
    LogRotationTimer.getInstance().startTimer(new LogRotationTimerTask(rotationTask,rotationTimeLimitValue / 60000));
    setLimitForRotation(0);
  }
 else {
    Long rotationTimeLimitValue=0L;
    try {
      rotationTimeLimitValue=Long.parseLong(manager.getProperty(cname + "String_Node_Str"));
    }
 catch (    NumberFormatException e) {
      lr=new LogRecord(Level.SEVERE,"String_Node_Str");
      lr.setThreadID((int)Thread.currentThread().getId());
      lr.setLoggerName(getClass().getName());
      EarlyLogHandler.earlyMessages.add(lr);
    }
    if (rotationTimeLimitValue != 0) {
      Task rotationTask=new Task(){
        public Object run(){
          rotate();
          return null;
        }
      }
;
      LogRotationTimer.getInstance().startTimer(new LogRotationTimerTask(rotationTask,rotationTimeLimitValue));
      setLimitForRotation(0);
    }
 else {
      Integer rotationLimitAttrValue=0;
      try {
        rotationLimitAttrValue=Integer.parseInt(manager.getProperty(cname + "String_Node_Str"));
      }
 catch (      NumberFormatException e) {
        lr=new LogRecord(Level.WARNING,"String_Node_Str");
        lr.setThreadID((int)Thread.currentThread().getId());
        lr.setLoggerName(getClass().getName());
        EarlyLogHandler.earlyMessages.add(lr);
      }
      setLimitForRotation(rotationLimitAttrValue);
    }
  }
  gffileHandlerFormatter=manager.getProperty(cname + "String_Node_Str");
  if (mustRotate) {
    rotate();
  }
 else   if (!currentgffileHandlerFormatter.equals("String_Node_Str") && gffileHandlerFormatter != null && !gffileHandlerFormatter.equals(currentgffileHandlerFormatter)) {
    rotate();
  }
  String ff=manager.getProperty(cname + "String_Node_Str");
  if (ff != null)   try {
    flushFrequency=Integer.parseInt(manager.getProperty(cname + "String_Node_Str"));
  }
 catch (  NumberFormatException e) {
    lr=new LogRecord(Level.WARNING,"String_Node_Str");
    lr.setThreadID((int)Thread.currentThread().getId());
    lr.setLoggerName(getClass().getName());
    EarlyLogHandler.earlyMessages.add(lr);
  }
  if (flushFrequency <= 0)   flushFrequency=1;
  String formatterName=manager.getProperty(cname + "String_Node_Str");
  if (formatterName == null || UniformLogFormatter.class.getName().equals(formatterName)) {
    UniformLogFormatter formatterClass=null;
    if (agent != null) {
      formatterClass=new UniformLogFormatter(new AgentFormatterDelegate(agent));
      setFormatter(formatterClass);
    }
 else {
      formatterClass=new UniformLogFormatter();
      setFormatter(formatterClass);
    }
    if (formatterClass != null) {
      recordBeginMarker=manager.getProperty(cname + "String_Node_Str");
      if (recordBeginMarker == null || ("String_Node_Str").equals(recordBeginMarker)) {
        recordBeginMarker=RECORD_BEGIN_MARKER;
      }
      recordEndMarker=manager.getProperty(cname + "String_Node_Str");
      if (recordEndMarker == null || ("String_Node_Str").equals(recordEndMarker)) {
        recordEndMarker=RECORD_END_MARKER;
      }
      recordFieldSeparator=manager.getProperty(cname + "String_Node_Str");
      if (recordFieldSeparator == null || ("String_Node_Str").equals(recordFieldSeparator) || recordFieldSeparator.length() > 1) {
        recordFieldSeparator=RECORD_FIELD_SEPARATOR;
      }
      recordDateFormat=manager.getProperty(cname + "String_Node_Str");
      if (recordDateFormat != null && !("String_Node_Str").equals(recordDateFormat)) {
        SimpleDateFormat sdf=new SimpleDateFormat(recordDateFormat);
        try {
          sdf.format(new Date());
        }
 catch (        Exception e) {
          recordDateFormat=RECORD_DATE_FORMAT;
        }
      }
 else {
        recordDateFormat=RECORD_DATE_FORMAT;
      }
      formatterClass.setRecordBeginMarker(recordBeginMarker);
      formatterClass.setRecordEndMarker(recordEndMarker);
      formatterClass.setRecordDateFormat(recordDateFormat);
      formatterClass.setRecordFieldSeparator(recordFieldSeparator);
    }
  }
 else   if (ODLLogFormatter.class.getName().equals(formatterName)) {
    ODLLogFormatter formatterClass=null;
    if (agent != null) {
      formatterClass=new ODLLogFormatter(new AgentFormatterDelegate(agent));
      setFormatter(formatterClass);
    }
 else {
      formatterClass=new ODLLogFormatter();
      setFormatter(formatterClass);
    }
  }
 else {
    try {
      setFormatter((Formatter)this.getClass().getClassLoader().loadClass(formatterName).newInstance());
    }
 catch (    InstantiationException e) {
      lr=new LogRecord(Level.SEVERE,"String_Node_Str" + formatterName);
      lr.setThreadID((int)Thread.currentThread().getId());
      lr.setLoggerName(getClass().getName());
      EarlyLogHandler.earlyMessages.add(lr);
    }
catch (    IllegalAccessException e) {
      lr=new LogRecord(Level.SEVERE,"String_Node_Str" + formatterName);
      lr.setThreadID((int)Thread.currentThread().getId());
      lr.setLoggerName(getClass().getName());
      EarlyLogHandler.earlyMessages.add(lr);
    }
catch (    ClassNotFoundException e) {
      lr=new LogRecord(Level.SEVERE,"String_Node_Str" + formatterName);
      lr.setThreadID((int)Thread.currentThread().getId());
      lr.setLoggerName(getClass().getName());
      EarlyLogHandler.earlyMessages.add(lr);
    }
  }
  try {
    maxHistoryFiles=Integer.parseInt(manager.getProperty(cname + "String_Node_Str"));
  }
 catch (  NumberFormatException e) {
    lr=new LogRecord(Level.WARNING,"String_Node_Str");
    lr.setThreadID((int)Thread.currentThread().getId());
    lr.setLoggerName(getClass().getName());
    EarlyLogHandler.earlyMessages.add(lr);
  }
  if (maxHistoryFiles < 0)   maxHistoryFiles=10;
}