directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r948490 - in /directory/apacheds/trunk: core/src/main/java/org/apache/directory/server/core/collective/ core/src/main/java/org/apache/directory/server/core/schema/ i18n/src/main/java/org/apache/directory/server/i18n/ i18n/src/main/resources...
Date Wed, 26 May 2010 16:30:27 GMT
Author: elecharny
Date: Wed May 26 16:30:26 2010
New Revision: 948490

URL: http://svn.apache.org/viewvc?rev=948490&view=rev
Log:
o Added a fix for DIRSERVER-1448 : w don't throw anymore a NPE if a modification removes all
the OC for an entry.
o The associated error message code has been improved

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java
    directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
    directory/apacheds/trunk/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java?rev=948490&r1=948489&r2=948490&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java
Wed May 26 16:30:26 2010
@@ -30,10 +30,10 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
-import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeTypeException;
 import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
@@ -83,6 +83,12 @@ public class CollectiveAttributesSchemaC
         
         EntryAttribute targetObjectClasses = targetEntry.get( SchemaConstants.OBJECT_CLASS_AT
);
         
+        if ( targetObjectClasses == null )
+        {
+            // This is not allowed 
+            throw new LdapSchemaViolationException( ResultCodeEnum.OTHER, I18n.err( I18n.ERR_272_MODIFY_LEAVES_NO_STRUCTURAL_OBJECT_CLASS,
originalEntry.getDn() ));
+        }
+        
         if ( targetObjectClasses.contains( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRY_OC
) )
         {
             return;

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java?rev=948490&r1=948489&r2=948490&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java
Wed May 26 16:30:26 2010
@@ -27,9 +27,9 @@ import java.util.Set;
 
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
-import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
@@ -88,7 +88,7 @@ public class SchemaChecker
         // all the objectClass values in which case we must throw an exception
         if ( attribute.size() == 0 )
         {
-            String msg = I18n.err( I18n.ERR_272, name );
+            String msg = I18n.err( I18n.ERR_272_MODIFY_LEAVES_NO_STRUCTURAL_OBJECT_CLASS,
name );
             
             if ( log.isInfoEnabled() )
             {
@@ -111,7 +111,7 @@ public class SchemaChecker
 
         // no structural object classes exist for the entry in the replacement
         // set for the objectClass attribute so we need to complain about that
-        String msg = I18n.err( I18n.ERR_272, name );
+        String msg = I18n.err( I18n.ERR_272_MODIFY_LEAVES_NO_STRUCTURAL_OBJECT_CLASS, name
);
         if ( log.isInfoEnabled() )
         {
             log.info( msg + ".  Raising LdapSchemaViolationException." );
@@ -152,7 +152,7 @@ public class SchemaChecker
         // all the objectClass values in which case we must throw an exception
         if ( objectClass.size() == 0 )
         {
-            String msg = I18n.err( I18n.ERR_272, name );
+            String msg = I18n.err( I18n.ERR_272_MODIFY_LEAVES_NO_STRUCTURAL_OBJECT_CLASS,
name );
             if ( log.isInfoEnabled() )
             {
                 log.info( msg + ".  Raising LdapSchemaViolationException." );
@@ -173,7 +173,7 @@ public class SchemaChecker
 
         // no structural object classes exist for the entry in the replacement
         // set for the objectClass attribute so we need to complain about that
-        String msg =  I18n.err( I18n.ERR_272, name );
+        String msg =  I18n.err( I18n.ERR_272_MODIFY_LEAVES_NO_STRUCTURAL_OBJECT_CLASS, name
);
         if ( log.isInfoEnabled() )
         {
             log.info( msg + ".  Raising LdapSchemaViolationException." );
@@ -232,7 +232,7 @@ public class SchemaChecker
         // all the objectClass values in which case we must throw an exception
         if ( attribute.size() == 0 )
         {
-            String msg =  I18n.err( I18n.ERR_272, name );
+            String msg =  I18n.err( I18n.ERR_272_MODIFY_LEAVES_NO_STRUCTURAL_OBJECT_CLASS,
name );
             
             if ( log.isInfoEnabled() )
             {
@@ -266,7 +266,7 @@ public class SchemaChecker
 
         // no structural object classes exist for the entry after the modifications
         // to the objectClass attribute so we need to complain about that
-        String msg =  I18n.err( I18n.ERR_272, name );
+        String msg =  I18n.err( I18n.ERR_272_MODIFY_LEAVES_NO_STRUCTURAL_OBJECT_CLASS, name
);
 
         if ( log.isInfoEnabled() )
         {

Modified: directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java?rev=948490&r1=948489&r2=948490&view=diff
==============================================================================
--- directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
(original)
+++ directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
Wed May 26 16:30:26 2010
@@ -305,7 +305,7 @@ public enum I18n
     ERR_269( "ERR_269" ),
     ERR_270( "ERR_270" ),
     ERR_271( "ERR_271" ),
-    ERR_272( "ERR_272" ),
+    ERR_272_MODIFY_LEAVES_NO_STRUCTURAL_OBJECT_CLASS( "ERR_272_MODIFY_LEAVES_NO_STRUCTURAL_OBJECT_CLASS"
),
     ERR_273( "ERR_273" ),
     ERR_274( "ERR_274" ),
     ERR_275( "ERR_275" ),

Modified: directory/apacheds/trunk/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties?rev=948490&r1=948489&r2=948490&view=diff
==============================================================================
--- directory/apacheds/trunk/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties
(original)
+++ directory/apacheds/trunk/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties
Wed May 26 16:30:26 2010
@@ -293,7 +293,7 @@ ERR_268=Cannot find a partition for {0}
 ERR_269=userRoot() in org.apache.directory.server.prefs.ServerPreferencesFactory not implemented!
 ERR_270=Failed to set up node.
 ERR_271=Failed to get SPI.
-ERR_272=Modify operation leaves no structural objectClass for entry {0}
+ERR_272_MODIFY_LEAVES_NO_STRUCTURAL_OBJECT_CLASS=Modify operation leaves no structural objectClass
for entry {0}
 ERR_273=Modify operation attempts to delete RDN attribute {0} on entry {1} violates schema
constraints
 ERR_274=Modify operation attempts to delete RDN attribute values in use for {0} on entry
{1} and violates schema constraints
 ERR_275={0} not found in attribute registry!



Mime
View raw message