You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bs...@apache.org on 2026/01/26 10:56:02 UTC

(cloudstack) branch 4.20 updated: Add log for null templateVO (#12406)

This is an automated email from the ASF dual-hosted git repository.

bstoyanov pushed a commit to branch 4.20
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.20 by this push:
     new 63bdc2b9903 Add log for null templateVO (#12406)
63bdc2b9903 is described below

commit 63bdc2b990314f5443961a24b7522397a65bc81f
Author: Manoj Kumar <ma...@gmail.com>
AuthorDate: Mon Jan 26 16:25:55 2026 +0530

    Add log for null templateVO (#12406)
---
 .../org/apache/cloudstack/storage/image/TemplateDataFactoryImpl.java   | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/TemplateDataFactoryImpl.java b/engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/TemplateDataFactoryImpl.java
index c6430bcf9f9..3e1504beb3a 100644
--- a/engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/TemplateDataFactoryImpl.java
+++ b/engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/TemplateDataFactoryImpl.java
@@ -296,6 +296,9 @@ public class TemplateDataFactoryImpl implements TemplateDataFactory {
     @Override
     public boolean isTemplateMarkedForDirectDownload(long templateId) {
         VMTemplateVO templateVO = imageDataDao.findById(templateId);
+        if (templateVO == null) {
+            throw new CloudRuntimeException(String.format("Template not found with ID: %s", templateId));
+        }
         return templateVO.isDirectDownload();
     }
 }