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 2007/10/02 17:21:25 UTC

svn commit: r581277 - /directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/common/AbstractValue.java

Author: elecharny
Date: Tue Oct  2 08:21:24 2007
New Revision: 581277

URL: http://svn.apache.org/viewvc?rev=581277&view=rev
Log:
- Removed a useless tests (when inside this method, we don't have to check that the obj is an instance of Value, as we will compare its class with this)
- Refactored the code for better readability (ternary operators are not cool, nor is a list of OR tests )

Modified:
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/common/AbstractValue.java

Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/common/AbstractValue.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/common/AbstractValue.java?rev=581277&r1=581276&r2=581277&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/common/AbstractValue.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/common/AbstractValue.java Tue Oct  2 08:21:24 2007
@@ -133,6 +133,17 @@
      */
     public boolean equals( Object obj )
     {
-        return obj == this || !( ( obj == null ) || !( obj instanceof Value ) ) && obj.getClass() == this.getClass();
+        if ( obj == this )
+        {
+            return true;
+        }
+
+        if ( obj == null )
+        {
+            return false;
+        }
+
+        // At the end, both classes should be equal
+        return ( obj.getClass() == this.getClass() );
     }
 }