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 when importing certain unlinked local files #5815

Closed
1 task done
0xDBFB7 opened this issue Jan 5, 2020 · 7 comments · Fixed by #6567
Closed
1 task done

Exception when importing certain unlinked local files #5815

0xDBFB7 opened this issue Jan 5, 2020 · 7 comments · Fixed by #6567
Labels
bug Confirmed bugs or reports that are very likely to be bugs good first issue An issue intended for project-newcomers. Varies in difficulty. import

Comments

@0xDBFB7
Copy link

0xDBFB7 commented Jan 5, 2020

JabRef version
JabRef 5.0-beta.1--2019-12-15--0b8b1d6
Linux 4.9.0-9-amd64 amd64
Java 13.0.1 on Debian 9

Seems to be related to #5128: a few specific pdf files cause an exception. It's not related to the filename. The misbehaving file in question can be downloaded here.

Steps to reproduce the behavior:

  1. Open "find unlinked files"
  2. Search the folder containing ref_571.pdf or ref_375.pdf
  3. Press import. Other files will import without difficulty, but when 571 is selected the exception will be thrown and the file is not imported.

Thanks! Awesome software, great work.

Log File

java.lang.StringIndexOutOfBoundsException: begin 0, end -1, length 2073
  at java.base/java.lang.String.checkBoundsBeginEnd(Unknown Source)
  at java.base/java.lang.String.substring(Unknown Source)
  at org.jabref/org.jabref.logic.xmp.XmpUtilReader.getXmpMetadata(Unknown Source)
  at org.jabref/org.jabref.logic.xmp.XmpUtilReader.readXmp(Unknown Source)
  at org.jabref/org.jabref.logic.importer.fileformat.PdfXmpImporter.importDatabase(Unknown Source)
  at org.jabref/org.jabref.logic.externalfiles.ExternalFilesContentImporter.importXMPContent(Unknown Source) at org.jabref/org.jabref.gui.externalfiles.ImportHandler.importAsNewEntries(Unknown Source)
  at org.jabref/org.jabref.gui.externalfiles.FindUnlinkedFilesDialog.startImport(Unknown Source)
  at org.jabref/org.jabref.gui.externalfiles.FindUnlinkedFilesDialog.lambda$initialize$8(Unknown Source)
  at org.jabref.merged.module/javafx.scene.control.Dialog.setResultAndClose(Unknown Source)
  at org.jabref.merged.module/javafx.scene.control.DialogPane.lambda$createButton$3(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
  at org.jabref.merged.module/javafx.event.Event.fireEvent(Unknown Source)
  at org.jabref.merged.module/javafx.scene.Node.fireEvent(Unknown Source)
  at org.jabref.merged.module/javafx.scene.control.Button.fire(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.scene.control.inputmap.InputMap.handle(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
  at org.jabref.merged.module/javafx.event.Event.fireEvent(Unknown Source)
  at org.jabref.merged.module/javafx.scene.Scene$MouseHandler.process(Unknown Source)
  at org.jabref.merged.module/javafx.scene.Scene.processMouseEvent(Unknown Source)
  at org.jabref.merged.module/javafx.scene.Scene$ScenePeerListener.mouseEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown Source)
  at java.base/java.security.AccessController.doPrivileged(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.glass.ui.View.handleMouseEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.glass.ui.View.notifyMouse(Unknown Source)
  at org.jabref.merged.module/com.sun.glass.ui.gtk.GtkApplication.enterNestedEventLoopImpl(Native Method)
  at org.jabref.merged.module/com.sun.glass.ui.gtk.GtkApplication._enterNestedEventLoop(Unknown Source)
  at org.jabref.merged.module/com.sun.glass.ui.Application.enterNestedEventLoop(Unknown Source)
  at org.jabref.merged.module/com.sun.glass.ui.EventLoop.enter(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.tk.quantum.QuantumToolkit.enterNestedEventLoop(Unknown Source)
  at org.jabref.merged.module/javafx.stage.Stage.showAndWait(Unknown Source)
  at org.jabref.merged.module/javafx.scene.control.HeavyweightDialog.showAndWait(Unknown Source)
  at org.jabref.merged.module/javafx.scene.control.Dialog.showAndWait(Unknown Source)
  at org.jabref/org.jabref.gui.externalfiles.FindUnlinkedFilesAction.execute(Unknown Source)
  at org.jabref/org.jabref.gui.actions.JabRefAction.lambda$new$2(Unknown Source)
  at org.jabref.merged.module/org.controlsfx.control.action.Action.handle(Unknown Source)
  at org.jabref.merged.module/org.controlsfx.control.action.Action.handle(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
  at org.jabref.merged.module/javafx.event.Event.fireEvent(Unknown Source)
  at org.jabref.merged.module/javafx.scene.control.MenuItem.fire(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.scene.control.ContextMenuContent$MenuItemContainer.doSelect(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.scene.control.ContextMenuContent$MenuItemContainer.lambda$createChildren$12(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
  at org.jabref.merged.module/javafx.event.Event.fireEvent(Unknown Source)
  at org.jabref.merged.module/javafx.scene.Scene$MouseHandler.process(Unknown Source)
  at org.jabref.merged.module/javafx.scene.Scene.processMouseEvent(Unknown Source)
  at org.jabref.merged.module/javafx.scene.Scene$ScenePeerListener.mouseEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown Source)
  at java.base/java.security.AccessController.doPrivileged(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(Unknown Source)
  at org.jabref.merged.module/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.glass.ui.View.handleMouseEvent(Unknown Source)
  at org.jabref.merged.module/com.sun.glass.ui.View.notifyMouse(Unknown Source)
  at org.jabref.merged.module/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
  at org.jabref.merged.module/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(Unknown Source)
  at java.base/java.lang.Thread.run(Unknown Source)
@0xDBFB7
Copy link
Author

0xDBFB7 commented Jan 5, 2020

If the file is opened in Chrome and printed to PDF, it's imported correctly. Clearly something about these files causes the crash.

@Siedlerchr
Copy link
Member

Siedlerchr commented Jan 10, 2020

Sorry, overlooked that you already linked the file

@Siedlerchr Siedlerchr added import good first issue An issue intended for project-newcomers. Varies in difficulty. labels Jan 10, 2020
@Siedlerchr
Copy link
Member

Siedlerchr commented Jan 10, 2020

The problem is in the class XMPUtilReader in the method private static List<XMPMetadata> getXmpMetadata(PDDocument document) throws IOException {

Debugigng shows, that the indexOf method return -1 which indicates that the tags are not found.
A fix would be to return the empty list when the indexOf method returns a value <0

saepenumero pushed a commit to saepenumero/jabref that referenced this issue Jan 19, 2020
@avm19
Copy link

avm19 commented May 18, 2020

I can confirm that this bug still persists in version:

JabRef 5.1--2020-05-17--a080191
Windows 10 10.0 amd64 
Java 14.0.1

Moreover, the behaviour is as follows.

  • If the problematic file is in the scanned folder then the exception is thrown. [picture 1]
  • If the problematic file is in a subfolder of the scanned folder, then the exception seems to be caught and suppressed, as the operation yields nothing (no bibtex entries are imported). [picture 2]
    (Issue Can't import files through find unlinked files #4525 maybe related to the second scenario)

jabref_error1
jabref_error2

@Siedlerchr Siedlerchr added the bug Confirmed bugs or reports that are very likely to be bugs label May 22, 2020
@ZhouSky
Copy link
Contributor

ZhouSky commented May 31, 2020

I'd like try to solve it.

@Siedlerchr
Copy link
Member

Thanks to @ZhouSky this is now fixed in the latest master version (currently building)

We would like to ask you to use a development build from https://builds.jabref.org/master and report back if it works for you. Please remember to make a backup of your library before trying-out this version.

@avm19
Copy link

avm19 commented Jun 3, 2020

This bug seems to have been fixed (at least, no exception pops up), thank you. Kudos to @ZhouSky !

@koppor koppor moved this to Done in Prioritization Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bugs or reports that are very likely to be bugs good first issue An issue intended for project-newcomers. Varies in difficulty. import
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants