OpenJDK / jdk7u / jdk7u-dev / jdk
changeset 1120:a8ec0998704e
6717680: LdapCtx does not close the connection if initialization fails
Reviewed-by: vinnie, xuelei
author | weijun |
---|---|
date | Tue, 30 Dec 2008 10:42:45 +0800 |
parents | dfb09d805b2d |
children | 6a4e03cc03bb |
files | src/share/classes/com/sun/jndi/ldap/LdapCtx.java |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/classes/com/sun/jndi/ldap/LdapCtx.java Wed Dec 24 15:48:59 2008 -0800 +++ b/src/share/classes/com/sun/jndi/ldap/LdapCtx.java Tue Dec 30 10:42:45 2008 +0800 @@ -302,7 +302,16 @@ schemaTrees = new Hashtable(11, 0.75f); initEnv(); - connect(false); + try { + connect(false); + } catch (NamingException e) { + try { + close(); + } catch (Exception e2) { + // Nothing + } + throw e; + } } LdapCtx(LdapCtx existing, String newDN) throws NamingException {