smolnar82 commented on code in PR #597:
URL: https://github.com/apache/knox/pull/597#discussion_r904699792
##########
gateway-provider-security-authz-composite/src/main/java/org/apache/knox/gateway/deploy/impl/CompositeAuthzDeploymentContributor.java:
##########
@@ -56,23 +59,24 @@ public void contributeFilter( DeploymentContext context,
Provider provider, Serv
Map<String, String> providerParams = provider.getParams();
String providerNames = providerParams.get("composite.provider.names");
- if (!providerNames.isEmpty()) {
- String[] names = parseProviderNames(providerNames);
- for (String name : names) {
- getProviderSpecificParams(resource, params, providerParams, name);
- DeploymentFactory.getProviderContributor("authorization", name)
- .contributeFilter(context, provider, service, resource, params);
- params.clear();
- }
+ if (!StringUtils.isEmpty(providerNames)) {
+ List<String> names = parseProviderNames(providerNames);
+ for (String name : names) {
+ getProviderSpecificParams(resource, params, providerParams, name);
+ DeploymentFactory.getProviderContributor("authorization", name)
+ .contributeFilter(context, provider, service, resource,
params);
+ params.clear();
+ }
}
}
- String[] parseProviderNames(String providerNames) {
- String[] b = providerNames.split("\\s*,\\s*");
- for (int i = 0; i < b.length; i++) {
- b[i] = b[i].trim();
+ List parseProviderNames(String providerNames) {
+ if (providerNames==null || StringUtils.isEmpty(providerNames) ||
StringUtils.isBlank(providerNames)){
Review Comment:
`StringUtils.isBlank(providerNames)` is enough here. It is `null safe` and
will also cover `StringUtils.isEmpty(providerNames)`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]