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 2018/08/08 08:36:19 UTC
[directory-ldap-api] branch master updated: Fix the failing test.
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 a755f84 Fix the failing test.
a755f84 is described below
commit a755f84bb580710164774bff166d8efc1fef3340
Author: Emmanuel Lécharny <el...@symas.com>
AuthorDate: Wed Aug 8 10:36:18 2018 +0200
Fix the failing test.
---
.../api/ldap/model/schema/comparators/IntegerComparator.java | 12 +++++++++---
1 file changed, 9 insertions(+), 3 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 448fa5d..94d06bc 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,6 +64,7 @@ public class IntegerComparator extends LdapComparator<Object> implements Seriali
@Override
public int compare( Object v1, Object v2 )
{
+ // The value can be a String, a Value or a Long
if ( v1 == null )
{
if ( v2 == null )
@@ -75,7 +76,12 @@ public class IntegerComparator extends LdapComparator<Object> implements Seriali
return -1;
}
}
- else if ( v1 instanceof String )
+ else if ( v2 == null )
+ {
+ return 1;
+ }
+
+ if ( v1 instanceof String )
{
return compare( ( String ) v1, ( String ) v2 );
}
@@ -83,9 +89,9 @@ public class IntegerComparator extends LdapComparator<Object> implements Seriali
{
return compare( ( ( Value ) v1 ).getValue(), ( ( Value ) v2 ).getValue() );
}
- else
+ else
{
- return 1;
+ return Long.compare( ( Long ) v1, ( Long ) v2 );
}
}