Skip to content

Commit eb9d43c

Browse files
authored
Fix exception in ExtractReferences from pdf (#15308)
* Fix exception in ExtraRefernces Exception * changelog * revert
1 parent 9688956 commit eb9d43c

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
4444
- We fixed an issue where the Windows installer was missing the JabRef icon. [#14965](https://github.com/JabRef/jabref/issues/14965)
4545
- We fixed an issue where quickly navigating up and down with the entry editor opened at the citations tab would lead to exception. [#15233](https://github.com/JabRef/jabref/pull/15233)
4646
- Fixed identifier selection not working on fresh start [#15000](https://github.com/JabRef/jabref/issues/15000)
47+
- We fixed an issue where an exception would be thrown when trying to extract references from a PDF [#15308](https://github.com/JabRef/jabref/pull/15308)
4748

4849
### Removed
4950

jabgui/src/main/java/org/jabref/gui/maintable/ExtractReferencesAction.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import org.jabref.gui.actions.ActionHelper;
1515
import org.jabref.gui.actions.SimpleCommand;
1616
import org.jabref.gui.importer.ImportEntriesDialog;
17+
import org.jabref.gui.util.UiTaskExecutor;
1718
import org.jabref.logic.importer.ParserResult;
1819
import org.jabref.logic.importer.fileformat.pdf.RuleBasedBibliographyPdfImporter;
1920
import org.jabref.logic.importer.util.GrobidService;
@@ -44,7 +45,6 @@ public class ExtractReferencesAction extends SimpleCommand {
4445
private final StateManager stateManager;
4546
private final CliPreferences preferences;
4647
private final BibEntry entry;
47-
private final LinkedFile linkedFile;
4848

4949
private final RuleBasedBibliographyPdfImporter ruleBasedBibliographyPdfImporter;
5050

@@ -67,10 +67,9 @@ private ExtractReferencesAction(@NonNull DialogService dialogService,
6767
this.stateManager = stateManager;
6868
this.preferences = preferences;
6969
this.entry = entry;
70-
this.linkedFile = linkedFile;
7170
ruleBasedBibliographyPdfImporter = new RuleBasedBibliographyPdfImporter(preferences.getCitationKeyPatternPreferences());
7271

73-
if (this.linkedFile == null) {
72+
if (linkedFile == null) {
7473
this.executable.bind(
7574
ActionHelper.needsEntriesSelected(stateManager)
7675
.and(ActionHelper.hasLinkedFileForSelectedEntries(stateManager))
@@ -155,7 +154,9 @@ private void extractReferences(Iterator<Path> fileListIterator, ParserResult res
155154
}
156155

157156
String cites = getCites(result.getDatabase().getEntries(), currentEntry);
158-
currentEntry.setField(StandardField.CITES, cites);
157+
UiTaskExecutor.runInJavaFXThread(() -> {
158+
currentEntry.setField(StandardField.CITES, cites);
159+
});
159160
}
160161

161162
/// Creates the field content for the "cites" field. The field contains the citation keys of the imported entries.

test-support/src/manual-tests/issue-13689/issue-13689.bib

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
@Misc{many,
2-
author = {Oliver Kopp and Carl Christian Snethlage and Christoph Schwentker},
3-
title = {JabRef: BibTeX-based literature management software},
4-
year = {2023},
5-
doi = {10.47397/tb/44-3/tb138kopp-jabref},
6-
issn = {0896-3207},
7-
issue = {138},
8-
journal = {TUGboat},
9-
number = {3},
10-
pages = {441--447},
11-
volume = {44},
2+
author = {Oliver Kopp and Carl Christian Snethlage and Christoph Schwentker},
3+
title = {JabRef: BibTeX-based literature management software},
4+
year = {2023},
5+
doi = {10.47397/tb/44-3/tb138kopp-jabref},
6+
issn = {0896-3207},
7+
issue = {138},
8+
journal = {TUGboat},
9+
number = {3},
10+
pages = {441--447},
11+
volume = {44},
1212
}
1313

1414
@Misc{one,

0 commit comments

Comments
 (0)