Author: bdaw
Date: 2008-04-16 02:41:26 -0400 (Wed, 16 Apr 2008)
New Revision: 10604
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPExtUserModuleImpl.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModuleImpl.java
Log:
bobo
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPExtUserModuleImpl.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPExtUserModuleImpl.java 2008-04-16
06:39:37 UTC (rev 10603)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPExtUserModuleImpl.java 2008-04-16
06:41:26 UTC (rev 10604)
@@ -52,6 +52,7 @@
public User findUserByUserName(String userName) throws IdentityException,
IllegalArgumentException, NoSuchUserException
{
+ Context ctx = null;
try
{
log.debug("findUserByUserName(): username = " + userName);
@@ -73,7 +74,7 @@
"Posible data inconsistency");
}
SearchResult res = (SearchResult)sr.iterator().next();
- Context ctx = (Context)res.getObject();
+ ctx = (Context)res.getObject();
String dn = ctx.getNameInNamespace();
User user = createUserInstance(res.getAttributes(), dn);
ctx.close();
@@ -89,6 +90,20 @@
{
throw new IdentityException("User search failed.", e);
}
+ finally
+ {
+ try
+ {
+ if (ctx != null)
+ {
+ ctx.close();
+ }
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
throw new NoSuchUserException("No user found with name: " + userName);
}
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModuleImpl.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModuleImpl.java 2008-04-16
06:39:37 UTC (rev 10603)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModuleImpl.java 2008-04-16
06:41:26 UTC (rev 10604)
@@ -65,6 +65,7 @@
public User findUserByUserName(String userName) throws IdentityException,
IllegalArgumentException, NoSuchUserException
{
+ Context ctx = null;
try
{
log.debug("findUserByUserName(): username = " + userName);
@@ -85,7 +86,7 @@
"Posible data inconsistency");
}
SearchResult res = (SearchResult)sr.iterator().next();
- Context ctx = (Context)res.getObject();
+ ctx = (Context)res.getObject();
String dn = ctx.getNameInNamespace();
User user = createUserInstance(res.getAttributes(), dn);
ctx.close();
@@ -101,6 +102,20 @@
{
throw new IdentityException("User search failed.", e);
}
+ finally
+ {
+ try
+ {
+ if (ctx != null)
+ {
+ ctx.close();
+ }
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
throw new NoSuchUserException("No user found with name: " + userName);
}
Show replies by date