Skip to content

Commit

Permalink
return null instead of []
Browse files Browse the repository at this point in the history
  • Loading branch information
jingyi-gao-ttd committed Oct 5, 2023
1 parent 4d5d988 commit 902cbfa
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/main/java/com/uid2/admin/vertx/service/SharingService.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,8 @@ private void handleListAllowedSites(RoutingContext rc) {
return;
}

JsonArray listedSites = new JsonArray();
Set<Integer> allowedSites = keyset.getAllowedSites();
if (allowedSites != null) {
allowedSites.stream().sorted().forEach((listedSiteId) -> listedSites.add(listedSiteId));
}
JsonObject jo = new JsonObject();
jo.put("allowed_sites", listedSites);
jo.put("allowed_sites", keyset.getAllowedSites());
jo.put("allowed_types", keyset.getAllowedTypes());
jo.put("hash", keyset.hashCode());

Expand All @@ -252,15 +247,10 @@ private void handleListAllAllowedSites(RoutingContext rc) {
JsonArray ja = new JsonArray();
Map<Integer, AdminKeyset> collection = this.keysetProvider.getSnapshot().getAllKeysets();
for (Map.Entry<Integer, AdminKeyset> keyset : collection.entrySet()) {
JsonArray listedSites = new JsonArray();
Set<Integer> allowedSites = keyset.getValue().getAllowedSites();
if (allowedSites != null) {
allowedSites.stream().sorted().forEach((listedSiteId) -> listedSites.add(listedSiteId));
}
JsonObject jo = new JsonObject();
jo.put("keyset_id", keyset.getValue().getKeysetId());
jo.put("site_id", keyset.getValue().getSiteId());
jo.put("allowed_sites", listedSites);
jo.put("allowed_sites", keyset.getValue().getAllowedSites());
jo.put("allowed_types", keyset.getValue().getAllowedTypes());
jo.put("hash", keyset.getValue().hashCode());
ja.add(jo);
Expand Down

0 comments on commit 902cbfa

Please sign in to comment.