{ if (cri == null) { cri = mcf.getDefaultConnectionRequestInfo(); } try { FBConnectionRequestInfo fbcri = (FBConnectionRequestInfo)cri; if (subject != null) {  for (Iterator i = subject.getPrivateCredentials().iterator(); i.hasNext(); ) { Object cred = i.next(); if (cred instanceof PasswordCredential && mcf.equals(((PasswordCredential)cred).getManagedConnectionFactory())) { PasswordCredential pcred = (PasswordCredential)cred; String user = pcred.getUserName(); String password = new String(pcred.getPassword()); fbcri.setPassword(password); fbcri.setUser(user); break; } }  }
{ if (cri == null) { cri = mcf.getDefaultConnectionRequestInfo(); } try { FBConnectionRequestInfo fbcri = (FBConnectionRequestInfo)cri; if (subject != null) {  for (Iterator i = subject.getPrivateCredentials().iterator(); i.hasNext(); ) { Object cred = i.next(); if (cred instanceof PasswordCredential && mcf.equals(((PasswordCredential)cred).getManagedConnectionFactory())) { PasswordCredential pcred = (PasswordCredential)cred; String user = pcred.getUserName(); String password = new String(pcred.getPassword()); fbcri.setPassword(password); fbcri.setUser(user); break; } } }  return fbcri; } catch (ClassCastException cce) { throw new ResourceException("Incorrect ConnectionRequestInfo class supplied"); }
	private FBConnectionRequestInfo getCombinedConnectionRequestInfo(Subject subject, ConnectionRequestInfo cri) throws ResourceException	{		if (cri == null) {			cri = mcf.getDefaultConnectionRequestInfo();		}		try		{			FBConnectionRequestInfo fbcri = (FBConnectionRequestInfo)cri;			if (subject != null)			{			   //see connector spec, section 8.2.6, contract for ManagedConnectinFactory, option A.			   for (Iterator i = subject.getPrivateCredentials().iterator(); i.hasNext(); )			   {				  Object cred = i.next();				  if (cred instanceof PasswordCredential && mcf.equals(((PasswordCredential)cred).getManagedConnectionFactory()))				  {					 PasswordCredential pcred = (PasswordCredential)cred;					 String user = pcred.getUserName();					 String password = new String(pcred.getPassword());					 fbcri.setPassword(password);					 fbcri.setUser(user);					 break;				  } // end of if ()			   } // end of for ()			   /*				Iterator iter = subject.getPrivateCredentials().iterator();				if (iter.hasNext()) {					PasswordCredential cred = (PasswordCredential) iter.next();					String user = cred.getUserName();					String password = new String(cred.getPassword());					fbcri.setPassword(password);					fbcri.setUser(user);				}			   */			} // end of if ()			return fbcri;		}		catch (ClassCastException cce)		{			throw new ResourceException("Incorrect ConnectionRequestInfo class supplied");		} // end of try-catch	}