提交 8e379f79 编写于 作者: X xuelei

7185576: Need to consider the connection timeout at test/com/sun/jndi/ldap/InvalidLdapFilters.java

Reviewed-by: vinnie
上级 31b7fb82
/*
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2012, 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
......@@ -171,7 +171,21 @@ public class InvalidLdapFilters {
// env.put(Context.SECURITY_CREDENTIALS,"root");
// create initial context
DirContext context = new InitialDirContext(env);
DirContext context = null;
int i = 0;
while (true) {
try {
context = new InitialDirContext(env);
break;
} catch (NamingException ne) {
// may be a connection or read timeout, try again
// no more than 5 times
if (i++ > 5) {
throw new Exception(
"Maybe timeout during context initialization", ne);
}
}
}
// searching
SearchControls scs = new SearchControls();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册