From 7b9568b870126514f6c95a5a8cada2950138395b Mon Sep 17 00:00:00 2001 From: Thomasr Date: Thu, 30 Jan 2025 09:07:50 -0500 Subject: [PATCH] Fix issues when application settings has null values for category, description, icon and title --- .../domain/application/model/Application.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/application/model/Application.java b/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/application/model/Application.java index 978f5c8c6..6933fd239 100644 --- a/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/application/model/Application.java +++ b/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/application/model/Application.java @@ -172,9 +172,9 @@ public Mono getCategory(ApplicationRecordService applicationRecordServic if (liveDSL == null || liveDSL.get("settings") == null) return ""; Object settingsObject = liveDSL.get("settings"); if (settingsObject instanceof Map) { - @SuppressWarnings("unchecked") - Map settings = (Map) liveDSL.get("settings"); - return (String) settings.get("category"); + Map settings = (Map) liveDSL.get("settings"); + Object category = settings.get("category"); + return (category != null & category instanceof String)?(String) category:""; } else { return ""; } @@ -186,9 +186,9 @@ public Mono getTitle(ApplicationRecordService applicationRecordService) if (liveDSL == null || liveDSL.get("settings") == null) return ""; Object settingsObject = liveDSL.get("settings"); if (settingsObject instanceof Map) { - @SuppressWarnings("unchecked") - Map settings = (Map) liveDSL.get("settings"); - return (String) settings.get("title"); + Map settings = (Map) liveDSL.get("settings"); + Object title = settings.get("title"); + return (title != null & title instanceof String)?(String) title:""; } else { return ""; } @@ -200,9 +200,9 @@ public Mono getDescription(ApplicationRecordService applicationRecordSer if (liveDSL == null || liveDSL.get("settings") == null) return ""; Object settingsObject = liveDSL.get("settings"); if (settingsObject instanceof Map) { - @SuppressWarnings("unchecked") - Map settings = (Map) liveDSL.get("settings"); - return (String) settings.get("description"); + Map settings = (Map) liveDSL.get("settings"); + Object description = settings.get("description"); + return (description != null & description instanceof String)?(String) description:""; } else { return ""; } @@ -215,9 +215,9 @@ public Mono getIcon(ApplicationRecordService applicationRecordService) { if (liveDSL == null || liveDSL.get("settings") == null) return ""; Object settingsObject = liveDSL.get("settings"); if (settingsObject instanceof Map) { - @SuppressWarnings("unchecked") - Map settings = (Map) liveDSL.get("settings"); - return (String) settings.get("icon"); + Map settings = (Map) liveDSL.get("settings"); + Object icon = settings.get("icon"); + return (icon != null & icon instanceof String)?(String) icon:""; } else { return ""; }