[ 
https://issues.apache.org/jira/browse/CAMEL-26198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-26198.
---------------------------------
    Resolution: Fixed

Fixed by https://github.com/apache/camel/pull/29023 (merged to main as 
a8f899e05c8b60adc7c18ca15f7c12b0876e12d8).

_Claude Code on behalf of Claus Ibsen (davsclaus)_

> camel-ldap - a DirContext bean is closed after the first exchange so the 
> second fails, and a missing dirContextName bean gives an NPE
> -------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-26198
>                 URL: https://issues.apache.org/jira/browse/CAMEL-26198
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-ldap
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Major
>             Fix For: 4.24.0
>
>
> Found while adding the catalog body types of ldap (CAMEL-24961, PR #28416).
> h4. 1. A DirContext bean is closed after the first exchange
> {{LdapProducer.process}} (main 2a465aa4814c, line 89 to 92) always closes the 
> DirContext in a finally block. When the bean in the registry is a DirContext 
> (not a Hashtable or Map), the javadoc of {{dirContextName}} ({{LdapEndpoint}} 
> line 77 to 82) says "the bean is used as given", but the second exchange 
> fails with NoInitialContextException because the bean was closed. Checked on 
> 4.24.0-SNAPSHOT with a local OpenLDAP container (osixia/openldap 1.5.0).
> Proposed: close only the contexts the producer created from a Hashtable or 
> Map; leave a DirContext bean open (or document that it must be prototype 
> scoped).
> h4. 2. No bean for dirContextName gives an NPE
> When no bean is found, {{LdapProducer.getDirContext}} (line 106 to 120) 
> returns null, and the search fails with the NullPointerException "ldapContext 
> is null" instead of a clear error. Checked on 4.24.0-SNAPSHOT with a route 
> with a dirContextName that is not in the registry.
> Proposed: throw NoSuchBeanException naming the bean when the lookup returns 
> null.
> h4. 3. The embedded ApacheDS setup of the module ITs does not start
> The embedded ApacheDS of {{LdapRouteManualIT}} (and {{LdapRouteTwoManualIT}}) 
> fails in beforeAll with "ERR_277 Attribute publicKey not declared", so the 
> module ITs cannot run. Checked on 4.24.0-SNAPSHOT with the module ITs on 
> 4.24.0-SNAPSHOT.
> Proposed: fix the schema of the embedded server (or move the ITs to the 
> openldap test-infra service).
> _Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to