ldifFile.deleteOnExit();
} catch (IOException ioe)
{
Message failedMsg =
getThrowableMsg(INFO_ERROR_CREATING_TEMP_FILE.get(), ioe);
throw new ApplicationException(
ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
failedMsg, ioe);
}
try
{
LDIFExportConfig exportConfig = new LDIFExportConfig(
ldifFile.getAbsolutePath(), ExistingFileBehavior.OVERWRITE);
LDIFWriter writer = new LDIFWriter(exportConfig);
DN dn = DN.decode(baseDn);
Entry entry = StaticUtils.createEntry(dn);
writer.writeEntry(entry);
writer.close();
} catch (DirectoryException de) {
throw new ApplicationException(
ReturnCode.CONFIGURATION_ERROR,
getThrowableMsg(INFO_ERROR_IMPORTING_LDIF.get(), de), de);
} catch (LDIFException le) {
throw new ApplicationException(
ReturnCode.CONFIGURATION_ERROR,
getThrowableMsg(INFO_ERROR_IMPORTING_LDIF.get(), le), le);
} catch (IOException ioe) {
throw new ApplicationException(
ReturnCode.CONFIGURATION_ERROR,
getThrowableMsg(INFO_ERROR_IMPORTING_LDIF.get(), ioe), ioe);
} catch (Throwable t) {
throw new ApplicationException(
ReturnCode.BUG, getThrowableMsg(
INFO_BUG_MSG.get(), t), t);
}
return ldifFile;
}