From 64944a3a7601e7fa5eab931a9c00a49f9384daad Mon Sep 17 00:00:00 2001 From: Nilesh Sarupriya Date: Wed, 7 May 2025 18:14:11 +0530 Subject: [PATCH] fix: non null check on published action (#40598) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description > [!TIP] > _Add a TL;DR when the description is longer than 500 words or extremely technical (helps the content, marketing, and DevRel team)._ > > _Please also include relevant motivation and context. List any dependencies that are required for this change. Add links to Notion, Figma or any other documents that might be relevant to the PR._ Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: 7b958d423567766bc8531425e5cb045c45752567 > Cypress dashboard. > Tags: `@tag.All` > Spec: >
Wed, 07 May 2025 10:34:51 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No ## Summary by CodeRabbit - **Bug Fixes** - Improved reliability during app import by preventing potential errors when handling actions without published versions. Co-authored-by: Nilesh Sarupriya <20905988+nsarupr@users.noreply.github.com> --- .../partial/PartialImportServiceCEImpl.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/partial/PartialImportServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/partial/PartialImportServiceCEImpl.java index 181068f83a..1ebdd50953 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/partial/PartialImportServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/partial/PartialImportServiceCEImpl.java @@ -64,6 +64,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -408,13 +409,15 @@ public class PartialImportServiceCEImpl implements PartialImportServiceCE { } applicationJson.getActionList().forEach(action -> { - action.getPublishedAction().setPageId(pageName); action.getUnpublishedAction().setPageId(pageName); - if (action.getPublishedAction().getCollectionId() != null) { - String collectionName = - action.getPublishedAction().getCollectionId().split("_")[1]; - action.getPublishedAction().setCollectionId(pageName + "_" + collectionName); - action.getUnpublishedAction().setCollectionId(pageName + "_" + collectionName); + if (Objects.nonNull(action.getPublishedAction())) { + action.getPublishedAction().setPageId(pageName); + if (action.getPublishedAction().getCollectionId() != null) { + String collectionName = + action.getPublishedAction().getCollectionId().split("_")[1]; + action.getPublishedAction().setCollectionId(pageName + "_" + collectionName); + action.getUnpublishedAction().setCollectionId(pageName + "_" + collectionName); + } } String actionName = action.getId().split("_")[1];