alexott 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_r390968458
 
 

 ##########
 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]+$");
 
 Review comment:
   I would move the pattern into static constant to avoid its compilation on 
every call....

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


With regards,
Apache Git Services

Reply via email to