Skip to content

Commit

Permalink
fix the exception occurred when publish/rollback namespaces with gray…
Browse files Browse the repository at this point in the history
… release
  • Loading branch information
nobodyiam committed Sep 11, 2022
1 parent e690e65 commit f4c7d35
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
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

0 comments on commit f4c7d35

Please sign in to comment.