src/share/classes/com/sun/jndi/ldap/sasl/LdapSasl.java
Print this page
@@ -87,13 +87,14 @@
* @param env The possibly null environment of the context, possibly containing
* properties for used by SASL mechanisms
* @param bindCtls The possibly null controls to accompany the bind
* @return LdapResult containing status of the bind
*/
+ @SuppressWarnings("unchecked")
public static LdapResult saslBind(LdapClient clnt, Connection conn,
String server, String dn, Object pw,
- String authMech, Hashtable env, Control[] bindCtls)
+ String authMech, Hashtable<?,?> env, Control[] bindCtls)
throws IOException, NamingException {
SaslClient saslClnt = null;
boolean cleanupHandler = false;
@@ -110,11 +111,11 @@
String[] mechs = getSaslMechanismNames(authMech);
try {
// Create SASL client to use using SASL package
saslClnt = Sasl.createSaslClient(
- mechs, authzId, "ldap", server, env, cbh);
+ mechs, authzId, "ldap", server, (Hashtable<String, ?>)env, cbh);
if (saslClnt == null) {
throw new AuthenticationNotSupportedException(authMech);
}
@@ -183,17 +184,17 @@
* @return A non-null array of String; each element of the array
* contains a single mechanism name.
*/
private static String[] getSaslMechanismNames(String str) {
StringTokenizer parser = new StringTokenizer(str);
- Vector mechs = new Vector(10);
+ Vector<String> mechs = new Vector<>(10);
while (parser.hasMoreTokens()) {
mechs.addElement(parser.nextToken());
}
String[] mechNames = new String[mechs.size()];
for (int i = 0; i < mechs.size(); i++) {
- mechNames[i] = (String)mechs.elementAt(i);
+ mechNames[i] = mechs.elementAt(i);
}
return mechNames;
}
private static final byte[] NO_BYTES = new byte[0];