1
0
mirror of synced 2026-05-22 13:23:17 +00:00

SEC-1732: Raise an exception if more than one LDIF resource is found.

This commit is contained in:
Luke Taylor
2011-05-03 18:19:31 +01:00
parent d7344254ec
commit 12121dcc54
@@ -232,7 +232,11 @@ public class ApacheDSContainer implements InitializingBean, DisposableBean, Life
// We need a standard context.
//DirContext dirContext = contextSource.getReadWriteContext();
if(ldifs != null && ldifs.length > 0) {
if (ldifs == null || ldifs.length == 0) {
return;
}
if(ldifs.length == 1) {
String ldifFile;
try {
@@ -243,6 +247,8 @@ public class ApacheDSContainer implements InitializingBean, DisposableBean, Life
logger.info("Loading LDIF file: " + ldifFile);
LdifFileLoader loader = new LdifFileLoader(service.getAdminSession(), ldifFile);
loader.execute();
} else {
throw new IllegalArgumentException("More than one LDIF resource found with the supplied pattern:" + ldifResources);
}
}