diff --git a/CHANGES.md b/CHANGES.md index 2b349eff0bd..53cc8e5f087 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -38,6 +38,7 @@ Apollo 2.1.0 * [fix Grayscale release Item Value length limit can not be synchronized with its main version](https://github.com/apolloconfig/apollo/pull/4622) * [feat: use can change spring.profiles.active's value without rebuild project](https://github.com/apolloconfig/apollo/pull/4616) * [refactor: remove app.properties and move some config file's location](https://github.com/apolloconfig/apollo/pull/4637) +* [Fix the problem of deleting blank items appear at the end](https://github.com/apolloconfig/apollo/pull/4662) ------------------ All issues and pull requests are [here](https://github.com/apolloconfig/apollo/milestone/11?closed=1) diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/txtresolver/PropertyResolver.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/txtresolver/PropertyResolver.java index 1d8833630b6..f7dd9b46e82 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/txtresolver/PropertyResolver.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/txtresolver/PropertyResolver.java @@ -194,8 +194,9 @@ private void deleteCommentAndBlankItem(Map oldLineNumMapItem, //1. old is blank by now is not //2.old is comment by now is not exist or modified + //3.old is blank by now is not exist or modified if ((isBlankItem(oldItem) && !isBlankItem(newItem)) - || isCommentItem(oldItem) && (newItem == null || !newItem.equals(oldItem.getComment()))) { + || (isCommentItem(oldItem) || isBlankItem(oldItem)) && (newItem == null || !newItem.equals(oldItem.getComment()))) { changeSets.addDeleteItem(oldItem); } }