mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
added note not found check for export
This commit is contained in:
parent
7351f31963
commit
db8b016bee
1 changed files with 5 additions and 2 deletions
|
|
@ -159,13 +159,16 @@ public class Notebook {
|
|||
* Export existing note.
|
||||
* @param noteId - the note ID to clone
|
||||
* @return Note JSON
|
||||
* @throws IOException
|
||||
* @throws IOException, IllegalArgumentException
|
||||
*/
|
||||
public String exportNote(String noteId) throws IOException {
|
||||
public String exportNote(String noteId) throws IOException, IllegalArgumentException {
|
||||
GsonBuilder gsonBuilder = new GsonBuilder();
|
||||
gsonBuilder.setPrettyPrinting();
|
||||
Gson gson = gsonBuilder.create();
|
||||
Note note = getNote(noteId);
|
||||
if (note == null) {
|
||||
throw new IllegalArgumentException(noteId + "not found");
|
||||
}
|
||||
return gson.toJson(note);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue