Error in finalizer after LDAP search with referrals

have rather weird problem.

Web application executes LDAP search against Active directory GC.

It does it in a standard steps:

1. Creates hash table with parameters

2. Creates InitialDirContext

3. Execute search using search objects, filter etc.

4. Enumerates result using hasMoreElements and next until the necessary object is found.

5. Closes NameEnumeration object and context object

If referral are not used, application is being executed without any problems.

If referrals ARE USED and object is found, no problems.

If enumeration does not contain any objects (the first hasMoreElements returns false) no exceptions are thrown immediately, but debugger stops while exciting finalizer.

System Thread [Finalizer thread] (Suspended at breakpoint (Throwable: uncaught))

LdapSearchEnumeration(LdapNamingEnumeration).cleanup() line: 420

LdapSearchEnumeration(LdapNamingEnumeration).finalize() line: 413

The LdapSearchEnumeration object is not the same object that was created during search operation, however all parameters (filters ets are the same).

So it brings up some questions:

Do additional LdapSearchEnumeration objects are created behind the scene while executing search with referrals (looks like it)?

How to get access to these additional objects?

Has anybody seen this behavior?

I do not see any problem while executing in non-debug mode, but I am concern that I might loose some resources (connections, memory etc).

I am using Sun com.sun.jndi.ldap.LdapCtxFactory and application run under Web Sphere application server version 6.

Any help / ideas are greatly appreciated

Yev

[1741 byte] By [Yeva] at [2007-11-27 6:58:58]
# 1
I may be sending you off on a wild goose chase but you may want to see whether using hasMore rather hasMoreElements may change things. IIRC hasMoreElements does not throw exceptions,
adler_stevena at 2007-7-12 18:49:31 > top of Java-index,Core,Core APIs...
# 2
i tried both. The same result.However, if i didn't call nasMore i do not see this problem.It looks like it occurs only when i go to the end of enumeration
Yeva at 2007-7-12 18:49:31 > top of Java-index,Core,Core APIs...