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

Incorrect(?) parsing of {\textendash} when renaming files #3990

Closed
1 task done
aphirst opened this issue Apr 27, 2018 · 4 comments
Closed
1 task done

Incorrect(?) parsing of {\textendash} when renaming files #3990

aphirst opened this issue Apr 27, 2018 · 4 comments
Labels
status: waiting-for-feedback The submitter or other users need to provide more information about the issue

Comments

@aphirst
Copy link

aphirst commented Apr 27, 2018

JabRef version 4.3-dev on Arch Linux x86_64

Steps to reproduce:

  1. Have an entry corresponding to the BibTeX entry below containing {\textendash} in its title (with a real PDF existing at the specified location, which for demonstration purposes starts with a literal - in the relevant place):
  2. Select the entry, and in "General -> File" choose to Rename the file (based on the metadata)
  3. Notice the new filename: Wu2014 - Initial Design with L2 Monge Kantorovich Theory for the Monge}Ampere Equation Method in Freeform Surface Illumination Design.pdf with its uncoupled } where the hyphen should be.
  4. Attempt to save, (understandably) get this error:
    a
  5. When performing this operation as part of "Quality -> Cleanup Entries", JabRef freezes.
@Article{Wu2014,
  author    = {Rengmao Wu and Yaqin Zhang and Mohamed M. Sulman and Zhenrong Zheng and Pablo Ben{\'{i}}tez and Juan C. Mi{\~{n}}ano},
  title     = {Initial design with L{\^{}}2 Monge-Kantorovich theory for the Monge{\textendash}Amp{\`{e}}re equation method in freeform surface illumination design},
  journal   = {Optics Express},
  year      = {2014},
  volume    = {22},
  number    = {13},
  pages     = {16161},
  month     = {jun},
  doi       = {10.1364/oe.22.016161},
  file      = {:Wu2014 - Initial Design with L2 Monge Kantorovich Theory for the Monge-Ampere Equation Method in Freeform Surface Illumination Design.pdf:PDF},
  publisher = {The Optical Society},
}
Log File
Opening: /home/adam/Projects/Library/Papers/Papers.bib
Opening: /home/adam/Projects/Library/Test/Test.bib
Error while saving file.
org.jabref.logic.exporter.SaveException: Error in field 'file': Unescaped '}' character without opening bracket ends string prematurely.
  at org.jabref.logic.exporter.BibtexDatabaseWriter.writeEntry(BibtexDatabaseWriter.java:169)
  at org.jabref.logic.exporter.BibDatabaseWriter.savePartOfDatabase(BibDatabaseWriter.java:198)
  at org.jabref.logic.exporter.BibDatabaseWriter.saveDatabase(BibDatabaseWriter.java:150)
  at org.jabref.logic.autosaveandbackup.BackupManager.performBackup(BackupManager.java:124)
  at java.util.Optional.ifPresent(Optional.java:159)
  at org.jabref.logic.autosaveandbackup.BackupManager.lambda$new$0(BackupManager.java:50)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  at java.lang.Thread.run(Thread.java:748)

Problem saving file
org.jabref.logic.exporter.SaveException: rt
  at org.jabref.gui.exporter.SaveDatabaseAction.saveDatabase(SaveDatabaseAction.java:215)
  at org.jabref.gui.exporter.SaveDatabaseAction.run(SaveDatabaseAction.java:142)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at spin.Invocation.evaluate(Invocation.java:175)
  at spin.off.SpinOffEvaluator$1.run(SpinOffEvaluator.java:108)
  at java.lang.Thread.run(Thread.java:748)

@stefan-kolb
Copy link
Member

stefan-kolb commented Apr 27, 2018

For me the file gets renamed to Wu2014 - Initial design with L{_^{}}2 Monge-Kantorovich theory for the Monge{textendash}Amp{`{e}}re equation method in freeform surface illumination design.pdf on version 4.2.

The current dev results in: Wu2014 - Initial design with L{_^{}}2 Monge-Kantorovich theory for the Monge{textendash}Amp{`{e}}re equation method in freeform surface illumination design.pdf

Do you have any other cleanup activated before the rename function kicks in? In other words, for me the Latex codes are not even replaced.

What is your file format pattern (Inside preferences - import)?

@stefan-kolb stefan-kolb added the status: waiting-for-feedback The submitter or other users need to provide more information about the issue label Apr 27, 2018
@Siedlerchr
Copy link
Member

This could be a similiar issue as #3920

@aphirst
Copy link
Author

aphirst commented Apr 27, 2018

The file format pattern in "Import" is:

[bibtexkey] - [title]

Hmm, for me, {\textendash} definitely ends up being replaced with just {, and it does smell an awful lot like #3920, as @Siedlerchr mentions.

I can play around with this more in the morning, but I can at least confirm that I get the same issue on 2 machines (both running Arch), with JabRef 4.1, 4.2, and git master.

@Siedlerchr
Copy link
Member

Thank you for reporting this issue. We think, that is already fixed in our development version and consequently the change will be included in the next release.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-feedback The submitter or other users need to provide more information about the issue
Projects
None yet
Development

No branches or pull requests

3 participants