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

saving destroyed library: error when using a PDF file name with opening "{" or closing "}" ONLY inside file name #10182

Closed
2 tasks done
ghost opened this issue Aug 16, 2023 · 6 comments · Fixed by #10205
Closed
2 tasks done
Labels
bug Confirmed bugs or reports that are very likely to be bugs export / save
Milestone

Comments

@ghost
Copy link

ghost commented Aug 16, 2023

JabRef version

5.9 (latest release)

Operating system

Windows

Details on version and operating system

Windows 10 22H2

Checked with the latest development build

  • I made a backup of my libraries before testing the latest development version.
  • I have tested the latest development version and the problem persists

Steps to reproduce the behaviour

  1. Create new library
  2. Create test PDF file with opening "{" or closing "}" ONLY inside file name
  3. Add new library entry
  4. Assign this PDF file to the "file" field of the entry
  5. Save the library
  6. Error occurs:

Opening { error:

afbeelding

Closing } error:

afbeelding

When you try to open the library file (after closing JabRef), the library file is destroyed somewhere and can't be opened anymore!!!

The following errors occur when opening the library file again

afbeelding

afbeelding

Appendix

...

Log File
Paste an excerpt of your log file here
@Siedlerchr
Copy link
Member

Uh yeah, that should not be allowed in the file field. Braces are bibtex' separators for the field values.
You can try to open it with a text editor (e.g. Notepad) and manually remove the offending braces, then it should be able to open again

@ghost
Copy link
Author

ghost commented Aug 16, 2023

Should jabref give message box maybe if you use not allowed characters on the file?

@Siedlerchr
Copy link
Member

I could reproduce this in the latest dev version as well.
Although I say discard changes, the changes are still present and it kills the rest of the library entries

org.jabref.logic.exporter.SaveException: Problems saving: java.io.IOException: Error in field 'FILE of entry Kriegman1965': Braces don't match. Field value: :broken{ asdf.pdf:PDF
	at org.jabref@100.0.0/org.jabref.gui.exporter.SaveDatabaseAction.saveDatabase(SaveDatabaseAction.java:263)
	at org.jabref@100.0.0/org.jabref.gui.exporter.SaveDatabaseAction.save(SaveDatabaseAction.java:213)
	at org.jabref@100.0.0/org.jabref.gui.exporter.SaveDatabaseAction.save(SaveDatabaseAction.java:187)
	at org.jabref@100.0.0/org.jabref.gui.exporter.SaveDatabaseAction.save(SaveDatabaseAction.java:74)
	at org.jabref@100.0.0/org.jabref.gui.exporter.SaveAction.execute(SaveAction.java:41)
	at org.jabref@100.0.0/org.jabref.gui.actions.JabRefAction.lambda$new$3(JabRefAction.java:40)
	at org.controlsfx.controls@11.1.2/org.controlsfx.control.action.Action.handle(Action.java:423)
	at org.controlsfx.controls@11.1.2/org.controlsfx.control.action.Action.handle(Action.java:64)
	at javafx.base@20/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
	at javafx.base@20/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:232)
	at javafx.base@20/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:189)
	at javafx.base@20/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at javafx.base@20/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base@20/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at javafx.base@20/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
	at javafx.base@20/javafx.event.Event.fireEvent(Event.java:198)
	at javafx.controls@20/javafx.scene.control.MenuItem.fire(MenuItem.java:459)
	at javafx.controls@20/com.sun.javafx.scene.control.GlobalMenuAdapter.lambda$bindMenuItemProperties$2(GlobalMenuAdapter.java:150)
	at javafx.base@20/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
	at javafx.base@20/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:232)
	at javafx.base@20/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:189)
	at javafx.base@20/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at javafx.base@20/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base@20/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at javafx.base@20/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
	at javafx.base@20/javafx.event.Event.fireEvent(Event.java:198)
	at javafx.controls@20/javafx.scene.control.MenuItem.fire(MenuItem.java:459)
	at javafx.graphics@20/com.sun.javafx.tk.quantum.GlassSystemMenu$1.action(GlassSystemMenu.java:234)
Caused by: java.io.IOException: Error in field 'FILE of entry Kriegman1965': Braces don't match. Field value: :broken{ asdf.pdf:PDF
	at org.jabref@100.0.0/org.jabref.logic.bibtex.BibEntryWriter.writeField(BibEntryWriter.java:169)
	at org.jabref@100.0.0/org.jabref.logic.bibtex.BibEntryWriter.writeRequiredFieldsFirstRemainingFieldsSecond(BibEntryWriter.java:138)
	at org.jabref@100.0.0/org.jabref.logic.bibtex.BibEntryWriter.write(BibEntryWriter.java:73)
	at org.jabref@100.0.0/org.jabref.logic.exporter.BibtexDatabaseWriter.writeEntry(BibtexDatabaseWriter.java:158)
	at org.jabref@100.0.0/org.jabref.logic.exporter.BibDatabaseWriter.savePartOfDatabase(BibDatabaseWriter.java:228)
	at org.jabref@100.0.0/org.jabref.logic.exporter.BibDatabaseWriter.saveDatabase(BibDatabaseWriter.java:180)
	at org.jabref@100.0.0/org.jabref.gui.exporter.SaveDatabaseAction.saveDatabase(SaveDatabaseAction.java:252)
	... 27 more
Caused by: org.jabref.logic.bibtex.InvalidFieldValueException: Braces don't match. Field value: :broken{ asdf.pdf:PDF
	at org.jabref@100.0.0/org.jabref.logic.bibtex.FieldWriter.checkBraces(FieldWriter.java:71)
	at org.jabref@100.0.0/org.jabref.logic.bibtex.FieldWriter.formatWithoutResolvingStrings(FieldWriter.java:177)
	at org.jabref@100.0.0/org.jabref.logic.bibtex.FieldWriter.write(FieldWriter.java:89)
	at org.jabref@100.0.0/org.jabref.logic.bibtex.BibEntryWriter.writeField(BibEntryWriter.java:166)
	... 33 more

@Siedlerchr Siedlerchr added the bug Confirmed bugs or reports that are very likely to be bugs label Aug 17, 2023
@Siedlerchr Siedlerchr added this to the v5.10 milestone Aug 17, 2023
@Siedlerchr
Copy link
Member

@Siedlerchr
Copy link
Member

Solution would be to check the filename on adding and trying to rename it to allowed characters

@ghost
Copy link

ghost commented Aug 17, 2023

Solution would be to check the filename on adding and trying to rename it to allowed characters

Yes! This is why I reported it. It destroys your library. It happened here by accident when inserting a "{".
I have restored using my backup.

Maybe even more other characters in the file name can have conflicts?

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 export / save
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant