Closed
Description
Summary
When configuring an embedded ldap server to import an ldif file (e.g., users.ldif), no log message (at not level) is written nor any exception is thrown if the provided file does not exist (e.g., uesrs.ldif):
private void importLdif(InMemoryDirectoryServer directoryServer) {
if (StringUtils.hasText(this.ldif)) {
Resource resource = this.context.getResource(this.ldif);
try {
if (resource.exists()) {
try (InputStream inputStream = resource.getInputStream()) {
directoryServer.importFromLDIF(false, new LDIFReader(inputStream));
}
}
} catch (Exception ex) {
throw new IllegalStateException("Unable to load LDIF " + this.ldif, ex);
}
}
}
While it is arguably legitimate not to throw an exception in this case and load the ldif file from a default location, logging a message out that warns the user that the configured ldif file was not found could spare some debugging time ;)
Actual Behavior
No log message is provided upon an unsuccessful import of a ldif file.
Expected Behavior
A log message that warns the users that the configured ldif file does not exist
Configuration
<security:ldap-server
id="local-ldap-server"
ldif="file:${configpath}/uesrs.ldif"
port="8389"
root="dc=springframework,dc=org"
/>
On the file system however, the file is: ${configpath}/users.ldif
Version
5.2.1.RELEASE