SEC-1732: Raise an exception if more than one LDIF resource is found.
This commit is contained in:
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue