From 505d3a331dc345532d97fcdf48d4476d895be2bc Mon Sep 17 00:00:00 2001 From: Anagh Hegde Date: Wed, 27 Jul 2022 17:14:17 +0530 Subject: [PATCH] chore: NPE issue while copying in git-theming migration (#15480) ## Description > Fix the NPE issue in theming while copying the properties. ## Type of change - Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? > Locally ## Checklist: - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes --- .../com/appsmith/server/migrations/DatabaseChangelog2.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/DatabaseChangelog2.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/DatabaseChangelog2.java index cf5ed7b019..a694ab9e72 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/DatabaseChangelog2.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/DatabaseChangelog2.java @@ -71,6 +71,7 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; +import static com.appsmith.external.helpers.AppsmithBeanUtils.copyNestedNonNullProperties; import static com.appsmith.external.helpers.AppsmithBeanUtils.copyNewFieldValuesIntoOldObject; import static com.appsmith.server.migrations.DatabaseChangelog.dropIndexIfExists; import static com.appsmith.server.migrations.DatabaseChangelog.ensureIndexes; @@ -1439,7 +1440,7 @@ public class DatabaseChangelog2 { Theme theme = mongockTemplate.findOne(themeQuery, Theme.class); for (Application application : applicationList) { Theme newTheme = new Theme(); - copyNewFieldValuesIntoOldObject(theme, newTheme); + copyNestedNonNullProperties(theme, newTheme); newTheme.setId(null); newTheme.setSystemTheme(false); newTheme = mongockTemplate.insert(newTheme);