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 2009/11/24 08:47:31 UTC

svn commit: r883616 - /directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java

Author: elecharny
Date: Tue Nov 24 07:47:31 2009
New Revision: 883616

URL: http://svn.apache.org/viewvc?rev=883616&view=rev
Log:
fixed some potential NPE in the getOid() method

Modified:
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java?rev=883616&r1=883615&r2=883616&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java (original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java Tue Nov 24 07:47:31 2009
@@ -288,7 +288,10 @@
         {
             AttributeType attributeType = attributeTypeRegistry.lookup( name );
             
-            return attributeType.getOid();
+            if ( attributeType != null )
+            {
+                return attributeType.getOid();
+            }
         }
         catch ( NamingException ne )
         {
@@ -300,7 +303,10 @@
         {
             ObjectClass objectClass = objectClassRegistry.lookup( name );
             
-            return objectClass.getOid();
+            if ( objectClass != null )
+            {
+                return objectClass.getOid();
+            }
         }
         catch ( NamingException ne )
         {
@@ -312,7 +318,10 @@
         {
             LdapSyntax ldapSyntax = ldapSyntaxRegistry.lookup( name );
             
-            return ldapSyntax.getOid();
+            if ( ldapSyntax != null )
+            {
+                return ldapSyntax.getOid();
+            }
         }
         catch ( NamingException ne )
         {
@@ -324,7 +333,10 @@
         {
             MatchingRule matchingRule = matchingRuleRegistry.lookup( name );
             
-            return matchingRule.getOid();
+            if ( matchingRule != null )
+            {
+                return matchingRule.getOid();
+            }
         }
         catch ( NamingException ne )
         {
@@ -336,7 +348,10 @@
         {
             MatchingRuleUse matchingRuleUse = matchingRuleUseRegistry.lookup( name );
             
-            return matchingRuleUse.getOid();
+            if ( matchingRuleUse != null )
+            {
+                return matchingRuleUse.getOid();
+            }
         }
         catch ( NamingException ne )
         {
@@ -348,7 +363,10 @@
         {
             NameForm nameForm = nameFormRegistry.lookup( name );
             
-            return nameForm.getOid();
+            if ( nameForm != null )
+            {
+                return nameForm.getOid();
+            }
         }
         catch ( NamingException ne )
         {
@@ -360,7 +378,10 @@
         {
             DITContentRule ditContentRule = ditContentRuleRegistry.lookup( name );
             
-            return ditContentRule.getOid();
+            if ( ditContentRule != null )
+            {
+                return ditContentRule.getOid();
+            }
         }
         catch ( NamingException ne )
         {
@@ -372,13 +393,17 @@
         {
             DITStructureRule ditStructureRule = ditStructureRuleRegistry.lookup( name );
             
-            return ditStructureRule.getOid();
+            if ( ditStructureRule != null )
+            {
+                return ditStructureRule.getOid();
+            }
         }
         catch ( NamingException ne )
         {
             // No more registries to look at...
-            return null;
         }
+        
+        return null;
     }