Skip to content

Commit db8b016

Browse files
committed
added note not found check for export
1 parent 7351f31 commit db8b016

File tree

1 file changed

+5
-2
lines changed
  • zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook

1 file changed

+5
-2
lines changed

zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Notebook.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,16 @@ public Note createNote(List<String> interpreterIds) throws IOException {
159159
* Export existing note.
160160
* @param noteId - the note ID to clone
161161
* @return Note JSON
162-
* @throws IOException
162+
* @throws IOException, IllegalArgumentException
163163
*/
164-
public String exportNote(String noteId) throws IOException {
164+
public String exportNote(String noteId) throws IOException, IllegalArgumentException {
165165
GsonBuilder gsonBuilder = new GsonBuilder();
166166
gsonBuilder.setPrettyPrinting();
167167
Gson gson = gsonBuilder.create();
168168
Note note = getNote(noteId);
169+
if (note == null) {
170+
throw new IllegalArgumentException(noteId + "not found");
171+
}
169172
return gson.toJson(note);
170173
}
171174

0 commit comments

Comments
 (0)