Program: 34563
Project: 34563
Buggy source:
@Override public boolean checkQueueAccess(Subject authenticatedSubject,String destination,String operationType,boolean logWarning) throws MessagingAuthorizationException {
  SibTr.entry(tc,CLASS_NAME + "String_Node_Str",new Object[]{authenticatedSubject,destination,operationType});
  String busName=null;
  String messagingEngine=null;
  String[] roles=null;
  if (auditManager != null) {
    if (auditManager.getJMSBusName() != null)     busName=auditManager.getJMSBusName();
    if (auditManager.getJMSMessagingEngine() != null)     messagingEngine=auditManager.getJMSMessagingEngine();
  }
  if (operationType.equalsIgnoreCase(MessagingSecurityConstants.OPERATION_TYPE_BROWSE)) {
    if (checkQueueAccess(authenticatedSubject,destination,MessagingSecurityConstants.OPERATION_TYPE_RECEIVE,false)) {
      return true;
    }
  }
  checkIfUserIsAuthenticated(authenticatedSubject);
  String userName=null;
  String user=authenticatedSubject.getPrincipals().iterator().next().getName();
  Map<String,QueuePermission> mq=messagingSecurityService.getQueuePermissions();
  roles=messagingSecurityService.getDestinationRoles(mq,destination,user);
  try {
    userName=MessagingSecurityUtility.getUniqueUserName(authenticatedSubject);
  }
 catch (  MessagingSecurityException e) {
    if (auditManager != null && auditManager.getJMSConversationMetaData() != null) {
      ConversationMetaData cmd=(ConversationMetaData)auditManager.getJMSConversationMetaData();
      Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01,user,cmd.getRemoteAddress().getHostAddress(),new Integer(cmd.getRemotePort()).toString(),cmd.getChainName(),busName,messagingEngine,destination,operationType,roles,"String_Node_Str",Integer.valueOf("String_Node_Str"));
    }
 else {
      Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01,user,null,null,null,busName,messagingEngine,destination,operationType,roles,"String_Node_Str",Integer.valueOf("String_Node_Str"));
    }
    throw new MessagingAuthorizationException(Tr.formatMessage(tc,"String_Node_Str",userName,operationType,destination),e);
  }
  Map<String,QueuePermission> queuePermissions=messagingSecurityService.getQueuePermissions();
  QueuePermission permission=queuePermissions.get(destination);
  boolean result=checkPermission(permission,operationType,userName);
  if (!result && logWarning) {
    if (auditManager != null && auditManager.getJMSConversationMetaData() != null) {
      ConversationMetaData cmd=(ConversationMetaData)auditManager.getJMSConversationMetaData();
      Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01,user,cmd.getRemoteAddress().getHostAddress(),new Integer(cmd.getRemotePort()).toString(),cmd.getChainName(),busName,messagingEngine,destination,operationType,roles,"String_Node_Str",Integer.valueOf("String_Node_Str"));
    }
 else {
      Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01,user,null,null,null,busName,messagingEngine,destination,operationType,roles,"String_Node_Str",Integer.valueOf("String_Node_Str"));
    }
    SibTr.debug(tc,"String_Node_Str",new Object[]{userName,operationType,destination});
    throw new MessagingAuthorizationException(Tr.formatMessage(tc,"String_Node_Str",userName,operationType,destination));
  }
  if (auditManager != null && auditManager.getJMSConversationMetaData() != null) {
    ConversationMetaData cmd=(ConversationMetaData)auditManager.getJMSConversationMetaData();
    Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01,user,cmd.getRemoteAddress().getHostAddress(),new Integer(cmd.getRemotePort()).toString(),cmd.getChainName(),busName,messagingEngine,destination,operationType,roles,"String_Node_Str",Integer.valueOf("String_Node_Str"));
  }
 else {
    Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01,user,null,null,null,busName,messagingEngine,destination,operationType,roles,"String_Node_Str",Integer.valueOf("String_Node_Str"));
  }
  SibTr.exit(tc,CLASS_NAME + "String_Node_Str",result);
  return result;
}

Fixed version (ground truth):
@Override public boolean checkQueueAccess(Subject authenticatedSubject,String destination,String operationType,boolean logWarning) throws MessagingAuthorizationException {
  SibTr.entry(tc,CLASS_NAME + "String_Node_Str",new Object[]{authenticatedSubject,destination,operationType});
  String busName=null;
  String messagingEngine=null;
  String[] roles=null;
  if (auditManager != null) {
    if (auditManager.getJMSBusName() != null)     busName=auditManager.getJMSBusName();
    if (auditManager.getJMSMessagingEngine() != null)     messagingEngine=auditManager.getJMSMessagingEngine();
  }
  if (operationType.equalsIgnoreCase(MessagingSecurityConstants.OPERATION_TYPE_BROWSE)) {
    if (checkQueueAccess(authenticatedSubject,destination,MessagingSecurityConstants.OPERATION_TYPE_RECEIVE,false)) {
      return true;
    }
  }
  checkIfUserIsAuthenticated(authenticatedSubject);
  String userName=null;
  String user=authenticatedSubject.getPrincipals().iterator().next().getName();
  Map<String,QueuePermission> mq=messagingSecurityService.getQueuePermissions();
  roles=messagingSecurityService.getDestinationRoles(mq,destination,user);
  try {
    userName=MessagingSecurityUtility.getUniqueUserName(authenticatedSubject);
  }
 catch (  MessagingSecurityException e) {
    if (auditManager != null && auditManager.getJMSConversationMetaData() != null) {
      ConversationMetaData cmd=(ConversationMetaData)auditManager.getJMSConversationMetaData();
      Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01,user,cmd.getRemoteAddress().getHostAddress(),new Integer(cmd.getRemotePort()).toString(),cmd.getChainName(),busName,messagingEngine,destination,operationType,roles,"String_Node_Str",Integer.valueOf("String_Node_Str"));
    }
 else {
      Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01,user,null,null,null,busName,messagingEngine,destination,operationType,roles,"String_Node_Str",Integer.valueOf("String_Node_Str"));
    }
    throw new MessagingAuthorizationException(Tr.formatMessage(tc,"String_Node_Str",userName,operationType,destination),e);
  }
  Map<String,QueuePermission> queuePermissions=messagingSecurityService.getQueuePermissions();
  QueuePermission permission=queuePermissions.get(destination);
  boolean result=checkPermission(permission,operationType,userName);
  if (!result) {
    if (auditManager != null && auditManager.getJMSConversationMetaData() != null) {
      ConversationMetaData cmd=(ConversationMetaData)auditManager.getJMSConversationMetaData();
      Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01,user,cmd.getRemoteAddress().getHostAddress(),new Integer(cmd.getRemotePort()).toString(),cmd.getChainName(),busName,messagingEngine,destination,operationType,roles,"String_Node_Str",Integer.valueOf("String_Node_Str"));
    }
 else {
      Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01,user,null,null,null,busName,messagingEngine,destination,operationType,roles,"String_Node_Str",Integer.valueOf("String_Node_Str"));
    }
    if (logWarning) {
      SibTr.debug(tc,"String_Node_Str",new Object[]{userName,operationType,destination});
      throw new MessagingAuthorizationException(Tr.formatMessage(tc,"String_Node_Str",userName,operationType,destination));
    }
  }
 else {
    if (auditManager != null && auditManager.getJMSConversationMetaData() != null) {
      ConversationMetaData cmd=(ConversationMetaData)auditManager.getJMSConversationMetaData();
      Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01,user,cmd.getRemoteAddress().getHostAddress(),new Integer(cmd.getRemotePort()).toString(),cmd.getChainName(),busName,messagingEngine,destination,operationType,roles,"String_Node_Str",Integer.valueOf("String_Node_Str"));
    }
 else {
      Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01,user,null,null,null,busName,messagingEngine,destination,operationType,roles,"String_Node_Str",Integer.valueOf("String_Node_Str"));
    }
  }
  SibTr.exit(tc,CLASS_NAME + "String_Node_Str",result);
  return result;
}