You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2021/02/19 00:36:55 UTC

[directory-ldap-api] 01/02: fix for DIRAPI-366

This is an automated email from the ASF dual-hosted git repository.

elecharny pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-ldap-api.git

commit dcb5ab04a8415434102c0f7f2ecb411763f0f61a
Author: emmanuel lecharny <el...@apache.org>
AuthorDate: Fri Feb 19 01:35:40 2021 +0100

    fix for DIRAPI-366
---
 .../api/ldap/codec/actions/controls/StoreControlValue.java   | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/actions/controls/StoreControlValue.java b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/actions/controls/StoreControlValue.java
index 18f519f..da5c39e 100644
--- a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/actions/controls/StoreControlValue.java
+++ b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/actions/controls/StoreControlValue.java
@@ -29,6 +29,7 @@ import org.apache.directory.api.ldap.codec.api.ControlFactory;
 import org.apache.directory.api.ldap.codec.api.LdapMessageContainer;
 import org.apache.directory.api.ldap.model.message.Control;
 import org.apache.directory.api.ldap.model.message.Message;
+import org.apache.directory.api.ldap.model.message.controls.OpaqueControl;
 import org.apache.directory.api.util.Strings;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -78,7 +79,16 @@ public class StoreControlValue extends GrammarAction<LdapMessageContainer<Messag
         if ( tlv.getLength() >= 0 )
         {
             ControlFactory<?> factory = container.getControlFactory();
-            factory.decodeValue( control, value.getData() );
+           
+            if ( factory == null )
+            {
+                // We don't know about this control, so it's an opaque control 
+                ( ( OpaqueControl ) control ).setEncodedValue( value.getData() );
+            }
+            else
+            {
+                factory.decodeValue( control, value.getData() );
+            }
         }
 
         // We can have an END transition