directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1391514 - /directory/shared/trunk/ldap/extras/aci/src/main/antlr/ACIItem.g
Date Fri, 28 Sep 2012 15:57:42 GMT
Author: elecharny
Date: Fri Sep 28 15:57:42 2012
New Revision: 1391514

URL: http://svn.apache.org/viewvc?rev=1391514&view=rev
Log:
Fixed some potential NPE when trying to access a null SchemaManager (see DIRSTUDIO-833)

Modified:
    directory/shared/trunk/ldap/extras/aci/src/main/antlr/ACIItem.g

Modified: directory/shared/trunk/ldap/extras/aci/src/main/antlr/ACIItem.g
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/aci/src/main/antlr/ACIItem.g?rev=1391514&r1=1391513&r2=1391514&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/aci/src/main/antlr/ACIItem.g (original)
+++ directory/shared/trunk/ldap/extras/aci/src/main/antlr/ACIItem.g Fri Sep 28 15:57:42 2012
@@ -599,7 +599,15 @@ aMaxValueCount returns [ MaxValueCountEl
     {
         try
         {
-            attributeType = schemaManager.lookupAttributeTypeRegistry( oid );
+            if ( schemaManager != null )
+            {
+                attributeType = schemaManager.lookupAttributeTypeRegistry( oid );
+            }
+            else
+            {
+                attributeType = new AttributeType( oid );
+            }
+
             maxValueCount = new MaxValueCountElem( attributeType, token2Integer( token )
);
         }
         catch ( LdapException le )
@@ -670,8 +678,17 @@ restrictedValue returns [ RestrictedByEl
     {
         try
         {
-            attributeType = schemaManager.lookupAttributeTypeRegistry( typeOid );
-            valueInAttributeType = schemaManager.lookupAttributeTypeRegistry( valuesInOid
);
+            if ( schemaManager != null )
+            {
+                attributeType = schemaManager.lookupAttributeTypeRegistry( typeOid );
+                valueInAttributeType = schemaManager.lookupAttributeTypeRegistry( valuesInOid
);
+            }
+            else
+            {
+                attributeType = new AttributeType( typeOid );
+                valueInAttributeType = new AttributeType( valuesInOid );
+            }
+            
             restrictedValue = new RestrictedByElem( attributeType, valueInAttributeType );
         }
         catch ( LdapException le )
@@ -695,7 +712,15 @@ attributeTypeSet returns [ Set<Attribute
         {
             try
             {
-                attributeType = schemaManager.lookupAttributeTypeRegistry( oid );
+                if ( schemaManager != null )
+                {
+                    attributeType = schemaManager.lookupAttributeTypeRegistry( oid );
+                }
+                else
+                {
+                    attributeType = new AttributeType( oid );
+                }
+                
                 attributeTypeSet.add( attributeType );
             }
             catch ( LdapException le )
@@ -708,7 +733,15 @@ attributeTypeSet returns [ Set<Attribute
             {
                 try
                 {
-                    attributeType = schemaManager.lookupAttributeTypeRegistry( oid );
+                    if ( schemaManager != null )
+                    {
+                        attributeType = schemaManager.lookupAttributeTypeRegistry( oid );
+                    }
+                    else
+                    {
+                        attributeType = new AttributeType( oid );
+                    }
+
                     attributeTypeSet.add( attributeType );
                 }
                 catch ( LdapException le )



Mime
View raw message