Skip to content

Commit

Permalink
fix map collision (#4962)
Browse files Browse the repository at this point in the history
  • Loading branch information
nrmancuso authored and Siedlerchr committed May 11, 2019
1 parent 751c5b5 commit 2c10284
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ public void execute() {
}
}

Task<Map<Optional<URL>, BibEntry>> findFullTextsTask = new Task<Map<Optional<URL>, BibEntry>>() {
Task<Map<BibEntry, Optional<URL>>> findFullTextsTask = new Task<Map<BibEntry, Optional<URL>>>() {
@Override
protected Map<Optional<URL>, BibEntry> call() {
Map<Optional<URL>, BibEntry> downloads = new ConcurrentHashMap<>();
protected Map<BibEntry, Optional<URL>> call() {
Map<BibEntry, Optional<URL>> downloads = new ConcurrentHashMap<>();
int count = 0;
for (BibEntry entry : basePanel.getSelectedEntries()) {
FulltextFetchers fetchers = new FulltextFetchers(Globals.prefs.getImportFormatPreferences());
downloads.put(fetchers.findFullTextPDF(entry), entry);
downloads.put(entry, fetchers.findFullTextPDF(entry));
updateProgress(++count, basePanel.getSelectedEntries().size());
}
return downloads;
Expand All @@ -93,10 +93,10 @@ protected Map<Optional<URL>, BibEntry> call() {
Globals.TASK_EXECUTOR.execute(findFullTextsTask);
}

private void downloadFullTexts(Map<Optional<URL>, BibEntry> downloads) {
for (Map.Entry<Optional<URL>, BibEntry> download : downloads.entrySet()) {
BibEntry entry = download.getValue();
Optional<URL> result = download.getKey();
private void downloadFullTexts(Map<BibEntry, Optional<URL>> downloads) {
for (Map.Entry<BibEntry, Optional<URL>> download : downloads.entrySet()) {
BibEntry entry = download.getKey();
Optional<URL> result = download.getValue();
if (result.isPresent()) {
Optional<Path> dir = basePanel.getBibDatabaseContext().getFirstExistingFileDir(Globals.prefs.getFilePreferences());

Expand Down

0 comments on commit 2c10284

Please sign in to comment.