You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/04/24 14:26:44 UTC
[camel] branch camel-3.x updated: CAMEL-19293: set dn only once (#9914)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.x by this push:
new 00c85607857 CAMEL-19293: set dn only once (#9914)
00c85607857 is described below
commit 00c8560785782ac6839e623cc8e488ff131e85e9
Author: Federico Mariani <34...@users.noreply.github.com>
AuthorDate: Mon Apr 24 16:26:09 2023 +0200
CAMEL-19293: set dn only once (#9914)
---
.../camel/component/springldap/SpringLdapProducer.java | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/components/camel-spring-ldap/src/main/java/org/apache/camel/component/springldap/SpringLdapProducer.java b/components/camel-spring-ldap/src/main/java/org/apache/camel/component/springldap/SpringLdapProducer.java
index 47735631f8b..bf11a2f4b67 100644
--- a/components/camel-spring-ldap/src/main/java/org/apache/camel/component/springldap/SpringLdapProducer.java
+++ b/components/camel-spring-ldap/src/main/java/org/apache/camel/component/springldap/SpringLdapProducer.java
@@ -93,13 +93,15 @@ public class SpringLdapProducer extends DefaultProducer {
LdapTemplate ldapTemplate = endpoint.getLdapTemplate();
String dn = (String) body.get(DN);
- if (ObjectHelper.isEmpty(dn)) {
- ContextSource contextSource = ldapTemplate.getContextSource();
- if (contextSource instanceof BaseLdapPathContextSource) {
- dn = ((BaseLdapPathContextSource) contextSource).getBaseLdapPathAsString();
+ boolean dnSetOnLdapTemplate = false;
+ ContextSource contextSource = ldapTemplate.getContextSource();
+ if (contextSource instanceof BaseLdapPathContextSource) {
+ if (ObjectHelper.isNotEmpty(((BaseLdapPathContextSource) contextSource).getBaseLdapPathAsString())) {
+ dn = ""; // DN already set on the ldapTemplate
+ dnSetOnLdapTemplate = true;
}
}
- if (operation != LdapOperation.FUNCTION_DRIVEN && (ObjectHelper.isEmpty(dn))) {
+ if (operation != LdapOperation.FUNCTION_DRIVEN && ObjectHelper.isEmpty(dn) && !dnSetOnLdapTemplate) {
throw new UnsupportedOperationException("DN must not be empty, but you provided an empty DN");
}