directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r546115 - /directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
Date Mon, 11 Jun 2007 12:06:06 GMT
Author: elecharny
Date: Mon Jun 11 05:06:05 2007
New Revision: 546115

URL: http://svn.apache.org/viewvc?view=rev&rev=546115
Log:
Fixed a NPE if the user send an empty Attributes

Modified:
    directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java

Modified: directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java?view=diff&rev=546115&r1=546114&r2=546115
==============================================================================
--- directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
(original)
+++ directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
Mon Jun 11 05:06:05 2007
@@ -829,7 +829,7 @@
         }
         else if ( existing == null )
         {
-            return new LockableAttributeImpl( "objectClasses" );
+            return new LockableAttributeImpl( "objectClass" );
         }
 
         switch ( modOp )
@@ -1247,6 +1247,11 @@
         if ( objectClassMod == null )
         {
             objectClass = entry.get( "objectClass" );
+            
+            if ( objectClass == null )
+            {
+                objectClass = new LockableAttributeImpl( "objectClass" );
+            }
         }
         else
         {
@@ -1607,6 +1612,15 @@
         // 3-2) or if the AttributeType is COLLECTIVE
         // 4) We also check that for H-R attributes, we have a valid String in the values
         Attribute objectClassAttr = entry.get( "objectClass" );
+        
+        // Protect the server against a null objectClassAttr
+        // It can be the case if the user forgot to add it to the entry ...
+        // In this case, we create an new one, empty
+        if ( objectClassAttr == null )
+        {
+            objectClassAttr = new LockableAttributeImpl( "objectClass" );
+        }
+
         List ocs = new ArrayList();
         
         alterObjectClasses( objectClassAttr );



Mime
View raw message