Program: 79685
Project: 79685
Buggy source:
/** 
 * Writes a log record.
 * @param s Array of data information for the log record.
 * @param type Type of log either <code>LOG_ERROR</code> or<code>LOG_ACCESS</code>.
 * @param messageName Message ID for the log record.
 * @param ssoProperties Single Sign On Properties to be written to thelog record. If this is <code>null</code>, properties will be retrieved from administrator Single Sign On Token.
 */
public void logIt(String[] s,int type,String messageName,Hashtable ssoProperties){
  if (logStatus && (s != null)) {
    try {
      LogMessageProviderBase provider=(LogMessageProviderBase)MessageProviderFactory.getProvider("String_Node_Str");
      if (auditor == null) {
        auditor=InjectorHolder.getInstance(LegacyAuthenticationEventAuditor.class);
      }
      CoreWrapper cw=new CoreWrapper();
      String orgName=(String)ssoProperties.get("String_Node_Str");
      String realmName=cw.convertOrgNameToRealmName(orgName);
      if (auditor.isAuditing(realmName)) {
        if (!auditor.isLogoutEvent(messageName)) {
          String userName=(String)ssoProperties.get("String_Node_Str");
          String description=provider.getAllHashMessageIDs().get(messageName).getDescription();
          String contextID=(String)ssoProperties.get("String_Node_Str");
          String LoginIDSid=(String)ssoProperties.get("String_Node_Str");
          long time=Calendar.getInstance().getTimeInMillis();
          Map<String,String> contexts=null;
          if (StringUtils.isNotEmpty(contextID)) {
            contexts=new HashMap<>();
            contexts.put(AUTH.toString(),contextID);
          }
          if (StringUtils.isNotEmpty(LoginIDSid)) {
            InternalSession session=AuthD.getSession(new SessionID(LoginIDSid));
            String sessionContext=null;
            if (session != null) {
              sessionContext=session.getProperty(Constants.AM_CTX_ID);
              contexts.put(SESSION.toString(),sessionContext);
            }
          }
          AMIdentity identity=cw.getIdentity(userName,realmName);
          String authentication=null;
          if (identity != null) {
            authentication=identity.getUniversalId();
          }
          String moduleName=(String)ssoProperties.get("String_Node_Str");
          List<?> entries=null;
          if (StringUtils.isNotEmpty(moduleName)) {
            Map<String,String> info=new HashMap<>();
            String ip=(String)ssoProperties.get("String_Node_Str");
            if (StringUtils.isNotEmpty(ip)) {
              info=Collections.singletonMap("String_Node_Str",ip);
            }
            Map<String,Object> map=new HashMap<>();
            map.put("String_Node_Str",moduleName);
            map.put("String_Node_Str",description);
            description=AM_LOGIN_CHAIN_COMPLETED.toString();
            map.put("String_Node_Str",info);
            entries=Collections.singletonList(map);
          }
          auditor.audit(messageName,description,AuditRequestContext.getTransactionIdValue(),authentication,realmName,time,contexts,entries);
        }
      }
      com.sun.identity.log.LogRecord lr=null;
      SSOToken ssot=AccessController.doPrivileged(AdminTokenAction.getInstance());
      if (ssoProperties == null) {
        lr=provider.createLogRecord(messageName,s,ssot);
      }
 else {
        lr=provider.createLogRecord(messageName,s,ssoProperties);
      }
      com.sun.identity.log.Logger logger;
switch (type) {
case LOG_ACCESS:
        logger=(com.sun.identity.log.Logger)Logger.getLogger("String_Node_Str");
      logger.log(lr,ssot);
    break;
case LOG_ERROR:
  logger=(com.sun.identity.log.Logger)Logger.getLogger("String_Node_Str");
logger.log(lr,ssot);
break;
default :
logger=(com.sun.identity.log.Logger)Logger.getLogger("String_Node_Str");
logger.log(lr,ssot);
break;
}
}
 catch (IOException ex) {
ex.printStackTrace();
debug.error("String_Node_Str" + ex.getMessage());
}
}
}

Fixed version (ground truth):
/** 
 * Writes a log record.
 * @param s Array of data information for the log record.
 * @param type Type of log either <code>LOG_ERROR</code> or<code>LOG_ACCESS</code>.
 * @param messageName Message ID for the log record.
 * @param ssoProperties Single Sign On Properties to be written to thelog record. If this is <code>null</code>, properties will be retrieved from administrator Single Sign On Token.
 */
public void logIt(String[] s,int type,String messageName,Hashtable ssoProperties){
  if (logStatus && (s != null)) {
    try {
      LogMessageProviderBase provider=(LogMessageProviderBase)MessageProviderFactory.getProvider("String_Node_Str");
      if (auditor == null) {
        auditor=InjectorHolder.getInstance(LegacyAuthenticationEventAuditor.class);
      }
      CoreWrapper cw=new CoreWrapper();
      String orgName=(String)ssoProperties.get("String_Node_Str");
      String realmName=cw.convertOrgNameToRealmName(orgName);
      if (auditor.isAuditing(realmName)) {
        if (!auditor.isLogoutEvent(messageName)) {
          String userName=(String)ssoProperties.get("String_Node_Str");
          String description=provider.getAllHashMessageIDs().get(messageName).getDescription();
          String contextID=(String)ssoProperties.get("String_Node_Str");
          String LoginIDSid=(String)ssoProperties.get("String_Node_Str");
          long time=Calendar.getInstance().getTimeInMillis();
          Map<String,String> contexts=null;
          if (StringUtils.isNotEmpty(contextID)) {
            contexts=new HashMap<>();
            contexts.put(AUTH.toString(),contextID);
          }
          if (StringUtils.isNotEmpty(LoginIDSid)) {
            InternalSession session=AuthD.getSession(new SessionID(LoginIDSid));
            String sessionContext=null;
            if (session != null) {
              sessionContext=session.getProperty(Constants.AM_CTX_ID);
              contexts.put(SESSION.toString(),sessionContext);
            }
          }
          AMIdentity identity=cw.getIdentity(userName,realmName);
          String authentication=null;
          if (identity != null) {
            authentication=identity.getUniversalId();
          }
          String moduleName=(String)ssoProperties.get("String_Node_Str");
          List<Entry> entries=null;
          if (StringUtils.isNotEmpty(moduleName)) {
            Map<String,String> info=null;
            String ip=(String)ssoProperties.get("String_Node_Str");
            if (StringUtils.isNotEmpty(ip)) {
              info=Collections.singletonMap("String_Node_Str",ip);
            }
            Entry entry=new Entry();
            entry.setModuleId(moduleName);
            entry.setResult(description);
            description=AM_LOGIN_CHAIN_COMPLETED.toString();
            if (info != null) {
              entry.setInfo(info);
            }
            entries=Collections.singletonList(entry);
          }
          auditor.audit(messageName,description,AuditRequestContext.getTransactionIdValue(),authentication,realmName,time,contexts,entries);
        }
      }
      com.sun.identity.log.LogRecord lr=null;
      SSOToken ssot=AccessController.doPrivileged(AdminTokenAction.getInstance());
      if (ssoProperties == null) {
        lr=provider.createLogRecord(messageName,s,ssot);
      }
 else {
        lr=provider.createLogRecord(messageName,s,ssoProperties);
      }
      com.sun.identity.log.Logger logger;
switch (type) {
case LOG_ACCESS:
        logger=(com.sun.identity.log.Logger)Logger.getLogger("String_Node_Str");
      logger.log(lr,ssot);
    break;
case LOG_ERROR:
  logger=(com.sun.identity.log.Logger)Logger.getLogger("String_Node_Str");
logger.log(lr,ssot);
break;
default :
logger=(com.sun.identity.log.Logger)Logger.getLogger("String_Node_Str");
logger.log(lr,ssot);
break;
}
}
 catch (IOException ex) {
ex.printStackTrace();
debug.error("String_Node_Str" + ex.getMessage());
}
}
}