From ba3e4623df0ee4c130e158ec691e5313a52c41eb Mon Sep 17 00:00:00 2001 From: nipuni Date: Tue, 12 Nov 2024 20:28:09 +0530 Subject: [PATCH] Fix NullPointerException in getFileMetaEntry method for URLs with chunked transfer encoding. --- .../mgt/core/impl/FileDownloaderServiceProvider.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/FileDownloaderServiceProvider.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/FileDownloaderServiceProvider.java index 7c8ad99533..d0ca149bcb 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/FileDownloaderServiceProvider.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/FileDownloaderServiceProvider.java @@ -122,7 +122,10 @@ public class FileDownloaderServiceProvider { } FileMetaEntry fileMetaEntry = new FileMetaEntry(); - fileMetaEntry.setSize(Long.parseLong(Objects.requireNonNull(response.header("Content-Length")))); + String contentLength = response.header("Content-Length"); + if (contentLength != null) { + fileMetaEntry.setSize(Long.parseLong(contentLength)); + } fileMetaEntry.setFileName(fileNameSegments[0]); fileMetaEntry.setExtension(fileNameSegments[1]); return fileMetaEntry;