use of com.unboundid.ldif.LDIFChangeRecord in project oxCore by GluuFederation.
the class LdifDataUtility method validateLDIF.
public ResultCode validateLDIF(LDIFReader ldifReader, String dn) {
String baseDn = dn.toLowerCase();
ResultCode resultCode = ResultCode.SUCCESS;
while (true) {
// Read the next change to process
LDIFChangeRecord ldifRecord = null;
try {
ldifRecord = ldifReader.readChangeRecord(true);
if (ldifRecord != null) {
if (StringHelper.isNotEmpty(baseDn)) {
if (!ldifRecord.getDN().toLowerCase().endsWith(baseDn)) {
resultCode = ResultCode.NOT_SUPPORTED;
break;
}
}
}
} catch (LDIFException le) {
log.info("Malformed ldif record " + ldifRecord);
log.error("Malformed ldif record", le);
resultCode = ResultCode.DECODING_ERROR;
break;
} catch (IOException ioe) {
log.error("I/O error encountered while reading a change record", ioe);
resultCode = ResultCode.LOCAL_ERROR;
break;
}
// changes to be processed.
if (ldifRecord == null) {
break;
}
}
return resultCode;
}
Aggregations