本文整理汇总了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;
}
}