* @throws IOException if there is an error creating the internal stream.
*/
protected Entry getEntry() throws LDIFException, IOException
{
Entry entry;
LDIFImportConfig ldifImportConfig = null;
try
{
String ldif = getLDIF();
if (ldif.trim().length() == 0)
{
throw new LDIFException(ERR_LDIF_REPRESENTATION_REQUIRED.get());
}
ldifImportConfig = new LDIFImportConfig(new StringReader(ldif));
LDIFReader reader = new LDIFReader(ldifImportConfig);
entry = reader.readEntry(checkSchema());
if (entry == null)
{
throw new LDIFException(ERR_LDIF_REPRESENTATION_REQUIRED.get());
}
else
{
if (entry.getObjectClasses().size() == 0)
{
throw new LDIFException(ERR_OBJECTCLASS_FOR_ENTRY_REQUIRED.get());
}
}
}
finally
{
if (ldifImportConfig != null)
{
ldifImportConfig.close();
}
}
return entry;
}