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<>(); Map<String, String> result = new HashMap<>();
for (int i = 0; i < keys.size(); i++) { 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; return result;

View File

@ -262,8 +262,7 @@ public class RedactionIntegrationTest {
public void redactionTest() throws IOException { public void redactionTest() throws IOException {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
ClassPathResource pdfFileResource = new ClassPathResource("files/Metolachlor/S" + ClassPathResource pdfFileResource = new ClassPathResource("files/Metolachlor/S-Metolachlor_RAR_21_Volume_3CP_A9396G_B-9_2018-09-06.pdf");
"-Metolachlor_RAR_01_Volume_1_2018-09-06.pdf");
RedactionRequest request = RedactionRequest.builder() RedactionRequest request = RedactionRequest.builder()
.document(IOUtils.toByteArray(pdfFileResource.getInputStream())) .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" rule "9: Redact Authors and Addresses in Reference Table, if it is a Vertebrate study"
when when
Section(tabularData != null && tabularData.size() > 0 Section(tabularData != null
&& tabularData.containsKey("Vertebrate study Y/N") && tabularData.containsKey("Vertebrate study Y/N")
&& tabularData.get("Vertebrate study Y/N").equals("Y") && tabularData.get("Vertebrate study Y/N").equals("Y")
) )