You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mo...@apache.org on 2017/05/05 17:36:34 UTC
zeppelin git commit: [ZEPPELIN-2484] Fix NullPointerException in
check for empty last paragraph
Repository: zeppelin
Updated Branches:
refs/heads/master 6db9929dd -> ae05740b1
[ZEPPELIN-2484] Fix NullPointerException in check for empty last paragraph
### What is this PR for?
Prevent NullPointerException during check to determine whether a new paragraph needs to added.
The fix is to switch order of null check and trim operation so that null check is performed before trim()
### What type of PR is it?
Bug Fix
### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-2484
### How should this be tested?
This can be tested with a hive interpreter
Create a note and add a paragraph with some query in it.
Run all paragraphs.
A new paragraph is automatically added.
Run all paragraphs again. A NullPointerException is logged in the logs.
### Screenshots (if appropriate)
### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No
Author: Benoy Antony <be...@apache.org>
Closes #2310 from benoyantony/ZEPPELIN-2484 and squashes the following commits:
1cc2f8b [Benoy Antony] ZEPPELIN-2484 do a Null check before calling trim on paragraph's text
Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/ae05740b
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/ae05740b
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/ae05740b
Branch: refs/heads/master
Commit: ae05740b1852a4251b66b9559486b62a85af5dd9
Parents: 6db9929
Author: Benoy Antony <be...@apache.org>
Authored: Tue May 2 15:17:44 2017 -0700
Committer: Lee moon soo <mo...@apache.org>
Committed: Fri May 5 13:36:25 2017 -0400
----------------------------------------------------------------------
.../main/java/org/apache/zeppelin/socket/NotebookServer.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/ae05740b/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 4a0665b..64a4126 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
@@ -1742,10 +1742,10 @@ public class NotebookServer extends WebSocketServlet
}
private void addNewParagraphIfLastParagraphIsExecuted(Note note, Paragraph p) {
- // if it's the last paragraph and empty, let's add a new one
+ // if it's the last paragraph and not empty, let's add a new one
boolean isTheLastParagraph = note.isLastParagraph(p.getId());
- if (!(p.getText().trim().equals(p.getMagic()) ||
- Strings.isNullOrEmpty(p.getText())) &&
+ if (!(Strings.isNullOrEmpty(p.getText()) ||
+ p.getText().trim().equals(p.getMagic())) &&
isTheLastParagraph) {
Paragraph newPara = note.addNewParagraph(p.getAuthenticationInfo());
broadcastNewParagraph(note, newPara);