Fix NPE for empty cells

This commit is contained in:
Thierry Göckel 2020-08-13 11:02:09 +02:00
parent 5542a97a38
commit a151a13b4c
3 changed files with 8 additions and 4 deletions

View File

@ -120,7 +120,12 @@ public class EntityRedactionService {
}
Map<String, String> result = new HashMap<>();
for (int i = 0; i < keys.size(); i++) {
result.put(keys.get(i), values.get(i));
String value = values.get(i);
if (value == null) {
log.warn("Drools does not support null values.");
continue;
}
result.put(keys.get(i), value);
}
return result;

View File

@ -262,8 +262,7 @@ public class RedactionIntegrationTest {
public void redactionTest() throws IOException {
long start = System.currentTimeMillis();
ClassPathResource pdfFileResource = new ClassPathResource("files/Metolachlor/S" +
"-Metolachlor_RAR_01_Volume_1_2018-09-06.pdf");
ClassPathResource pdfFileResource = new ClassPathResource("files/Metolachlor/S-Metolachlor_RAR_21_Volume_3CP_A9396G_B-9_2018-09-06.pdf");
RedactionRequest request = RedactionRequest.builder()
.document(IOUtils.toByteArray(pdfFileResource.getInputStream()))

View File

@ -101,7 +101,7 @@ rule "8: Redact contact information, if Producer is found"
rule "9: Redact Authors and Addresses in Reference Table, if it is a Vertebrate study"
when
Section(tabularData != null && tabularData.size() > 0
Section(tabularData != null
&& tabularData.containsKey("Vertebrate study Y/N")
&& tabularData.get("Vertebrate study Y/N").equals("Y")
)