Skip to content

Commit

Permalink
Fix freezing when fetching IBSN and no results are found
Browse files Browse the repository at this point in the history
Fixes part of #9979
  • Loading branch information
Siedlerchr committed Jun 7, 2023
1 parent 7d64663 commit aa447cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed an issue where an Automatic Keyword Group could not be deleted in the UI. [#9778](https://github.com/JabRef/jabref/issues/9778)
- We fixed an issue where the citation key pattern `[edtrN_M]` returned the wrong editor. [#9946](https://github.com/JabRef/jabref/pull/9946)
- We fixed an issue where empty grey containers would remain in the groups panel, if displaying of group item count is turned off [#9972](https://github.com/JabRef/jabref/issues/9972)
- We fixed an issue where fetching an ISBN could lead to application freezing when the fetcher did not return any results [#9979](https://github.com/JabRef/jabref/issues/9979)

### Removed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -69,8 +70,10 @@ public Optional<BibEntry> performSearchById(String identifier) throws FetcherExc
LOGGER.debug("Try using the alternate ISBN fetchers to find an entry.");
}
} finally {
while (bibEntry.isEmpty() && retryIsbnFetcher.iterator().hasNext()) {
AbstractIsbnFetcher fetcher = retryIsbnFetcher.iterator().next();
// do not move the iterator in the loop as this would always return a new one and thus create and endless loop
Iterator<AbstractIsbnFetcher> iterator = retryIsbnFetcher.iterator();
while (bibEntry.isEmpty() && iterator.hasNext()) {
AbstractIsbnFetcher fetcher = iterator.next();
LOGGER.debug("No entry found for ISBN=" + identifier + "; trying " + fetcher.getName() + " next.");
bibEntry = fetcher.performSearchById(identifier);
}
Expand Down

0 comments on commit aa447cd

Please sign in to comment.