Skip to content
Permalink
Browse files
Applied patch submitted by Ghenadii Batalski (DIRMINA-341)
  • Loading branch information
elecharny committed May 6, 2019
1 parent b9cb116 commit cb569e72be731647413c0ef1e147028b670fb95e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 47 deletions.
@@ -957,6 +957,7 @@
ERR_16077_SCHEMA_MANAGER_CANT_BE_LOADED( "ERR_16077_SCHEMA_MANAGER_CANT_BE_LOADED" ),
ERR_16078_CANNOT_LOAD_UNKNOWN_SCHEMA( "ERR_16078_CANNOT_LOAD_UNKNOWN_SCHEMA" ),
ERR_16079_INVALID_SCHEMA_OBJECT_CANNOT_BE_LOADED( "ERR_16079_INVALID_SCHEMA_OBJECT_CANNOT_BE_LOADED" ),
ERR_16080_SCHEMA_LOADER_CANT_BE_CREATED("ERR_16080_SCHEMA_LOADER_CANT_BE_CREATED"),

// api-utils 17000 - 17999
ERR_17000_UNEXPECTED_PARSER_CONDITION( "ERR_17000_UNEXPECTED_PARSER_CONDITION" ),
@@ -42,7 +42,7 @@ ERR_01008_REMAINING_BYTES_FOR_DECODED_PDU=The PDU has been fully decoded but the
# actions 1100 - 1199
ERR_01100_INCORRECT_LENGTH=The expected length is incorrect, expected {0}, got {1}
ERR_01101_NULL_LENGTH=The length should not be 0
ERR_01102_INVALID_INTEGER=The received bytes can't be decoded to a valid integer: ''{0}''
ERR_01102_INVALID_INTEGER=The received bytes can''t be decoded to a valid integer: ''{0}''

# grammar 1200 - 1299
ERR_01200_BAD_TRANSITION_FROM_STATE=Bad transition from state {0}, tag {1}
@@ -198,7 +198,7 @@ ERR_04169_RESPONSE_QUEUE_EMPTIED=The response queue has been emptied, no respons
ERR_04170_TIMEOUT_OCCURED=TimeOut occurred
ERR_04171_CANNOT_PARSE_MATCHED_DN=Could not parse matchedDn while transforming Codec value to Internal: {0}
ERR_04172_KEYSTORE_INIT_FAILURE=Keystore initialisation failure
ERR_04173_ALGORITHM_NOT_FOUND=Not TrustManagerFactory found for algorithm '{0}'
ERR_04173_ALGORITHM_NOT_FOUND=Not TrustManagerFactory found for algorithm ''{0}''

ERR_04174_INPUT_FILE_NAME_NULL=LdapClientTrustStoreManager constructor : input file name is null
ERR_04175_TRUST_STORE_FILE_NULL=TrustStoreFile : file not found
@@ -275,7 +275,7 @@ ERR_05154_EMPTY_SUBSTRING_INITIAL_FILTER_PDU=The substring initial filter is emp
ERR_05155_FLAG_TYPE_INVALID=The types only flag {0} is invalid: {1}. It should be 0 or 255
ERR_05156_INVALID_ATTRIBUTE_TYPE=The Attribute type {0} is invalid : {1}
ERR_05157_INVALID_DN=The Dn {0} is invalid : {1}
ERR_05158_INVALID_REQUEST_VALUE=The encoded value '{0}' cannot be decoded
ERR_05158_INVALID_REQUEST_VALUE=The encoded value ''{0}'' cannot be decoded
ERR_05159_INVALID_RESPONSE_NAME_OID=The Response name is not a valid OID : {0} ({1}) is invalid

# api-ldap-codec-core api 5200-5299
@@ -526,7 +526,7 @@ ERR_13243_ENTRY_IMMUTABLE_CANT_DESERIALIZE=Cannot deserialize the entry {0} is i
ERR_13244_ID_AT_NOT_COMPATIBLE=ID ''{0}'' and AttributeType ''{1}'' are not compatible
ERR_13245_AT_PARAMETER_NULL=The AttributeType parameter should not be null
ERR_13246_INVALID_VALUE_PER_SYNTAX=Invalid upValue per syntax
ERR_13247_INVALID_VALUE_CANT_NORMALIZE=Invalid upValue, it can't be normalized
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
@@ -644,7 +644,7 @@ ERR_13509_UNEXPECTED_SCOPE=Unexpected scope {0}
ERR_13510_UNKNOWN_DEREF_MODE=Unknown derefmode {0}
ERR_13511_INVALID_PROXIED_AUTHZ_NULL=Invalid proxied authz value: cannot be null
ERR_13512_INVALID_PROXIED_AUTHZ_BAD_DN=Invalid proxied authz value: the DN is not valid
ERR_13513_INVALID_PROXIED_AUTHZ_NO_DN_OR_U=Invalid proxied authz value: should start with 'dn:' or 'u:'
ERR_13513_INVALID_PROXIED_AUTHZ_NO_DN_OR_U=Invalid proxied authz value: should start with ''dn:'' or ''u:''
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}
@@ -776,7 +776,7 @@ ERR_13791_KEYCHAR_EXPECTED=keychar expected, got {0} (line {1}, col {2})
ERR_13792_SIMPLE_QUOTE_EXPECTED_AT_END=Simple quote expected at the end of a descr (line {0}, col {1})
ERR_13793_NO_CLOSING_PAREN=No closing '')'' (line {0}, col {1})
ERR_13794_MORE_OIDS_EXPECTED=more OIDs expected (line {0}, col {1})
ERR_13795_OPENED_BRACKET_NOT_CLOSED=Opened ''{'' hasn't been closed (line {0}, col {1})
ERR_13795_OPENED_BRACKET_NOT_CLOSED=Opened ''{'' hasn''t been closed (line {0}, col {1})
ERR_13796_USAGE_EXPECTED=Expected an USAGE (line {0}, col {1})
ERR_13797_USAGE_UNKNOWN=The USAGE value is unknown (line {0}, col {1})
ERR_13798_AT_DESCRIPTION_INVALID=Error, AttributeType definition invalid (line {0}, col {1})
@@ -947,9 +947,10 @@ ERR_16073_CANNOT_INST_NORM_CLASS=Cannot instantiate the normalizer class: {0}
ERR_16074_CANNOT_ACCESS_NORM_CTOR_CLASS=Cannot access the normalizer class constructor for class {0}
ERR_16075_CANNOT_ACCESS_NORM_CTOR=Cannot access the normalizer class constructor: {0}
ERR_16076_NOT_A_SCHEMA_DEFINITION=The first entry in the LDIF file is not a schema definition
ERR_16077_SCHEMA_MANAGER_CANT_BE_LOADED=SchemaManager can't be loaded: {0}
ERR_16077_SCHEMA_MANAGER_CANT_BE_LOADED=SchemaManager can''t be loaded: {0}
ERR_16078_CANNOT_LOAD_UNKNOWN_SCHEMA=Cannot load the unknown schema {0}
ERR_16079_INVALID_SCHEMA_OBJECT_CANNOT_BE_LOADED=the SchemaObject {0} cannot be added, it''s not a valid LoadableSchemaObject.
ERR_16080_SCHEMA_LOADER_CANT_BE_CREATED=Default SchemaLoader cannot be created {0}

# api-utils 17000 - 17999
ERR_17000_UNEXPECTED_PARSER_CONDITION=Unexpected parser condition throwing IllegalStateException.
@@ -129,77 +129,65 @@ public class DefaultSchemaManager implements SchemaManager
private SchemaErrorHandler errorHandler;

/**
* Creates a new instance of DefaultSchemaManager with the default schema schemaLoader
* Creates a new instance of DefaultSchemaManager with LDIF based SchemaLoader,
* Strict schema validation
*/
public DefaultSchemaManager()
{
// Default to the the root (one schemaManager for all the entries
namingContext = Dn.ROOT_DSE;
registries = new Registries();
factory = new SchemaEntityFactory();
isRelaxed = STRICT;
setErrorHandler( new LoggingSchemaErrorHandler() );
this( STRICT, jarLdifSchemaLoader().getAllSchemas() );

try
{
SchemaLoader schemaLoader = new JarLdifSchemaLoader();

for ( Schema schema : schemaLoader.getAllSchemas() )
{
schemaMap.put( schema.getSchemaName(), schema );
}

loadAllEnabled();
}
catch ( LdapException | IOException e )
catch ( LdapException e )
{
LOG.error( I18n.err( I18n.ERR_16077_SCHEMA_MANAGER_CANT_BE_LOADED, e.getMessage() ) );
throw new RuntimeException( e.getMessage() );
}
}


/*
* Static helper factory Create LDIF based SchemaLoader
*/
private static SchemaLoader jarLdifSchemaLoader()
{
try
{
return new JarLdifSchemaLoader();
}
catch ( LdapException | IOException e )
{
LOG.error( I18n.err( I18n.ERR_16080_SCHEMA_LOADER_CANT_BE_CREATED, e.getMessage() ) );
throw new RuntimeException( e.getMessage() );
}
}



/**
* Creates a new instance of DefaultSchemaManager with the default schema schemaLoader
* Strict schema validation
*
* @param schemas The list of schema to load
*/
public DefaultSchemaManager( Collection<Schema> schemas )
{
// Default to the the root (one schemaManager for all the entries
namingContext = Dn.ROOT_DSE;

for ( Schema schema : schemas )
{
schemaMap.put( schema.getSchemaName(), schema );
}

registries = new Registries();
factory = new SchemaEntityFactory();
isRelaxed = STRICT;
setErrorHandler( new LoggingSchemaErrorHandler() );
this( STRICT, schemas );
}


/**
* Creates a new instance of DefaultSchemaManager with the default schema schemaLoader
* Creates a new instance of DefaultSchemaManager with the given schemaLoader
*
* Schema validation strictness (i.e. relaxed/strict) controlled by the given schemaLoader
*
* @param schemaLoader The schemaLoader containing the schemas to load
*/
public DefaultSchemaManager( SchemaLoader schemaLoader )
{
// Default to the the root (one schemaManager for all the entries
namingContext = Dn.ROOT_DSE;

for ( Schema schema : schemaLoader.getAllSchemas() )
{
schemaMap.put( schema.getSchemaName(), schema );
}

registries = new Registries();
factory = new SchemaEntityFactory();
isRelaxed = STRICT;
setErrorHandler( new LoggingSchemaErrorHandler() );
this( schemaLoader.isRelaxed(), schemaLoader.getAllSchemas() );
}


0 comments on commit cb569e7

Please sign in to comment.