Skip to content

Commit

Permalink
Fixes ClassCastException
Browse files Browse the repository at this point in the history
Signed-off-by: Darshit Chanpura <[email protected]>
  • Loading branch information
DarshitChanpura committed Dec 6, 2024
1 parent bfc39ad commit acc22c4
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
package org.opensearch.sample.actions.access.revoke;

import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;

import org.opensearch.accesscontrol.resources.EntityType;
Expand Down Expand Up @@ -59,7 +56,7 @@ protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient cli
}
}, Map.Entry::getValue));
@SuppressWarnings("unchecked")
Set<String> scopes = source.containsKey("scopes") ? (Set<String>) source.get("scopes") : Set.of();
Set<String> scopes = new HashSet<>(source.containsKey("scopes") ? (List<String>) source.get("scopes") : List.of());
final RevokeResourceAccessRequest revokeResourceAccessRequest = new RevokeResourceAccessRequest(resourceId, revoke, scopes);
return channel -> client.executeLocally(
RevokeResourceAccessAction.INSTANCE,
Expand Down

0 comments on commit acc22c4

Please sign in to comment.