Skip to content

Commit 452195c

Browse files
committed
Fix fetcher worker execution on background thread
1 parent bc8fb3f commit 452195c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/org/jabref/gui/EntryTypeViewModel.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import org.jabref.gui.externalfiles.ImportHandler;
1818
import org.jabref.gui.importer.NewEntryAction;
19+
import org.jabref.gui.util.DefaultTaskExecutor;
1920
import org.jabref.gui.util.TaskExecutor;
2021
import org.jabref.logic.importer.FetcherClientException;
2122
import org.jabref.logic.importer.FetcherException;
@@ -24,6 +25,7 @@
2425
import org.jabref.logic.importer.WebFetchers;
2526
import org.jabref.logic.importer.fetcher.DoiFetcher;
2627
import org.jabref.logic.l10n.Localization;
28+
import org.jabref.logic.layout.format.Default;
2729
import org.jabref.model.entry.BibEntry;
2830
import org.jabref.model.entry.types.StandardEntryType;
2931
import org.jabref.model.strings.StringUtil;
@@ -131,7 +133,6 @@ private class FetcherWorker extends Task<Optional<BibEntry>> {
131133

132134
@Override
133135
protected Optional<BibEntry> call() throws FetcherException {
134-
searchingProperty().setValue(true);
135136
storeSelectedFetcher();
136137
fetcher = selectedItemProperty().getValue();
137138
searchID = idText.getValue();
@@ -144,7 +145,8 @@ protected Optional<BibEntry> call() throws FetcherException {
144145

145146
public void runFetcherWorker() {
146147
searchSuccesfulProperty.set(false);
147-
fetcherWorker.run();
148+
searchingProperty().setValue(true);
149+
taskExecutor.execute(fetcherWorker);
148150
fetcherWorker.setOnFailed(event -> {
149151
Throwable exception = fetcherWorker.getException();
150152
String fetcherExceptionMessage = exception.getMessage();

0 commit comments

Comments
 (0)