directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject [directory-ldap-api] branch master updated: Applied patch from DIRAPI-324
Date Thu, 15 Nov 2018 16:01:47 GMT
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


The following commit(s) were added to refs/heads/master by this push:
     new 1378a30  Applied patch from DIRAPI-324
1378a30 is described below

commit 1378a300c409f2b1295249177b0d767952de70fe
Author: elecharny <elecharny@pierre-arnauds-macbook-pro.home>
AuthorDate: Thu Nov 15 17:01:45 2018 +0100

    Applied patch from DIRAPI-324
---
 .../directory/api/asn1/ber/tlv/BerValue.java       | 30 ++++++++
 distribution/pom.xml                               |  8 +-
 distribution/src/main/assembly/anon.xml            |  2 +-
 ldap/codec/core/pom.xml                            |  8 +-
 .../directory/api/ldap/codec/api/LdapEncoder.java  | 73 ++++++++++++++++++
 ldap/extras/sp/pom.xml                             |  6 +-
 .../directory/api/ldap/sp/JavaStoredProcUtils.java | 22 +++---
 ldap/extras/trigger/pom.xml                        |  6 +-
 .../api/ldap/trigger/TriggerSpecification.java     | 35 +++++----
 ldap/model/pom.xml                                 | 18 ++---
 .../api/ldap/model/filter/BranchNode.java          | 40 +++++-----
 .../apache/directory/api/ldap/model/name/Dn.java   | 87 +++++++++++-----------
 .../ldap/model/schema/registries/OidRegistry.java  | 48 ++++++------
 ldap/schema/converter/pom.xml                      |  4 +-
 .../api/ldap/schema/converter/SchemaParser.java    | 20 ++---
 pom.xml                                            | 12 +--
 16 files changed, 260 insertions(+), 159 deletions(-)

diff --git a/asn1/ber/src/main/java/org/apache/directory/api/asn1/ber/tlv/BerValue.java b/asn1/ber/src/main/java/org/apache/directory/api/asn1/ber/tlv/BerValue.java
index c88f401..72ebbe4 100644
--- a/asn1/ber/src/main/java/org/apache/directory/api/asn1/ber/tlv/BerValue.java
+++ b/asn1/ber/src/main/java/org/apache/directory/api/asn1/ber/tlv/BerValue.java
@@ -24,6 +24,7 @@ import java.nio.BufferOverflowException;
 import java.nio.ByteBuffer;
 
 import org.apache.directory.api.asn1.EncoderException;
+import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.asn1.util.Asn1StringUtils;
 import org.apache.directory.api.asn1.util.BitString;
 import org.apache.directory.api.asn1.util.Oid;
@@ -788,6 +789,35 @@ public class BerValue
 
 
     /**
+     * Encode an integer value
+     *
+     * @param buffer The PDU in which the value will be put
+     * @param value The integer to be encoded
+     */
+    public static void encodeInteger( Asn1Buffer buffer, int value )
+    {
+        buffer.put( getBytes( value ) );
+        buffer.put( ( byte ) getNbBytes( value ) );
+        buffer.put( UniversalTag.INTEGER.getValue() );
+    }
+
+
+    /**
+     * Encode an integer value, with a specific tag
+     *
+     * @param buffer The PDU in which the value will be put
+     * @param tag The tag to use
+     * @param value The integer to be encoded
+     */
+    public static void encodeInteger( Asn1Buffer buffer, byte tag, int value )
+    {
+        buffer.put( getBytes( value ) );
+        buffer.put( ( byte ) getNbBytes( value ) );
+        buffer.put( tag );
+    }
+
+
+    /**
      * Encode a long value
      *
      * @param buffer The PDU in which the value will be put
diff --git a/distribution/pom.xml b/distribution/pom.xml
index ed2e9df..581bf52 100644
--- a/distribution/pom.xml
+++ b/distribution/pom.xml
@@ -81,8 +81,8 @@
     </dependency>
 
     <dependency>
-      <groupId>commons-collections</groupId>
-      <artifactId>commons-collections</artifactId>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-collections4</artifactId>
     </dependency>
 
     <dependency>
@@ -139,8 +139,8 @@
                     </artifactItem>
                     
                     <artifactItem>
-                      <groupId>commons-collections</groupId>
-                      <artifactId>commons-collections</artifactId>
+                      <groupId>org.apache.commons</groupId>
+                      <artifactId>commons-collections4</artifactId>
                     </artifactItem>
                     
                     <artifactItem>
diff --git a/distribution/src/main/assembly/anon.xml b/distribution/src/main/assembly/anon.xml
index 17ef68d..5bb1ca7 100644
--- a/distribution/src/main/assembly/anon.xml
+++ b/distribution/src/main/assembly/anon.xml
@@ -42,7 +42,7 @@
 
         <!-- The external dependencies -->
         <include>antlr:antlr:jar:${antlr.version}</include>
-        <include>commons-collections:commons-collections:jar:${commons.collections.version}</include>
+        <include>org.apache.commons:commons-collections4:jar:${commons.collections.version}</include>
         <include>log4j:log4j:jar:${log4j.version}</include>
         <include>org.slf4j:slf4j-api:jar:${slf4j.api.version}</include>
         <include>org.slf4j:slf4j-log4j12:jar:${slf4j.log4j12.version}</include>
diff --git a/ldap/codec/core/pom.xml b/ldap/codec/core/pom.xml
index 7a64fbb..8345d8c 100644
--- a/ldap/codec/core/pom.xml
+++ b/ldap/codec/core/pom.xml
@@ -68,13 +68,13 @@
     </dependency>
     
     <dependency>
-      <groupId>commons-lang</groupId>
-      <artifactId>commons-lang</artifactId>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
     </dependency>
 
     <dependency>
-      <groupId>commons-collections</groupId>
-      <artifactId>commons-collections</artifactId>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-collections4</artifactId>
     </dependency>
     
     <dependency>
diff --git a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/LdapEncoder.java
b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/LdapEncoder.java
index d0d72c6..d2807c0 100644
--- a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/LdapEncoder.java
+++ b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/LdapEncoder.java
@@ -29,6 +29,7 @@ import org.apache.directory.api.asn1.EncoderException;
 import org.apache.directory.api.asn1.ber.tlv.BerValue;
 import org.apache.directory.api.asn1.ber.tlv.TLV;
 import org.apache.directory.api.asn1.ber.tlv.UniversalTag;
+import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.i18n.I18n;
 import org.apache.directory.api.ldap.model.message.Control;
 import org.apache.directory.api.ldap.model.message.Message;
@@ -43,6 +44,9 @@ import org.apache.directory.api.util.Strings;
  */
 public final class LdapEncoder
 {
+    /**
+     * Make this final class impossible to instaciate from teh outside
+     */
     private LdapEncoder()
     {
         // Nothing to do
@@ -122,6 +126,75 @@ public final class LdapEncoder
         return buffer;
     }
 
+
+    /**
+     * Encode the controls
+     *
+     * @param buffer The buffer that will contain the encoded control
+     * @param codec The LdapApiService instance
+     * @param controls The control to encode
+     */
+    public static void encodeControlsReverse( Asn1Buffer buffer, LdapApiService codec, Map<String,
Control> controls )
+    {
+
+    }
+
+
+    /**
+     * Generate the PDU which contains the encoded object.
+     *
+     * The generation is done in two phases :
+     * - first, we compute the length of each part and the
+     * global PDU length
+     * - second, we produce the PDU.
+     *
+     * <pre>
+     * 0x30 L1
+     *   |
+     *   +--&gt; 0x02 L2 MessageId
+     *   +--&gt; ProtocolOp
+     *   +--&gt; Controls
+     *
+     * L2 = Length(MessageId)
+     * L1 = Length(0x02) + Length(L2) + L2 + Length(ProtocolOp) + Length(Controls)
+     * LdapMessageLength = Length(0x30) + Length(L1) + L1
+     * </pre>
+     *
+     * @param codec The LdapApiService instance
+     * @param message The message to encode
+     * @return A ByteBuffer that contains the PDU
+     * @throws EncoderException If anything goes wrong.
+     */
+    public static ByteBuffer encodeMessageReverse( LdapApiService codec, Message message
) throws EncoderException
+    {
+        Asn1Buffer buffer = new Asn1Buffer();
+
+        // The controls, if any
+        Map<String, Control> controls = message.getControls();
+
+        if ( ( controls != null ) && ( controls.size() > 0 ) )
+        {
+            encodeControlsReverse( buffer, codec, message.getControls() );
+        }
+
+
+        // The protocolOp part
+
+        // The message Id
+        BerValue.encodeInteger( buffer, message.getMessageId() );
+
+        // The LdapMessage Sequence
+        // BerValue.encodeSequence( buffer );
+
+        byte[] result = buffer.getBytes();
+        ByteBuffer bb = ByteBuffer.allocate( result.length );
+        bb.put( result );
+        bb.flip();
+
+        return bb;
+    }
+
+
     /**
      * Generate the PDU which contains the encoded object.
      *
diff --git a/ldap/extras/sp/pom.xml b/ldap/extras/sp/pom.xml
index c266503..5607cd7 100644
--- a/ldap/extras/sp/pom.xml
+++ b/ldap/extras/sp/pom.xml
@@ -63,8 +63,8 @@
     </dependency> 
 
     <dependency>
-      <groupId>commons-lang</groupId>
-      <artifactId>commons-lang</artifactId>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
     </dependency>
   </dependencies>
 
@@ -83,7 +83,7 @@
               org.apache.directory.api.ldap.sp;version=${project.version};-noimport:=true
             </Export-Package>
             <Import-Package>
-              org.apache.commons.lang;version=${commons.lang.version},
+              org.apache.commons.lang3;version=${commons.lang.version},
               org.apache.directory.api.ldap.codec.api;version=${project.version},
               org.apache.directory.api.ldap.extras.extended.storedProcedure;version=${project.version},
               org.apache.directory.api.ldap.model.constants;version=${project.version},
diff --git a/ldap/extras/sp/src/main/java/org/apache/directory/api/ldap/sp/JavaStoredProcUtils.java
b/ldap/extras/sp/src/main/java/org/apache/directory/api/ldap/sp/JavaStoredProcUtils.java
index 02c6398..f27689b 100644
--- a/ldap/extras/sp/src/main/java/org/apache/directory/api/ldap/sp/JavaStoredProcUtils.java
+++ b/ldap/extras/sp/src/main/java/org/apache/directory/api/ldap/sp/JavaStoredProcUtils.java
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- * 
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
  *  under the License.
- * 
+ *
  */
 
 package org.apache.directory.api.ldap.sp;
@@ -36,7 +36,7 @@ import javax.naming.ldap.ExtendedRequest;
 import javax.naming.ldap.ExtendedResponse;
 import javax.naming.ldap.LdapContext;
 
-import org.apache.commons.lang.SerializationUtils;
+import org.apache.commons.lang3.SerializationUtils;
 import org.apache.directory.api.ldap.codec.api.LdapApiServiceFactory;
 import org.apache.directory.api.ldap.extras.extended.storedProcedure.StoredProcedureRequestImpl;
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
@@ -61,7 +61,7 @@ public final class JavaStoredProcUtils
 
     /**
      * Returns the stream data of a Java class.
-     * 
+     *
      * @param clazz
      *           The class whose stream data will be retrieved.
      * @return
@@ -76,7 +76,7 @@ public final class JavaStoredProcUtils
         String classFileName = fullClassName.substring( lastDot + 1 ) + ".class";
         URL url = clazz.getResource( classFileName );
         InputStream in;
-        
+
         try
         {
             in = url.openStream();
@@ -87,9 +87,9 @@ public final class JavaStoredProcUtils
             ne.setRootCause( ioe );
             throw ne;
         }
-        
+
         File file;
-        
+
         try
         {
             file = new File( url.toURI() );
@@ -100,7 +100,7 @@ public final class JavaStoredProcUtils
             ne.setRootCause( urie );
             throw ne;
         }
-        
+
         int size = ( int ) file.length();
         byte[] buf = new byte[size];
 
@@ -125,7 +125,7 @@ public final class JavaStoredProcUtils
 
     /**
      * Loads a Java class's stream data as a subcontext of an LdapContext given.
-     * 
+     *
      * @param ctx
      *           The parent context of the Java class entry to be loaded.
      * @param clazz
@@ -151,7 +151,7 @@ public final class JavaStoredProcUtils
 
     /**
      * Invoke a Stored Procedure
-     * 
+     *
      * @param ctx The execution context
      * @param procedureName The procedure to execute
      * @param arguments The procedure's arguments
diff --git a/ldap/extras/trigger/pom.xml b/ldap/extras/trigger/pom.xml
index 11321f7..e1d3f9c 100644
--- a/ldap/extras/trigger/pom.xml
+++ b/ldap/extras/trigger/pom.xml
@@ -67,8 +67,8 @@
     </dependency>
 
     <dependency>
-      <groupId>commons-lang</groupId>
-      <artifactId>commons-lang</artifactId>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
     </dependency>
   </dependencies>
 
@@ -104,7 +104,7 @@
             <Import-Package>
               antlr;version=${antlr.version},
               antlr.collections.impl;version=${antlr.version},
-              org.apache.commons.lang;version=${commons.lang.version},
+              org.apache.commons.lang3;version=${commons.lang.version},
               org.apache.directory.api.i18n;version=${project.version},
               org.apache.directory.api.util;version=${project.version},
               org.apache.directory.api.ldap.model.constants;version=${project.version},
diff --git a/ldap/extras/trigger/src/main/java/org/apache/directory/api/ldap/trigger/TriggerSpecification.java
b/ldap/extras/trigger/src/main/java/org/apache/directory/api/ldap/trigger/TriggerSpecification.java
index bf0928e..7f2df66 100644
--- a/ldap/extras/trigger/src/main/java/org/apache/directory/api/ldap/trigger/TriggerSpecification.java
+++ b/ldap/extras/trigger/src/main/java/org/apache/directory/api/ldap/trigger/TriggerSpecification.java
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 
 package org.apache.directory.api.ldap.trigger;
@@ -23,13 +23,12 @@ package org.apache.directory.api.ldap.trigger;
 
 import java.util.List;
 
-import org.apache.commons.lang.NullArgumentException;
 import org.apache.directory.api.i18n.I18n;
 
 
 /**
  * The Trigger Specification Bean.
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class TriggerSpecification
@@ -52,17 +51,17 @@ public class TriggerSpecification
     public TriggerSpecification( LdapOperation ldapOperation, ActionTime actionTime, List<SPSpec>
spSpecs )
     {
         super();
-        
+
         if ( ( ldapOperation == null ) || ( actionTime == null ) || ( spSpecs == null ) )
         {
-            throw new NullArgumentException( I18n.err( I18n.ERR_11000_TRIGGER_SPECIFICATION_INIT_WITH_NULL
) );
+            throw new NullPointerException( I18n.err( I18n.ERR_11000_TRIGGER_SPECIFICATION_INIT_WITH_NULL
) );
         }
-        
+
         if ( spSpecs.isEmpty() )
         {
             throw new IllegalArgumentException( I18n.err( I18n.ERR_11001_TRIGGER_SPECIFICATION_INIT_WITH_EPTY_SPEC_LIST
) );
         }
-        
+
         this.ldapOperation = ldapOperation;
         this.actionTime = actionTime;
         this.spSpecs = spSpecs;
@@ -173,7 +172,7 @@ public class TriggerSpecification
             h = h * 17 + ( ( name == null ) ? 0 : name.hashCode() );
             h = h * 17 + ( ( options == null ) ? 0 : options.hashCode() );
             h = h * 17 + ( ( parameters == null ) ? 0 : parameters.hashCode() );
-            
+
             return h;
         }
 
@@ -188,19 +187,19 @@ public class TriggerSpecification
             {
                 return true;
             }
-            
+
             if ( obj == null )
             {
                 return false;
             }
-            
+
             if ( getClass() != obj.getClass() )
             {
                 return false;
             }
-            
+
             SPSpec other = ( SPSpec ) obj;
-            
+
             if ( name == null )
             {
                 if ( other.name != null )
@@ -212,7 +211,7 @@ public class TriggerSpecification
             {
                 return false;
             }
-            
+
             if ( options == null )
             {
                 if ( other.options != null )
@@ -224,7 +223,7 @@ public class TriggerSpecification
             {
                 return false;
             }
-            
+
             if ( parameters == null )
             {
                 if ( other.parameters != null )
@@ -236,7 +235,7 @@ public class TriggerSpecification
             {
                 return false;
             }
-            
+
             return true;
         }
     }
diff --git a/ldap/model/pom.xml b/ldap/model/pom.xml
index 6cd7574..473568b 100644
--- a/ldap/model/pom.xml
+++ b/ldap/model/pom.xml
@@ -77,13 +77,13 @@
     </dependency>
 
     <dependency>
-      <groupId>commons-lang</groupId>
-      <artifactId>commons-lang</artifactId>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
     </dependency>
 
     <dependency>
-      <groupId>commons-collections</groupId>
-      <artifactId>commons-collections</artifactId>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-collections4</artifactId>
     </dependency>
 
     <dependency>
@@ -181,11 +181,11 @@
               antlr;version=${antlr.version},
               antlr.collections.impl;version=${antlr.version},
               org.apache.commons.codec.digest;version=${commons.codec.version},
-              org.apache.commons.collections;version=${commons.collections.version},
-              org.apache.commons.collections.list;version=${commons.collections.version},
-              org.apache.commons.collections.map;version=${commons.collections.version},
-              org.apache.commons.lang;version=${commons.lang.version},
-              org.apache.commons.lang.exception;version=${commons.lang.version},
+              org.apache.commons.collections4;version=${commons.collections.version},
+              org.apache.commons.collections4.list;version=${commons.collections.version},
+              org.apache.commons.collections4.map;version=${commons.collections.version},
+              org.apache.commons.lang3;version=${commons.lang.version},
+              org.apache.commons.lang3.exception;version=${commons.lang.version},
               org.apache.directory.api.asn1;version=${project.version},
               org.apache.directory.api.asn1.util;version=${project.version},
               org.apache.directory.api.i18n;version=${project.version},
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/BranchNode.java
b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/BranchNode.java
index 96a5866..19d8f3a 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/BranchNode.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/BranchNode.java
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.api.ldap.model.filter;
 
@@ -23,13 +23,13 @@ package org.apache.directory.api.ldap.model.filter;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections4.CollectionUtils;
 
 
 /**
  * Node representing branches within the expression tree corresponding to
  * logical operators within the filter expression.
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public abstract class BranchNode extends AbstractExprNode
@@ -60,7 +60,7 @@ public abstract class BranchNode extends AbstractExprNode
 
     /**
      * Creates a BranchNode using a logical operator and a list of children.
-     * 
+     *
      * @param assertionType the node's type
      * @param childList the child nodes under this branch node.
      */
@@ -79,7 +79,7 @@ public abstract class BranchNode extends AbstractExprNode
 
     /**
      * Creates a BranchNode using a logical operator.
-     * 
+     *
      * @param assertionType the node's type
      */
     protected BranchNode( AssertionType assertionType )
@@ -103,7 +103,7 @@ public abstract class BranchNode extends AbstractExprNode
 
     /**
      * Makes a full clone in new memory space of the current node and children
-     * 
+     *
      * @return the clone
      */
     @Override
@@ -118,7 +118,7 @@ public abstract class BranchNode extends AbstractExprNode
 
             for ( ExprNode child : children )
             {
-                ( ( BranchNode ) clone ).children.add( ( ExprNode ) child.clone() );
+                ( ( BranchNode ) clone ).children.add( child.clone() );
             }
         }
 
@@ -128,7 +128,7 @@ public abstract class BranchNode extends AbstractExprNode
 
     /**
      * Adds a child node to this branch node node
-     * 
+     *
      * @param node the child expression to add to this branch node
      */
     public void addNode( ExprNode node )
@@ -138,8 +138,8 @@ public abstract class BranchNode extends AbstractExprNode
 
 
     /**
-     * Adds a child node to this branch node at the head rather than the tail. 
-     * 
+     * Adds a child node to this branch node at the head rather than the tail.
+     *
      * @param node the child expression to add to this branch node
      */
     public void addNodeToHead( ExprNode node )
@@ -153,7 +153,7 @@ public abstract class BranchNode extends AbstractExprNode
      * array list so that backends can sort the order of children using their
      * own search optimization algorithms. We want backends and other parts of
      * the system to be able to induce side effects on the tree structure.
-     * 
+     *
      * @return the list of child nodes under this branch node.
      */
     public List<ExprNode> getChildren()
@@ -164,7 +164,7 @@ public abstract class BranchNode extends AbstractExprNode
 
     /**
      * Sets the list of children under this node.
-     * 
+     *
      * @param list the list of children to set.
      */
     public void setChildren( List<ExprNode> list )
@@ -177,7 +177,7 @@ public abstract class BranchNode extends AbstractExprNode
      * Convenience method that gets the first child in the children array. Its
      * very useful for NOT nodes since they only have one child by avoiding code
      * that looks like: <code> ( ExprNode ) m_children.get( 0 ) </code>
-     * 
+     *
      * @return the first child
      */
     public ExprNode getFirstChild()
@@ -194,7 +194,7 @@ public abstract class BranchNode extends AbstractExprNode
     /**
      * @see ExprNode#accept(
      *FilterVisitor)
-     *      
+     *
      * @return The modified element
      */
     @Override
@@ -233,7 +233,7 @@ public abstract class BranchNode extends AbstractExprNode
 
     /**
      * Tells if this Node is Schema aware.
-     * 
+     *
      * @return true if the Node is SchemaAware
      */
     @Override
@@ -252,7 +252,7 @@ public abstract class BranchNode extends AbstractExprNode
                     return false;
                 }
             }
-            
+
             return true;
         }
     }
@@ -260,7 +260,7 @@ public abstract class BranchNode extends AbstractExprNode
 
     /**
      * @see Object#hashCode()
-     * @return the instance's hash code 
+     * @return the instance's hash code
      */
     @Override
     public int hashCode()
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Dn.java b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Dn.java
index c5a0f8a..b75d0cf 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Dn.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Dn.java
@@ -29,7 +29,7 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.commons.collections.list.UnmodifiableList;
+import org.apache.commons.collections4.list.UnmodifiableList;
 import org.apache.directory.api.i18n.I18n;
 import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
 import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
@@ -165,7 +165,7 @@ public class Dn implements Iterable<Rdn>, Externalizable
 
     /**
      * Construct an empty Schema aware Dn object
-     * 
+     *
      *  @param schemaManager The SchemaManager to use
      */
     public Dn( SchemaManager schemaManager )
@@ -178,7 +178,7 @@ public class Dn implements Iterable<Rdn>, Externalizable
 
     /**
      * Construct an empty Schema aware Dn object
-     * 
+     *
      *  @param schemaManager The SchemaManager to use
      *  @param dn The Dn to use
      *  @throws LdapInvalidDnException If the Dn is invalid
@@ -219,7 +219,7 @@ public class Dn implements Iterable<Rdn>, Externalizable
      *     "ou", exampleName,
      *     baseDn);
      * </pre>
-     * 
+     *
      * @param upRdns The list of String composing the Dn
      * @throws LdapInvalidDnException If the resulting Dn is invalid
      */
@@ -247,7 +247,7 @@ public class Dn implements Iterable<Rdn>, Externalizable
      *     "ou", exampleName,
      *     baseDn);
      * </pre>
-     * 
+     *
      * @param schemaManager the schema manager
      * @param upRdns The list of String composing the Dn
      * @throws LdapInvalidDnException If the resulting Dn is invalid
@@ -300,7 +300,7 @@ public class Dn implements Iterable<Rdn>, Externalizable
         // Stores the representations of a Dn : internal (as a string and as a
         // byte[]) and external.
         upName = sbUpName.toString();
-        
+
         try
         {
             normName = parseInternal( schemaManager, upName, rdns );
@@ -376,7 +376,7 @@ public class Dn implements Iterable<Rdn>, Externalizable
     public Dn( SchemaManager schemaManager, Rdn... rdns ) throws LdapInvalidDnException
     {
         this.schemaManager = schemaManager;
-        
+
         if ( rdns == null )
         {
             return;
@@ -400,7 +400,7 @@ public class Dn implements Iterable<Rdn>, Externalizable
 
     /**
      * Get the associated SchemaManager if any.
-     * 
+     *
      * @return The SchemaManager
      */
     public SchemaManager getSchemaManager()
@@ -491,17 +491,17 @@ public class Dn implements Iterable<Rdn>, Externalizable
     {
         return normName == null ? "" : normName;
     }
-    
-    
+
+
     /**
      * @return The RDN as an escaped String
      */
     public String getEscaped()
     {
         StringBuilder sb = new StringBuilder();
-        
+
         boolean isFirst = true;
-        
+
         for ( Rdn rdn : rdns )
         {
             if ( isFirst )
@@ -512,10 +512,10 @@ public class Dn implements Iterable<Rdn>, Externalizable
             {
                 sb.append( ',' );
             }
-            
+
             sb.append( rdn.getEscaped() );
         }
-        
+
         return sb.toString();
     }
 
@@ -724,10 +724,9 @@ public class Dn implements Iterable<Rdn>, Externalizable
      *
      * @return All the components
      */
-    @SuppressWarnings("unchecked")
     public List<Rdn> getRdns()
     {
-        return UnmodifiableList.decorate( rdns );
+        return UnmodifiableList.unmodifiableList( rdns );
     }
 
 
@@ -739,12 +738,12 @@ public class Dn implements Iterable<Rdn>, Externalizable
      * as a parameter. Here is a working example :
      * <pre>
      * Dn dn = new Dn( "cn=test, dc=server, dc=directory, dc=apache, dc=org" );
-     * 
+     *
      * Dn descendant = dn.getDescendantOf( "dc=apache, dc=org" );
-     * 
+     *
      * // At this point, the descendant contains cn=test, dc=server, dc=directory"
      * </pre>
-     * 
+     *
      * @param ancestor The parent DN
      * @return The part of the DN that is the descendant
      * @throws LdapInvalidDnException If the Dn is invalid
@@ -763,12 +762,12 @@ public class Dn implements Iterable<Rdn>, Externalizable
      * as a parameter. Here is a working example :
      * <pre>
      * Dn dn = new Dn( "cn=test, dc=server, dc=directory, dc=apache, dc=org" );
-     * 
+     *
      * Dn descendant = dn.getDescendantOf( "dc=apache, dc=org" );
-     * 
+     *
      * // At this point, the descendant contains cn=test, dc=server, dc=directory"
      * </pre>
-     * 
+     *
      * @param ancestor The parent DN
      * @return The part of the DN that is the descendant
      * @throws LdapInvalidDnException If the Dn is invalid
@@ -827,12 +826,12 @@ public class Dn implements Iterable<Rdn>, Externalizable
      * as a parameter. Here is a working example :
      * <pre>
      * Dn dn = new Dn( "cn=test, dc=server, dc=directory, dc=apache, dc=org" );
-     * 
+     *
      * Dn ancestor = dn.getAncestorOf( "cn=test, dc=server, dc=directory" );
-     * 
+     *
      * // At this point, the ancestor contains "dc=apache, dc=org"
      * </pre>
-     * 
+     *
      * @param descendant The child DN
      * @return The part of the DN that is the ancestor
      * @throws LdapInvalidDnException If the Dn is invalid
@@ -851,12 +850,12 @@ public class Dn implements Iterable<Rdn>, Externalizable
      * as a parameter. Here is a working example :
      * <pre>
      * Dn dn = new Dn( "cn=test, dc=server, dc=directory, dc=apache, dc=org" );
-     * 
+     *
      * Dn ancestor = dn.getAncestorOf( new Dn( "cn=test, dc=server, dc=directory" ) );
-     * 
+     *
      * // At this point, the ancestor contains "dc=apache, dc=org"
      * </pre>
-     * 
+     *
      * @param descendant The child DN
      * @return The part of the DN that is the ancestor
      * @throws LdapInvalidDnException If the Dn is invalid
@@ -909,12 +908,12 @@ public class Dn implements Iterable<Rdn>, Externalizable
 
     /**
      * Add a suffix to the Dn. For instance, if the current Dn is "ou=people",
-     * and the suffix "dc=example,dc=com", then the resulting Dn will be 
-     * "ou=people,dc=example,dc=com" 
-     * 
+     * and the suffix "dc=example,dc=com", then the resulting Dn will be
+     * "ou=people,dc=example,dc=com"
+     *
      * @param suffix the suffix to add
      * @return The resulting Dn with the additional suffix
-     * @throws LdapInvalidDnException If the resulting Dn is not valid 
+     * @throws LdapInvalidDnException If the resulting Dn is not valid
      */
     public Dn add( Dn suffix ) throws LdapInvalidDnException
     {
@@ -947,12 +946,12 @@ public class Dn implements Iterable<Rdn>, Externalizable
 
     /**
      * Add a suffix to the Dn. For instance, if the current Dn is "ou=people",
-     * and the suffix "dc=example,dc=com", then the resulting Dn will be 
-     * "ou=people,dc=example,dc=com" 
-     * 
+     * and the suffix "dc=example,dc=com", then the resulting Dn will be
+     * "ou=people,dc=example,dc=com"
+     *
      * @param comp the suffix to add
      * @return The resulting Dn with the additional suffix
-     * @throws LdapInvalidDnException If the resulting Dn is not valid 
+     * @throws LdapInvalidDnException If the resulting Dn is not valid
      */
     public Dn add( String comp ) throws LdapInvalidDnException
     {
@@ -1028,7 +1027,7 @@ public class Dn implements Iterable<Rdn>, Externalizable
 
     /**
      * Create a copy of the current Dn
-     * 
+     *
      * @return The copied Dn
      */
     private Dn copy()
@@ -1053,7 +1052,7 @@ public class Dn implements Iterable<Rdn>, Externalizable
     public boolean equals( Object obj )
     {
         Dn other;
-        
+
         if ( obj instanceof String )
         {
             try
@@ -1073,7 +1072,7 @@ public class Dn implements Iterable<Rdn>, Externalizable
         {
             return false;
         }
-        
+
         if ( other.size() != this.size() )
         {
             return false;
@@ -1089,7 +1088,7 @@ public class Dn implements Iterable<Rdn>, Externalizable
             }
             return normName.equals( other.normName );
         }
-        
+
         for ( int i = 0; i < this.size(); i++ )
         {
             if ( !other.rdns.get( i ).equals( rdns.get( i ) ) )
@@ -1102,7 +1101,7 @@ public class Dn implements Iterable<Rdn>, Externalizable
         return true;
     }
 
-    
+
     /**
      * Tells if the Dn is schema aware
      *
@@ -1119,7 +1118,7 @@ public class Dn implements Iterable<Rdn>, Externalizable
      * the rightmost to the leftmost. For instance, the following code :<br>
      * <pre>
      * Dn dn = new Dn( "sn=test, dc=apache, dc=org );
-     * 
+     *
      * for ( Rdn rdn : dn )
      * {
      *     System.out.println( rdn.toString() );
@@ -1131,7 +1130,7 @@ public class Dn implements Iterable<Rdn>, Externalizable
      * dc=apache
      * sn=test
      * </pre>
-     * 
+     *
      */
     @Override
     public Iterator<Rdn> iterator()
@@ -1243,7 +1242,7 @@ public class Dn implements Iterable<Rdn>, Externalizable
             rdn.readExternal( in );
             rdns.add( rdn );
         }
-        
+
         toUpName();
     }
 
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/OidRegistry.java
b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/OidRegistry.java
index e3e416a..3aa420b 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/OidRegistry.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/OidRegistry.java
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.api.ldap.model.schema.registries;
 
@@ -26,7 +26,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.directory.api.asn1.util.Oid;
 import org.apache.directory.api.i18n.I18n;
 import org.apache.directory.api.ldap.model.exception.LdapException;
@@ -39,7 +39,7 @@ import org.slf4j.LoggerFactory;
 /**
  * Object identifier registry. It stores the OIDs for AT, OC, MR, LS, MRU, DSR, DCR and NF.
  * An OID is unique, and associated with a SO.
- * 
+ *
  * @param <T> The type of SchemaObject
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
@@ -51,7 +51,7 @@ public class OidRegistry<T extends SchemaObject> implements Iterable<T>
 
     /** Maps OID to a type of SchemaObject */
     private Map<String, T> byOid = new HashMap<>();
-    
+
     /** A flag indicating that the Registry is relaxed or not */
     private boolean isRelaxed = Registries.STRICT;
 
@@ -59,7 +59,7 @@ public class OidRegistry<T extends SchemaObject> implements Iterable<T>
 
     /**
      * Tells if the given OID is present on this registry
-     * 
+     *
      * @param oid The OID to lookup
      * @return true if the OID already exists
      */
@@ -72,7 +72,7 @@ public class OidRegistry<T extends SchemaObject> implements Iterable<T>
     /**
      * Gets the primary name associated with an OID.  The primary name is the
      * first name specified for the OID.
-     * 
+     *
      * @param oid the object identifier
      * @return the primary name
      * @throws LdapException if oid does not exist
@@ -96,8 +96,8 @@ public class OidRegistry<T extends SchemaObject> implements Iterable<T>
 
 
     /**
-     * Gets the SchemaObject associated with an OID. 
-     * 
+     * Gets the SchemaObject associated with an OID.
+     *
      * @param oid the object identifier
      * @return the associated SchemaObject
      * @throws LdapException if oid does not exist
@@ -121,13 +121,13 @@ public class OidRegistry<T extends SchemaObject> implements Iterable<T>
 
 
     /**
-     * Gets the names associated with an OID.  An OID is unique however it may 
+     * Gets the names associated with an OID.  An OID is unique however it may
      * have many names used to refer to it.  A good example is the cn and
-     * commonName attribute names for OID 2.5.4.3.  Within a server one name 
+     * commonName attribute names for OID 2.5.4.3.  Within a server one name
      * within the set must be chosen as the primary name.  This is used to
      * name certain things within the server internally.  If there is more than
      * one name then the first name is taken to be the primary.
-     * 
+     *
      * @param oid the OID for which we return the set of common names
      * @return a sorted set of names
      * @throws org.apache.directory.api.ldap.model.exception.LdapException if oid does not
exist
@@ -157,7 +157,7 @@ public class OidRegistry<T extends SchemaObject> implements Iterable<T>
 
     /**
      * Lists all the OIDs within the registry.  This may be a really big list.
-     * 
+     *
      * @return all the OIDs registered
      */
     public Iterator<String> iteratorOids()
@@ -168,7 +168,7 @@ public class OidRegistry<T extends SchemaObject> implements Iterable<T>
 
     /**
      * Lists all the SchemaObjects within the registry.  This may be a really big list.
-     * 
+     *
      * @return all the SchemaObject registered
      */
     @Override
@@ -177,7 +177,7 @@ public class OidRegistry<T extends SchemaObject> implements Iterable<T>
         return byOid.values().iterator();
     }
 
-    
+
     /**
      * Tells if the Registry is permissive or if it must be checked
      * against inconsistencies.
@@ -220,7 +220,7 @@ public class OidRegistry<T extends SchemaObject> implements Iterable<T>
         isRelaxed = Registries.STRICT;
     }
 
-    
+
     public SchemaErrorHandler getErrorHandler()
     {
         return errorHandler;
@@ -235,7 +235,7 @@ public class OidRegistry<T extends SchemaObject> implements Iterable<T>
 
     /**
      * Adds an OID name pair to the registry.
-     * 
+     *
      * @param schemaObject The SchemaObject the oid belongs to
      * @throws LdapException If something went wrong
      */
@@ -249,7 +249,7 @@ public class OidRegistry<T extends SchemaObject> implements Iterable<T>
             {
                 LOG.debug( message );
             }
-            
+
             throw new LdapException( message );
         }
 
@@ -265,7 +265,7 @@ public class OidRegistry<T extends SchemaObject> implements Iterable<T>
                 {
                     LOG.debug( message );
                 }
-                
+
                 throw new LdapException( message );
             }
         }
@@ -297,8 +297,8 @@ public class OidRegistry<T extends SchemaObject> implements Iterable<T>
 
 
     /**
-     * Store the given SchemaObject into the OidRegistry. Available only to 
-     * the current package. A weak form (no check is done) of the register 
+     * Store the given SchemaObject into the OidRegistry. Available only to
+     * the current package. A weak form (no check is done) of the register
      * method, define for clone methods.
      *
      * @param schemaObject The SchemaObject to inject into the OidRegistry
@@ -329,7 +329,7 @@ public class OidRegistry<T extends SchemaObject> implements Iterable<T>
 
     /**
      * Copy the OidRegistry, without the contained values
-     * 
+     *
      * @return A new OidRegistry instance
      */
     public OidRegistry<T> copy()
diff --git a/ldap/schema/converter/pom.xml b/ldap/schema/converter/pom.xml
index a44d2d3..7c96993 100644
--- a/ldap/schema/converter/pom.xml
+++ b/ldap/schema/converter/pom.xml
@@ -38,8 +38,8 @@
     </dependency>
     
     <dependency>
-      <groupId>commons-lang</groupId>
-      <artifactId>commons-lang</artifactId>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
     </dependency>
     
     <dependency>
diff --git a/ldap/schema/converter/src/main/java/org/apache/directory/api/ldap/schema/converter/SchemaParser.java
b/ldap/schema/converter/src/main/java/org/apache/directory/api/ldap/schema/converter/SchemaParser.java
index e5ee22a..2218b71 100755
--- a/ldap/schema/converter/src/main/java/org/apache/directory/api/ldap/schema/converter/SchemaParser.java
+++ b/ldap/schema/converter/src/main/java/org/apache/directory/api/ldap/schema/converter/SchemaParser.java
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.api.ldap.schema.converter;
 
@@ -31,7 +31,7 @@ import java.nio.file.Paths;
 import java.text.ParseException;
 import java.util.List;
 
-import org.apache.commons.lang.exception.ExceptionUtils;
+import org.apache.commons.lang3.exception.ExceptionUtils;
 import org.apache.directory.api.i18n.I18n;
 import org.apache.directory.api.util.Strings;
 
@@ -120,14 +120,14 @@ public class SchemaParser
         }
 
         producerThread.start();
-        
+
         return invokeParser( schemaObject );
     }
 
 
     /**
      * Invoke the parser
-     * 
+     *
      * @param schemaName The schema to be parsed
      * @return A list of schema elements
      * @throws java.io.IOException If the schema file can't be processed
@@ -143,13 +143,13 @@ public class SchemaParser
         }
         catch ( RecognitionException re )
         {
-            String msg = I18n.err( I18n.ERR_15003_PARSER_FAILURE, schemaName, ExceptionUtils.getFullStackTrace(
re ) );
+            String msg = I18n.err( I18n.ERR_15003_PARSER_FAILURE, schemaName, ExceptionUtils.getStackTrace(
re ) );
             init();
             throw new ParseException( msg, re.getColumn() );
         }
         catch ( TokenStreamException tse )
         {
-            String msg = I18n.err( I18n.ERR_15003_PARSER_FAILURE, schemaName, ExceptionUtils.getFullStackTrace(
tse ) );
+            String msg = I18n.err( I18n.ERR_15003_PARSER_FAILURE, schemaName, ExceptionUtils.getStackTrace(
tse ) );
             init();
             throw new ParseException( msg, 0 );
         }
@@ -198,7 +198,7 @@ public class SchemaParser
         producerThread.start();
         invokeParser( "schema file ==> " + schemaFile.getAbsolutePath() );
     }
-    
+
 
     /**
      * The thread which read the schema files and fill the
diff --git a/pom.xml b/pom.xml
index 32d80a6..51bec22 100644
--- a/pom.xml
+++ b/pom.xml
@@ -46,8 +46,8 @@
     <!-- Set versions for depending jars -->
     <antlr.version>2.7.7</antlr.version>
     <commons.codec.version>1.11</commons.codec.version>
-    <commons.collections.version>3.2.2</commons.collections.version>
-    <commons.lang.version>2.6</commons.lang.version>
+    <commons.collections.version>4.2</commons.collections.version>
+    <commons.lang.version>3.8.1</commons.lang.version>
     <commons.pool.version>2.6.0</commons.pool.version>
     <dom4j.version>1.6.1</dom4j.version>
     <forbiddenapis.version>2.5</forbiddenapis.version>
@@ -474,14 +474,14 @@
       </dependency>
 
       <dependency>
-        <groupId>commons-collections</groupId>
-        <artifactId>commons-collections</artifactId>
+        <groupId>org.apache.commons</groupId>
+        <artifactId>commons-collections4</artifactId>
         <version>${commons.collections.version}</version>
       </dependency>
 
       <dependency>
-        <groupId>commons-lang</groupId>
-        <artifactId>commons-lang</artifactId>
+        <groupId>org.apache.commons</groupId>
+        <artifactId>commons-lang3</artifactId>
         <version>${commons.lang.version}</version>
       </dependency>
 


Mime
View raw message