mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
ZEPPELIN-501: fix NPE on double-delete
This commit is contained in:
parent
d2b44ac955
commit
cf44b1f8b1
2 changed files with 12 additions and 0 deletions
|
|
@ -302,6 +302,11 @@ public class SearchService {
|
|||
* Deletes all docs no given Note from index
|
||||
*/
|
||||
public void deleteIndexDocs(Note note) {
|
||||
if (null == note) {
|
||||
LOG.error("Trying to delete note by reference to NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
LOG.debug("Deleting note {}, out of: {}", note.getId(), writer.numDocs());
|
||||
try {
|
||||
writer.deleteDocuments(new WildcardQuery(new Term(ID_FIELD, note.getId() + "*")));
|
||||
|
|
|
|||
|
|
@ -134,6 +134,13 @@ public class SearchServiceTest {
|
|||
assertThat(results).isNotEmpty();
|
||||
}
|
||||
|
||||
@Test public void canDeleteNull() throws IOException {
|
||||
//give
|
||||
// looks like a bug in web UI: it tries to delete a note twice (after it has just been deleted)
|
||||
//when
|
||||
notebookIndex.deleteIndexDocs(null);
|
||||
}
|
||||
|
||||
@Test public void canDeleteFromIndex() throws IOException {
|
||||
//given
|
||||
Note note1 = newNoteWithParapgraph("Notebook1", "test");
|
||||
|
|
|
|||
Loading…
Reference in a new issue