zeppelin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jongy...@apache.org
Subject zeppelin git commit: [MINOR] Supported old note format in case of not having name of note
Date Wed, 22 Feb 2017 09:16:55 GMT
Repository: zeppelin
Updated Branches:
  refs/heads/master 6fd41fa3c -> 5144050f9


[MINOR] Supported old note format in case of not having name of note

### What is this PR for?
Supporting old format of note which doesn't have name inside. Long time ago, when creating
note without specific name, name field become empty string. but it become error while remove
note for current master. It will fix this error

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

### Todos
* [ ] - Enable getName returns getId if it has empty value

### What is the Jira issue?
N/A

### How should this be tested?
See the test added

### Screenshots (if appropriate)
N/A

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

Author: Jongyoul Lee <jongyoul@gmail.com>

Closes #2028 from jongyoul/hotfix/remove-note-without-name and squashes the following commits:

e671040 [Jongyoul Lee] Set note's name if it's empty
cc6b6ca [Jongyoul Lee] Supported old note format in case of not having name of note


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

Branch: refs/heads/master
Commit: 5144050f990988e99ad0901ba4513467dc4bf119
Parents: 6fd41fa
Author: Jongyoul Lee <jongyoul@gmail.com>
Authored: Tue Feb 21 13:03:07 2017 +0900
Committer: Jongyoul Lee <jongyoul@apache.org>
Committed: Wed Feb 22 18:16:47 2017 +0900

----------------------------------------------------------------------
 .../src/main/java/org/apache/zeppelin/notebook/Note.java      | 5 ++++-
 .../src/test/java/org/apache/zeppelin/notebook/NoteTest.java  | 7 +++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/5144050f/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java
index 62ded18..0ee89d8 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java
@@ -144,6 +144,9 @@ public class Note implements Serializable, ParagraphJobListener {
   }
 
   public String getName() {
+    if (isNameEmpty()) {
+      name = getId();
+    }
     return name;
   }
 
@@ -181,7 +184,7 @@ public class Note implements Serializable, ParagraphJobListener {
   }
 
   public boolean isNameEmpty() {
-    return getName().trim().isEmpty();
+    return this.name.trim().isEmpty();
   }
 
   private String normalizeNoteName(String name) {

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/5144050f/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NoteTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NoteTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NoteTest.java
index 708acd6..2267a4a 100644
--- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NoteTest.java
+++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NoteTest.java
@@ -203,4 +203,11 @@ public class NoteTest {
     note.setName(Folder.TRASH_FOLDER_ID + "/a/b/c");
     assertTrue(note.isTrash());
   }
+
+  @Test
+  public void getNameWithoutNameItself() {
+    Note note = new Note(repo, interpreterFactory, interpreterSettingManager, jobListenerFactory,
index, credentials, noteEventListener);
+
+    assertEquals("getName should return same as getId when name is empty", note.getId(),
note.getName());
+  }
 }


Mime
View raw message