directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject [directory-ldap-api] branch master updated: Refactored the error messages for extra-utils
Date Tue, 10 Apr 2018 13:07:40 GMT
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-ldap-api.git


The following commit(s) were added to refs/heads/master by this push:
     new 6f7a695  Refactored the error messages for extra-utils
6f7a695 is described below

commit 6f7a6957483f4bb87bc7e59fd6c4e7233b0e5fc1
Author: Emmanuel L├ęcharny <elecharny@symas.com>
AuthorDate: Tue Apr 10 15:07:36 2018 +0200

    Refactored the error messages for extra-utils
---
 .../java/org/apache/directory/api/i18n/I18n.java   | 10 ++++----
 .../apache/directory/api/i18n/errors.properties    | 27 +++++++++++-----------
 .../directory/api/ldap/util/tree/DnNode.java       |  7 +++---
 .../api/ldap/model/entry/DefaultEntry.java         |  2 +-
 4 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/i18n/src/main/java/org/apache/directory/api/i18n/I18n.java b/i18n/src/main/java/org/apache/directory/api/i18n/I18n.java
index 143f663..640b46d 100644
--- a/i18n/src/main/java/org/apache/directory/api/i18n/I18n.java
+++ b/i18n/src/main/java/org/apache/directory/api/i18n/I18n.java
@@ -433,10 +433,9 @@ public enum I18n
     ERR_11007( "ERR_11007" ),
 
     // ldap-schema-manager
-    ERR_12014_BASE64_DN_EXPECTED( "ERR_12014_BASE64_DN_EXPECTED" ),
-    ERR_12015_INVALID_BASE64_DN( "ERR_12015_INVALID_BASE64_DN" ),
-    ERR_12080( "ERR_12080" ),
-    ERR_12087( "ERR_12087 " ),
+    ERR_12000_CANNOT_PROCESS_EMPTY_DN( "ERR_12000_CANNOT_PROCESS_EMPTY_DN" ),
+    ERR_12001_CANNOT_ADD_NODE_CHILD_EXISTS( "ERR_12001_CANNOT_ADD_NODE_CHILD_EXISTS" ),
+    ERR_12002_CANNOT_ADD_NODE_ALREADY_EXISTS( "ERR_12002_CANNOT_ADD_NODE_ALREADY_EXISTS"
),
     
     // api-ldap-model 13000 - 13999
     ERR_13000_INVALID_LENGTH( "ERR_13000_INVALID_LENGTH" ),
@@ -547,7 +546,8 @@ public enum I18n
     ERR_13247_INVALID_VALUE_CANT_NORMALIZE( "ERR_13247_INVALID_VALUE_CANT_NORMALIZE" ),
     ERR_13248_CANNOT_READ_ENTRY( "ERR_13248_CANNOT_READ_ENTRY" ),
     ERR_13249_NO_COMPARATOR_FOR_AT( "ERR_13249_NO_COMPARATOR_FOR_AT" ),
-
+    ERR_13250_VALUE_MISSING_AT_THE_END( "ERR_13250_VALUE_MISSING_AT_THE_END" ),
+    
     //   filter         13300 - 13399
     ERR_13300_BAD_PLACE_HOLDERS_NUMBER( "ERR_13300_BAD_PLACE_HOLDERS_NUMBER" ),
     ERR_13301_NO_ORDERING_MR_FOR_AT( "ERR_13301_NO_ORDERING_MR_FOR_AT" ),
diff --git a/i18n/src/main/resources/org/apache/directory/api/i18n/errors.properties b/i18n/src/main/resources/org/apache/directory/api/i18n/errors.properties
index a2f1613..c1e457b 100644
--- a/i18n/src/main/resources/org/apache/directory/api/i18n/errors.properties
+++ b/i18n/src/main/resources/org/apache/directory/api/i18n/errors.properties
@@ -401,13 +401,13 @@ ERR_11012=Cannot remove {0} for the registries, it would become inconsistent.
Th
 ERR_11013=Cannot delete the SchemaObject {0} as it''s not associated with a schema
 
 # ldif
-ERR_12002_ENTRY_WITH_TWO_DNS=An entry must not have two DNs, at line {0}
-ERR_12014_BASE64_DN_EXPECTED=The ldif entry is supposed to have a base 64 encoded DN, at
line {0}
-ERR_12015_INVALID_BASE64_DN=Invalid base 64 encoded DN
-ERR_12080=Can''t rename an entry using the same name ...
-ERR_12087=A value is missing at the end
 
-# api-ldap-model 13000-13999
+# api-ldap-extra-utils <> 12000-12999
+ERR_12000_CANNOT_PROCESS_EMPTY_DN=Cannot process an empty Dn
+ERR_12001_CANNOT_ADD_NODE_CHILD_EXISTS=Cannot add a node to a node already having an element
+ERR_12002_CANNOT_ADD_NODE_ALREADY_EXISTS=Cannot add a node with no element if it already
exists
+
+# api-ldap-model <> 13000-13999
 ERR_13000_INVALID_LENGTH=Invalid len
 ERR_13001_INVALID_MAXOLEN=Invalid maxolen
 ERR_13002_BAD_NUMBERS_OF_ROUNDS=Bad number of rounds
@@ -449,7 +449,7 @@ ERR_13038_INVALID_EXTENSIONS=Extensions are invalid
 ERR_13039_INVALID_CHAR_AT_LDAP_URL_END=Invalid character at the end of the ldapUrl
 ERR_13040_INVALID_URL_ENCODING=Invalid URL encoding
 
-#   cursor         13100-13199
+# api-ldap-model cursor         13100-13199
 ERR_13100_FAILURE_ON_UNDERLYING_CURSOR=Failure on underlying Cursor.
 ERR_13101_MONITOR=monitor
 ERR_13102_UNSUPPORTED_OPERATION=The method {0} is not supported
@@ -465,7 +465,7 @@ ERR_13111_NO_COMPARATOR_CANT_MOVE_AFTER=Without a comparator I cannot
advance to
 ERR_13112_CANNOT_ACCESS_IF_BEFORE_FIRST=Cannot access element if positioned before first.
 ERR_13113_CANNOT_ACCESS_IF_AFTER_LAST=Cannot access element if positioned after last.
 
-#   entry           13200-13299
+# api-ldap-model entry           13200-13299
 ERR_13200_VALUE_CANT_BE_NORMALIZED=The value ''{0}'' can''t be normalized, it hasn''t been
added
 ERR_13201_EMPTY_OPTION_NOT_ALLOWED=An empty option is not allowed
 ERR_13202_INVALID_OID_MISSING_NUMBER=Invalid OID, missing a number after a ''.''
@@ -516,8 +516,9 @@ ERR_13246_INVALID_VALUE_PER_SYNTAX=Invalid upValue per syntax
 ERR_13247_INVALID_VALUE_CANT_NORMALIZE=Invalid upValue, it can't be normalized
 ERR_13248_CANNOT_READ_ENTRY=Cannot read an entry
 ERR_13249_NO_COMPARATOR_FOR_AT=No comparator for attributeType {0}
+ERR_13250_VALUE_MISSING_AT_THE_END=A value is missing at the end
 
-#   filter          13300-13399
+# api-ldap-model filter          13300-13399
 ERR_13300_BAD_PLACE_HOLDERS_NUMBER=Filter template {0} has {1} place-holders but {2} arguments
provided.
 ERR_13301_NO_ORDERING_MR_FOR_AT=There is no ORDERING matchingRule for AttributeType {0}
 ERR_13302_CANNOT_CREATE_NODE_NULL_ATTR=Cannot create a Node with a null Attribute
@@ -538,7 +539,7 @@ ERR_13316_EMPTY_FILTER=Empty filter
 ERR_13317_NO_MORE_THAN_ONE_ELEM_IN_NOT=Cannot add more than one element to a negation node.
 ERR_13318_INVALID_ATTR_IN_REFINEMENT=Invalid attribute {0} for a refinement
 
-#   ldif            13400-13499
+# api-ldap-model ldif            13400-13499
 ERR_13400_ENTRY_WITH_TWO_DNS=An entry must not have two DNs, at line {0}
 ERR_13401_CHANGE_NOT_ALLOWED=We cannot have changes when reading a file which already contains
entries, at line {0}
 ERR_13402_EXPECTING_ATTRIBUTE_TYPE=Expecting an attribute type
@@ -616,7 +617,7 @@ ERR_13473_MODDN_WITH_ATTRIBUTES=Invalid Entry: a modifyDN operation entry
should
 ERR_13474_LINE_LENGTH_TOO_SHORT=The length of each line must be at least 2 chars long
 ERR_13475_UNKNOWN_ATTRIBUTETYPE=The AttributeType is unknonw for this attribute: {0}
 
-#   message         13500-13599
+# api-ldap-model message         13500-13599
 ERR_13500_UNDEFINED_CHANGETYPE=Undefined changeType value: {0}
 ERR_13501_UNKNOWN_JNDI_SCOPE=Unknown JNDI scope constant value: {0}
 ERR_13502_UNKNOWN_LDAP_URL_SCOPE=Unknown LDAP URL scope value: {0}
@@ -635,7 +636,7 @@ ERR_13514_UNKNOWN_SORT_RESPONSE_RESULT=Unknown sort response result code
{0}
 ERR_13515_UNEXPECTED_MOD_OP=Unexpected ModificationOperation
 ERR_13516_UNEXPECTED_MESSAGE_TYPE=Unexpected MessageTypeEnum {0}
 
-#   name            13600-13699
+# api-ldap-model name            13600-13699
 ERR_13600_TYPE_IS_NULL_OR_EMPTY=The type cannot be empty or null
 ERR_13601_EXPECTED_COMMA_SEMI_COLON=Unexpected character ''{0}'' at position {1}. Excpected
'','' or '';''.
 ERR_13602_RDN_EMPTY=RDN must not be empty
@@ -664,7 +665,7 @@ ERR_13624_CANNOT_SERIALIZE_NULL_DN_=Cannot serialize a NULL Dn";
 ERR_13625_INVALID_RDN=Invalid RDN
 ERR_13626_INVALID_RDN_DUPLICATE_AVA=Invalid RDN: the {0} is already present in the RDN
 
-#   schema          13700-13899
+# api-ldap-model schema          13700-13899
 ERR_13700_CANNOT_MODIFY_LOCKED_SCHEMA_OBJECT=Cannot modify the SchemaObject {0}, it has been
locked
 ERR_13701_CANNOT_MODIFY_AT_REGISTRY_COPY=Cannot modify the AttributeTypeRegistry copy
 ERR_13702_CANNOT_MODIFY_CMP_REGISTRY_COPY=Cannot modify the ComparatorRegistry copy
diff --git a/ldap/extras/util/src/main/java/org/apache/directory/api/ldap/util/tree/DnNode.java
b/ldap/extras/util/src/main/java/org/apache/directory/api/ldap/util/tree/DnNode.java
index 3277b65..7bd6ee0 100644
--- a/ldap/extras/util/src/main/java/org/apache/directory/api/ldap/util/tree/DnNode.java
+++ b/ldap/extras/util/src/main/java/org/apache/directory/api/ldap/util/tree/DnNode.java
@@ -25,6 +25,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.directory.api.i18n.I18n;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
 import org.apache.directory.api.ldap.model.exception.LdapUnwillingToPerformException;
@@ -143,7 +144,7 @@ public class DnNode<N>
     {
         if ( ( dn == null ) || dn.isEmpty() )
         {
-            String message = "Cannot process an empty Dn";
+            String message = I18n.err( I18n.ERR_12000_CANNOT_PROCESS_EMPTY_DN );
             LOG.error( message );
             throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM,
message );
         }
@@ -586,14 +587,14 @@ public class DnNode<N>
                 // That means the added Dn is already present. Check if it already has an
element
                 if ( parentNode.hasElement() )
                 {
-                    String message = "Cannot add a node to a node already having an element";
+                    String message = I18n.err( I18n.ERR_12001_CANNOT_ADD_NODE_CHILD_EXISTS
);
                     LOG.error( message );
                     throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM,
message );
                 }
                 // We may try to add twice the same Dn, without any element
                 else if ( element == null )
                 {
-                    String message = "Cannot add a node with no element if it already exists";
+                    String message = I18n.err( I18n.ERR_12002_CANNOT_ADD_NODE_ALREADY_EXISTS
);
                     LOG.error( message );
                     throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM,
message );
                 }
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java
b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java
index 5ea2821..f8a676c 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java
@@ -397,7 +397,7 @@ public final class DefaultEntry implements Entry
         if ( valueExpected )
         {
             throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX,
I18n
-                .err( I18n.ERR_12087 ) );
+                .err( I18n.ERR_13250_VALUE_MISSING_AT_THE_END ) );
         }
 
         try ( LdifAttributesReader reader = new LdifAttributesReader() )

-- 
To stop receiving notification emails like this one, please contact
elecharny@apache.org.

Mime
View raw message