jabref
jabref copied to clipboard
Illegal character in query: pipe character in file field
JabRef version
Other (please describe below)
Operating system
GNU / Linux
Details on version and operating system
No response
Checked with the latest development build (copy version output from About dialog)
- [x] I made a backup of my libraries before testing the latest development version.
- [x] I have tested the latest development version and the problem persists
Steps to reproduce the behaviour
I think this exception was trigger by searching full text online, which added a URL to the file field. The important part is that a pipe character in the URL raised an exception that recurred until l I killed JabRef and removed the offending URL from the .bib file.
- Add a URL containing a pipe (
|) character to the file field (URLs from GALE ONEFILE, containing the string&docId=GALE|)
Appendix
JabRef 6.0--2024-09-25--91d0709 Linux 6.9.9-1-default amd64 Java 21.0.2 JavaFX 23+29
Log File
java.lang.IllegalArgumentException: Illegal character in query at index 58: https://go.gale.com/ps/i.do?p=HRCA&u=googlescholar&id=GALE|A653693412&v=2.1&it=r&sid=googleScholar&asid=68b1dec7
at java.base/java.net.URI.create(Unknown Source)
at [email protected]/org.jabref.logic.importer.util.FileFieldParser.convert(Unknown Source)
at [email protected]/org.jabref.logic.importer.util.FileFieldParser.parse(Unknown Source)
at [email protected]/org.jabref.logic.importer.util.FileFieldParser.parse(Unknown Source)
at java.base/java.util.Optional.map(Unknown Source)
at [email protected]/com.tobiasdiez.easybind.optional.PreboundOptionalBinding$1.computeValue(Unknown Source)
at [email protected]/com.tobiasdiez.easybind.optional.PreboundOptionalBinding$1.computeValue(Unknown Source)
at javafx.base@23/javafx.beans.binding.ObjectBinding.get(Unknown Source)
at javafx.base@23/javafx.beans.binding.ObjectExpression.getValue(Unknown Source)
at [email protected]/com.tobiasdiez.easybind.optional.PreboundOptionalBinding$3.computeValue(Unknown Source)
at javafx.base@23/javafx.beans.binding.ObjectBinding.get(Unknown Source)
at javafx.base@23/javafx.beans.binding.ObjectExpression.getValue(Unknown Source)
at javafx.controls@23/javafx.scene.control.TableCell.updateItem(Unknown Source)
at javafx.controls@23/javafx.scene.control.TableCell.indexChanged(Unknown Source)
at javafx.controls@23/javafx.scene.control.IndexedCell.updateIndex(Unknown Source)
at javafx.controls@23/javafx.scene.control.skin.TableRowSkinBase.updateCells(Unknown Source)
at javafx.controls@23/javafx.scene.control.skin.TableRowSkinBase.checkState(Unknown Source)
at javafx.controls@23/javafx.scene.control.skin.TableRowSkinBase.computePrefHeight(Unknown Source)
at javafx.controls@23/javafx.scene.control.Control.computePrefHeight(Unknown Source)
at javafx.graphics@23/javafx.scene.Parent.prefHeight(Unknown Source)
at javafx.graphics@23/javafx.scene.layout.Region.prefHeight(Unknown Source)
at javafx.controls@23/javafx.scene.control.skin.VirtualFlow.resizeCell(Unknown Source)
at javafx.controls@23/javafx.scene.control.skin.VirtualFlow.getCell(Unknown Source)
at javafx.controls@23/javafx.scene.control.skin.VirtualFlow.getOrCreateCellSize(Unknown Source)
at javafx.controls@23/javafx.scene.control.skin.VirtualFlow.getOrCreateCellSize(Unknown Source)
at javafx.controls@23/javafx.scene.control.skin.VirtualFlow.recalculateAndImproveEstimatedSize(Unknown Source)
at javafx.controls@23/javafx.scene.control.skin.VirtualFlow.recalculateAndImproveEstimatedSize(Unknown Source)
at javafx.controls@23/javafx.scene.control.skin.VirtualFlow.recalculateEstimatedSize(Unknown Source)
at javafx.controls@23/javafx.scene.control.skin.VirtualFlow.layoutChildren(Unknown Source)
at javafx.graphics@23/javafx.scene.Parent.layout(Unknown Source)
at javafx.graphics@23/javafx.scene.Parent.layout(Unknown Source)
at javafx.graphics@23/javafx.scene.Parent.layout(Unknown Source)
at javafx.graphics@23/javafx.scene.Parent.layout(Unknown Source)
at javafx.graphics@23/javafx.scene.Parent.layout(Unknown Source)
at javafx.graphics@23/javafx.scene.Parent.layout(Unknown Source)
at javafx.graphics@23/javafx.scene.Parent.layout(Unknown Source)
at javafx.graphics@23/javafx.scene.Parent.layout(Unknown Source)
at javafx.graphics@23/javafx.scene.Parent.layout(Unknown Source)
at javafx.graphics@23/javafx.scene.Parent.layout(Unknown Source)
at javafx.graphics@23/javafx.scene.Scene.doLayoutPass(Unknown Source)
at javafx.graphics@23/javafx.scene.Scene$ScenePulseListener.pulse(Unknown Source)
at javafx.graphics@23/com.sun.javafx.tk.Toolkit.lambda$runPulse$2(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at javafx.graphics@23/com.sun.javafx.tk.Toolkit.runPulse(Unknown Source)
at javafx.graphics@23/com.sun.javafx.tk.Toolkit.firePulse(Unknown Source)
at javafx.graphics@23/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(Unknown Source)
at javafx.graphics@23/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(Unknown Source)
at javafx.graphics@23/com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(Unknown Source)
at javafx.graphics@23/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$11(Unknown Source)
at javafx.graphics@23/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at javafx.graphics@23/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
at javafx.graphics@23/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$10(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.net.URISyntaxException: Illegal character in query at index 58: https://go.gale.com/ps/i.do?p=HRCA&u=googlescholar&id=GALE|A653693412&v=2.1&it=r&sid=googleScholar&asid=68b1dec7
at java.base/java.net.URI$Parser.fail(Unknown Source)
at java.base/java.net.URI$Parser.checkChars(Unknown Source)
at java.base/java.net.URI$Parser.parseHierarchical(Unknown Source)
at java.base/java.net.URI$Parser.parse(Unknown Source)
at java.base/java.net.URI.<init>(Unknown Source)
... 53 more
Seems like a problem with the underlying URI implementation in the JDK, they implement RFC2396 + RFC2732 while the usage of pipe characters is only supported in RFC3986.
Source: https://github.com/gatling/gatling/issues/1981#issuecomment-47118450.
Solution: Encode pipe characters as %7C before passing them into the URI.
raised an exception that recurred until l I killed JabRef and removed the offending URL from the .bib file.
This is bad. This type of exceptions should never make the program unusable.
hi @ryan-carpenter , Is this issue still available for contribution? I have a student assignment that requires contributing to an open-source project, and Iām interested in contributing to this one.Could you assign this issue to me?
@jiaxin0103 Please have a look at https://github.com/orgs/JabRef/projects/5 and choose a "free to take" issue, as it depends on the JDK. It would be needed to open a PR over there, if a solution is found.
Edit: Sorry, this is not search related. My bad. Not sure, why I completely missed HoussemNasri's comment.
I think, this can be done inside JabRef, too. As stated at https://github.com/JabRef/jabref/issues/11876#issuecomment-2395122403, one needs to recode the pipe sign into %7C.
Replace all calls to URI.create with a new method.
- Create a new method
createinorg.jabref.gui.fieldeditors.URLUtil. That method returns an URL It makes use ofcreateUriand then callstoUrl() - Create a new method
createUriinorg.jabref.gui.fieldeditors.URLUtil. That method returns an URI. - Replace all calls of
URI.create(...).toURL()byURLUtil.create(...). - Replace all calls of
URI.create(...)byURLUtil.createUri(...).
The method in step 2 does that escaping.
Test cases need to be added to org.jabref.logic.net.URLUtilTest.
@jiaxin0103 Please reply with /assign-me if you want to take this issue.
Hello @koppor , I would like to work on this problem.
/assign @hitalo-siriano
š Hey @hitalo-siriano, thank you for your interest in this issue! š
We're excited to have you on board. Start by exploring our Contributing guidelines, and don't forget to check out our workspace setup guidelines to get started smoothly.
In case you encounter failing tests during development, please check our developer FAQs!
Having any questions or issues? Feel free to ask here on GitHub. Need help setting up your local workspace? Join the conversation on JabRef's Gitter chat. And don't hesitate to open a (draft) pull request early on to show the direction it is heading towards. This way, you will receive valuable feedback.
Happy coding! š
ā³ Please note, you will be automatically unassigned if the issue isn't closed within 30 days (by 19 November 2024). A maintainer can also add the "š Pinned"" label to prevent automatic unassignment.