Repository: zeppelin Updated Branches: refs/heads/branch-0.6 7d3ee991e -> 0ed00646e
ZEPPELIN-1374. Should prevent use dot in interpreter name dot is invalid for interpreter name as it is used as the separator of interpreter group name and interpreter name. [Improvement] * [ ] - Task * https://issues.apache.org/jira/browse/ZEPPELIN-1374 Tested it manually as shown in the screenshot.  * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Author: Jeff Zhang <[email protected]> Closes #1365 from zjffdu/ZEPPELIN-1374 and squashes the following commits: d36d437 [Jeff Zhang] add rest api checking 0620c6a [Jeff Zhang] ZEPPELIN-1374. Should prevent use dot in interpreter name (cherry picked from commit 33ddc00c637d043a31f3a7f2e861f58f2c1ebc5a) Signed-off-by: Mina Lee <[email protected]> Conflicts: zeppelin-web/src/app/interpreter/interpreter.controller.js zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/0ed00646 Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/0ed00646 Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/0ed00646 Branch: refs/heads/branch-0.6 Commit: 0ed00646e75b3ea335806691ea5755eec29d5da1 Parents: 7d3ee99 Author: Jeff Zhang <[email protected]> Authored: Mon Aug 29 10:35:06 2016 +0800 Committer: Mina Lee <[email protected]> Committed: Fri Sep 2 12:04:46 2016 +0200 ---------------------------------------------------------------------- .../src/app/interpreter/interpreter.controller.js | 9 +++++++++ .../zeppelin/interpreter/InterpreterFactoryTest.java | 10 ++++++++++ 2 files changed, 19 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0ed00646/zeppelin-web/src/app/interpreter/interpreter.controller.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/app/interpreter/interpreter.controller.js b/zeppelin-web/src/app/interpreter/interpreter.controller.js index d787238..5336642 100644 --- a/zeppelin-web/src/app/interpreter/interpreter.controller.js +++ b/zeppelin-web/src/app/interpreter/interpreter.controller.js @@ -225,6 +225,15 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope, return; } + if (!$scope.newInterpreterSetting.name.indexOf('.') >= 0) { + BootstrapDialog.alert({ + closable: true, + title: 'Add interpreter', + message: '\'.\' is invalid for interpreter name' + }); + return; + } + if (_.findIndex($scope.interpreterSettings, { 'name': $scope.newInterpreterSetting.name }) >= 0) { BootstrapDialog.alert({ closable: true, http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0ed00646/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java ---------------------------------------------------------------------- diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java index 3d9ee6f..267705b 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java @@ -136,4 +136,14 @@ public class InterpreterFactoryTest { InterpreterFactory factory2 = new InterpreterFactory(conf, null, null, null, depResolver); assertEquals(3, factory2.get().size()); } + + @Test + public void testInvalidInterpreterSettingName() { + try { + factory.createNewSetting("new.mock1", "mock1", new LinkedList<Dependency>(), new InterpreterOption(false), new Properties()); + fail("expect fail because of invalid InterpreterSetting Name"); + } catch (IOException e) { + assertEquals("'.' is invalid for InterpreterSetting name.", e.getMessage()); + } + } }
