Skip to content

Fix exception in ExtractReferences from pdf#15308

Merged
Siedlerchr merged 3 commits into
mainfrom
extractReferences
Mar 9, 2026
Merged

Fix exception in ExtractReferences from pdf#15308
Siedlerchr merged 3 commits into
mainfrom
extractReferences

Conversation

@Siedlerchr

@Siedlerchr Siedlerchr commented Mar 9, 2026

Copy link
Copy Markdown
Member

Related issues and pull requests

Fix


2026-03-09 21:21:50 [pool-2-thread-4] org.jabref.logic.util.FallbackExceptionHandler.uncaughtException()
ERROR: Uncaught exception occurred in Thread[#65,pool-2-thread-4,5,main]: java.lang.IllegalStateException: This operation is permitted on the event thread only; currentThread = pool-2-thread-4
	at javafx.graphics@25.0.2/com.sun.glass.ui.Application.checkEventThread(Application.java:442)
	at javafx.graphics@25.0.2/com.sun.glass.ui.MenuItem.setEnabled(MenuItem.java:108)
	at javafx.graphics@25.0.2/com.sun.javafx.tk.quantum.GlassSystemMenu.lambda$insertMenuItem$2(GlassSystemMenu.java:289)
	at javafx.base@25.0.2/com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:376)
	at javafx.base@25.0.2/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:91)
	at javafx.base@25.0.2/javafx.beans.property.BooleanPropertyBase.fireValueChangedEvent(BooleanPropertyBase.java:104)
	at javafx.base@25.0.2/javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:111)
	at javafx.base@25.0.2/javafx.beans.property.BooleanPropertyBase$Listener.invalidated(BooleanPropertyBase.java:239)
	at javafx.base@25.0.2/com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:147)
	at javafx.base@25.0.2/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:91)
	at javafx.base@25.0.2/javafx.beans.property.BooleanPropertyBase.fireValueChangedEvent(BooleanPropertyBase.java:104)
	at javafx.base@25.0.2/javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:111)
	at javafx.base@25.0.2/javafx.beans.property.BooleanPropertyBase$Listener.invalidated(BooleanPropertyBase.java:239)
	at javafx.base@25.0.2/com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:147)
	at javafx.base@25.0.2/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:91)
	at javafx.base@25.0.2/javafx.beans.property.BooleanPropertyBase.fireValueChangedEvent(BooleanPropertyBase.java:104)
	at javafx.base@25.0.2/javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:111)
	at javafx.base@25.0.2/javafx.beans.property.BooleanPropertyBase$Listener.invalidated(BooleanPropertyBase.java:239)
	at javafx.base@25.0.2/com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:147)
	at javafx.base@25.0.2/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:91)
	at javafx.base@25.0.2/javafx.beans.binding.BooleanBinding.invalidate(BooleanBinding.java:180)
	at javafx.base@25.0.2/com.sun.javafx.binding.BindingHelperObserver.invalidated(BindingHelperObserver.java:52)
	at javafx.base@25.0.2/com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:147)
	at javafx.base@25.0.2/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:91)
	at javafx.base@25.0.2/javafx.beans.property.ReadOnlyBooleanPropertyBase.fireValueChangedEvent(ReadOnlyBooleanPropertyBase.java:78)
	at javafx.base@25.0.2/javafx.beans.property.ReadOnlyBooleanWrapper.fireValueChangedEvent(ReadOnlyBooleanWrapper.java:103)
	at javafx.base@25.0.2/javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:111)
	at javafx.base@25.0.2/javafx.beans.property.BooleanPropertyBase$Listener.invalidated(BooleanPropertyBase.java:239)
	at javafx.base@25.0.2/com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:147)
	at javafx.base@25.0.2/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:91)
	at javafx.base@25.0.2/javafx.beans.binding.BooleanBinding.invalidate(BooleanBinding.java:180)
	at javafx.base@25.0.2/javafx.beans.binding.Bindings$ShortCircuitAndInvalidator.invalidated(Bindings.java:4669)
	at javafx.base@25.0.2/com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:147)
	at javafx.base@25.0.2/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:91)
	at javafx.base@25.0.2/javafx.beans.binding.BooleanBinding.invalidate(BooleanBinding.java:180)
	at javafx.base@25.0.2/com.sun.javafx.binding.BindingHelperObserver.invalidated(BindingHelperObserver.java:52)
	at javafx.base@25.0.2/com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:147)
	at javafx.base@25.0.2/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:91)
	at javafx.base@25.0.2/javafx.beans.binding.ObjectBinding.invalidate(ObjectBinding.java:192)
	at javafx.base@25.0.2/com.sun.javafx.binding.BindingHelperObserver.invalidated(BindingHelperObserver.java:52)
	at javafx.base@25.0.2/com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:376)
	at javafx.base@25.0.2/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:91)
	at javafx.base@25.0.2/javafx.beans.binding.ObjectBinding.invalidate(ObjectBinding.java:192)
	at com.tobiasdiez.easybind@2.3.0/com.tobiasdiez.easybind.FlatMapBindingBase.mappedInvalidated(FlatMap.java:72)
	at com.tobiasdiez.easybind@2.3.0/com.tobiasdiez.easybind.FlatMapBindingBase.lambda$new$1(FlatMap.java:22)
	at javafx.base@25.0.2/javafx.beans.WeakInvalidationListener.invalidated(WeakInvalidationListener.java:82)
	at javafx.base@25.0.2/com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:147)
	at javafx.base@25.0.2/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:91)
	at javafx.base@25.0.2/javafx.beans.binding.BooleanBinding.invalidate(BooleanBinding.java:180)
	at javafx.base@25.0.2/com.sun.javafx.binding.BindingHelperObserver.invalidated(BindingHelperObserver.java:52)
	at javafx.base@25.0.2/com.sun.javafx.collections.MapListenerHelper$Generic.fireValueChangedEvent(MapListenerHelper.java:318)
	at javafx.base@25.0.2/com.sun.javafx.collections.MapListenerHelper.fireValueChangedEvent(MapListenerHelper.java:70)
	at javafx.base@25.0.2/com.sun.javafx.collections.ObservableMapWrapper.callObservers(ObservableMapWrapper.java:115)
	at javafx.base@25.0.2/com.sun.javafx.collections.ObservableMapWrapper.put(ObservableMapWrapper.java:173)
	at org.jabref.jablib/org.jabref.model.entry.BibEntry.setField(BibEntry.java:592)
	at org.jabref.jablib/org.jabref.model.entry.BibEntry.setField(BibEntry.java:608)
	at org.jabref/org.jabref.gui.maintable.ExtractReferencesAction.extractReferences(ExtractReferencesAction.java:158)
	at org.jabref/org.jabref.gui.maintable.ExtractReferencesAction.lambda$getParserResultCallableOffline$0(ExtractReferencesAction.java:136)
	at org.jabref.jablib/org.jabref.logic.util.BackgroundTask$1.call(BackgroundTask.java:69)
	at org.jabref/org.jabref.gui.util.UiTaskExecutor$1.call(UiTaskExecutor.java:175)
	at javafx.graphics@25.0.2/javafx.concurrent.Task$TaskCallable.call(Task.java:1407)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:328)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:545)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:328)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1090)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
	at java.base/java.lang.Thread.run(Thread.java:1474)

Closes _____

PR Description

Steps to test

  1. Have an entry with pdf

  2. Right click -> Extract references

  3. No exception is thrown

Checklist

  • I own the copyright of the code submitted and I license it under the MIT license
  • I manually tested my changes in running JabRef (always required)
  • [/] I added JUnit tests for changes (if applicable)
  • [/] I added screenshots in the PR description (if change is visible to the user)
  • [/] I added a screenshot in the PR description showing a library with a single entry with me as author and as title the issue number
  • I described the change in CHANGELOG.md in a way that can be understood by the average user (if change is visible to the user)
  • [/] I checked the user documentation for up to dateness and submitted a pull request to our user documentation repository

@Siedlerchr Siedlerchr changed the title Fix exception in ExtractReferences Exception Fix exception in ExtractReferences from pdf Mar 9, 2026
@qodo-free-for-open-source-projects

Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Fix thread safety exception in ExtractReferencesAction

🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Fix IllegalStateException when extracting references from PDF
• Wrap field update in JavaFX thread to prevent thread safety violation
• Remove unused linkedFile instance variable from class
• Add test data entries for reference extraction validation
Diagram
flowchart LR
  A["Extract References Action"] -->|Previously| B["Direct Field Update<br/>on Worker Thread"]
  B -->|Causes| C["IllegalStateException<br/>Event Thread Violation"]
  A -->|Now| D["UiTaskExecutor Wrapper"]
  D -->|Executes| E["Field Update<br/>on JavaFX Thread"]
  E -->|Result| F["Thread Safe Operation"]
Loading

Grey Divider

File Changes

1. jabgui/src/main/java/org/jabref/gui/maintable/ExtractReferencesAction.java 🐞 Bug fix +5/-4

Wrap field update in JavaFX thread executor

• Import UiTaskExecutor utility class for thread-safe operations
• Remove unused linkedFile instance variable from class fields
• Wrap currentEntry.setField() call in UiTaskExecutor.runInJavaFXThread() to ensure UI updates
 occur on the JavaFX event thread
• Update null check to use local parameter instead of instance variable

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


2. test-support/src/manual-tests/issue-13689/issue-13689.bib 🧪 Tests +34/-0

Add test bibliography entries for validation

• Add new Ralph2022 article entry with comprehensive metadata and cites field
• Add new stugf book entry with editor and comment fields for testing
• Expand test data for reference extraction validation scenarios

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


3. CHANGELOG.md 📝 Documentation +1/-0

Document reference extraction exception fix

• Document fix for exception thrown during PDF reference extraction
• Reference issue #15308 in changelog entry

CHANGELOG.md


Grey Divider

Qodo Logo

@Siedlerchr Siedlerchr added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Mar 9, 2026
@Siedlerchr Siedlerchr enabled auto-merge March 9, 2026 20:36
@qodo-free-for-open-source-projects

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@Siedlerchr Siedlerchr added this pull request to the merge queue Mar 9, 2026
@testlens-app

testlens-app Bot commented Mar 9, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: 4b80a96
▶️ Tests: 10126 executed
⚪️ Checks: 88/88 completed


Learn more about TestLens at testlens.app.

@github-actions github-actions Bot added the status: to-be-merged PRs which are accepted and should go into the merge-queue. label Mar 9, 2026
Merged via the queue into main with commit eb9d43c Mar 9, 2026
81 of 89 checks passed
@Siedlerchr Siedlerchr deleted the extractReferences branch March 9, 2026 21:15
Siedlerchr added a commit to statxc/jabref that referenced this pull request Mar 10, 2026
* upstream/main:
  fix jbang (JabRef#15311)
  New Crowdin updates (JabRef#15310)
  Fix exception in ExtractReferences from pdf (JabRef#15308)
  feat: add --entry-type-pattern option to citationkeys generate command (JabRef#15072)
  Fix reflection excpetion, add missing (JabRef#15307)
FynnianB pushed a commit to FynnianB/jabref that referenced this pull request Mar 14, 2026
* Fix exception in ExtraRefernces Exception

* changelog

* revert
FynnianB pushed a commit to FynnianB/jabref that referenced this pull request Mar 19, 2026
* Fix exception in ExtraRefernces Exception

* changelog

* revert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers status: to-be-merged PRs which are accepted and should go into the merge-queue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants