< prev index next >
test/jdk/com/sun/jndi/ldap/BalancedParentheses.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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.
@@ -101,11 +101,11 @@
while (!serverReady) {
Thread.sleep(50);
}
// set up the environment for creating the initial context
- Hashtable<Object, Object> env = new Hashtable<Object, Object>();
+ Hashtable<Object, Object> env = new Hashtable<>();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://localhost:" + serverPort);
env.put("com.sun.jndi.ldap.read.timeout", "1000");
@@ -119,33 +119,33 @@
// searching
SearchControls scs = new SearchControls();
scs.setSearchScope(SearchControls.SUBTREE_SCOPE);
try {
- NamingEnumeration answer = context.search(
+ NamingEnumeration<SearchResult> answer = context.search(
"o=sun,c=us", "(&(cn=Bob)))", scs);
} catch (InvalidSearchFilterException isfe) {
// ignore, it is the expected filter exception.
System.out.println("Expected exception: " + isfe.getMessage());
} catch (NamingException ne) {
// maybe a read timeout exception, as the server does not response.
throw new Exception("Expect a InvalidSearchFilterException", ne);
}
try {
- NamingEnumeration answer = context.search(
+ NamingEnumeration<SearchResult> answer = context.search(
"o=sun,c=us", ")(&(cn=Bob)", scs);
} catch (InvalidSearchFilterException isfe) {
// ignore, it is the expected filter exception.
System.out.println("Expected exception: " + isfe.getMessage());
} catch (NamingException ne) {
// maybe a read timeout exception, as the server does not response.
throw new Exception("Expect a InvalidSearchFilterException", ne);
}
try {
- NamingEnumeration answer = context.search(
+ NamingEnumeration<SearchResult> answer = context.search(
"o=sun,c=us", "(&(cn=Bob))", scs);
} catch (InvalidSearchFilterException isfe) {
// ignore, it is the expected filter exception.
throw new Exception("Unexpected ISFE", isfe);
} catch (NamingException ne) {
< prev index next >