本文整理汇总了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
}
示例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
}
示例3: nextElement
import javax.naming.NamingException; //导入方法依赖的package包/类
@Override
public Binding nextElement() {
try {
return nextElementInternal();
} catch (NamingException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
示例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;
}
}
示例5: nextElement
import javax.naming.NamingException; //导入方法依赖的package包/类
public Object nextElement() {
try {
return nextElementInternal();
} catch (NamingException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
示例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);
}
}
示例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);
}
}
示例8: nextElement
import javax.naming.NamingException; //导入方法依赖的package包/类
@Override
public Binding nextElement() {
try {
return nextElementInternal();
} catch (NamingException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
示例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;
}
}