forked from D-Net/dnet-hadoop
return empty Oaf list if record cannot be parsed
This commit is contained in:
parent
27af5122d2
commit
b99a011345
|
@ -143,7 +143,7 @@ public abstract class AbstractMdRecordToOafMapper {
|
|||
return createOafs(doc, type, instances, collectedFrom, info, lastUpdateTimestamp);
|
||||
} catch (DocumentException e) {
|
||||
log.error("Error with record:\n" + xml);
|
||||
throw e;
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -931,11 +931,8 @@ class MappersTest {
|
|||
void testNotWellFormed() throws IOException, DocumentException {
|
||||
final String xml = IOUtils
|
||||
.toString(Objects.requireNonNull(getClass().getResourceAsStream("oaf_notwellformed.xml")));
|
||||
final DocumentException generalEx = new DocumentException();
|
||||
assertEquals(0, new OafToOafMapper(vocs, false, true).processMdRecord(xml).size());
|
||||
|
||||
DocumentException exception = assertThrows(DocumentException.class, () -> {
|
||||
new OafToOafMapper(vocs, false, true).processMdRecord(xml);
|
||||
});
|
||||
}
|
||||
|
||||
private void assertValidId(final String id) {
|
||||
|
|
Loading…
Reference in New Issue