docs: JmsJcaUserDetails getUserDetails(final Subject subject,
                                       final ConnectionRequestInfo requestInfo) {
  
          if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
              SibTr.entry(this, TRACE, "getUserDetails", new Object[] {
                                                                       JmsJcaManagedConnection.subjectToString(subject),
                                                                       requestInfo });
          }
  
          JmsJcaUserDetails result = null;
  
          if (subject == null) {
  
              // We don't have a subject (case 3 or 4)
  
              String userName = null;
              String password = null;
  
              if (requestInfo instanceof JmsJcaConnectionRequestInfo) {
  
                  // See if the request information contains any user details
                  JmsJcaConnectionRequestInfo jmsJcaConnReq = (JmsJcaConnectionRequestInfo) requestInfo;
                  result = jmsJcaConnReq.getUserDetails();
  
              }
  
              if (result == null) {
  
                  // The request information did not contain any user details
                  // (case 4)
  
                  userName = getUserName();
                  password = getPassword();
                  result = new JmsJcaUserDetails(userName, password);
  
                  if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
                      SibTr.debug(this, TRACE, "Using default credentials from "
                                               + "managed connection factory");
                  }
  
              } else {
  
                  // The request information did contain user details (case 3)
                  if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
                      SibTr.debug(this, TRACE,
                                  "Using credentials passed by application");
                  }
  
              }
  
          } else {
  
              // We were passed a Subject (case 1 or 2)
  
              // See if the credential set for the Subject contains a
              // PasswordCredential for this managed connection factory
  
              PasswordCredential credential = (PasswordCredential) AccessController
                              .doPrivileged(new PrivilegedAction() {
  
                                  @Override
                                  public Object run() {
  
                                      final Set credentialSet = subject
                                                      .getPrivateCredentials(PasswordCredential.class);
  
                                      for (final Iterator iterator = credentialSet
                                                      .iterator(); iterator.hasNext();) {
  
                                          final Object next = iterator.next();
                                          if (next instanceof PasswordCredential) {
  
                                              final PasswordCredential subjectCredential = (PasswordCredential) next;
  
                                              if (JmsJcaManagedConnectionFactoryImpl.this
                                                              .equals(subjectCredential
                                                                              .getManagedConnectionFactory())) {
  
                                                  return subjectCredential;
  
                                              }
                                          }
                                      }
                                      return null;
                                  }
                              });
  
              if (credential == null) {
  
                  // Subject didn't contain a suitable PasswordCredential (case 2)
  
                  if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
                      SibTr.debug(this, TRACE,
                                  "No PasswordCredential in Subject - "
                                                  + "using Subject for authentication");
                  }
  
              } else {
  
                  // Subject did contain a PasswordCredential (case 1)
  
                  if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
                      SibTr.debug(TRACE, "Using PasswordCredential from Subject");
                  }
                  result = new JmsJcaUserDetails(credential.getUserName(), String
                                  .valueOf(credential.getPassword()));
  
              }
          }
  
          if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
              if (result != null) {
                  SibTr.debug(this, TRACE, "Credential contains userName", result
                                  .getUserName());
              }
          }
  
          if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
              SibTr.exit(this, TRACE, "getUserDetails", result);
          }
          return result;
  
      }