directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1005803 - in /directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema: LdapSyntax.java MatchingRule.java
Date Fri, 08 Oct 2010 12:23:07 GMT
Author: pamarcelot
Date: Fri Oct  8 12:23:07 2010
New Revision: 1005803

URL: http://svn.apache.org/viewvc?rev=1005803&view=rev
Log:
Fixed a few NPEs.

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LdapSyntax.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRule.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LdapSyntax.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LdapSyntax.java?rev=1005803&r1=1005802&r2=1005803&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LdapSyntax.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LdapSyntax.java
Fri Oct  8 12:23:07 2010
@@ -145,7 +145,7 @@ public class LdapSyntax extends Abstract
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName()
) );
         }
-        
+
         if ( !isReadOnly )
         {
             this.isHumanReadable = humanReadable;
@@ -176,7 +176,7 @@ public class LdapSyntax extends Abstract
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName()
) );
         }
-        
+
         if ( !isReadOnly )
         {
             this.syntaxChecker = syntaxChecker;
@@ -195,7 +195,7 @@ public class LdapSyntax extends Abstract
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName()
) );
         }
-        
+
         this.syntaxChecker = newSyntaxChecker;
     }
 
@@ -236,12 +236,13 @@ public class LdapSyntax extends Abstract
             }
         }
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
-    @SuppressWarnings("PMD.CollapsibleIfStatements") // Used because of comments
+    @SuppressWarnings("PMD.CollapsibleIfStatements")
+    // Used because of comments
     public void removeFromRegistries( List<Throwable> errors, Registries registries
) throws LdapException
     {
         if ( registries != null )
@@ -303,7 +304,19 @@ public class LdapSyntax extends Abstract
         }
 
         // Check the SyntaxChecker (not a equals)
-        return syntaxChecker.getOid().equals( that.syntaxChecker.getOid() );
+        if ( syntaxChecker != null )
+        {
+            if ( that.syntaxChecker == null )
+            {
+                return false;
+            }
+
+            return syntaxChecker.getOid().equals( that.syntaxChecker.getOid() );
+        }
+        else
+        {
+            return that.syntaxChecker == null;
+        }
     }
 
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRule.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRule.java?rev=1005803&r1=1005802&r2=1005803&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRule.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRule.java
Fri Oct  8 12:23:07 2010
@@ -252,7 +252,7 @@ public class MatchingRule extends Abstra
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName()
) );
         }
-        
+
         if ( !isReadOnly )
         {
             this.ldapSyntaxOid = oid;
@@ -271,7 +271,7 @@ public class MatchingRule extends Abstra
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName()
) );
         }
-        
+
         if ( !isReadOnly )
         {
             this.ldapSyntax = ldapSyntax;
@@ -291,7 +291,7 @@ public class MatchingRule extends Abstra
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName()
) );
         }
-        
+
         this.ldapSyntax = ldapSyntax;
         this.ldapSyntaxOid = ldapSyntax.getOid();
     }
@@ -321,7 +321,7 @@ public class MatchingRule extends Abstra
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName()
) );
         }
-        
+
         if ( !isReadOnly )
         {
             this.ldapComparator = ( LdapComparator<? super Object> ) ldapComparator;
@@ -340,7 +340,7 @@ public class MatchingRule extends Abstra
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName()
) );
         }
-        
+
         this.ldapComparator = ( LdapComparator<? super Object> ) ldapComparator;
     }
 
@@ -369,7 +369,7 @@ public class MatchingRule extends Abstra
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName()
) );
         }
-        
+
         if ( !isReadOnly )
         {
             this.normalizer = normalizer;
@@ -388,7 +388,7 @@ public class MatchingRule extends Abstra
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName()
) );
         }
-        
+
         this.normalizer = normalizer;
     }
 
@@ -474,13 +474,29 @@ public class MatchingRule extends Abstra
             }
         }
 
-        // Check the Syntax
+        // Check the Syntax OID
         if ( !compareOid( ldapSyntaxOid, that.ldapSyntaxOid ) )
         {
             return false;
         }
 
-        return ldapSyntax.equals( that.ldapSyntax );
+        // Check the Syntax
+        if ( ldapSyntax != null )
+        {
+            if ( !ldapSyntax.equals( that.ldapSyntax ) )
+            {
+                return false;
+            }
+        }
+        else
+        {
+            if ( that.ldapSyntax != null )
+            {
+                return false;
+            }
+        }
+
+        return true;
     }
 
 



Mime
View raw message