final LDAPConnection connection = connect();
try {
for (final Source source : sources) {
try {
getLog().info("Processing input source: " + source);
final FormatHandler handler = getFormatHandler(source);
if (handler == null) {
getLog().warn("No handler for input source: " + source);
} else {
final InputStream inputStream = source.open();
if (inputStream == null) {
if (!this.continueOnError) {
throw new MojoExecutionException("Cannot open source for reading: " + source);
} else {
getLog().warn("Skipping source that could not be opened for reading: " + source);
}
} else {
try {
handler.load(connection, source.open(), continueOnError, this);
} finally {
inputStream.close();
}
}
}