directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1666521 - /directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/SchemaObjectWrapper.java
Date Fri, 13 Mar 2015 17:20:52 GMT
Author: elecharny
Date: Fri Mar 13 17:20:52 2015
New Revision: 1666521

URL: http://svn.apache.org/r1666521
Log:
Forgot to commit a patch submitted by Radovan...

Modified:
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/SchemaObjectWrapper.java

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/SchemaObjectWrapper.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/SchemaObjectWrapper.java?rev=1666521&r1=1666520&r2=1666521&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/SchemaObjectWrapper.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/SchemaObjectWrapper.java
Fri Mar 13 17:20:52 2015
@@ -53,7 +53,11 @@ public class SchemaObjectWrapper
     {
         int h = 37;
         h += h * 17 + schemaObject.getObjectType().getValue();
-        h += h * 17 + schemaObject.getOid().hashCode();
+
+        if ( schemaObject.getOid() != null )
+        {
+            h += h * 17 + schemaObject.getOid().hashCode();
+        }
 
         return h;
     }
@@ -77,7 +81,20 @@ public class SchemaObjectWrapper
         SchemaObject that = ( ( SchemaObjectWrapper ) o ).get();
         SchemaObject current = get();
 
-        return ( that.getOid().equals( current.getOid() ) && ( that.getObjectType()
== current.getObjectType() ) );
+        // Ultimately, that has to be true, regardless of the OID value
+        if ( that.getObjectType() != current.getObjectType() )
+        {
+            return false;
+        }
+
+        // If both OID are null, instances are equals
+        if ( that.getOid() == null )
+        {
+            return ( current.getOid() == null );
+        }
+
+        // The that'oid will never be null, we don't really care if current.oid is null here.
+        return that.getOid().equals( current.getOid() );
     }
 
 



Mime
View raw message