本文整理匯總了Java中javax.naming.CommunicationException.setRootCause方法的典型用法代碼示例。如果您正苦於以下問題:Java CommunicationException.setRootCause方法的具體用法?Java CommunicationException.setRootCause怎麽用?Java CommunicationException.setRootCause使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.naming.CommunicationException
的用法示例。
在下文中一共展示了CommunicationException.setRootCause方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: removeNamingListener
import javax.naming.CommunicationException; //導入方法依賴的package包/類
public void removeNamingListener(NamingListener namingListener)
throws NamingException {
if (listeners == null || !listeners.containsKey(namingListener)) {
return;
}
if (namingListener instanceof UnsolicitedNotificationListener) {
unls.remove(namingListener);
}
List<Integer> idList = listeners.remove(namingListener);
if (idList == null) {
return;
}
try {
for (Integer id : idList) {
client.removePersistentSearch(id.intValue(), requestControls);
}
} catch (IOException e) {
CommunicationException ex = new CommunicationException();
ex.setRootCause(e);
}
}
示例2: doBasicOperation
import javax.naming.CommunicationException; //導入方法依賴的package包/類
/**
* Do operations with one request and one response which contains
* LdapResult. This is the convenience way to do the most of ldap operation
* except search opeartion which has multi-response, bind operation, abandon
* and unbind operations which have no response.
*
* @param op
* @throws NamingException
*/
protected void doBasicOperation(LdapOperation op) throws NamingException {
applyEnvChange();
LdapMessage message = null;
try {
message = client.doOperation(op, requestControls);
} catch (IOException e) {
CommunicationException ex = new CommunicationException();
ex.setRootCause(e);
// operation failed, clear responseControls
responseControls = null;
throw ex;
}
Control[] rawControls = message.getControls();
responseControls = narrowingControls(rawControls);
LdapResult result = op.getResult();
if (result.getResultCode() == LdapResult.REFERRAL) {
throw new ReferralExceptionImpl(contextDn.toString(), result
.getReferrals(), env);
}
if (LdapUtils.getExceptionFromResult(result) != null) {
throw LdapUtils.getExceptionFromResult(result);
}
}
示例3: newInstance
import javax.naming.CommunicationException; //導入方法依賴的package包/類
public static LdapClient newInstance(String host, int port,
Hashtable<?, ?> envmt, boolean isLdaps) throws NamingException {
SocketFactory factory = LdapUtils.getSocketFactory(envmt, isLdaps);
// TODO: get LdapClient from pool first.
try {
return new LdapClient(factory, host, port);
} catch (IOException e) {
CommunicationException ex = new CommunicationException();
ex.setRootCause(e);
throw ex;
}
}