directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r373392 - /directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/schema/SchemaService.java
Date Sun, 29 Jan 2006 23:30:59 GMT
Author: elecharny
Date: Sun Jan 29 15:30:55 2006
New Revision: 373392

URL: http://svn.apache.org/viewcvs?rev=373392&view=rev
Log:
Added a check of the attributes for an add operation.

Modified:
    directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/schema/SchemaService.java

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/schema/SchemaService.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/schema/SchemaService.java?rev=373392&r1=373391&r2=373392&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/schema/SchemaService.java
(original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/schema/SchemaService.java
Sun Jan 29 15:30:55 2006
@@ -727,4 +727,26 @@
             return true;
         }
     }
+
+    /**
+     * Check that all the attributes exist in the schema for this entry.
+     */
+    public void add( NextInterceptor next, String upName, Name normName, Attributes attrs
) throws NamingException
+    {
+        AttributeTypeRegistry atRegistry = this.globalRegistries.getAttributeTypeRegistry();
+
+        NamingEnumeration attrEnum = attrs.getIDs();
+        
+        while ( attrEnum.hasMoreElements())
+        {
+            String name = (String)attrEnum.nextElement();
+
+            if ( ! atRegistry.hasAttributeType( name ) )
+            {
+                throw new LdapInvalidAttributeIdentifierException();
+            }
+        }
+
+        next.add( upName, normName, attrs );
+    }
 }



Mime
View raw message