zeppelin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject incubator-zeppelin git commit: [ZEPPELIN-755] Invalid notebook JSON file prevents Zeppelin daemon from starting
Date Thu, 24 Mar 2016 02:31:16 GMT
Repository: incubator-zeppelin
Updated Branches:
  refs/heads/master af99a76f8 -> 3de8da3c0


[ZEPPELIN-755] Invalid notebook JSON file prevents Zeppelin daemon from starting

### What is this PR for?
Invalid json file prevents Zeppelin daemon starting.
This PR catches all exceptions during json file read. So Invalid notebook file will be skipped.

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

### Todos
* [x] - Catch all exception and skip invalid json file reading
* [x] - Unittest

### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-755

### How should this be tested?
Create any directory in notebook directory, and put empty note.json. And then start Zeppelin
and see if daemon started.

### 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: Lee moon soo <moon@apache.org>

Closes #786 from Leemoonsoo/ZEPPELIN-755 and squashes the following commits:

5914dec [Lee moon soo] Catch all exception on getting noteinfo in S3NotebookRepo, AzureNoteobokRepo
9ced086 [Lee moon soo] Catch all exceptions when listing


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

Branch: refs/heads/master
Commit: 3de8da3c04a7448e8d0344dd56bec9e055dfc51d
Parents: af99a76
Author: Lee moon soo <moon@apache.org>
Authored: Tue Mar 22 10:54:10 2016 -0700
Committer: Lee moon soo <moon@apache.org>
Committed: Wed Mar 23 19:31:24 2016 -0700

----------------------------------------------------------------------
 .../zeppelin/notebook/repo/AzureNotebookRepo.java     |  5 ++---
 .../apache/zeppelin/notebook/repo/S3NotebookRepo.java |  2 +-
 .../zeppelin/notebook/repo/VFSNotebookRepo.java       |  2 +-
 .../zeppelin/notebook/repo/VFSNotebookRepoTest.java   | 14 ++++++++++++++
 4 files changed, 18 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/3de8da3c/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/AzureNotebookRepo.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/AzureNotebookRepo.java
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/AzureNotebookRepo.java
index 9bec90a..14c56ec 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/AzureNotebookRepo.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/AzureNotebookRepo.java
@@ -88,10 +88,9 @@ public class AzureNotebookRepo implements NotebookRepo {
           }
         } catch (StorageException | URISyntaxException e) {
           String msg = "Error enumerating notebooks from Azure storage";
-
           LOG.error(msg, e);
-
-          throw new IOException(msg, e);
+        } catch (Exception e) {
+          LOG.error(e.getMessage(), e);
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/3de8da3c/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/S3NotebookRepo.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/S3NotebookRepo.java
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/S3NotebookRepo.java
index caf24fb..e0df65f 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/S3NotebookRepo.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/S3NotebookRepo.java
@@ -102,7 +102,7 @@ public class S3NotebookRepo implements NotebookRepo {
               if (info != null) {
                 infos.add(info);
               }
-            } catch (IOException e) {
+            } catch (Exception e) {
               LOG.error("Can't read note ", e);
             }
           }

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/3de8da3c/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepo.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepo.java
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepo.java
index 1f9308f..6db4828 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepo.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepo.java
@@ -134,7 +134,7 @@ public class VFSNotebookRepo implements NotebookRepo {
         if (info != null) {
           infos.add(info);
         }
-      } catch (IOException e) {
+      } catch (Exception e) {
         logger.error("Can't read note " + f.getName().toString(), e);
       }
     }

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/3de8da3c/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepoTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepoTest.java
b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepoTest.java
index 4932ae2..6058f82 100644
--- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepoTest.java
+++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepoTest.java
@@ -91,6 +91,20 @@ public class VFSNotebookRepoTest implements JobListenerFactory {
   }
 
   @Test
+  public void testInvalidJsonFile() throws IOException {
+    // given
+    int numNotes = notebookRepo.list().size();
+
+    // when create invalid json file
+    File testNoteDir = new File(mainNotebookDir, "test");
+    testNoteDir.mkdir();
+    FileUtils.writeStringToFile(new File(testNoteDir, "note.json"), "");
+
+    // then
+    assertEquals(numNotes, notebookRepo.list().size());
+  }
+
+  @Test
   public void testSaveNotebook() throws IOException, InterruptedException {
     Note note = notebook.createNote();
     note.getNoteReplLoader().setInterpreters(factory.getDefaultInterpreterSettingList());


Mime
View raw message