Skip to content

Commit

Permalink
Partial fix for DIRSERVER-1728
Browse files Browse the repository at this point in the history
  • Loading branch information
elecharny committed Aug 15, 2024
1 parent ef7b302 commit a4da7a9
Show file tree
Hide file tree
Showing 23 changed files with 108 additions and 122 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void mkdirs() throws IOException
{
if ( !requiredDirectory.exists() && !requiredDirectory.mkdirs() )
{
throw new IOException( I18n.err( I18n.ERR_02000_COULD_NOT_CREATE_DIRECTORY, requiredDirectory ) );
throw new IOException( I18n.err( I18n.ERR_00004_COULD_NOT_CREATE_DIRECTORY, requiredDirectory ) );
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,7 @@ public void rename( Name oldName, Name newName ) throws NamingException

if ( oldDn.size() == 0 )
{
throw new NoPermissionException( I18n.err( I18n.ERR_312 ) );
throw new NoPermissionException( I18n.err( I18n.ERR_00014_CANNOT_REMOVE_ROOT_DSE ) );
}

// calculate parents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ public long revert() throws LdapException
{
if ( changeLog == null || !changeLog.isEnabled() )
{
throw new IllegalStateException( I18n.err( I18n.ERR_310 ) );
throw new IllegalStateException( I18n.err( I18n.ERR_00012_CHANGE_LOG_NOT_ENABLED ) );
}

Tag latest = changeLog.getLatest();
Expand All @@ -1031,7 +1031,7 @@ public long revert() throws LdapException
}
}

throw new IllegalStateException( I18n.err( I18n.ERR_311 ) );
throw new IllegalStateException( I18n.err( I18n.ERR_00013_MISSING_TAG_TO_REVERT ) );
}


Expand All @@ -1042,7 +1042,7 @@ private void moddn( Dn oldDn, Dn newDn, boolean delOldRdn ) throws LdapException
{
if ( oldDn.size() == 0 )
{
throw new LdapNoPermissionException( I18n.err( I18n.ERR_312 ) );
throw new LdapNoPermissionException( I18n.err( I18n.ERR_00014_CANNOT_REMOVE_ROOT_DSE ) );
}

// calculate parents
Expand Down Expand Up @@ -1085,17 +1085,17 @@ public long revert( long revision ) throws LdapException
{
if ( changeLog == null || !changeLog.isEnabled() )
{
throw new IllegalStateException( I18n.err( I18n.ERR_310 ) );
throw new IllegalStateException( I18n.err( I18n.ERR_00012_CHANGE_LOG_NOT_ENABLED ) );
}

if ( revision < 0 )
{
throw new IllegalArgumentException( I18n.err( I18n.ERR_239 ) );
throw new IllegalArgumentException( I18n.err( I18n.ERR_00023_NEGATIVE_REVISION ) );
}

if ( revision >= changeLog.getChangeLogStore().getCurrentRevision() )
{
throw new IllegalArgumentException( I18n.err( I18n.ERR_314 ) );
throw new IllegalArgumentException( I18n.err( I18n.ERR_00015_TOO_HIGH_REVISION_NUMBER ) );
}

Cursor<ChangeLogEvent> cursor = changeLog.getChangeLogStore().findAfter( revision );
Expand Down Expand Up @@ -1160,8 +1160,8 @@ public long revert( long revision ) throws LdapException
break;

default:
LOG.error( I18n.err( I18n.ERR_75 ) );
throw new NotImplementedException( I18n.err( I18n.ERR_76, reverse.getChangeType() ) );
LOG.error( I18n.err( I18n.ERR_00016_CHANGE_TYPE_UNKNOWN ) );
throw new NotImplementedException( I18n.err( I18n.ERR_00020_REVERT_CHANGE_TYPE_NOT_IMPLEMENTED, reverse.getChangeType() ) );
}
}

Expand Down Expand Up @@ -2131,7 +2131,7 @@ public Entry newEntry( String ldif, String dn )
}
catch ( Exception e )
{
LOG.error( I18n.err( I18n.ERR_78, ldif, dn ) );
LOG.error( I18n.err( I18n.ERR_00021_CANNOT_BUILD_ENTRY, ldif, dn ) );
// do nothing
return null;
}
Expand Down Expand Up @@ -2293,7 +2293,7 @@ public void setReplicaId( int replicaId )
{
if ( ( replicaId < 0 ) || ( replicaId > 999 ) )
{
LOG.error( I18n.err( I18n.ERR_79 ) );
LOG.error( I18n.err( I18n.ERR_00022_BAD_REPLICA_ID ) );
this.replicaId = 0;
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ private void eagerlyPopulateFields( OperationContext opContext ) throws LdapExce
else
{
// This is an error : we *must* have an entry if we want to be able to rename.
throw new LdapNoSuchObjectException( I18n.err( I18n.ERR_256_NO_SUCH_OBJECT, opContext.getDn() ) );
throw new LdapNoSuchObjectException( I18n.err( I18n.ERR_00017_NO_SUCH_OBJECT, opContext.getDn() ) );
}
}
}
Expand All @@ -215,7 +215,7 @@ private Entry getOriginalEntry( OperationContext opContext ) throws LdapExceptio
else
{
// This is an error : we *must* have an entry if we want to be able to rename.
throw new LdapNoSuchObjectException( I18n.err( I18n.ERR_256_NO_SUCH_OBJECT,
throw new LdapNoSuchObjectException( I18n.err( I18n.ERR_00017_NO_SUCH_OBJECT,
opContext.getDn() ) );
}
}
Expand Down Expand Up @@ -337,7 +337,7 @@ private LdapReferralException buildReferralExceptionForSearch( Entry parentEntry

private LdapPartialResultException buildLdapPartialResultException( Dn childDn )
{
LdapPartialResultException lpre = new LdapPartialResultException( I18n.err( I18n.ERR_315 ) );
LdapPartialResultException lpre = new LdapPartialResultException( I18n.err( I18n.ERR_00018_CANNOT_CREATE_REFERRAL_WHEN_IGNORE ) );

lpre.setRemainingDn( childDn );
lpre.setResolvedDn( Dn.EMPTY_DN );
Expand Down Expand Up @@ -1992,7 +1992,7 @@ private void ensureStarted() throws LdapServiceUnavailableException
{
if ( !directoryService.isStarted() )
{
throw new LdapServiceUnavailableException( ResultCodeEnum.UNAVAILABLE, I18n.err( I18n.ERR_316 ) );
throw new LdapServiceUnavailableException( ResultCodeEnum.UNAVAILABLE, I18n.err( I18n.ERR_00019_DIRECTORY_SERVICE_NOT_STARTED ) );
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public static X509Certificate getCertificate( Entry entry ) throws LdapException
}
catch ( Exception e )
{
LdapException ne = new LdapException( I18n.err( I18n.ERR_286 ) );
LdapException ne = new LdapException( I18n.err( I18n.ERR_00005_FAILED_TO_GET_X509_CERTIFICATE_FACTORY ) );
ne.initCause( e );
throw ne;
}
Expand All @@ -140,7 +140,7 @@ public static X509Certificate getCertificate( Entry entry ) throws LdapException
}
catch ( CertificateException e )
{
LdapException ne = new LdapException( I18n.err( I18n.ERR_287 ) );
LdapException ne = new LdapException( I18n.err( I18n.ERR_00006_BAD_CERTIFICATE_FORMAT ) );
ne.initCause( e );
throw ne;
}
Expand Down Expand Up @@ -168,7 +168,7 @@ public static KeyPair getKeyPair( Entry entry ) throws LdapException
}
catch ( Exception e )
{
LdapException ne = new LdapException( I18n.err( I18n.ERR_288, ALGORITHM ) );
LdapException ne = new LdapException( I18n.err( I18n.ERR_00007_FAILED_TO_GET_KEY_FACTORY, ALGORITHM ) );
ne.initCause( e );
throw ne;
}
Expand All @@ -180,7 +180,7 @@ public static KeyPair getKeyPair( Entry entry ) throws LdapException
}
catch ( Exception e )
{
LdapException ne = new LdapException( I18n.err( I18n.ERR_289 ) );
LdapException ne = new LdapException( I18n.err( I18n.ERR_00008_BAD_PRIVATE_KEY_FORMAT ) );
ne.initCause( e );
throw ne;
}
Expand All @@ -192,7 +192,7 @@ public static KeyPair getKeyPair( Entry entry ) throws LdapException
}
catch ( InvalidKeySpecException e )
{
LdapException ne = new LdapException( I18n.err( I18n.ERR_290 ) );
LdapException ne = new LdapException( I18n.err( I18n.ERR_00009_BAD_PUBLIC_KEY_FORMAT ) );
ne.initCause( e );
throw ne;
}
Expand Down Expand Up @@ -278,7 +278,7 @@ public static void addKeyPair( Entry entry, String issuerDN, String subjectDN, D
}
catch ( NoSuchAlgorithmException e )
{
LdapException ne = new LdapException( I18n.err( I18n.ERR_291 ) );
LdapException ne = new LdapException( I18n.err( I18n.ERR_00010_CANNPOT_GENERATE_KEY_PAIR ) );
ne.initCause( e );
throw ne;
}
Expand Down Expand Up @@ -325,7 +325,7 @@ public static void addKeyPair( Entry entry, String issuerDN, String subjectDN, D
}
catch ( Exception e )
{
LdapException ne = new LdapException( I18n.err( I18n.ERR_292 ) );
LdapException ne = new LdapException( I18n.err( I18n.ERR_00011_CANNOT_GENERATE_SELF_SIGNED_CERTIFICATE ) );
ne.initCause( e );
throw ne;
}
Expand Down
50 changes: 21 additions & 29 deletions i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,29 @@ public enum I18n
ERR_00002_FAILED_COMPARE_CERTIFICATE_BYTES("ERR_00002_FAILED_COMPARE_CERTIFICATE_BYTES"),
ERR_00003_FAILED_EXTRACT_KEY("ERR_00003_FAILED_EXTRACT_KEY"),
ERR_00004_COULD_NOT_CREATE_DIRECTORY("ERR_00004_COULD_NOT_CREATE_DIRECTORY"),
ERR_00005_FAILED_TO_GET_X509_CERTIFICATE_FACTORY("ERR_00005_FAILED_TO_GET_X509_CERTIFICATE_FACTORY"),
ERR_00006_BAD_CERTIFICATE_FORMAT("ERR_00006_BAD_CERTIFICATE_FORMAT"),
ERR_00007_FAILED_TO_GET_KEY_FACTORY("ERR_00007_FAILED_TO_GET_KEY_FACTORY"),
ERR_00008_BAD_PRIVATE_KEY_FORMAT("ERR_00008_BAD_PRIVATE_KEY_FORMAT"),
ERR_00009_BAD_PUBLIC_KEY_FORMAT("ERR_00009_BAD_PUBLIC_KEY_FORMAT"),
ERR_00010_CANNPOT_GENERATE_KEY_PAIR("ERR_00010_CANNPOT_GENERATE_KEY_PAIR"),
ERR_00011_CANNOT_GENERATE_SELF_SIGNED_CERTIFICATE("ERR_00011_CANNOT_GENERATE_SELF_SIGNED_CERTIFICATE"),
ERR_00012_CHANGE_LOG_NOT_ENABLED("ERR_00012_CHANGE_LOG_NOT_ENABLED"),
ERR_00013_MISSING_TAG_TO_REVERT("ERR_00013_MISSING_TAG_TO_REVERT"),
ERR_00014_CANNOT_REMOVE_ROOT_DSE("ERR_00014_CANNOT_REMOVE_ROOT_DSE"),
ERR_00015_TOO_HIGH_REVISION_NUMBER("ERR_00015_TOO_HIGH_REVISION_NUMBER"),
ERR_00016_CHANGE_TYPE_UNKNOWN("ERR_00016_CHANGE_TYPE_UNKNOWN"),
ERR_00017_NO_SUCH_OBJECT("ERR_00017_NO_SUCH_OBJECT"),
ERR_00018_CANNOT_CREATE_REFERRAL_WHEN_IGNORE("ERR_00018_CANNOT_CREATE_REFERRAL_WHEN_IGNORE"),
ERR_00019_DIRECTORY_SERVICE_NOT_STARTED("ERR_00019_DIRECTORY_SERVICE_NOT_STARTED"),
ERR_00020_REVERT_CHANGE_TYPE_NOT_IMPLEMENTED("ERR_00020_REVERT_CHANGE_TYPE_NOT_IMPLEMENTED"),
ERR_00021_CANNOT_BUILD_ENTRY("ERR_00021_CANNOT_BUILD_ENTRY"),
ERR_00022_BAD_REPLICA_ID("ERR_00022_BAD_REPLICA_ID"),
ERR_00023_NEGATIVE_REVISION("ERR_00023_NEGATIVE_REVISION"),

// apacheds-core-annotation errors 1000 - 1999

// apacheds-core-api errors 2000 - 2999
ERR_02000_COULD_NOT_CREATE_DIRECTORY("ERR_02000_COULD_NOT_CREATE_DIRECTORY"),

// apacheds-core-avl errors 3000 - 3999
ERR_03000_NEGATIVE_AVL_NODE_COUNT("ERR_03000_NEGATIVE_AVL_NODE_COUNT"),
Expand All @@ -67,7 +85,6 @@ public enum I18n
// apacheds-installers errors 10000 - 10999

// apacheds-installers-maven-plugins errors 11000 - 11999
ERR_11000_COULD_NOT_CREATE_DIRECTORY("ERR_11000_COULD_NOT_CREATE_DIRECTORY"),

// apacheds-interceptor-kerberos errors 12000 - 12999
// apacheds-interceptors-admin errors 13000 - 13999
Expand All @@ -89,33 +106,26 @@ public enum I18n
// apacheds-interceptors-subtree errors 29000 - 29999
// apacheds-interceptors-trigger errors 30000 - 30999
// apacheds-jdbm-partition errors 31000 - 31999
ERR_31000_COULD_NOT_CREATE_DIRECTORY("ERR_31000_COULD_NOT_CREATE_DIRECTORY"),
ERR_31001_ODD_NUMBER_OF_BYTES_IN_SERIALIZED_STRING("ERR_31001_ODD_NUMBER_OF_BYTES_IN_SERIALIZED_STRING"),
ERR_31002_NEGATIOVE_NB_ATTRIBUTES_IN_ENTRY("ERR_31002_NEGATIOVE_NB_ATTRIBUTES_IN_ENTRY"),

// apacheds-kerberos-codec errors 32000 - 32999
// apacheds-ldif-partition errors 33000 - 33999
ERR_33000_COULD_NOT_CREATE_DIRECTORY("ERR_33000_COULD_NOT_CREATE_DIRECTORY"),

// apacheds-ldif-partition errors 33000 - 33999
// apacheds-mavipot-partition errors 34000 - 34999
ERR_34000_COULD_NOT_CREATE_DIRECTORY("ERR_34000_COULD_NOT_CREATE_DIRECTORY"),

// apacheds-osgi-integ errors 35000 - 35999
// apacheds-protocol-dhcp errors 36000 - 36999
// apacheds-protocol-dns errors 37000 - 37999
// apacheds-protocol-ldap errors 38000 - 38999
ERR_38000_COULD_NOT_CREATE_DIRECTORY("ERR_38000_COULD_NOT_CREATE_DIRECTORY"),

// apacheds-protocol-ntp errors 39000 - 39999
// apacheds-protocol-shared errors 40000 - 40999
// apacheds-server-annotations errors 41000 - 41999
// apacheds-server-config errors 42000 - 42999
ERR_42000_COULD_NOT_CREATE_DIRECTORY("ERR_42000_COULD_NOT_CREATE_DIRECTORY"),

// apacheds-server-integ errors 43000 - 43999
// apacheds-server-jndi errors 44000 - 44999
// apacheds-service errors 45000 - 45999
ERR_45000_COULD_NOT_CREATE_DIRECTORY("ERR_45000_COULD_NOT_CREATE_DIRECTORY"),

// apacheds-service-builder errors 46000 - 46999
// apacheds-test-framework errors 47000 - 47999
Expand Down Expand Up @@ -192,11 +202,7 @@ public enum I18n
ERR_72("ERR_72"),
ERR_73("ERR_73"),
ERR_74("ERR_74"),
ERR_75("ERR_75"),
ERR_76("ERR_76"),
ERR_77("ERR_77"),
ERR_78("ERR_78"),
ERR_79("ERR_79"),
ERR_80("ERR_80"),
ERR_81("ERR_81"),
ERR_82("ERR_82"),
Expand Down Expand Up @@ -355,7 +361,6 @@ public enum I18n
ERR_236("ERR_236"),
ERR_237("ERR_237"),
ERR_238("ERR_238"),
ERR_239("ERR_239"),
ERR_240("ERR_240"),
ERR_241_CANNOT_STORE_COLLECTIVE_ATT_IN_ENTRY("ERR_241_CANNOT_STORE_COLLECTIVE_ATT_IN_ENTRY"),
ERR_242("ERR_242"),
Expand All @@ -372,7 +377,6 @@ public enum I18n
ERR_253("ERR_253"),
ERR_254_ADD_EXISTING_VALUE("ERR_254_ADD_EXISTING_VALUE"),
ERR_255("ERR_255"),
ERR_256_NO_SUCH_OBJECT("ERR_256_NO_SUCH_OBJECT"),
ERR_257_COLLECTIVE_SUBENTRY_WITHOUT_COLLECTIVE_AT("ERR_257_COLLECTIVE_SUBENTRY_WITHOUT_COLLECTIVE_AT"),
ERR_258("ERR_258"),
ERR_259("ERR_259"),
Expand Down Expand Up @@ -402,13 +406,6 @@ public enum I18n
ERR_283("ERR_283"),
ERR_284("ERR_284"),
ERR_285("ERR_285"),
ERR_286("ERR_286"),
ERR_287("ERR_287"),
ERR_288("ERR_288"),
ERR_289("ERR_289"),
ERR_290("ERR_290"),
ERR_291("ERR_291"),
ERR_292("ERR_292"),
ERR_293("ERR_293"),
ERR_294("ERR_294"),
ERR_295("ERR_295"),
Expand All @@ -426,13 +423,8 @@ public enum I18n
ERR_307("ERR_307"),
ERR_308("ERR_308"),
ERR_309("ERR_309"),
ERR_310("ERR_310"),
ERR_311("ERR_311"),
ERR_312("ERR_312"),

ERR_313("ERR_313"),
ERR_314("ERR_314"),
ERR_315("ERR_315"),
ERR_316("ERR_316"),
ERR_317("ERR_317"),
// ERR_318( "ERR_318" ),
ERR_319("ERR_319"),
Expand Down
Loading

0 comments on commit a4da7a9

Please sign in to comment.