Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shutdown previus AutosaveManager and BackupManager during SaveAs #2994

Merged
merged 6 commits into from
Jul 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We improved the duplicate checker such that different editions of the same publication are not marked as duplicates. [2960](https://github.com/JabRef/jabref/issues/2960)

### Fixed
- We fixed a bug that leaves .sav file after SaveAs [#2947](https://github.com/JabRef/jabref/issues/2947)
- We fixed the function "Edit - Copy BibTeX key and link" to pass a hyperlink rather than an HTML statement.
- We fixed the adding of a new entry from DOI which led to a connection error. The DOI resolution now uses HTTPS to protect the user's privacy.[#2879](https://github.com/JabRef/jabref/issues/2897)
- We fixed the IEEE Xplore web search functionality [#2789](https://github.com/JabRef/jabref/issues/2789)
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ public void saveAs() throws Exception {
*/
public void saveAs(File file) throws Exception {
BibDatabaseContext context = panel.getBibDatabaseContext();

Path oldFile = context.getDatabasePath().get();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not your fault: I always wondered why this is an Optional, I think in this case I see no reason why it could be empty, so you are probably on the save side calling directly get.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you don't have a database path if the library comes from a SQL server.


if (context.getLocation() == DatabaseLocation.SHARED) {
// Save all properties dependent on the ID. This makes it possible to restore them.
DBMSConnectionProperties properties = context.getDBMSSynchronizer().getDBProcessor()
Expand All @@ -334,8 +335,14 @@ public void saveAs(File file) throws Exception {
if (!success) {
return;
}
// Register so we get notifications about outside changes to the file.

//closing AutosaveManager and BackupManager for original library
context.setDatabaseFile(oldFile.toFile());
AutosaveManager.shutdown(context);
BackupManager.shutdown(context);
context.setDatabaseFile(file);

// Register so we get notifications about outside changes to the file.
try {
panel.setFileMonitorHandle(Globals.getFileUpdateMonitor().addUpdateListener(panel,
context.getDatabaseFile().orElse(null)));
Expand Down