Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the exception occurred when publish/rollback namespaces with grayrelease #4564

Merged
merged 1 commit into from
Sep 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Apollo 2.1.0
* [Add index for table ReleaseHistory](https://github.com/apolloconfig/apollo/pull/4550)
* [add an option to custom oidc userDisplayName](https://github.com/apolloconfig/apollo/pull/4507)
* [fix openapi item with url illegalKey 400 error](https://github.com/apolloconfig/apollo/pull/4549)
* [fix the exception occurred when publish/rollback namespaces with grayrelease](https://github.com/apolloconfig/apollo/pull/4564)

------------------
All issues and pull requests are [here](https://github.com/apolloconfig/apollo/milestone/11?closed=1)
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@
import com.google.common.collect.Sets;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import org.apache.commons.lang.time.FastDateFormat;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
Expand All @@ -47,9 +56,6 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;

import java.lang.reflect.Type;
import java.util.*;

/**
* @author Jason Song([email protected])
*/
Expand All @@ -62,7 +68,7 @@ public class ReleaseService {
.newHashSet(ReleaseOperation.GRAY_RELEASE, ReleaseOperation.MASTER_NORMAL_RELEASE_MERGE_TO_GRAY,
ReleaseOperation.MATER_ROLLBACK_MERGE_TO_GRAY);
private static final Pageable FIRST_ITEM = PageRequest.of(0, 1);
private static final Type OPERATION_CONTEXT_TYPE_REFERENCE = new TypeToken<Map<String, Collection<String>>>() { }.getType();
private static final Type OPERATION_CONTEXT_TYPE_REFERENCE = new TypeToken<Map<String, Object>>() { }.getType();

private final ReleaseRepository releaseRepository;
private final ItemService itemService;
Expand Down Expand Up @@ -329,14 +335,14 @@ private Collection<String> getBranchReleaseKeys(long releaseId) {
return null;
}

Map<String, Collection<String>> operationContext = GSON
.fromJson(operationContextJson, OPERATION_CONTEXT_TYPE_REFERENCE);
Map<String, Object> operationContext = GSON.fromJson(operationContextJson,
OPERATION_CONTEXT_TYPE_REFERENCE);

if (operationContext == null) {
return null;
}

return operationContext.get(ReleaseOperationContext.BRANCH_RELEASE_KEYS);
return (Collection<String>) operationContext.get(ReleaseOperationContext.BRANCH_RELEASE_KEYS);
}

private Release publishBranchNamespace(Namespace parentNamespace, Namespace childNamespace,
Expand Down