Repository: zeppelin Updated Branches: refs/heads/master b77f9ea8d -> 6e3a1d26f
[ZEPPELIN-1487] Resolve possible NPEs in storage sync mechanism ### What is this PR for? This is to resolve possible NPEs in storage mechanism related to empty subject ### What type of PR is it? Bug Fix ### Todos * [x] - pass `subject` instead of `null` ### What is the Jira issue? [ZEPPELIN-1487](https://issues.apache.org/jira/browse/ZEPPELIN-1487) ### How should this be tested? storage tests pass, CI green ### 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: Khalid Huseynov <khalid...@gmail.com> Closes #1459 from khalidhuseynov/fix/storage-npe and squashes the following commits: 1f2dcd3 [Khalid Huseynov] pass subject to get method in sync Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/6e3a1d26 Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/6e3a1d26 Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/6e3a1d26 Branch: refs/heads/master Commit: 6e3a1d26ffc3e9bae355df3533430791cdcfd5e4 Parents: b77f9ea Author: Khalid Huseynov <khalid...@gmail.com> Authored: Thu Sep 22 17:13:31 2016 +0900 Committer: Lee moon soo <m...@apache.org> Committed: Tue Oct 18 10:27:38 2016 +0900 ---------------------------------------------------------------------- .../apache/zeppelin/notebook/repo/NotebookRepoSync.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/6e3a1d26/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/NotebookRepoSync.java ---------------------------------------------------------------------- diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/NotebookRepoSync.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/NotebookRepoSync.java index 4f414d5..fdf7e78 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/NotebookRepoSync.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/NotebookRepoSync.java @@ -186,7 +186,8 @@ public class NotebookRepoSync implements NotebookRepo { List <NoteInfo> srcNotes = auth.filterByUser(allSrcNotes, subject); List <NoteInfo> dstNotes = dstRepo.list(subject); - Map<String, List<String>> noteIDs = notesCheckDiff(srcNotes, srcRepo, dstNotes, dstRepo); + Map<String, List<String>> noteIDs = notesCheckDiff(srcNotes, srcRepo, dstNotes, dstRepo, + subject); List<String> pushNoteIDs = noteIDs.get(pushKey); List<String> pullNoteIDs = noteIDs.get(pullKey); List<String> delDstNoteIDs = noteIDs.get(delDstKey); @@ -263,7 +264,8 @@ public class NotebookRepoSync implements NotebookRepo { } private Map<String, List<String>> notesCheckDiff(List<NoteInfo> sourceNotes, - NotebookRepo sourceRepo, List<NoteInfo> destNotes, NotebookRepo destRepo) + NotebookRepo sourceRepo, List<NoteInfo> destNotes, NotebookRepo destRepo, + AuthenticationInfo subject) throws IOException { List <String> pushIDs = new ArrayList<String>(); List <String> pullIDs = new ArrayList<String>(); @@ -275,8 +277,8 @@ public class NotebookRepoSync implements NotebookRepo { dnote = containsID(destNotes, snote.getId()); if (dnote != null) { /* note exists in source and destination storage systems */ - sdate = lastModificationDate(sourceRepo.get(snote.getId(), null)); - ddate = lastModificationDate(destRepo.get(dnote.getId(), null)); + sdate = lastModificationDate(sourceRepo.get(snote.getId(), subject)); + ddate = lastModificationDate(destRepo.get(dnote.getId(), subject)); if (sdate.compareTo(ddate) != 0) { if (sdate.after(ddate) || oneWaySync) {