Repository: zeppelin
Updated Branches:
  refs/heads/master 2a2a2e82b -> a7a653999


[ZEPPELIN-1094] Run all paragraphs keeps appending empty paragraphs

### What is this PR for?
Every time user clicks on "Run all paragraphs" button system keeps appending an 
empty paragraph. Ideally content of paragraph should be checked before adding 
any empty paragraph.
This started happening after 
[ZEPPELIN-707](https://issues.apache.org/jira/browse/ZEPPELIN-707) was merged.

### What type of PR is it?
[Bug Fix | Improvement]

### Todos
* [x] - add more condition before calling note.addParagraph()

### What is the Jira issue?
* [ZEPPELIN-1094](https://issues.apache.org/jira/browse/ZEPPELIN-1094)

### Screenshots (if appropriate)

Before
![before](https://cloud.githubusercontent.com/assets/674497/16512206/5d9b91b4-3f76-11e6-991f-560817efb331.gif)

After
![after](https://cloud.githubusercontent.com/assets/674497/16512205/5d993bbc-3f76-11e6-916a-2924a17bd6a1.gif)

### Questions:
* Does the licenses files need update? n/a
* Is there breaking changes for older versions? n/a
* Does this needs documentation? n/a

Author: Prabhjyot Singh <[email protected]>

Closes #1111 from prabhjyotsingh/ZEPPELIN-1094 and squashes the following 
commits:

7919648 [Prabhjyot Singh] add more condition before calling note.addParagraph()


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/a7a65399
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/a7a65399
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/a7a65399

Branch: refs/heads/master
Commit: a7a653999055e9931fa5d0aad067669a7e395914
Parents: 2a2a2e8
Author: Prabhjyot Singh <[email protected]>
Authored: Fri Jul 1 10:25:01 2016 +0530
Committer: Prabhjyot Singh <[email protected]>
Committed: Sun Jul 3 09:50:16 2016 +0530

----------------------------------------------------------------------
 .../src/main/java/org/apache/zeppelin/socket/NotebookServer.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a7a65399/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java 
b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java
index 42edb08..1c3220b 100644
--- 
a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java
+++ 
b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java
@@ -1075,7 +1075,8 @@ public class NotebookServer extends WebSocketServlet 
implements
     boolean isTheLastParagraph = note.getLastParagraph().getId()
         .equals(p.getId());
     note.setLastReplName(paragraphId);
-    if (!Strings.isNullOrEmpty(text) && isTheLastParagraph) {
+    if (!(text.equals(note.getLastInterpreterName() + " ") || 
Strings.isNullOrEmpty(text)) &&
+        isTheLastParagraph) {
       note.addParagraph();
     }
 

Reply via email to