< prev index next >
test/jdk/com/sun/jndi/ldap/LdapName/EmptyNameSearch.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -44,11 +44,11 @@
Server s = new Server();
s.start();
Thread.sleep(3000);
// Setup JNDI parameters
- Hashtable env = new Hashtable();
+ Hashtable<Object, Object> env = new Hashtable<>();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://localhost:" + s.getPortNumber());
try {
@@ -56,11 +56,11 @@
// Create initial context
System.out.println("Client: connecting...");
DirContext ctx = new InitialDirContext(env);
System.out.println("Client: performing search...");
- ctx.search(new LdapName(Collections.EMPTY_LIST), "cn=*", null);
+ ctx.search(new LdapName(Collections.emptyList()), "cn=*", null);
ctx.close();
// Exit
throw new RuntimeException();
< prev index next >