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

Fix importing preferences after resetting without restarting #3065

Merged
merged 2 commits into from
Aug 2, 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 @@ -15,6 +15,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
### Fixed
We fixed an issue where the fetcher for the Astrophysics Data System (ADS) added some non-bibtex data to the entry returned from the search [#3035](https://github.com/JabRef/jabref/issues/3035)
We fixed an issue where assigning an entry via drag and drop to a group caused JabRef to stop/freeze completely [#3036](https://github.com/JabRef/jabref/issues/3036)
We fixed an issue where the preferences could not be imported without a restart of JabRef [#3064](https://github.com/JabRef/jabref/issues/3064)
### Removed


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ public Builder withInitialDirectory(Path directory) {
}
//The lines above work also if the dir does not exist at all!
//NULL is accepted by the filechooser as no inital path
if (!Files.exists(directory)) {
//Explicit null check, if somehow the parent is null, as Files.exists throws an NPE otherwise
if ((directory != null) && !Files.exists(directory)) {
directory = null;
}
initialDirectory = directory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ private JabRefPreferences() {
defaults.put(EXPORT_WORKING_DIRECTORY, USER_HOME);
// Remembers working directory of last import
defaults.put(IMPORT_WORKING_DIRECTORY, USER_HOME);
defaults.put(PREFS_EXPORT_PATH, WORKING_DIRECTORY);
defaults.put(PREFS_EXPORT_PATH, USER_HOME);
defaults.put(AUTO_OPEN_FORM, Boolean.TRUE);
defaults.put(BACKUP, Boolean.TRUE);
defaults.put(OPEN_LAST_EDITED, Boolean.TRUE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ public void testWithNullPathDirectory() {
assertEquals(Optional.ofNullable(tempFolder), fileDialogConfiguration.getInitialDirectory());
}

@Test
public void testWithNonExistingDirectoryAndParentNull() {
String tempFolder = "workingDirectory";
FileDialogConfiguration fileDialogConfiguration = new FileDialogConfiguration.Builder()
.withInitialDirectory(tempFolder).build();

assertEquals(Optional.ofNullable(null), fileDialogConfiguration.getInitialDirectory());
}

@Test
public void testSingleExtension() {
FileDialogConfiguration fileDialogConfiguration = new FileDialogConfiguration.Builder()
Expand Down