Program: 34562
Project: 34562
Buggy source:
@Override public boolean checkTopicAccess(Subject authenticatedSubject,String topicSpace,String topicName,String operationType) throws MessagingAuthorizationException {
  String busName=null;
  String messagingEngine=null;
  String[] roles=null;
  String resource=null;
  if (auditManager != null) {
    if (auditManager.getJMSBusName() != null)     busName=auditManager.getJMSBusName();
    if (auditManager.getJMSMessagingEngine() != null)     messagingEngine=auditManager.getJMSMessagingEngine();
  }
  String destinationName=topicSpace;
  resource="String_Node_Str";
  if (topicName != null) {
    destinationName=topicSpace + MessagingSecurityConstants.TOPIC_DELIMITER + topicName;
    resource="String_Node_Str";
  }
  SibTr.entry(tc,CLASS_NAME + "String_Node_Str",new Object[]{authenticatedSubject,destinationName,operationType});
  checkIfUserIsAuthenticated(authenticatedSubject);
  String userName=null;
  String user=authenticatedSubject.getPrincipals().iterator().next().getName();
  Map<String,TopicPermission> mq=messagingSecurityService.getTopicPermissions();
  roles=messagingSecurityService.getDestinationRoles(mq,destinationName,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,destinationName,operationType,roles,resource,Integer.valueOf("String_Node_Str"));
    }
 else {
      Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01,user,null,null,null,busName,messagingEngine,destinationName,operationType,roles,resource,Integer.valueOf("String_Node_Str"));
    }
    throw new MessagingAuthorizationException(Tr.formatMessage(tc,"String_Node_Str",userName,operationType,destinationName),e);
  }
  Map<String,TopicPermission> topicPermissions=messagingSecurityService.getTopicPermissions();
  TopicPermission permission=getTopicPermission(topicPermissions,destinationName);
  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,destinationName,operationType,roles,resource,Integer.valueOf("String_Node_Str"));
    }
 else {
      Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01,user,null,null,null,busName,messagingEngine,destinationName,operationType,roles,resource,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,resource,Integer.valueOf("String_Node_Str"));
  }
 else {
    Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01,user,null,null,null,busName,messagingEngine,destinationName,operationType,roles,resource,Integer.valueOf("String_Node_Str"));
  }
  SibTr.exit(tc,CLASS_NAME + "String_Node_Str",result);
  return result;
}

Fixed version (ground truth):
@Override public boolean checkTopicAccess(Subject authenticatedSubject,String topicSpace,String topicName,String operationType) throws MessagingAuthorizationException {
  String busName=null;
  String messagingEngine=null;
  String[] roles=null;
  String resource=null;
  if (auditManager != null) {
    if (auditManager.getJMSBusName() != null)     busName=auditManager.getJMSBusName();
    if (auditManager.getJMSMessagingEngine() != null)     messagingEngine=auditManager.getJMSMessagingEngine();
  }
  String destinationName=topicSpace;
  resource="String_Node_Str";
  if (topicName != null) {
    destinationName=topicSpace + MessagingSecurityConstants.TOPIC_DELIMITER + topicName;
    resource="String_Node_Str";
  }
  SibTr.entry(tc,CLASS_NAME + "String_Node_Str",new Object[]{authenticatedSubject,destinationName,operationType});
  checkIfUserIsAuthenticated(authenticatedSubject);
  String userName=null;
  String user=authenticatedSubject.getPrincipals().iterator().next().getName();
  Map<String,TopicPermission> mq=messagingSecurityService.getTopicPermissions();
  roles=messagingSecurityService.getDestinationRoles(mq,destinationName,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,destinationName,operationType,roles,resource,Integer.valueOf("String_Node_Str"));
    }
 else {
      Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01,user,null,null,null,busName,messagingEngine,destinationName,operationType,roles,resource,Integer.valueOf("String_Node_Str"));
    }
    throw new MessagingAuthorizationException(Tr.formatMessage(tc,"String_Node_Str",userName,operationType,destinationName),e);
  }
  Map<String,TopicPermission> topicPermissions=messagingSecurityService.getTopicPermissions();
  TopicPermission permission=getTopicPermission(topicPermissions,destinationName);
  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,destinationName,operationType,roles,resource,Integer.valueOf("String_Node_Str"));
    }
 else {
      Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01,user,null,null,null,busName,messagingEngine,destinationName,operationType,roles,resource,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,resource,Integer.valueOf("String_Node_Str"));
    }
 else {
      Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01,user,null,null,null,busName,messagingEngine,destinationName,operationType,roles,resource,Integer.valueOf("String_Node_Str"));
    }
  }
  SibTr.exit(tc,CLASS_NAME + "String_Node_Str",result);
  return result;
}