當前位置: 首頁>>代碼示例>>Java>>正文


Java NamingException.getMessage方法代碼示例

本文整理匯總了Java中javax.naming.NamingException.getMessage方法的典型用法代碼示例。如果您正苦於以下問題:Java NamingException.getMessage方法的具體用法?Java NamingException.getMessage怎麽用?Java NamingException.getMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.naming.NamingException的用法示例。


在下文中一共展示了NamingException.getMessage方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: Rdn

import javax.naming.NamingException; //導入方法依賴的package包/類
/**
 * Constructs an Rdn from the given attribute set. See
 * {@link javax.naming.directory.Attributes Attributes}.
 * <p>
 * The string attribute values are not interpreted as
 * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>
 * formatted RDN strings. That is, the values are used
 * literally (not parsed) and assumed to be unescaped.
 *
 * @param attrSet The non-null and non-empty attributes containing
 * type/value mappings.
 * @throws InvalidNameException If contents of <tt>attrSet</tt> cannot
 *          be used to construct a valid RDN.
 */
public Rdn(Attributes attrSet) throws InvalidNameException {
    if (attrSet.size() == 0) {
        throw new InvalidNameException("Attributes cannot be empty");
    }
    entries = new ArrayList<>(attrSet.size());
    NamingEnumeration<? extends Attribute> attrs = attrSet.getAll();
    try {
        for (int nEntries = 0; attrs.hasMore(); nEntries++) {
            RdnEntry entry = new RdnEntry();
            Attribute attr = attrs.next();
            entry.type = attr.getID();
            entry.value = attr.get();
            entries.add(nEntries, entry);
        }
    } catch (NamingException e) {
        InvalidNameException e2 = new InvalidNameException(
                                    e.getMessage());
        e2.initCause(e);
        throw e2;
    }
    sort(); // arrange entries for comparison
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:37,代碼來源:Rdn.java

示例2: Rdn

import javax.naming.NamingException; //導入方法依賴的package包/類
/**
 * Constructs an Rdn from the given attribute set. See
 * {@link javax.naming.directory.Attributes Attributes}.
 * <p>
 * The string attribute values are not interpreted as
 * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>
 * formatted RDN strings. That is, the values are used
 * literally (not parsed) and assumed to be unescaped.
 *
 * @param attrSet The non-null and non-empty attributes containing
 * type/value mappings.
 * @throws InvalidNameException If contents of {@code attrSet} cannot
 *          be used to construct a valid RDN.
 */
public Rdn(Attributes attrSet) throws InvalidNameException {
    if (attrSet.size() == 0) {
        throw new InvalidNameException("Attributes cannot be empty");
    }
    entries = new ArrayList<>(attrSet.size());
    NamingEnumeration<? extends Attribute> attrs = attrSet.getAll();
    try {
        for (int nEntries = 0; attrs.hasMore(); nEntries++) {
            RdnEntry entry = new RdnEntry();
            Attribute attr = attrs.next();
            entry.type = attr.getID();
            entry.value = attr.get();
            entries.add(nEntries, entry);
        }
    } catch (NamingException e) {
        InvalidNameException e2 = new InvalidNameException(
                                    e.getMessage());
        e2.initCause(e);
        throw e2;
    }
    sort(); // arrange entries for comparison
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:37,代碼來源:Rdn.java

示例3: nextElement

import javax.naming.NamingException; //導入方法依賴的package包/類
@Override
public Binding nextElement() {
    try {
        return nextElementInternal();
    } catch (NamingException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:9,代碼來源:NamingContextBindingsEnumeration.java

示例4: searchLdapUsersOverLimit

import javax.naming.NamingException; //導入方法依賴的package包/類
@Override
@Interceptors({ ServiceProviderInterceptor.class })
public boolean searchLdapUsersOverLimit(final String userIdPattern)
        throws ValidationException {
    ArgumentValidator.notNull("userIdPattern", userIdPattern);

    Organization organization = dm.getCurrentUser().getOrganization();

    LdapConnector connector = getLdapConnectionForOrganization(
            organization);
    Properties dirProperties = connector.getDirProperties();
    Map<SettingType, String> attrMap = connector.getAttrMap();
    String baseDN = connector.getBaseDN();
    ILdapResultMapper<VOUserDetails> mapper = new LdapVOUserDetailsMapper(
            null, attrMap);
    try {
        return ldapAccess.searchOverLimit(dirProperties, baseDN,
                getLdapSearchFilter(attrMap, userIdPattern), mapper, false);
    } catch (NamingException e) {
        Object[] params = new Object[] {
                dirProperties.get(Context.PROVIDER_URL), e.getMessage() };
        ValidationException vf = new ValidationException(
                ReasonEnum.LDAP_CONNECTION_REFUSED, null, params);
        logger.logError(Log4jLogger.SYSTEM_LOG, vf,
                LogMessageIdentifier.ERROR_LDAP_SYSTEM_CONNECTION_REFUSED);
        throw vf;
    }
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:29,代碼來源:IdentityServiceBean.java

示例5: nextElement

import javax.naming.NamingException; //導入方法依賴的package包/類
public Object nextElement() {
    try {
        return nextElementInternal();
    } catch (NamingException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:8,代碼來源:NamingContextBindingsEnumeration.java

示例6: initialize

import javax.naming.NamingException; //導入方法依賴的package包/類
public void initialize() {
    try {
        this.workManager = (WorkManager) new InitialContext().lookup(workManagerName);
    } catch (NamingException e) {
        throw new IllegalStateException("Could not locate WorkManager: " + e.getMessage(), e);
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:8,代碼來源:WorkManagerThreadExecutor.java

示例7: lookupConnectivityConfiguration

import javax.naming.NamingException; //導入方法依賴的package包/類
private synchronized ConnectivityConfiguration lookupConnectivityConfiguration() throws IOException {
	try {
		if (this.localConnectivityConfiguration == null) {
			Context ctx = new InitialContext();
			this.localConnectivityConfiguration = (ConnectivityConfiguration) ctx.lookup(CONNECTIVITY_CONFIGURATION_LOOKUP_NAME);
		}
		return this.localConnectivityConfiguration;
	} catch (NamingException e) {
		throw new IOException(e.getMessage(), e);
	}
}
 
開發者ID:SAP,項目名稱:cloud-c4c-ticket-duplicate-finder-ext,代碼行數:12,代碼來源:HTTPConnector.java

示例8: nextElement

import javax.naming.NamingException; //導入方法依賴的package包/類
@Override
public Binding nextElement() {
	try {
		return nextElementInternal();
	} catch (NamingException e) {
		throw new RuntimeException(e.getMessage(), e);
	}
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:9,代碼來源:NamingContextBindingsEnumeration.java

示例9: searchLdapUsers

import javax.naming.NamingException; //導入方法依賴的package包/類
@Override
@Interceptors({ ServiceProviderInterceptor.class })
public List<VOUserDetails> searchLdapUsers(final String userIdPattern)
        throws ValidationException {

    ArgumentValidator.notNull("userIdPattern", userIdPattern);

    Organization organization = dm.getCurrentUser().getOrganization();

    LdapConnector connector = getLdapConnectionForOrganization(
            organization);
    Properties dirProperties = connector.getDirProperties();
    Map<SettingType, String> attrMap = connector.getAttrMap();
    String baseDN = connector.getBaseDN();

    List<SettingType> attrList = new ArrayList<>(attrMap.keySet());
    ILdapResultMapper<VOUserDetails> mapper = new LdapVOUserDetailsMapper(
            null, attrMap);
    try {
        // read user from LDAP
        List<VOUserDetails> voUserList = ldapAccess.search(dirProperties,
                baseDN, getLdapSearchFilter(attrMap, userIdPattern), mapper,
                false);

        int size = voUserList.size();
        for (int i = 0; i < size; i++) {
            VOUserDetails voUser = voUserList.get(i);
            PlatformUser user = getPlatformUserByOrgAndReamUserId(
                    organization, voUser.getRealmUserId());
            if (null != user) {
                // update the domain object with possibly changed LDAP
                // attributes and return a complete value object
                UserDataAssembler.updatePlatformUser(voUser, attrList,
                        user);
                voUserList.set(i, UserDataAssembler.toVOUserDetails(user));
            } else {
                // set some mandatory attributes
                voUser.setOrganizationId(organization.getOrganizationId());
                String locale = voUser.getLocale();
                if (locale == null || locale.trim().length() == 0) {
                    voUser.setLocale(organization.getLocale());
                }
            }
        }
        return voUserList;
    } catch (NamingException e) {
        Object[] params = new Object[] {
                dirProperties.get(Context.PROVIDER_URL), e.getMessage() };
        ValidationException vf = new ValidationException(
                ReasonEnum.LDAP_CONNECTION_REFUSED, null, params);
        logger.logError(Log4jLogger.SYSTEM_LOG, vf,
                LogMessageIdentifier.ERROR_LDAP_SYSTEM_CONNECTION_REFUSED);
        throw vf;
    }
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:56,代碼來源:IdentityServiceBean.java


注:本文中的javax.naming.NamingException.getMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。