Skip to content

Commit 73a28bb

Browse files
committed
ZEPPELIN-501: fix NPE on Note creation by NotebookRepo, \wo DI constructor
1 parent cf44b1f commit 73a28bb

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ public void setNotebookRepo(NotebookRepo repo) {
133133
this.repo = repo;
134134
}
135135

136+
public void setIndex(SearchService index) {
137+
this.index = index;
138+
}
139+
136140
@SuppressWarnings("rawtypes")
137141
public Map<String, List<AngularObject>> getAngularObjects() {
138142
return angularObjects;

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,14 @@ private Note loadNoteFromRepo(String id) {
252252
return null;
253253
}
254254

255-
// set NoteInterpreterLoader
255+
//Manually inject ALL dependencies, as DI constructor was NOT used
256+
note.setIndex(this.notebookIndex);
257+
256258
NoteInterpreterLoader replLoader = new NoteInterpreterLoader(replFactory);
257259
note.setReplLoader(replLoader);
258260
replLoader.setNoteId(note.id());
259261

260-
// set JobListenerFactory
261262
note.setJobListenerFactory(jobListenerFactory);
262-
263-
// set notebookRepo
264263
note.setNotebookRepo(notebookRepo);
265264

266265
Map<String, SnapshotAngularObject> angularObjectSnapshot = new HashMap<>();

0 commit comments

Comments
 (0)