|
@@ -64,6 +64,8 @@ import java.util.LinkedHashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
import java.util.Set;
|
|
|
|
+import java.util.regex.Matcher;
|
|
|
|
+import java.util.regex.Pattern;
|
|
|
|
|
|
import static org.apache.hadoop.yarn.service.exceptions.RestApiErrorMessages.ERROR_COMP_DOES_NOT_NEED_UPGRADE;
|
|
import static org.apache.hadoop.yarn.service.exceptions.RestApiErrorMessages.ERROR_COMP_DOES_NOT_NEED_UPGRADE;
|
|
import static org.apache.hadoop.yarn.service.exceptions.RestApiErrorMessages.ERROR_COMP_INSTANCE_DOES_NOT_NEED_UPGRADE;
|
|
import static org.apache.hadoop.yarn.service.exceptions.RestApiErrorMessages.ERROR_COMP_INSTANCE_DOES_NOT_NEED_UPGRADE;
|
|
@@ -246,6 +248,16 @@ public class ServiceApiUtil {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public static void validateJvmOpts(String jvmOpts)
|
|
|
|
+ throws IllegalArgumentException {
|
|
|
|
+ Pattern pattern = Pattern.compile("[!~#?@*&%${}()<>\\[\\]|\"\\/,`;]");
|
|
|
|
+ Matcher matcher = pattern.matcher(jvmOpts);
|
|
|
|
+ if (matcher.find()) {
|
|
|
|
+ throw new IllegalArgumentException(
|
|
|
|
+ RestApiErrorMessages.ERROR_JVM_OPTS);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
public static void validateKerberosPrincipal(
|
|
public static void validateKerberosPrincipal(
|
|
KerberosPrincipal kerberosPrincipal) throws IOException {
|
|
KerberosPrincipal kerberosPrincipal) throws IOException {
|
|
if (!StringUtils.isEmpty(kerberosPrincipal.getPrincipalName())) {
|
|
if (!StringUtils.isEmpty(kerberosPrincipal.getPrincipalName())) {
|