From ec2f1fbdba8039d438c254b5ceb483f3a553fa9e Mon Sep 17 00:00:00 2001 From: emmanuel lecharny Date: Wed, 21 Aug 2024 11:56:24 +0200 Subject: [PATCH] Partial fix to DIRSERVER_1728: interceptor-collective --- .../main/java/org/apache/directory/server/i18n/I18n.java | 7 ++++--- .../org/apache/directory/server/i18n/errors.properties | 8 +++++--- .../core/collective/CollectiveAttributeInterceptor.java | 6 +++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java b/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java index 39007f4104..321d2e1c8b 100644 --- a/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java +++ b/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java @@ -319,6 +319,10 @@ public enum I18n // apacheds-interceptors-collective errors 17000 - 17999 + ERR_17000_CANNOT_STORE_COLLECTIVE_ATT_IN_ENTRY("ERR_17000_CANNOT_STORE_COLLECTIVE_ATT_IN_ENTRY"), + ERR_17001_CANNOT_OPERATE_ON_COLLECTIVE_ATTRIBUTE("ERR_17001_CANNOT_OPERATE_ON_COLLECTIVE_ATTRIBUTE"), + ERR_17002_COLLECTIVE_SUBENTRY_WITHOUT_COLLECTIVE_AT("ERR_17002_COLLECTIVE_SUBENTRY_WITHOUT_COLLECTIVE_AT"), + // apacheds-interceptors-event errors 18000 - 18999 // No error @@ -613,15 +617,12 @@ public enum I18n ERR_223("ERR_223"), ERR_224("ERR_224"), ERR_226("ERR_226"), - ERR_241_CANNOT_STORE_COLLECTIVE_ATT_IN_ENTRY("ERR_241_CANNOT_STORE_COLLECTIVE_ATT_IN_ENTRY"), - ERR_242("ERR_242"), ERR_249("ERR_249"), ERR_251_PARENT_NOT_FOUND("ERR_251_PARENT_NOT_FOUND"), ERR_252_ALIAS_WITH_CHILD_NOT_ALLOWED("ERR_252_ALIAS_WITH_CHILD_NOT_ALLOWED"), ERR_253("ERR_253"), ERR_254_ADD_EXISTING_VALUE("ERR_254_ADD_EXISTING_VALUE"), ERR_255("ERR_255"), - ERR_257_COLLECTIVE_SUBENTRY_WITHOUT_COLLECTIVE_AT("ERR_257_COLLECTIVE_SUBENTRY_WITHOUT_COLLECTIVE_AT"), ERR_258("ERR_258"), ERR_259("ERR_259"), ERR_261("ERR_261"), diff --git a/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties b/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties index fde90079f1..087039ba55 100644 --- a/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties +++ b/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties @@ -308,6 +308,11 @@ ERR_16004_FILE_CANNOT_BE_DELETED=Can''t delete file {0} # apacheds-interceptors-collective errors 17000 - 17999 +ERR_17000_CANNOT_STORE_COLLECTIVE_ATT_IN_ENTRY=Collective attributes cannot be stored in non-collectiveAttributeSubentries +ERR_17001_CANNOT_OPERATE_ON_COLLECTIVE_ATTRIBUTE=Cannot operate on collective attributes in non-collectiveAttributeSubentries +ERR_17002_COLLECTIVE_SUBENTRY_WITHOUT_COLLECTIVE_AT=A CollectiveAttribute Subentry must have at least one collective Attribute + + # apacheds-interceptors-event errors 18000 - 18999 # --- no error --- @@ -627,15 +632,12 @@ ERR_222=Cannot call store method: {0} ERR_223=[36] aliasDereferencingProblem - attempt to create alias to itself. ERR_224=[36] aliasDereferencingProblem - attempt to create alias with cycle to relative {0} not allowed from descendent alias {1} ERR_226=[33] aliasProblem - the alias when dereferenced would not name a known object the aliasedObjectName must be set to a valid existing entry. -ERR_241_CANNOT_STORE_COLLECTIVE_ATT_IN_ENTRY=Collective attributes cannot be stored in non-collectiveAttributeSubentries -ERR_242=Cannot operate on collective attributes in non-collectiveAttributeSubentries ERR_249=The global schema subentry cannot be added since it exists by default. ERR_251_PARENT_NOT_FOUND=Parent {0} not found ERR_252_ALIAS_WITH_CHILD_NOT_ALLOWED=Attempt to add entry ''{0}'' under alias ''{1}'' not allowed. ERR_253=Can not allow the deletion of the subschemaSubentry ({0}) for the global schema. ERR_254_ADD_EXISTING_VALUE=Trying to add existing value ''{0}'' to attribute {1} ERR_255=Can not allow the renaming of the subschemaSubentry ({0}) for the global schema: it is fixed at {1} -ERR_257_COLLECTIVE_SUBENTRY_WITHOUT_COLLECTIVE_AT=A CollectiveAttribute Subentry must have at least one collective Attribute ERR_258=Can not allow the move of the subschemaSubentry ({0}) for the global schema\: it is fixed at {1} ERR_259=Attempt to search under non-existant entry\: ERR_261=Failed to expand node diff --git a/interceptors/collective/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java b/interceptors/collective/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java index bcfc08fa2d..442d4271ec 100644 --- a/interceptors/collective/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java +++ b/interceptors/collective/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java @@ -216,7 +216,7 @@ private void checkAdd( Dn normName, Entry entry ) throws LdapException LOG.info( "A CollectiveAttribute subentry *should* have at least one collectiveAttribute" ); throw new LdapSchemaViolationException( ResultCodeEnum.OBJECT_CLASS_VIOLATION, - I18n.err( I18n.ERR_257_COLLECTIVE_SUBENTRY_WITHOUT_COLLECTIVE_AT ) ); + I18n.err( I18n.ERR_17002_COLLECTIVE_SUBENTRY_WITHOUT_COLLECTIVE_AT ) ); } if ( containsAnyCollectiveAttributes( entry ) ) @@ -228,7 +228,7 @@ private void checkAdd( Dn normName, Entry entry ) throws LdapException "Cannot add the entry {} : it contains some CollectiveAttributes and is not a collective subentry", entry ); throw new LdapSchemaViolationException( ResultCodeEnum.OBJECT_CLASS_VIOLATION, - I18n.err( I18n.ERR_241_CANNOT_STORE_COLLECTIVE_ATT_IN_ENTRY ) ); + I18n.err( I18n.ERR_17000_CANNOT_STORE_COLLECTIVE_ATT_IN_ENTRY ) ); } } @@ -259,7 +259,7 @@ private void checkModify( ModifyOperationContext modifyContext ) throws LdapExce LOG.info( "Cannot modify the entry {} : it contains some CollectiveAttributes and is not a collective subentry", targetEntry ); - throw new LdapSchemaViolationException( ResultCodeEnum.OBJECT_CLASS_VIOLATION, I18n.err( I18n.ERR_242 ) ); + throw new LdapSchemaViolationException( ResultCodeEnum.OBJECT_CLASS_VIOLATION, I18n.err( I18n.ERR_17001_CANNOT_OPERATE_ON_COLLECTIVE_ATTRIBUTE ) ); } }