当前位置: 首页>>代码示例>>Java>>正文


Java CommunicationException.setRootCause方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:25,代码来源:LdapContextImpl.java

示例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);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:37,代码来源:LdapContextImpl.java

示例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;
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:15,代码来源:LdapClient.java


注:本文中的javax.naming.CommunicationException.setRootCause方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。