[
https://issues.apache.org/jira/browse/GEODE-8583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17210327#comment-17210327
]
ASF GitHub Bot commented on GEODE-8583:
---------------------------------------
jhutchison commented on a change in pull request #5604:
URL: https://github.com/apache/geode/pull/5604#discussion_r501864551
##########
File path:
geode-redis/src/main/java/org/apache/geode/redis/internal/ParameterRequirements/RestrictedInputValuesParameterRequirements.java
##########
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express
+ * or implied. See the License for the specific language governing permissions
and limitations under
+ * the License.
+ */
+
+package org.apache.geode.redis.internal.ParameterRequirements;
+
+import java.util.List;
+
+import org.apache.geode.redis.internal.netty.Command;
+import org.apache.geode.redis.internal.netty.ExecutionHandlerContext;
+
+public class RestrictedInputValuesParameterRequirements implements
ParameterRequirements {
+
+ List<String> allowedValues = null;
+
+ public RestrictedInputValuesParameterRequirements(List<String>
allowedValues) {
+ this.allowedValues = allowedValues;
+ }
+
+ @Override
+ public void checkParameters(Command command,
+ ExecutionHandlerContext executionHandlerContext) {
+ List<byte[]> parameters = command.getProcessedCommand();
+ String commandType = command.getCommandType().name();
+
+ parameters.forEach(parameter -> {
+ String parameterString = parameter.toString();
+ if (isNotAllowed(parameterString) &&
+ !parameterString.equalsIgnoreCase(commandType)) {
+ throw new RedisParametersMismatchException("");
+ }
+ });
+ }
+
+ private boolean isNotAllowed(String parameterString) {
+ return (allowedValues.contains(parameterString));
Review comment:
probably. Thanks
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
> create RestrictedInputValuesParameterRequirements in Redis Module
> -----------------------------------------------------------------
>
> Key: GEODE-8583
> URL: https://issues.apache.org/jira/browse/GEODE-8583
> Project: Geode
> Issue Type: Improvement
> Reporter: John Hutchison
> Priority: Minor
> Labels: pull-request-available, redis
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)