Skip to content

Commit

Permalink
Some partial fixes for DIRSERVER-1728
Browse files Browse the repository at this point in the history
  • Loading branch information
elecharny committed Aug 16, 2024
1 parent e56ec6c commit 9da1a4d
Show file tree
Hide file tree
Showing 15 changed files with 77 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ public Entry toClientEntry() throws LdapException
@Override
public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException
{
throw new IllegalStateException( I18n.err( I18n.ERR_455 ) );
throw new IllegalStateException( I18n.err( I18n.ERR_02000_CANNOT_USE_SERIALIZATION_FOR_SERVER_ATTRIBUTE ) );
}


Expand All @@ -485,7 +485,7 @@ public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundExce
@Override
public void writeExternal( ObjectOutput out ) throws IOException
{
throw new IllegalStateException( I18n.err( I18n.ERR_456 ) );
throw new IllegalStateException( I18n.err( I18n.ERR_02001_CANNOT_USE_SERIALIZATION_FOR_SERVER_ENTRY ) );
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public static Entry getTargetEntry( Modification mod, Entry entry, SchemaManager
break;

default:
throw new IllegalStateException( I18n.err( I18n.ERR_464, modOp ) );
throw new IllegalStateException( I18n.err( I18n.ERR_02002_UNDEFINED_MODIFICATION_TYPE, modOp ) );
}

return targetEntry;
Expand All @@ -353,7 +353,7 @@ public static Attribute getUnion( Attribute attr0, Attribute attr1 ) throws Ldap
{
if ( attr0 == null && attr1 == null )
{
throw new IllegalArgumentException( I18n.err( I18n.ERR_465 ) );
throw new IllegalArgumentException( I18n.err( I18n.ERR_02003_ATTRIBUTE_ID_UNKNOWN ) );
}
else if ( attr0 == null )
{
Expand All @@ -365,7 +365,7 @@ else if ( attr1 == null )
}
else if ( !attr0.getAttributeType().equals( attr1.getAttributeType() ) )
{
throw new IllegalArgumentException( I18n.err( I18n.ERR_466 ) );
throw new IllegalArgumentException( I18n.err( I18n.ERR_02004_ATTTRIBUTE_UNION_NOT_POSSIBLE ) );
}

Attribute attr = attr0.clone();
Expand Down Expand Up @@ -493,7 +493,7 @@ public static List<Modification> toServerModification( Modification[] modificati
{
// The attributeType does not exist in the schema.
// It's an error
String message = I18n.err( I18n.ERR_467, id );
String message = I18n.err( I18n.ERR_02005_UNKNOWN_ATTRIBUTE_TYPE, id );
throw new LdapInvalidAttributeTypeException( message );
}
else
Expand Down Expand Up @@ -681,7 +681,7 @@ public SearchResult nextElement()
catch ( NamingException ne )
{
NoSuchElementException nsee =
new NoSuchElementException( I18n.err( I18n.ERR_468 ) );
new NoSuchElementException( I18n.err( I18n.ERR_02006_NAMING_EXCEPTION_ENCOUNTERED ) );
nsee.initCause( ne );
throw nsee;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ else if ( bnode instanceof NotNode )
return !evaluate( bnode.getFirstChild(), dn, entry );
}

throw new LdapInvalidSearchFilterException( I18n.err( I18n.ERR_243, node ) );
throw new LdapInvalidSearchFilterException( I18n.err( I18n.ERR_02007_NEGATION_HAS_NO_CHILD, node ) );
}
else
{
throw new LdapInvalidSearchFilterException( I18n.err( I18n.ERR_244, bnode ) );
throw new LdapInvalidSearchFilterException( I18n.err( I18n.ERR_02008_UNRECOGNIZED_BRANCH_NODE_OPERATOR, bnode ) );
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ else if ( node instanceof ExtensibleNode )
}
else
{
throw new LdapInvalidSearchFilterException( I18n.err( I18n.ERR_245, node ) );
throw new LdapInvalidSearchFilterException( I18n.err( I18n.ERR_02009_UNRECOGNIZED_LEAF_NODE_TYPE, node ) );
}
}

Expand Down Expand Up @@ -287,7 +287,7 @@ private MatchingRule getMatchingRule( AttributeType attributeType, int matchType
break;

default:
throw new LdapException( I18n.err( I18n.ERR_246, matchType ) );
throw new LdapException( I18n.err( I18n.ERR_02010_UNKNOWN_MATCH_TYPE, matchType ) );
}

if ( ( mrule == null ) && ( matchType != EQUALITY_MATCH ) )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public boolean evaluate( ExprNode node, Dn dn, Entry record ) throws LdapExcepti
return dn.isDescendantOf( snode.getBaseDn() );

default:
throw new LdapInvalidSearchFilterException( I18n.err( I18n.ERR_247 ) );
throw new LdapInvalidSearchFilterException( I18n.err( I18n.ERR_02011_UNRECOGNIZED_SEARCH_SCOPE ) );
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public boolean evaluate( ExprNode node, Dn dn, Entry entry ) throws LdapExceptio
}
catch ( PatternSyntaxException pse )
{
LdapInvalidSearchFilterException ne = new LdapInvalidSearchFilterException( I18n.err( I18n.ERR_248, node ) );
LdapInvalidSearchFilterException ne = new LdapInvalidSearchFilterException( I18n.err( I18n.ERR_02012_INCORRECT_SUBSTRING_NODE_SYNTAX, node ) );
ne.initCause( pse );
throw ne;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public void setReferralHandlingMode( ReferralHandlingMode referralHandlingMode )
@Override
public void throwReferral()
{
throw new NotImplementedException( I18n.err( I18n.ERR_320 ) );
throw new NotImplementedException( I18n.err( I18n.ERR_02013_THROW_REFERRAL_NOT_IMPLEMENTED_FOR_BIND ) );
}


Expand All @@ -251,7 +251,7 @@ public void throwReferral()
@Override
public boolean isReferralThrown()
{
throw new NotImplementedException( I18n.err( I18n.ERR_321 ) );
throw new NotImplementedException( I18n.err( I18n.ERR_02014_IS_REFERRAL_THROWN_NOT_IMPLEMENTED_FOR_BIND ) );
}


Expand All @@ -261,7 +261,7 @@ public boolean isReferralThrown()
@Override
public void ignoreReferral()
{
throw new NotImplementedException( I18n.err( I18n.ERR_322 ) );
throw new NotImplementedException( I18n.err( I18n.ERR_02015_IGNORE_REFERRAL_NOT_IMPLEMENTED_FOR_BIND ) );
}


Expand All @@ -271,7 +271,7 @@ public void ignoreReferral()
@Override
public boolean isReferralIgnored()
{
throw new NotImplementedException( I18n.err( I18n.ERR_323 ) );
throw new NotImplementedException( I18n.err( I18n.ERR_02016_IS_REFERRAL_IGNORED_NOT_IMPLEMENTED_FOR_BIND ) );
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void setDn( Dn dn )
return;
}

throw new UnsupportedOperationException( I18n.err( I18n.ERR_324 ) );
throw new UnsupportedOperationException( I18n.err( I18n.ERR_02017_EMPTY_OPERATION_CONTEXT_FORBIDDEN ) );
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public MoveAndRenameOperationContext( CoreSession session, ModifyDnRequest modif
}
catch ( LdapInvalidDnException lide )
{
throw new IllegalStateException( I18n.err( I18n.ERR_325, modifyDnRequest ), lide );
throw new IllegalStateException( I18n.err( I18n.ERR_02018_NEW_SUPERIOR_MUST_BE_NOT_NULL, modifyDnRequest ), lide );
}
}

Expand All @@ -118,7 +118,7 @@ public MoveAndRenameOperationContext( CoreSession session, ModifyDnRequest modif

if ( newSuperiorDn == null )
{
throw new IllegalStateException( I18n.err( I18n.ERR_325, modifyDnRequest ) );
throw new IllegalStateException( I18n.err( I18n.ERR_02018_NEW_SUPERIOR_MUST_BE_NOT_NULL, modifyDnRequest ) );
}

if ( requestControls.containsKey( ManageDsaIT.OID ) )
Expand All @@ -136,7 +136,7 @@ public MoveAndRenameOperationContext( CoreSession session, ModifyDnRequest modif
}
catch ( LdapInvalidDnException lide )
{
throw new IllegalStateException( I18n.err( I18n.ERR_325, modifyDnRequest ), lide );
throw new IllegalStateException( I18n.err( I18n.ERR_02018_NEW_SUPERIOR_MUST_BE_NOT_NULL, modifyDnRequest ), lide );
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ public MoveOperationContext( CoreSession session, ModifyDnRequest modifyDnReques

if ( newSuperior == null )
{
throw new IllegalArgumentException( I18n.err( I18n.ERR_326_NEW_SUPERIROR_CANNOT_BE_NULL, modifyDnRequest ) );
throw new IllegalArgumentException( I18n.err( I18n.ERR_02019_NEW_SUPERIROR_CANNOT_BE_NULL, modifyDnRequest ) );
}

this.requestControls = modifyDnRequest.getControls();

if ( modifyDnRequest.getNewRdn() != null )
{
throw new IllegalArgumentException( I18n.err( I18n.ERR_327_MOVE_AND_RENAME_OPERATION, modifyDnRequest ) );
throw new IllegalArgumentException( I18n.err( I18n.ERR_02020_MOVE_AND_RENAME_OPERATION, modifyDnRequest ) );
}

if ( requestControls.containsKey( ManageDsaIT.OID ) )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public RenameOperationContext( CoreSession session, ModifyDnRequest modifyDnRequ

if ( newRdn == null )
{
throw new IllegalStateException( I18n.err( I18n.ERR_328, modifyDnRequest ) );
throw new IllegalStateException( I18n.err( I18n.ERR_02021_NEWRDN_MUST_NOT_BE_NULL_ON_RENAME, modifyDnRequest ) );
}

this.deleteOldRdn = modifyDnRequest.getDeleteOldRdn();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ protected void checkInitialized( String property )
{
if ( initialized )
{
throw new IllegalStateException( I18n.err( I18n.ERR_576, property ) );
throw new IllegalStateException( I18n.err( I18n.ERR_02022_CANNOT_SET_JDBM_PROPERTY, property ) );
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ else if ( node instanceof NotNode )
return !evaluate( bnode.getFirstChild(), objectClasses );
}

throw new IllegalArgumentException( I18n.err( I18n.ERR_243, node ) );
throw new IllegalArgumentException( I18n.err( I18n.ERR_02007_NEGATION_HAS_NO_CHILD, node ) );

}
else
{
throw new IllegalArgumentException( I18n.err( I18n.ERR_244, bnode ) );
throw new IllegalArgumentException( I18n.err( I18n.ERR_02008_UNRECOGNIZED_BRANCH_NODE_OPERATOR, bnode ) );
}
}
}
48 changes: 25 additions & 23 deletions i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,29 @@ public enum I18n
ERR_01002_UNSUPPORTED_CHANGE_TYPE("ERR_01002_UNSUPPORTED_CHANGE_TYPE"),

// apacheds-core-api errors 2000 - 2999
ERR_02000_CANNOT_USE_SERIALIZATION_FOR_SERVER_ATTRIBUTE("ERR_02000_CANNOT_USE_SERIALIZATION_FOR_SERVER_ATTRIBUTE"),
ERR_02001_CANNOT_USE_SERIALIZATION_FOR_SERVER_ENTRY("ERR_02001_CANNOT_USE_SERIALIZATION_FOR_SERVER_ENTRY"),
ERR_02002_UNDEFINED_MODIFICATION_TYPE("ERR_02002_UNDEFINED_MODIFICATION_TYPE"),
ERR_02003_ATTRIBUTE_ID_UNKNOWN("ERR_02003_ATTRIBUTE_ID_UNKNOWN"),
ERR_02004_ATTTRIBUTE_UNION_NOT_POSSIBLE("ERR_02004_ATTTRIBUTE_UNION_NOT_POSSIBLE"),
ERR_02005_UNKNOWN_ATTRIBUTE_TYPE("ERR_02005_UNKNOWN_ATTRIBUTE_TYPE"),
ERR_02006_NAMING_EXCEPTION_ENCOUNTERED("ERR_02006_NAMING_EXCEPTION_ENCOUNTERED"),
ERR_02007_NEGATION_HAS_NO_CHILD("ERR_02007_NEGATION_HAS_NO_CHILD"),
ERR_02008_UNRECOGNIZED_BRANCH_NODE_OPERATOR("ERR_02008_UNRECOGNIZED_BRANCH_NODE_OPERATOR"),
ERR_02009_UNRECOGNIZED_LEAF_NODE_TYPE("ERR_02009_UNRECOGNIZED_LEAF_NODE_TYPE"),
ERR_02010_UNKNOWN_MATCH_TYPE("ERR_02010_UNKNOWN_MATCH_TYPE"),
ERR_02011_UNRECOGNIZED_SEARCH_SCOPE(" ERR_02011_UNRECOGNIZED_SEARCH_SCOPE"),
ERR_02012_INCORRECT_SUBSTRING_NODE_SYNTAX("ERR_02012_INCORRECT_SUBSTRING_NODE_SYNTAX"),
ERR_02013_THROW_REFERRAL_NOT_IMPLEMENTED_FOR_BIND("ERR_02013_THROW_REFERRAL_NOT_IMPLEMENTED_FOR_BIND"),
ERR_02014_IS_REFERRAL_THROWN_NOT_IMPLEMENTED_FOR_BIND("ERR_02014_IS_REFERRAL_THROWN_NOT_IMPLEMENTED_FOR_BIND"),
ERR_02015_IGNORE_REFERRAL_NOT_IMPLEMENTED_FOR_BIND("ERR_0201_IGNORE_REFERRAL_NOT_IMPLEMENTED_FOR_BIND"),
ERR_02016_IS_REFERRAL_IGNORED_NOT_IMPLEMENTED_FOR_BIND("ERR_02016_IS_REFERRAL_IGNORED_NOT_IMPLEMENTED_FOR_BIND"),
ERR_02017_EMPTY_OPERATION_CONTEXT_FORBIDDEN("ERR_02017_EMPTY_OPERATION_CONTEXT_FORBIDDEN"),
ERR_02018_NEW_SUPERIOR_MUST_BE_NOT_NULL("ERR_02018_NEW_SUPERIOR_MUST_BE_NOT_NULL"),
ERR_02019_NEW_SUPERIROR_CANNOT_BE_NULL("ERR_02019_NEW_SUPERIROR_CANNOT_BE_NULL"),
ERR_02020_MOVE_AND_RENAME_OPERATION("ERR_02020_MOVE_AND_RENAME_OPERATION"),
ERR_02021_NEWRDN_MUST_NOT_BE_NULL_ON_RENAME("ERR_02021_NEWRDN_MUST_NOT_BE_NULL_ON_RENAME"),
ERR_02022_CANNOT_SET_JDBM_PROPERTY("ERR_02022_CANNOT_SET_JDBM_PROPERTY"),

// apacheds-core-avl errors 3000 - 3999
ERR_03000_NEGATIVE_AVL_NODE_COUNT("ERR_03000_NEGATIVE_AVL_NODE_COUNT"),
Expand Down Expand Up @@ -365,12 +388,6 @@ public enum I18n
ERR_240("ERR_240"),
ERR_241_CANNOT_STORE_COLLECTIVE_ATT_IN_ENTRY("ERR_241_CANNOT_STORE_COLLECTIVE_ATT_IN_ENTRY"),
ERR_242("ERR_242"),
ERR_243("ERR_243"),
ERR_244("ERR_244"),
ERR_245("ERR_245"),
ERR_246("ERR_246"),
ERR_247("ERR_247"),
ERR_248("ERR_248"),
ERR_249("ERR_249"),
ERR_250_ENTRY_ALREADY_EXISTS("ERR_250_ENTRY_ALREADY_EXISTS"),
ERR_251_PARENT_NOT_FOUND("ERR_251_PARENT_NOT_FOUND"),
Expand Down Expand Up @@ -428,15 +445,8 @@ public enum I18n
ERR_313("ERR_313"),
// ERR_318( "ERR_318" ),
ERR_319("ERR_319"),
ERR_320("ERR_320"),
ERR_321("ERR_321"),
ERR_322("ERR_322"),
ERR_323("ERR_323"),
ERR_324("ERR_324"),
ERR_325("ERR_325"),
ERR_326_NEW_SUPERIROR_CANNOT_BE_NULL("ERR_326_NEW_SUPERIROR_CANNOT_BE_NULL"),
ERR_327_MOVE_AND_RENAME_OPERATION("ERR_327_MOVE_AND_RENAME_OPERATION"),
ERR_328("ERR_328"),


ERR_329("ERR_329"),
ERR_330("ERR_330"),
ERR_331("ERR_331"),
Expand Down Expand Up @@ -563,20 +573,13 @@ public enum I18n
ERR_452("ERR_452"),
ERR_453("ERR_453"),
ERR_454("ERR_454"),
ERR_455("ERR_455"),
ERR_456("ERR_456"),
// ERR_457( "ERR_457" ),
// ERR_458( "ERR_458" ),
// ERR_459( "ERR_459" ),
// ERR_460( "ERR_460" ),
// ERR_461( "ERR_461" ),
// ERR_462( "ERR_462" ),
// ERR_463( "ERR_463" ),
ERR_464("ERR_464"),
ERR_465("ERR_465"),
ERR_466("ERR_466"),
ERR_467("ERR_467"),
ERR_468("ERR_468"),
// ERR_469( "ERR_469" ),
// ERR_470( "ERR_470" ),
// ERR_471( "ERR_471" ),
Expand Down Expand Up @@ -684,7 +687,6 @@ public enum I18n
ERR_573("ERR_573"),
ERR_574("ERR_574"),
ERR_575("ERR_575"),
ERR_576("ERR_576"),
ERR_577("ERR_577"),
// ERR_578( "ERR_578" ),
// ERR_579( "ERR_579" ),
Expand Down
Loading

0 comments on commit 9da1a4d

Please sign in to comment.