You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by GitBox <gi...@apache.org> on 2022/06/21 18:34:22 UTC
[GitHub] [knox] smolnar82 commented on a diff in pull request #597: KNOX-2762 Bug fixes for spaces around delimiters with all reviewed comments addressed
smolnar82 commented on code in PR #597:
URL: https://github.com/apache/knox/pull/597#discussion_r902941720
##########
gateway-provider-security-authz-composite/src/main/java/org/apache/knox/gateway/deploy/impl/CompositeAuthzDeploymentContributor.java:
##########
@@ -57,22 +59,23 @@ 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();
- }
+ 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){
Review Comment:
nit: formatting
##########
gateway-provider-security-authz-composite/src/main/java/org/apache/knox/gateway/deploy/impl/CompositeAuthzDeploymentContributor.java:
##########
@@ -57,22 +59,23 @@ 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();
- }
+ 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){
+ return Collections.singletonList("");
}
- return b;
+ List<String> providerNamesList = Arrays.asList(providerNames.split("\\s*,\\s*"));
+ providerNamesList.replaceAll(String::trim);
Review Comment:
Cool; I like this change.
--
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: dev-unsubscribe@knox.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org