You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2024/08/20 10:57:18 UTC

(directory-server) 01/02: Partial fix for DIRSERVER_1728: mavibot-partition

This is an automated email from the ASF dual-hosted git repository.

elecharny pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-server.git

commit 8f295eb262dd7ceee0078d0620de8a59b78e81ab
Merge: 4e7ce99bca 8384bf855c
Author: emmanuel lecharny <el...@apache.org>
AuthorDate: Tue Aug 20 10:39:10 2024 +0200

    Partial fix for DIRSERVER_1728: mavibot-partition

 .../java/org/apache/directory/server/i18n/I18n.java   | 19 +++++++++----------
 .../apache/directory/server/i18n/errors.properties    | 17 ++++++++---------
 .../core/partition/impl/btree/jdbm/JdbmDnIndex.java   |  2 +-
 .../core/partition/impl/btree/jdbm/JdbmIndex.java     |  2 +-
 .../core/partition/impl/btree/jdbm/JdbmPartition.java |  2 +-
 .../core/partition/impl/btree/jdbm/JdbmRdnIndex.java  |  2 +-
 .../core/partition/impl/btree/jdbm/JdbmTable.java     | 12 ++++++------
 .../core/partition/impl/btree/jdbm/NoDupsCursor.java  |  4 ++--
 .../partition/impl/btree/mavibot/MavibotCursor.java   |  4 ++--
 .../partition/impl/btree/mavibot/MavibotDnIndex.java  |  2 +-
 .../partition/impl/btree/mavibot/MavibotIndex.java    |  2 +-
 .../impl/btree/mavibot/MavibotPartition.java          |  2 +-
 .../partition/impl/btree/mavibot/MavibotRdnIndex.java |  2 +-
 .../partition/impl/btree/mavibot/MavibotTable.java    | 12 ++++++------
 14 files changed, 41 insertions(+), 43 deletions(-)

diff --cc i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
index ffebe96f21,e1db9203a7..33d76b572c
--- a/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
+++ b/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
@@@ -292,12 -292,9 +292,20 @@@ public enum I18
      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    
 +    // apacheds-ldif-partition errors                33000 - 33999
 +    ERR_33000_CANNOT_INITIALIZE_PARTITION_WITH_INVALID_SUFFIX("ERR_33000_CANNOT_INITIALIZE_PARTITION_WITH_INVALID_SUFFIX"),
 +    ERR_33001_PARTITION_CANNOT_BE_CREATED("ERR_33001_PARTITION_CANNOT_BE_CREATED"),
 +
      // apacheds-mavipot-partition errors             34000 - 34999
--    
++    ERR_34000_FAILED_TO_CLOSE_RECORD_MANAGER("ERR_34000_FAILED_TO_CLOSE_RECORD_MANAGER"),
++    ERR_34001_ERROR_WHILE_ADDING_KEY_ON_TABLE("ERR_34001_ERROR_WHILE_ADDING_KEY_ON_TABLE"),
++    ERR_34002_ERROR_WHILE_ADDING_KEY_VALUE_ON_TABLE("ERR_34002_ERROR_WHILE_ADDING_KEY_VALUE_ON_TABLE"),
++    ERR_34003_EXCEPTION_WHILE_REMOVING_FROM_INDEX("ERR_34003_EXCEPTION_WHILE_REMOVING_FROM_INDEX"),
++    ERR_34004_NO_EQUALITY_MATCHING_RULE_FOR_ATTRIBUTE("ERR_34004_NO_EQUALITY_MATCHING_RULE_FOR_ATTRIBUTE"),
++    ERR_34005_MISSING_VALUE_COMPARATOR("ERR_34005_MISSING_VALUE_COMPARATOR"),
++    ERR_34006_NULL_KEY_VALUE_FORBIDDEN("ERR_34006_NULL_KEY_VALUE_FORBIDDEN"),
++    ERR_34007_DUPLICATE_KEYS_FORBIDDEN("ERR_34007_DUPLICATE_KEYS_FORBIDDEN"),
++
      // apacheds-osgi-integ errors                    35000 - 35999
      // apacheds-protocol-dhcp errors                 36000 - 36999
      // apacheds-protocol-dns errors                  37000 - 37999
@@@ -457,13 -454,13 +465,9 @@@
      ERR_116("ERR_116"),
      ERR_122("ERR_122"),
      // ERR_123( "ERR_123" ),
--    ERR_127("ERR_127"),
      ERR_128("ERR_128"),
      // ERR_129( "ERR_129" ),
      // ERR_130( "ERR_130" ),
--    ERR_131("ERR_131"),
--    ERR_132("ERR_132"),
--    ERR_133("ERR_133"),
      ERR_135("ERR_135"),
      ERR_136("ERR_136"),
      ERR_137("ERR_137"),
@@@ -710,12 -709,12 +714,7 @@@
      ERR_571("ERR_571"),
      ERR_572("ERR_572"),
      ERR_573("ERR_573"),
--    ERR_574("ERR_574"),
      ERR_592("ERR_592"),
--    ERR_593("ERR_593"),
--    ERR_594("ERR_594"),
--    // ERR_595( "ERR_595" ),
--    ERR_596("ERR_596"),
      ERR_597("ERR_597"),
      // ERR_598( "ERR_598" ),
      ERR_599("ERR_599"),
diff --cc i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties
index 77be28b768,93ba3fd546..c45a42e042
--- a/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties
+++ b/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties
@@@ -285,10 -285,8 +285,18 @@@ ERR_31002_NEGATIOVE_NB_ATTRIBUTES_IN_EN
  
  # apacheds-kerberos-codec errors                32000 - 32999
  # apacheds-ldif-partition errors                33000 - 33999
 +ERR_33000_CANNOT_INITIALIZE_PARTITION_WITH_INVALID_SUFFIX=Cannot initialize a partition without a valid suffix
 +ERR_33001_PARTITION_CANNOT_BE_CREATED=The {0} partition cannot be created : {1}
  
  # apacheds-mavipot-partition errors             34000 - 34999
++ERR_34000_FAILED_TO_CLOSE_RECORD_MANAGER=Failed to close the record manager
++ERR_34001_ERROR_WHILE_ADDING_KEY_ON_TABLE=Error while adding {0} on table {1}
++ERR_34002_ERROR_WHILE_ADDING_KEY_VALUE_ON_TABLE=Error while adding {0}, {1} on table {2}
++ERR_34003_EXCEPTION_WHILE_REMOVING_FROM_INDEX=Exception while removing {0} from index {1}
++ERR_34004_NO_EQUALITY_MATCHING_RULE_FOR_ATTRIBUTE=No Equality MatchingRule available for attribute {0}
++ERR_34005_MISSING_VALUE_COMPARATOR=Unfortunately this Table without duplicates enabled does not contain a value comparator which is needed to answer your ordering question.
++ERR_34006_NULL_KEY_VALUE_FORBIDDEN=null for key or value is not valid
++ERR_34007_DUPLICATE_KEYS_FORBIDDEN=This Cursor does not support duplicate keys.
  
  # apacheds-osgi-integ errors                    35000 - 35999
  # apacheds-protocol-dhcp errors                 36000 - 36999
@@@ -449,13 -447,13 +457,9 @@@ ERR_115=Failed to delete the working di
  ERR_116=Failed to delete\: 
  ERR_122=Error encoding EncryptionKey.
  # ERR_123=
--ERR_127=Failed to close the record manager
  ERR_128=Failed to identify OID for\: 
  # ERR_129=
  # ERR_130=
--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_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
@@@ -700,13 -700,13 +704,8 @@@ ERR_570=this is not an arrayTree contai
  ERR_571=this is not a btreeRedirect container
  ERR_572=This cursor can only be used with tables that have duplicate keys enabled.
  ERR_573=Value based advances not supported.
--ERR_574=No Equality MatchingRule available for attribute {0}
  
  ERR_592=Value comparator must not be null for tables with duplicate keys.
--ERR_593=Unfortunately this Table without duplicates enabled does not contain a value comparator which is needed to answer your ordering question.
--ERR_594=null for key or value is not valid
--# ERR_595=
--ERR_596=This Cursor does not support duplicate keys.
  ERR_597=Encoder unavailable for {0}
  # ERR_598=
  ERR_599=Error instantiating encoder for {0}
diff --cc jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmDnIndex.java
index 1c7a4ca685,1c7a4ca685..893e9d0f1e
--- a/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmDnIndex.java
+++ b/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmDnIndex.java
@@@ -109,7 -109,7 +109,7 @@@ public class JdbmDnIndex extends JdbmIn
  
          if ( mr == null )
          {
--            throw new IOException( I18n.err( I18n.ERR_574, attributeType.getName() ) );
++            throw new IOException( I18n.err( I18n.ERR_34004_NO_EQUALITY_MATCHING_RULE_FOR_ATTRIBUTE, attributeType.getName() ) );
          }
  
          DnSerializerComparator comp = new DnSerializerComparator( mr.getOid() );
diff --cc jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
index bc7396d793,bc7396d793..96df8562d7
--- a/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
+++ b/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
@@@ -191,7 -191,7 +191,7 @@@ public class JdbmIndex<K> extends Abstr
  
          if ( mr == null )
          {
--            throw new IOException( I18n.err( I18n.ERR_574, attributeType.getName() ) );
++            throw new IOException( I18n.err( I18n.ERR_34004_NO_EQUALITY_MATCHING_RULE_FOR_ATTRIBUTE, attributeType.getName() ) );
          }
  
          comp = new SerializableComparator<>( mr.getOid() );
diff --cc jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
index f7e15fa43f,f7e15fa43f..0498f9ada0
--- a/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
+++ b/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
@@@ -869,7 -869,7 +869,7 @@@ public class JdbmPartition extends Abst
          }
          catch ( IOException t )
          {
--            LOG.error( I18n.err( I18n.ERR_127 ), t );
++            LOG.error( I18n.err( I18n.ERR_34000_FAILED_TO_CLOSE_RECORD_MANAGER ), t );
              errors.addThrowable( t );
          }
          finally
diff --cc jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java
index a84f9aa812,a84f9aa812..b5068d9cb0
--- a/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java
+++ b/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java
@@@ -109,7 -109,7 +109,7 @@@ public class JdbmRdnIndex extends JdbmI
  
          if ( mr == null )
          {
--            throw new IOException( I18n.err( I18n.ERR_574, attributeType.getName() ) );
++            throw new IOException( I18n.err( I18n.ERR_34004_NO_EQUALITY_MATCHING_RULE_FOR_ATTRIBUTE, attributeType.getName() ) );
          }
  
          ParentIdAndRdnComparator<String> comp = new ParentIdAndRdnComparator<>( mr.getOid() );
diff --cc jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
index 57addded62,57addded62..f656bca2bc
--- a/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
+++ b/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
@@@ -313,7 -313,7 +313,7 @@@ public class JdbmTable<K, V> extends Ab
  
          if ( !allowsDuplicates )
          {
--            throw new UnsupportedOperationException( I18n.err( I18n.ERR_593 ) );
++            throw new UnsupportedOperationException( I18n.err( I18n.ERR_34005_MISSING_VALUE_COMPARATOR ) );
          }
  
          try
@@@ -352,7 -352,7 +352,7 @@@
  
          if ( !allowsDuplicates )
          {
--            throw new UnsupportedOperationException( I18n.err( I18n.ERR_593 ) );
++            throw new UnsupportedOperationException( I18n.err( I18n.ERR_34005_MISSING_VALUE_COMPARATOR ) );
          }
  
          try
@@@ -531,7 -531,7 +531,7 @@@
  
              if ( ( value == null ) || ( key == null ) )
              {
--                throw new IllegalArgumentException( I18n.err( I18n.ERR_594 ) );
++                throw new IllegalArgumentException( I18n.err( I18n.ERR_34006_NULL_KEY_VALUE_FORBIDDEN ) );
              }
  
              V replaced;
@@@ -606,7 -606,7 +606,7 @@@
          }
          catch ( IOException | CursorException | LdapException e )
          {
--            LOG.error( I18n.err( I18n.ERR_131, key, name ), e );
++            LOG.error( I18n.err( I18n.ERR_34001_ERROR_WHILE_ADDING_KEY_ON_TABLE, key, name ), e );
              throw new LdapOtherException( e.getMessage(), e );
          }
      }
@@@ -710,7 -710,7 +710,7 @@@
          }
          catch ( Exception e )
          {
--            LOG.error( I18n.err( I18n.ERR_132, key, value, name ), e );
++            LOG.error( I18n.err( I18n.ERR_34002_ERROR_WHILE_ADDING_KEY_VALUE_ON_TABLE, key, value, name ), e );
          }
      }
  
@@@ -785,7 -785,7 +785,7 @@@
          }
          catch ( Exception e )
          {
--            LOG.error( I18n.err( I18n.ERR_133, key, name ), e );
++            LOG.error( I18n.err( I18n.ERR_34003_EXCEPTION_WHILE_REMOVING_FROM_INDEX, key, name ), e );
          }
      }
  
diff --cc jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java
index e46c693503,e46c693503..df9d917535
--- a/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java
+++ b/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java
@@@ -145,13 -145,13 +145,13 @@@ class NoDupsCursor<K, V> extends Abstra
  
      public void beforeValue( K key, V value ) throws Exception
      {
--        throw new UnsupportedOperationException( I18n.err( I18n.ERR_596 ) );
++        throw new UnsupportedOperationException( I18n.err( I18n.ERR_34007_DUPLICATE_KEYS_FORBIDDEN ) );
      }
  
  
      public void afterValue( K key, V value )
      {
--        throw new UnsupportedOperationException( I18n.err( I18n.ERR_596 ) );
++        throw new UnsupportedOperationException( I18n.err( I18n.ERR_34007_DUPLICATE_KEYS_FORBIDDEN ) );
      }
  
  
diff --cc mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotCursor.java
index f7c651feef,f7c651feef..7e71dca13f
--- a/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotCursor.java
+++ b/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotCursor.java
@@@ -163,7 -163,7 +163,7 @@@ class MavibotCursor<K, V> extends Abstr
       */
      public void beforeValue( K key, V value ) throws LdapException, CursorException
      {
--        throw new UnsupportedOperationException( I18n.err( I18n.ERR_596 ) );
++        throw new UnsupportedOperationException( I18n.err( I18n.ERR_34007_DUPLICATE_KEYS_FORBIDDEN ) );
      }
  
  
@@@ -176,7 -176,7 +176,7 @@@
       */
      public void afterValue( K key, V value ) throws LdapException, CursorException
      {
--        throw new UnsupportedOperationException( I18n.err( I18n.ERR_596 ) );
++        throw new UnsupportedOperationException( I18n.err( I18n.ERR_34007_DUPLICATE_KEYS_FORBIDDEN ) );
      }
  
  
diff --cc mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotDnIndex.java
index 71be9522ba,71be9522ba..80beabdfae
--- a/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotDnIndex.java
+++ b/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotDnIndex.java
@@@ -94,7 -94,7 +94,7 @@@ public class MavibotDnIndex extends Mav
  
          if ( mr == null )
          {
--            throw new IOException( I18n.err( I18n.ERR_574, attributeType.getName() ) );
++            throw new IOException( I18n.err( I18n.ERR_34004_NO_EQUALITY_MATCHING_RULE_FOR_ATTRIBUTE, attributeType.getName() ) );
          }
  
          /*
diff --cc mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotIndex.java
index 3067c54ddd,3067c54ddd..5a4f2c50d0
--- a/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotIndex.java
+++ b/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotIndex.java
@@@ -161,7 -161,7 +161,7 @@@ public class MavibotIndex<K> extends Ab
  
          if ( mr == null )
          {
--            throw new IOException( I18n.err( I18n.ERR_574, attributeType.getName() ) );
++            throw new IOException( I18n.err( I18n.ERR_34004_NO_EQUALITY_MATCHING_RULE_FOR_ATTRIBUTE, attributeType.getName() ) );
          }
  
          SerializableComparator<K> comp = new SerializableComparator<>( mr.getOid() );
diff --cc mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java
index 400e67a505,400e67a505..8bd21aa559
--- a/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java
+++ b/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java
@@@ -313,7 -313,7 +313,7 @@@ public class MavibotPartition extends A
          }
          catch ( Throwable t )
          {
--            LOG.error( I18n.err( I18n.ERR_127 ), t );
++            LOG.error( I18n.err( I18n.ERR_34000_FAILED_TO_CLOSE_RECORD_MANAGER ), t );
              errors.addThrowable( t );
          }
          finally
diff --cc mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotRdnIndex.java
index 5726923988,5726923988..4791eb5fd3
--- a/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotRdnIndex.java
+++ b/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotRdnIndex.java
@@@ -105,7 -105,7 +105,7 @@@ public class MavibotRdnIndex extends Ma
  
          if ( mr == null )
          {
--            throw new IOException( I18n.err( I18n.ERR_574, attributeType.getName() ) );
++            throw new IOException( I18n.err( I18n.ERR_34004_NO_EQUALITY_MATCHING_RULE_FOR_ATTRIBUTE, attributeType.getName() ) );
          }
  
          MavibotParentIdAndRdnSerializer.setSchemaManager( schemaManager );
diff --cc mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotTable.java
index 737168a26e,737168a26e..0f3801ac05
--- a/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotTable.java
+++ b/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotTable.java
@@@ -270,7 -270,7 +270,7 @@@ public class MavibotTable<K, V> extend
  
          if ( !allowsDuplicates )
          {
--            throw new UnsupportedOperationException( I18n.err( I18n.ERR_593 ) );
++            throw new UnsupportedOperationException( I18n.err( I18n.ERR_34005_MISSING_VALUE_COMPARATOR ) );
          }
  
          ValueCursor<V> valueCursor = null;
@@@ -315,7 -315,7 +315,7 @@@
  
          if ( !allowsDuplicates )
          {
--            throw new UnsupportedOperationException( I18n.err( I18n.ERR_593 ) );
++            throw new UnsupportedOperationException( I18n.err( I18n.ERR_34005_MISSING_VALUE_COMPARATOR ) );
          }
  
          try
@@@ -376,7 -376,7 +376,7 @@@
          {
              if ( ( value == null ) || ( key == null ) )
              {
--                throw new IllegalArgumentException( I18n.err( I18n.ERR_594 ) );
++                throw new IllegalArgumentException( I18n.err( I18n.ERR_34006_NULL_KEY_VALUE_FORBIDDEN ) );
              }
  
              V existingVal = bt.insert( key, value );
@@@ -388,7 -388,7 +388,7 @@@
          }
          catch ( IOException ioe )
          {
--            LOG.error( I18n.err( I18n.ERR_131, key, name ), ioe );
++            LOG.error( I18n.err( I18n.ERR_34001_ERROR_WHILE_ADDING_KEY_ON_TABLE, key, name ), ioe );
              throw new LdapOtherException( ioe.getMessage(), ioe );
          }
      }
@@@ -436,7 -436,7 +436,7 @@@
          }
          catch ( IOException | KeyNotFoundException e )
          {
--            LOG.error( I18n.err( I18n.ERR_133, key, name ), e );
++            LOG.error( I18n.err( I18n.ERR_34003_EXCEPTION_WHILE_REMOVING_FROM_INDEX, key, name ), e );
  
              throw new LdapOtherException( e.getMessage(), e );
          }
@@@ -466,7 -466,7 +466,7 @@@
          }
          catch ( Exception e )
          {
--            LOG.error( I18n.err( I18n.ERR_132, key, value, name ), e );
++            LOG.error( I18n.err( I18n.ERR_34002_ERROR_WHILE_ADDING_KEY_VALUE_ON_TABLE, key, value, name ), e );
          }
      }