Skip to content

Commit

Permalink
Partial fix to DIRSERVER_1728: interceptor-exception
Browse files Browse the repository at this point in the history
  • Loading branch information
elecharny committed Aug 21, 2024
1 parent ec2f1fb commit 3663272
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
11 changes: 6 additions & 5 deletions i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,12 @@ public enum I18n
// No error

// apacheds-interceptors-exception errors 19000 - 19999
ERR_19000_PARENT_NOT_FOUND("ERR_19000_PARENT_NOT_FOUND"),
ERR_19001_ALIAS_WITH_CHILD_NOT_ALLOWED("ERR_19001_ALIAS_WITH_CHILD_NOT_ALLOWED"),
ERR_19002_CANNOT_ALLOW_SUBSCHEMA_SUBENTRY_DELETION("ERR_19002_CANNOT_ALLOW_SUBSCHEMA_SUBENTRY_DELETION"),
ERR_19003_CANNOT_ALLOW_SUBSCHEMA_SUBENTRY_RENAMING("ERR_19003_CANNOT_ALLOW_SUBSCHEMA_SUBENTRY_RENAMING"),
ERR_19004_CANNOT_ALLOW_SUBSCHEMA_SUBENTRY_MOVE("ERR_19004_CANNOT_ALLOW_SUBSCHEMA_SUBENTRY_MOVE"),

// apacheds-interceptors-hash errors 20000 - 20999
// No error

Expand Down Expand Up @@ -618,12 +624,7 @@ public enum I18n
ERR_224("ERR_224"),
ERR_226("ERR_226"),
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_258("ERR_258"),
ERR_259("ERR_259"),
ERR_261("ERR_261"),
ERR_262("ERR_262"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,12 @@ ERR_17002_COLLECTIVE_SUBENTRY_WITHOUT_COLLECTIVE_AT=A CollectiveAttribute Subent
# --- no error ---

# apacheds-interceptors-exception errors 19000 - 19999
ERR_19000_PARENT_NOT_FOUND=Parent {0} not found
ERR_19001_ALIAS_WITH_CHILD_NOT_ALLOWED=Attempt to add entry ''{0}'' under alias ''{1}'' not allowed.
ERR_19002_CANNOT_ALLOW_SUBSCHEMA_SUBENTRY_DELETION=Can not allow the deletion of the subschemaSubentry ({0}) for the global schema.
ERR_19003_CANNOT_ALLOW_SUBSCHEMA_SUBENTRY_RENAMING=Can not allow the renaming of the subschemaSubentry ({0}) for the global schema: it is fixed at {1}
ERR_19004_CANNOT_ALLOW_SUBSCHEMA_SUBENTRY_MOVE=Can not allow the move of the subschemaSubentry ({0}) for the global schema\: it is fixed at {1}

# apacheds-interceptors-hash errors 20000 - 20999
# --- no error ---

Expand Down Expand Up @@ -633,12 +639,7 @@ 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_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_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
ERR_262=System partition has wrong name: should be ''system'' not ''{0}''.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,15 @@ public void add( AddOperationContext addContext ) throws LdapException
}
catch ( Exception e )
{
throw new LdapNoSuchObjectException( I18n.err( I18n.ERR_251_PARENT_NOT_FOUND, parentDn.getName() ) );
throw new LdapNoSuchObjectException( I18n.err( I18n.ERR_19000_PARENT_NOT_FOUND, parentDn.getName() ) );
}

Attribute objectClass = ( ( ClonedServerEntry ) attrs ).getOriginalEntry().get(
directoryService.getAtProvider().getObjectClass() );

if ( objectClass.contains( SchemaConstants.ALIAS_OC ) )
{
String msg = I18n.err( I18n.ERR_252_ALIAS_WITH_CHILD_NOT_ALLOWED, name.getName(), parentDn.getName() );
String msg = I18n.err( I18n.ERR_19001_ALIAS_WITH_CHILD_NOT_ALLOWED, name.getName(), parentDn.getName() );
throw new LdapAliasException( msg );
}
else
Expand All @@ -197,7 +197,7 @@ public void delete( DeleteOperationContext deleteContext ) throws LdapException

if ( dn.equals( subschemSubentryDn ) )
{
throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_253,
throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_19002_CANNOT_ALLOW_SUBSCHEMA_SUBENTRY_DELETION,
subschemSubentryDn ) );
}

Expand Down Expand Up @@ -282,7 +282,7 @@ public void move( MoveOperationContext moveContext ) throws LdapException

if ( oriChildName.equals( subschemSubentryDn ) )
{
throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_258,
throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_19004_CANNOT_ALLOW_SUBSCHEMA_SUBENTRY_MOVE,
subschemSubentryDn, subschemSubentryDn ) );
}

Expand Down Expand Up @@ -313,7 +313,7 @@ public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext )
// Don't allow M&R in the SSSE
if ( oldDn.getNormName().equals( subschemSubentryDn.getNormName() ) )
{
throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_258,
throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_19004_CANNOT_ALLOW_SUBSCHEMA_SUBENTRY_MOVE,
subschemSubentryDn, subschemSubentryDn ) );
}

Expand Down Expand Up @@ -343,7 +343,7 @@ public void rename( RenameOperationContext renameContext ) throws LdapException

if ( dn.equals( subschemSubentryDn ) )
{
throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_255,
throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_19003_CANNOT_ALLOW_SUBSCHEMA_SUBENTRY_RENAMING,
subschemSubentryDn, subschemSubentryDn ) );
}

Expand Down

0 comments on commit 3663272

Please sign in to comment.