diff --git a/src/main/java/org/jabref/gui/JabRefFrame.java b/src/main/java/org/jabref/gui/JabRefFrame.java index 9a1a2bdb735..ff496a25e09 100644 --- a/src/main/java/org/jabref/gui/JabRefFrame.java +++ b/src/main/java/org/jabref/gui/JabRefFrame.java @@ -1313,18 +1313,20 @@ private boolean confirmClose(BasePanel panel) { // The user wants to save. try { SaveDatabaseAction saveAction = new SaveDatabaseAction(panel, Globals.prefs); - if (!saveAction.save()) { - // The action was either canceled or unsuccessful. - output(Localization.lang("Unable to save library")); - return false; + if (saveAction.save()) { + // Saved, now exit. + return true; } + // The action was either canceled or unsuccessful. + output(Localization.lang("Unable to save library")); } catch (Throwable ex) { - return false; + LOGGER.error("A problem occurred when trying to save the file", ex); + dialogService.showErrorDialogAndWait(Localization.lang("Save library"), Localization.lang("Could not save file."), ex); } - } else { - return !response.isPresent() || !response.get().equals(cancel); + // Save was cancelled or an error occurred. + return false; } - return false; + return !response.isPresent() || !response.get().equals(cancel); } private void closeTab(BasePanel panel) { diff --git a/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java b/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java index 681cf946275..f1bfe5c0739 100644 --- a/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java +++ b/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java @@ -19,7 +19,6 @@ import org.jabref.gui.JabRefFrame; import org.jabref.gui.dialogs.AutosaveUIManager; import org.jabref.gui.util.BackgroundTask; -import org.jabref.gui.util.DefaultTaskExecutor; import org.jabref.gui.util.FileDialogConfiguration; import org.jabref.logic.autosaveandbackup.AutosaveManager; import org.jabref.logic.autosaveandbackup.BackupManager; @@ -138,15 +137,13 @@ private boolean doSave() { panel.setBaseChanged(false); panel.markExternalChangesAsResolved(); - DefaultTaskExecutor.runInJavaFXThread(() -> { - // Reset title of tab - frame.setTabTitle(panel, panel.getTabTitle(), - panel.getBibDatabaseContext().getDatabaseFile().get().getAbsolutePath()); - frame.output(Localization.lang("Saved library") + " '" - + panel.getBibDatabaseContext().getDatabaseFile().get().getPath() + "'."); - frame.setWindowTitle(); - frame.updateAllTabTitles(); - }); + // Reset title of tab + frame.setTabTitle(panel, panel.getTabTitle(), + panel.getBibDatabaseContext().getDatabaseFile().get().getAbsolutePath()); + frame.output(Localization.lang("Saved library") + " '" + + panel.getBibDatabaseContext().getDatabaseFile().get().getPath() + "'."); + frame.setWindowTitle(); + frame.updateAllTabTitles(); } return success; } catch (SaveException ex) {