NPE fix RED-3800
This commit is contained in:
parent
874c94d702
commit
b82d20473d
@ -32,7 +32,6 @@ public class MigrateHighlights3 extends Migration {
|
||||
@Autowired
|
||||
private FileManagementStorageService fileManagementStorageService;
|
||||
|
||||
|
||||
public MigrateHighlights3() {
|
||||
|
||||
super(NAME, VERSION);
|
||||
@ -48,12 +47,16 @@ public class MigrateHighlights3 extends Migration {
|
||||
files.forEach(file -> {
|
||||
if (file.getHardDeletedTime() == null) {
|
||||
|
||||
if (fileManagementStorageService.objectExists(dossier.getId(), file.getId(), FileType.ORIGIN)) {
|
||||
var fileBytes = fileManagementStorageService.getStoredObjectBytes(dossier.getId(), file.getId(), FileType.ORIGIN);
|
||||
var hasHighlights = pdfTronRedactionClient.extractHighlights(new DocumentRequest(dossier.getId(), file.getId(), file.getFilename(), fileBytes));
|
||||
fileStatusPersistenceService.updateHasHighlights(file.getId(), hasHighlights);
|
||||
} else {
|
||||
log.warn("Invalid file: {} in dossier: {}. File Data ( PDF ) does not exist", file.getId(), file.getDossierId());
|
||||
try {
|
||||
if (fileManagementStorageService.objectExists(dossier.getId(), file.getId(), FileType.ORIGIN)) {
|
||||
var fileBytes = fileManagementStorageService.getStoredObjectBytes(dossier.getId(), file.getId(), FileType.ORIGIN);
|
||||
var hasHighlights = pdfTronRedactionClient.extractHighlights(new DocumentRequest(dossier.getId(), file.getId(), file.getFilename(), fileBytes));
|
||||
fileStatusPersistenceService.updateHasHighlights(file.getId(), hasHighlights);
|
||||
} else {
|
||||
log.warn("Invalid file: {} in dossier: {}. File Data ( PDF ) does not exist", file.getId(), file.getDossierId());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to extract text highlights for document: {}", file.getId());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user