當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。