From 051443a5792adf07dbfa51463d48a1d54422e1f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B3nio=20Lindo?= Date: Fri, 17 May 2024 11:00:57 +0100 Subject: [PATCH] fixed NPE when fileExtension is empty and entry null --- .../transformers/ToolkitStructure2ViewerStructure.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/databasepreservation/common/transformers/ToolkitStructure2ViewerStructure.java b/src/main/java/com/databasepreservation/common/transformers/ToolkitStructure2ViewerStructure.java index d15a9ede..a7f37b93 100644 --- a/src/main/java/com/databasepreservation/common/transformers/ToolkitStructure2ViewerStructure.java +++ b/src/main/java/com/databasepreservation/common/transformers/ToolkitStructure2ViewerStructure.java @@ -9,7 +9,6 @@ import com.databasepreservation.common.client.models.structure.ViewerLobStoreType; import java.io.ByteArrayInputStream; -import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; @@ -912,7 +911,11 @@ private static void detectMimeType(ViewerRow row, ViewerCell cell, String databa if (StringUtils.isAllBlank(fileExtension)) { try { if (blobIsInsideSiard) { - inputStream = zipFile.getInputStream(entry); + if (entry != null) { + inputStream = zipFile.getInputStream(entry); + } else { + inputStream = new ByteArrayInputStream(lobCellValue.getBytes()); + } } else { final Path lobPath = Paths.get(lobCellValue); final Path completeLobPath = ViewerFactory.getViewerConfiguration().getSIARDFilesPath().resolve(lobPath);