Program: 34561
Project: 34561
Buggy source:
@Override public boolean checkTemporaryDestinationAccess(Subject authenticatedSubject,String destinationName,String operationType) throws MessagingAuthorizationException {
  SibTr.entry(tc,CLASS_NAME + "String_Node_Str",new Object[]{authenticatedSubject,destinationName,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();
  }
  checkIfUserIsAuthenticated(authenticatedSubject);
  String userName=null;
  String user=authenticatedSubject.getPrincipals().iterator().next().getName();
  Map<String,TemporaryDestinationPermission> mq=messagingSecurityService.getTemporaryDestinationPermissions();
  roles=messagingSecurityService.getDestinationRoles(mq,destinationName,user);
  boolean result=false;
  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,destinationName,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,destinationName,operationType,roles,"String_Node_Str",Integer.valueOf("String_Node_Str"));
    }
    throw new MessagingAuthorizationException(Tr.formatMessage(tc,"String_Node_Str",userName,operationType,destinationName),e);
  }
  Map<String,TemporaryDestinationPermission> tempDestinationPermissions=messagingSecurityService.getTemporaryDestinationPermissions();
  List<String> prefixList=getPrefixMatchingTemporaryDestination(tempDestinationPermissions.keySet(),destinationName);
  for (  String prefix : prefixList) {
    TemporaryDestinationPermission permission=tempDestinationPermissions.get(prefix);
    result=checkPermission(permission,operationType,userName);
    if (result)     break;
  }
  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,destinationName,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,destinationName,operationType,roles,"String_Node_Str",Integer.valueOf("String_Node_Str"));
    }
    SibTr.debug(tc,"String_Node_Str",new Object[]{userName,operationType,destinationName});
    throw new MessagingAuthorizationException(Tr.formatMessage(tc,"String_Node_Str",userName,operationType,destinationName));
  }
  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,destinationName,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,destinationName,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 checkTemporaryDestinationAccess(Subject authenticatedSubject,String destinationName,String operationType) throws MessagingAuthorizationException {
  SibTr.entry(tc,CLASS_NAME + "String_Node_Str",new Object[]{authenticatedSubject,destinationName,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();
  }
  checkIfUserIsAuthenticated(authenticatedSubject);
  String userName=null;
  String user=authenticatedSubject.getPrincipals().iterator().next().getName();
  Map<String,TemporaryDestinationPermission> mq=messagingSecurityService.getTemporaryDestinationPermissions();
  roles=messagingSecurityService.getDestinationRoles(mq,destinationName,user);
  boolean result=false;
  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,destinationName,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,destinationName,operationType,roles,"String_Node_Str",Integer.valueOf("String_Node_Str"));
    }
    throw new MessagingAuthorizationException(Tr.formatMessage(tc,"String_Node_Str",userName,operationType,destinationName),e);
  }
  Map<String,TemporaryDestinationPermission> tempDestinationPermissions=messagingSecurityService.getTemporaryDestinationPermissions();
  List<String> prefixList=getPrefixMatchingTemporaryDestination(tempDestinationPermissions.keySet(),destinationName);
  for (  String prefix : prefixList) {
    TemporaryDestinationPermission permission=tempDestinationPermissions.get(prefix);
    result=checkPermission(permission,operationType,userName);
    if (result)     break;
  }
  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,destinationName,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,destinationName,operationType,roles,"String_Node_Str",Integer.valueOf("String_Node_Str"));
    }
    SibTr.debug(tc,"String_Node_Str",new Object[]{userName,operationType,destinationName});
    throw new MessagingAuthorizationException(Tr.formatMessage(tc,"String_Node_Str",userName,operationType,destinationName));
  }
 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,destinationName,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,destinationName,operationType,roles,"String_Node_Str",Integer.valueOf("String_Node_Str"));
    }
  }
  SibTr.exit(tc,CLASS_NAME + "String_Node_Str",result);
  return result;
}