You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zeppelin.apache.org by GitBox <gi...@apache.org> on 2020/03/11 14:51:38 UTC

[GitHub] [zeppelin] zjffdu commented on a change in pull request #3684: ZEPPELIN-4679: Add API validation for creating interpreter

zjffdu commented on a change in pull request #3684: ZEPPELIN-4679: Add API validation for creating interpreter
URL: https://github.com/apache/zeppelin/pull/3684#discussion_r391028501
 
 

 ##########
 File path: zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java
 ##########
 @@ -767,9 +769,17 @@ private InterpreterSetting inlineCreateNewSetting(String name, String group,
                                                     InterpreterOption option,
                                                     Map<String, InterpreterProperty> properties)
       throws IOException {
-    if (name.indexOf(".") >= 0) {
-      throw new IOException("'.' is invalid for InterpreterSetting name.");
+    if (name == null) {
+      throw new IOException("Interpreter name shouldn't be empty.");
     }
+
+    // check if name is valid
+    Pattern pattern = Pattern.compile("^[-_a-zA-Z0-9]+$");
+    Matcher matcher = pattern.matcher(name);
+    if(!matcher.find()){
+      throw new IOException("Interpreter name shouldn't be empty, and can consist only of: -_a-zA-Z0-9");
 
 Review comment:
   Regarding this, we do need to revisit that, and could do it in other PR

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services