Skip to content

Commit

Permalink
Partial fix for DIRSERVER-1728: core-shared
Browse files Browse the repository at this point in the history
  • Loading branch information
elecharny committed Aug 19, 2024
1 parent 094f5d7 commit 40e8051
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public Object deserialize( byte[] serialized ) throws IOException
}
catch ( ClassNotFoundException cnfe )
{
LOG.error( I18n.err( I18n.ERR_134, cnfe.getLocalizedMessage() ) );
LOG.error( I18n.err( I18n.ERR_07000_CANNOT_DESERIALIZE_ENTRY, cnfe.getLocalizedMessage() ) );
throw new IOException( cnfe.getLocalizedMessage() );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public DefaultPartitionNexus( Entry rootDse ) throws LdapException
}
catch ( IOException e )
{
LOG.error( I18n.err( I18n.ERR_33 ) );
LOG.error( I18n.err( I18n.ERR_07001_FAILED_TO_LOG_VERSION ) );
}

rootDse.put( SchemaConstants.VENDOR_VERSION_AT, props.getProperty( "apacheds.version", "UNKNOWN" ) );
Expand Down Expand Up @@ -312,7 +312,7 @@ protected synchronized void doDestroy( PartitionTxn partitionTxn )
@Override
public void setId( String id )
{
throw new UnsupportedOperationException( I18n.err( I18n.ERR_264 ) );
throw new UnsupportedOperationException( I18n.err( I18n.ERR_07005_PARTITION_ID_CANNOT_BE_SET ) );
}


Expand Down Expand Up @@ -348,7 +348,7 @@ public void sync() throws LdapException
if ( errors == null )
{
//noinspection ThrowableInstanceNeverThrown
errors = new MultiException( I18n.err( I18n.ERR_265 ) );
errors = new MultiException( I18n.err( I18n.ERR_07006_GROUPING_EXCEPTIONS_ON_ROOT_NEXUS ) );
}

// @todo really need to send this info to a monitor
Expand Down Expand Up @@ -826,7 +826,7 @@ public synchronized void addContextPartition( Partition partition ) throws LdapE

if ( partitions.containsKey( key ) )
{
throw new LdapOtherException( I18n.err( I18n.ERR_263, key ) );
throw new LdapOtherException( I18n.err( I18n.ERR_07004_DUPLICATE_PARTITION_SUFFIX, key ) );
}

if ( !partition.isInitialized() )
Expand All @@ -840,7 +840,7 @@ public synchronized void addContextPartition( Partition partition ) throws LdapE

if ( partitionSuffix == null )
{
throw new LdapOtherException( I18n.err( I18n.ERR_267, partition.getId() ) );
throw new LdapOtherException( I18n.err( I18n.ERR_07007_PARTITION_HAS_NO_SUFFIX, partition.getId() ) );
}

partitions.put( partitionSuffix.getNormName(), partition );
Expand Down Expand Up @@ -874,7 +874,7 @@ public synchronized void removeContextPartition( String partitionDn )

if ( partition == null )
{
String msg = I18n.err( I18n.ERR_34, partitionDn );
String msg = I18n.err( I18n.ERR_07002_NO_PARTITION_WITH_SUFFIX, partitionDn );
LOG.error( msg );
throw new LdapNoSuchObjectException( msg );
}
Expand Down Expand Up @@ -906,7 +906,7 @@ public synchronized void removeContextPartition( String partitionDn )
}
else
{
String msg = I18n.err( I18n.ERR_35, partitionDn );
String msg = I18n.err( I18n.ERR_07003_NO_PARTITION_WITH_SUFFIX_IN_NAMING_CONTEXTS, partitionDn );
LOG.error( msg );
throw new LdapNoSuchObjectException( msg );
}
Expand Down Expand Up @@ -961,7 +961,7 @@ public Partition getPartition( Dn dn ) throws LdapException

if ( parent == null )
{
throw new LdapNoSuchObjectException( I18n.err( I18n.ERR_268, dn ) );
throw new LdapNoSuchObjectException( I18n.err( I18n.ERR_07008_CANNOT_FIND_PARTITION, dn ) );
}
else
{
Expand Down
21 changes: 11 additions & 10 deletions i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,15 @@ public enum I18n
// apacheds-core-jndi errors 6000 - 6999

// apacheds-core-shared errors 7000 - 7999
ERR_07000_CANNOT_DESERIALIZE_ENTRY("ERR_07000_CANNOT_DESERIALIZE_ENTRY"),
ERR_07001_FAILED_TO_LOG_VERSION("ERR_07001_FAILED_TO_LOG_VERSION"),
ERR_07002_NO_PARTITION_WITH_SUFFIX("ERR_07002_NO_PARTITION_WITH_SUFFIX"),
ERR_07003_NO_PARTITION_WITH_SUFFIX_IN_NAMING_CONTEXTS("ERR_07003_NO_PARTITION_WITH_SUFFIX_IN_NAMING_CONTEXTS"),
ERR_07004_DUPLICATE_PARTITION_SUFFIX("ERR_07004_DUPLICATE_PARTITION_SUFFIX"),
ERR_07005_PARTITION_ID_CANNOT_BE_SET("ERR_07005_PARTITION_ID_CANNOT_BE_SET"),
ERR_07006_GROUPING_EXCEPTIONS_ON_ROOT_NEXUS("ERR_07006_GROUPING_EXCEPTIONS_ON_ROOT_NEXUS"),
ERR_07007_PARTITION_HAS_NO_SUFFIX("ERR_07007_PARTITION_HAS_NO_SUFFIX"),
ERR_07008_CANNOT_FIND_PARTITION("ERR_07008_CANNOT_FIND_PARTITION"),

// apacheds-http-directory-bridge errors 8000 - 8999

Expand Down Expand Up @@ -252,6 +261,8 @@ public enum I18n
// apacheds-interceptors-ppolicy errors 26000 - 26999
// apacheds-interceptors-referral errors 27000 - 27999
// apacheds-interceptors-schema errors 28000 - 28999
ERR_28000_OBJECT_NOT_FOUND_IN_AT_REGISTRY("ERR_28000_OBJECT_NOT_FOUND_IN_AT_REGISTRY"),

// apacheds-interceptors-subtree errors 29000 - 29999
// apacheds-interceptors-trigger errors 30000 - 30999
// apacheds-jdbm-partition errors 31000 - 31999
Expand Down Expand Up @@ -313,9 +324,6 @@ public enum I18n
ERR_30("ERR_30"),
ERR_31("ERR_31"),
ERR_32("ERR_32"),
ERR_33("ERR_33"),
ERR_34("ERR_34"),
ERR_35("ERR_35"),
ERR_36("ERR_36"),
ERR_37("ERR_37"),
ERR_38("ERR_38"),
Expand Down Expand Up @@ -392,7 +400,6 @@ public enum I18n
ERR_131("ERR_131"),
ERR_132("ERR_132"),
ERR_133("ERR_133"),
ERR_134("ERR_134"),
ERR_135("ERR_135"),
ERR_136("ERR_136"),
ERR_137("ERR_137"),
Expand Down Expand Up @@ -513,12 +520,6 @@ public enum I18n
ERR_260("ERR_260"),
ERR_261("ERR_261"),
ERR_262("ERR_262"),
ERR_263("ERR_263"),
ERR_264("ERR_264"),
ERR_265("ERR_265"),
ERR_266("ERR_266"),
ERR_267("ERR_267"),
ERR_268("ERR_268"),
ERR_269("ERR_269"),
ERR_270("ERR_270"),
ERR_271("ERR_271"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,16 @@ ERR_03019_ALREADY_IN_ORDERED_SET_MODE=Already in ordered set mode.
# apacheds-core-jndi errors 6000 - 6999

# apacheds-core-shared errors 7000 - 7999
ERR_07000_CANNOT_DESERIALIZE_ENTRY=Cannot deserialize the entry : {0}
ERR_07001_FAILED_TO_LOG_VERSION=failed to LOG version properties
ERR_07002_NO_PARTITION_WITH_SUFFIX=No partition with suffix: {0}
ERR_07003_NO_PARTITION_WITH_SUFFIX_IN_NAMING_CONTEXTS=No partition with suffix ''{0}'' can be found in the NamingContexts
ERR_07004_DUPLICATE_PARTITION_SUFFIX=Duplicate partition suffix: {0}
ERR_07005_PARTITION_ID_CANNOT_BE_SET=The id cannot be set for the partition nexus.
ERR_07006_GROUPING_EXCEPTIONS_ON_ROOT_NEXUS=Grouping many exceptions on root nexus sync()
ERR_07007_PARTITION_HAS_NO_SUFFIX=The current partition does not have any suffix: {0}
ERR_07008_CANNOT_FIND_PARTITION=Cannot find a partition for {0}


# apacheds-http-directory-bridge errors 8000 - 8999

Expand Down Expand Up @@ -242,12 +252,15 @@ ERR_09001_FAILED_TO_CONFIGURE_WEB_APPLICATION=Failed to configure the web applic
# apacheds-interceptors-ppolicy errors 26000 - 26999
# apacheds-interceptors-referral errors 27000 - 27999
# apacheds-interceptors-schema errors 28000 - 28999
ERR_28000_OBJECT_NOT_FOUND_IN_AT_REGISTRY={0} not found within the attributeType registry

# apacheds-interceptors-subtree errors 29000 - 29999
# apacheds-interceptors-trigger errors 30000 - 30999
# apacheds-jdbm-partition errors 31000 - 31999
ERR_31001_ODD_NUMBER_OF_BYTES_IN_SERIALIZED_STRING=The serialized String contains an odd number of bytes
ERR_31002_NEGATIOVE_NB_ATTRIBUTES_IN_ENTRY=The number of attributes is negative


# apacheds-kerberos-codec errors 32000 - 32999
# apacheds-ldif-partition errors 33000 - 33999

Expand Down Expand Up @@ -304,9 +317,6 @@ ERR_29=Cannot set a changeLog store when one is already active
ERR_30=The {0} operational attribute cannot be modified by a user
ERR_31=The ModifiersName operational attribute cannot be modified by a user
ERR_32=The ModifyTimestamp operational attribute cannot be modified by a user
ERR_33=failed to LOG version properties
ERR_34=No partition with suffix: {0}
ERR_35=No partition with suffix ''{0}'' can be found in the NamingContexts
ERR_36=An LDAPURL should not contains a scope
ERR_37=An LDAPURL should not contains filters
ERR_38=An LDAPURL should not contains any description attribute list
Expand Down Expand Up @@ -383,7 +393,6 @@ ERR_128=Failed to identify OID for\:
ERR_131=Error while adding {0} on table {1}
ERR_132=Error while adding {0}, {1} on table {2}
ERR_133=Exception while removing {0} from index {1}
ERR_134=Cannot deserialize the entry : {0}
ERR_135=Cannot create a ticket for the {0} KerberosPrincipal, error : {1}
ERR_136=Cannot create a ticket : {0}
ERR_137=Cannot encode the Ticket object, the PDU size is {0} when only {1} bytes has been allocated
Expand Down Expand Up @@ -504,12 +513,6 @@ ERR_259=Attempt to search under non-existant entry\:
ERR_260=Unknown assertion type: {0}
ERR_261=Failed to expand node
ERR_262=System partition has wrong name: should be ''system'' not ''{0}''.
ERR_263=Duplicate partition suffix: {0}
ERR_264=The id cannot be set for the partition nexus.
ERR_265=Grouping many exceptions on root nexus sync()
ERR_266={0} not found within the attributeType registry
ERR_267=The current partition does not have any suffix: {0}
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public boolean compare( CompareOperationContext compareContext ) throws LdapExce
}
catch ( LdapException le )
{
throw new LdapInvalidAttributeTypeException( I18n.err( I18n.ERR_266, compareContext.getOid() ) );
throw new LdapInvalidAttributeTypeException( I18n.err( I18n.ERR_28000_OBJECT_NOT_FOUND_IN_AT_REGISTRY, compareContext.getOid() ) );
}

return next( compareContext );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,7 @@ public boolean compare( CompareOperationContext compareContext ) throws LdapExce
// complain if we do not recognize the attribute being compared
if ( !schemaManager.getAttributeTypeRegistry().contains( compareContext.getOid() ) )
{
throw new LdapInvalidAttributeTypeException( I18n.err( I18n.ERR_266, compareContext.getOid() ) );
throw new LdapInvalidAttributeTypeException( I18n.err( I18n.ERR_28000_OBJECT_NOT_FOUND_IN_AT_REGISTRY, compareContext.getOid() ) );
}

return next( compareContext );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public Object deserialize( byte[] bytes ) throws IOException
}
catch ( ClassNotFoundException cnfe )
{
LOG.error( I18n.err( I18n.ERR_134, cnfe.getLocalizedMessage() ) );
LOG.error( I18n.err( I18n.ERR_07000_CANNOT_DESERIALIZE_ENTRY, cnfe.getLocalizedMessage() ) );
throw new IOException( cnfe.getLocalizedMessage() );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public Object deserialize( byte[] bytes ) throws IOException
}
catch ( ClassNotFoundException cnfe )
{
LOG.error( I18n.err( I18n.ERR_134, cnfe.getLocalizedMessage() ) );
LOG.error( I18n.err( I18n.ERR_07000_CANNOT_DESERIALIZE_ENTRY, cnfe.getLocalizedMessage() ) );
throw new IOException( cnfe.getLocalizedMessage() );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public Object deserialize( byte[] bytes ) throws IOException
}
catch ( ClassNotFoundException cnfe )
{
LOG.error( I18n.err( I18n.ERR_134, cnfe.getLocalizedMessage() ) );
LOG.error( I18n.err( I18n.ERR_07000_CANNOT_DESERIALIZE_ENTRY, cnfe.getLocalizedMessage() ) );
throw new IOException( cnfe.getLocalizedMessage() );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public Dn deserialize( BufferHandler bufferHandler ) throws IOException
}
catch ( ClassNotFoundException cnfe )
{
LOG.error( I18n.err( I18n.ERR_134, cnfe.getLocalizedMessage() ) );
LOG.error( I18n.err( I18n.ERR_07000_CANNOT_DESERIALIZE_ENTRY, cnfe.getLocalizedMessage() ) );
throw new IOException( cnfe.getLocalizedMessage() );
}
}
Expand Down Expand Up @@ -176,7 +176,7 @@ public Dn fromBytes( byte[] buffer, int pos ) throws IOException
}
catch ( ClassNotFoundException cnfe )
{
LOG.error( I18n.err( I18n.ERR_134, cnfe.getLocalizedMessage() ) );
LOG.error( I18n.err( I18n.ERR_07000_CANNOT_DESERIALIZE_ENTRY, cnfe.getLocalizedMessage() ) );
throw new IOException( cnfe.getLocalizedMessage() );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public Entry deserialize( ByteBuffer buffer ) throws IOException
}
catch ( ClassNotFoundException cnfe )
{
LOG.error( I18n.err( I18n.ERR_134, cnfe.getLocalizedMessage() ) );
LOG.error( I18n.err( I18n.ERR_07000_CANNOT_DESERIALIZE_ENTRY, cnfe.getLocalizedMessage() ) );
throw new IOException( cnfe.getLocalizedMessage() );
}
}
Expand Down Expand Up @@ -363,7 +363,7 @@ public Entry fromBytes( byte[] buffer, int pos ) throws IOException
}
catch ( ClassNotFoundException cnfe )
{
LOG.error( I18n.err( I18n.ERR_134, cnfe.getLocalizedMessage() ) );
LOG.error( I18n.err( I18n.ERR_07000_CANNOT_DESERIALIZE_ENTRY, cnfe.getLocalizedMessage() ) );
throw new IOException( cnfe.getLocalizedMessage() );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public ParentIdAndRdn fromBytes( byte[] buffer, int pos ) throws IOException
}
catch ( LdapInvalidAttributeValueException cnfe )
{
LOG.error( I18n.err( I18n.ERR_134, cnfe.getLocalizedMessage() ) );
LOG.error( I18n.err( I18n.ERR_07000_CANNOT_DESERIALIZE_ENTRY, cnfe.getLocalizedMessage() ) );
throw new IOException( cnfe.getLocalizedMessage() );
}
}
Expand Down

0 comments on commit 40e8051

Please sign in to comment.