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: Fixed a stack overflow
Date Wed, 08 Aug 2018 07:31:28 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 67153d9  Fixed a stack overflow
     new cc31690  Merge branch 'master' of https://gitbox.apache.org/repos/asf/directory-ldap-api
67153d9 is described below

commit 67153d9935b8ffca30f55157e04903b63d01fb06
Author: Emmanuel L├ęcharny <elecharny@symas.com>
AuthorDate: Wed Aug 8 00:51:43 2018 +0200

    Fixed a stack overflow
---
 .../schema/comparators/IntegerComparator.java      | 26 +++++++++++-----------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/IntegerComparator.java
b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/IntegerComparator.java
index e721164..448fa5d 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/IntegerComparator.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/IntegerComparator.java
@@ -64,7 +64,18 @@ public class IntegerComparator extends LdapComparator<Object> implements
Seriali
     @Override
     public int compare( Object v1, Object v2 )
     {
-        if ( v1 instanceof String )
+        if ( v1 == null )
+        {
+            if ( v2 == null )
+            {
+                return 0;
+            }
+            else
+            {
+                return -1;
+            }
+        }
+        else if ( v1 instanceof String )
         {
             return compare( ( String ) v1, ( String ) v2 );
         }
@@ -74,18 +85,7 @@ public class IntegerComparator extends LdapComparator<Object> implements
Seriali
         }
         else
         {
-            if ( v2 instanceof String )
-            {
-                return compare( ( String ) v1, ( String ) v2 );
-            }
-            else if ( v2 instanceof Value )
-            {
-                return compare( null, ( ( Value ) v2 ).getValue() );
-            }
-            else
-            {
-                return compare( null, v2 );
-            }
+            return 1;
         }
     }
 


Mime
View raw message