4646import org .apache .zeppelin .notebook .Notebook ;
4747import org .apache .zeppelin .notebook .Paragraph ;
4848import org .apache .zeppelin .notebook .AuthorizationService ;
49- import org .apache .zeppelin .notebook .exception .NotePathAlreadyExistsException ;
5049import org .apache .zeppelin .notebook .repo .NotebookRepoWithVersionControl ;
5150import org .apache .zeppelin .notebook .scheduler .SchedulerService ;
5251import org .apache .zeppelin .rest .exception .BadRequestException ;
53- import org .apache .zeppelin .rest .exception .ConflictException ;
5452import org .apache .zeppelin .rest .exception .ForbiddenException ;
5553import org .apache .zeppelin .rest .exception .NoteNotFoundException ;
5654import org .apache .zeppelin .rest .exception .ParagraphNotFoundException ;
@@ -488,15 +486,7 @@ public Response exportNote(@PathParam("noteId") String noteId) throws IOExceptio
488486 @ ZeppelinApi
489487 public Response importNote (@ QueryParam ("notePath" ) String notePath , String noteJson ) throws IOException {
490488 String noteId = notebookService .importNote (notePath , noteJson , getServiceContext (),
491- new RestServiceCallback <>() {
492- @ Override
493- public void onFailure (Exception ex , ServiceContext context ) throws IOException {
494- if (ex instanceof NotePathAlreadyExistsException ) {
495- ex = new ConflictException (ex .getMessage ());
496- }
497- super .onFailure (ex , context );
498- }
499- });
489+ new RestServiceCallback <>());
500490 return new JsonResponse <>(Status .OK , "" , noteId ).build ();
501491 }
502492
@@ -522,15 +512,7 @@ public Response createNote(String message) throws IOException {
522512 defaultInterpreterGroup ,
523513 request .getAddingEmptyParagraph (),
524514 getServiceContext (),
525- new RestServiceCallback <>() {
526- @ Override
527- public void onFailure (Exception ex , ServiceContext context ) throws IOException {
528- if (ex instanceof NotePathAlreadyExistsException ) {
529- ex = new ConflictException (ex .getMessage ());
530- }
531- super .onFailure (ex , context );
532- }
533- });
515+ new RestServiceCallback <>());
534516 return notebook .processNote (noteId ,
535517 note -> {
536518 AuthenticationInfo subject = new AuthenticationInfo (authenticationService .getPrincipal ());
@@ -631,13 +613,6 @@ public void onSuccess(Note note, ServiceContext context) throws IOException {
631613 notebookServer .broadcastNote (note );
632614 notebookServer .broadcastNoteList (context .getAutheInfo (), context .getUserAndRoles ());
633615 }
634- @ Override
635- public void onFailure (Exception ex , ServiceContext context ) throws IOException {
636- if (ex instanceof NotePathAlreadyExistsException ) {
637- ex = new ConflictException (ex .getMessage ());
638- }
639- super .onFailure (ex , context );
640- }
641616 });
642617 return new JsonResponse <>(Status .OK , "" ).build ();
643618 }
0 commit comments