Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception thrown while JR-LibreOffice connection updates references in the ODT document #7615

Closed
1 task done
ytzemih opened this issue Apr 11, 2021 · 9 comments
Closed
1 task done

Comments

@ytzemih
Copy link

ytzemih commented Apr 11, 2021

JabRef 5.3--2021-03-29--2948e6d
Linux 5.8.0-48-generic amd64
Java 15.0.2
JavaFX 16+8

Steps to reproduce the behaviour:

  1. Open multi-page LibreOffice document with 30+ references and connect with JR
  2. Add further reference
  3. JR updates all references and re-generates the reference list
  4. The exception is thrown in a JavaFX Application Thread.
  5. However, the reference is added both to the text and to the list.

It happened several times to me like described but it is not easily reproducible. I am reporting this because I'm not sure whether the ODT document model is correctly manipulated.

Log File com.sun.star.uno.RuntimeException: at org.libreoffice.uno/com.sun.star.lib.uno.environments.remote.Job.remoteUnoRequestRaisedException(Unknown Source) at org.libreoffice.uno/com.sun.star.lib.uno.environments.remote.Job.execute(Unknown Source) at org.libreoffice.uno/com.sun.star.lib.uno.environments.remote.JobQueue.enter(Unknown Source) at org.libreoffice.uno/com.sun.star.lib.uno.environments.remote.JobQueue.enter(Unknown Source) at org.libreoffice.uno/com.sun.star.lib.uno.environments.remote.JavaThreadPool.enter(Unknown Source) at org.libreoffice.uno/com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest(Unknown Source) at org.libreoffice.uno/com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.request(Unknown Source) at org.libreoffice.uno/com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.invoke(Unknown Source) at com.sun.proxy.$Proxy29.gotoRange(Unknown Source) at org.jabref@5.3.229/org.jabref.gui.openoffice.OOBibBase.insertEntry(Unknown Source) at org.jabref@5.3.229/org.jabref.gui.openoffice.OpenOfficePanel.pushEntries(Unknown Source) at org.jabref@5.3.229/org.jabref.gui.openoffice.OpenOfficePanel.lambda$initPanel$5(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.EventUtil.fireEvent(Unknown Source) at org.jabref.merged.module@5.3.229/javafx.event.Event.fireEvent(Unknown Source) at org.jabref.merged.module@5.3.229/javafx.scene.Node.fireEvent(Unknown Source) at org.jabref.merged.module@5.3.229/javafx.scene.control.Button.fire(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.scene.control.inputmap.InputMap.handle(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.event.EventUtil.fireEvent(Unknown Source) at org.jabref.merged.module@5.3.229/javafx.event.Event.fireEvent(Unknown Source) at org.jabref.merged.module@5.3.229/javafx.scene.Scene$MouseHandler.process(Unknown Source) at org.jabref.merged.module@5.3.229/javafx.scene.Scene.processMouseEvent(Unknown Source) at org.jabref.merged.module@5.3.229/javafx.scene.Scene$ScenePeerListener.mouseEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.glass.ui.View.handleMouseEvent(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.glass.ui.View.notifyMouse(Unknown Source) at org.jabref.merged.module@5.3.229/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method) at org.jabref.merged.module@5.3.229/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source)
@antalk2
Copy link
Contributor

antalk2 commented May 28, 2021

org.libreoffice.uno/com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.invoke(Unknown Source) at
com.sun.proxy.$Proxy29.gotoRange(Unknown Source) at
org.jabref@5.3.229/org.jabref.gui.openoffice.OOBibBase.insertEntry(Unknown Source) at

When finished inserting and syncing, JR tries to move the cursor back to its original position.
I have seen such failure of gotoRange() when this original position was overwritten
in the process. This may happen if the cursor was inside or at the edge of a citation mark,
or in the bibliography section. If the reference is added to the list of references, the internal state
(the state written to the document) is probably OK, the list of references comes from there.

With JabRef 5.2

  • I can provoke an exception like this by citing in the bibliography (in the section named JR_bib in the navigator).
    But in this case the new citation is lost.
  • I could not provoke an exception like this by citing in a citation mark.

Could you check if

  1. this happens when the cursor is not in the JR_bib section and is separated from citation marks?
  2. The version at https://github.com/antalk2/jabref/tree/improve-reversibility-rebased-03 checks the cursor position and
    refuses to insert if the cursor is in any of the ranges that will be overwritten. In case you are ready to compile it,
    please test if it improves the situation.

@ytzemih
Copy link
Author

ytzemih commented May 28, 2021

I can provoke an exception like this by citing in the bibliography (in the section named JR_bib in the navigator).
But in this case the new citation is lost.

Thanks for handling this issue.

  1. I can also provoke an exception when placing the cursor in the bib.
  2. I can also NOT do this when placing it in or at the rear edge of a citation mark.
  3. But I was able to reproduce it when putting the cursor directly at the front edge of a citation mark. I must have done that occasionally, hence, the exception hasn't always shown up.

I've not had time to compile JR by myself, but if the fix can detect this more likely case, then I suppose it's fine.

@antalk2
Copy link
Contributor

antalk2 commented May 28, 2021

if the fix can detect this more likely case, then I suppose it's fine

  1. It can detect it.
  2. There is an associated cost in time. At 23 pages with a lot of citations "Cite" can take 4 seconds
    without updating the bibliography.
    The code behind is comparing each citation mark to each citation mark,
    because I originally wrote it to diagnose the mess that may happen if one inserts a citation
    within another. A simplified version would be enough for "Cite"

@ytzemih
Copy link
Author

ytzemih commented May 29, 2021

Great! Regarding time consumption: An alternative would be to let the user insert citations and only update the bibliography on demand or on save, for example.

Also, it's very unlikely that one places the cursor inside the bibliography when inserting a citation. I recall I tried "updating" the bibliography when the cursor is inside it and that seemed to work without exception.

Thanks, again.

@antalk2
Copy link
Contributor

antalk2 commented May 29, 2021

only update the bibliography on demand or on save, for example.

In the Openoffice/Libreoffice panel [Settings]/[Automatically sync bibliography...]
lets you turn off the bibliography update.

@ytzemih
Copy link
Author

ytzemih commented May 29, 2021

Ah, thanks! Perfect.

@ThiloteE
Copy link
Member

ThiloteE commented Mar 12, 2022

Could you please try the latest Jabref development-build and check if the issue here still is reproducible? It can be found here: https://builds.jabref.org/main/

In the newest build, #7795, mainly authored by @antalk2, was merged. There were some changes related to the Open Office (OO) and Libre Office (LO) integration.

Edit: Antalk2 clarified, this issue here might be resolved with the merger.

"#7615 might work. It did at the time, but I was worried about the check taking too much time (#7615 (comment)) and I am not sure if I turned it off (probably did not)."

@ytzemih
Copy link
Author

ytzemih commented Apr 20, 2022

@ThiloteE Thanks for the update. I've tried it as described above (reference added and updated the bibliography) and it seems to work now. No exception thrown at that time.

@ThiloteE
Copy link
Member

Great! Closing this :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants