CLAR-139 - fixed outline error for unparsable object
This commit is contained in:
parent
28d8ad0a3f
commit
5b6a706c28
@ -82,10 +82,18 @@ public class OutlineExtractorService {
|
|||||||
|
|
||||||
String title = item.getTitle();
|
String title = item.getTitle();
|
||||||
|
|
||||||
PDPage page = item.findDestinationPage(document);
|
PDPage page;
|
||||||
if (page == null) {
|
try {
|
||||||
|
// Can throw: "Error: can't convert to Destination COSArray" for some OCR'd PDFs
|
||||||
|
page = item.findDestinationPage(document);
|
||||||
|
if (page == null) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
}catch (IOException e){
|
||||||
|
log.info(String.format("Error occurred during position resolution for outline item with title %s: " + e, title));
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
int pageNumber = document.getPages().indexOf(page);
|
int pageNumber = document.getPages().indexOf(page);
|
||||||
|
|
||||||
Optional<Point2D> outlinePosition = Optional.empty();
|
Optional<Point2D> outlinePosition = Optional.empty();
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.knecon.fforesight.service.layoutparser.server;
|
package com.knecon.fforesight.service.layoutparser.server;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
@ -56,6 +57,15 @@ public class OutlineDetectionTest extends AbstractTest {
|
|||||||
pdfNetInitializer.init();
|
pdfNetInitializer.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@SneakyThrows
|
||||||
|
public void testOutlineError(){
|
||||||
|
String fileName = "files/syngenta/CustomerFiles/Clarifynd/VV-470942.pdf";
|
||||||
|
|
||||||
|
ClassificationDocument classificationDocument = parseLayout(fileName, LayoutParsingType.CLARIFYND);
|
||||||
|
assertThat(classificationDocument).isNotNull();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
Subproject commit 21fefb64bf27ca2b3329a6c69d90a27450b17930
|
Subproject commit c6fd9e849f3efd7d1507401f63629b91dec9f4ec
|
||||||
Loading…
x
Reference in New Issue
Block a user