Jabref: export via command line fails

Created on 15 Nov 2016  路  7Comments  路  Source: JabRef/jabref

JabRef versions 3.3 - 3.7 on Ubuntu 14.04 and 16.04.

Steps to reproduce:

  1. Download JabRef's jar file for any of the releases 3.3 to 3.7
  2. Create or find a bib file, references.bib, say (an example is given below)
  3. Try java -jar JabRef-3.7.jar -n -o references.html,tablerefsabsbib references.bib (other export formats do not work either)

In current JabRef 3.7, no html file is produced and the output is:

09:57:04.556 [AWT-EventQueue-0] INFO  net.sf.jabref.logic.importer.OpenDatabase - Opening: references.bib
Exporting: references.html
Could not export file 'references.html': null

Note: exporting bibfiles via the GUI works flawlessly.

In JabRef 3.2, the html file is produced correctly and the output is:

Nov 15, 2016 9:51:39 AM net.sf.jabref.JabRef openBibFile
INFO: Opening: references.bib
Exporting: references.html
Nov 15, 2016 9:51:39 AM net.sf.jabref.exporter.ExportFormat performExport
WARNING: []

I used the following simple references.bib:

@Book{key,
  Title = {Title},
  Author = {An Author},
  Publisher = {A Publisher},
  Year = {2016},
  Address = {Address}
}
bug 馃悰

Most helpful comment

Looks good.

All 7 comments

I can confirm the bug for v. 3.8 (Ubuntu 14.04), it is IMO a very serious problem.

Each one of the exporters listed in jabref -h:

for format in MSBib bibordf bibtexml din1505 docbook endnote harvard html iso690rtf iso690txt listrefs misq mods ods oocalc oocsv ris simplehtml tablerefs tablerefsabsbib; do
    jabref -n -o references.$format,$format references.bib
done

fails with:

22:19:31.879 [AWT-EventQueue-0] INFO  net.sf.jabref.logic.importer.OpenDatabase - Opening: references.bib
Exporting: references.<format>
Could not export file 'references.<format>': null

Confirmed on Windows 7 x64, too.
I will look into that.

I could boil it down to a NPE in ExportFormat

Seems to be a mismatch beetween the assumption:

entries (may be null) A list containing all entries that should be exported. If null, all entries will be exported.

However, if null it fails with an NPE as it explictiyl requires non null

java.lang.NullPointerException: Entries must not be null!
    at java.util.Objects.requireNonNull(Unknown Source)
    at net.sf.jabref.logic.exporter.ExportFormat.performExport(ExportFormat.java:198)
    at net.sf.jabref.cli.ArgumentProcessor.exportFile(ArgumentProcessor.java:389)
    at net.sf.jabref.cli.ArgumentProcessor.processArguments(ArgumentProcessor.java:141)
    at net.sf.jabref.cli.ArgumentProcessor.<init>(ArgumentProcessor.java:77)

@WastlM @har-wradim
I fixed this in this build version. Export via commandline works again and manual export still does work.
It would be nice if you can confirm that,
http://builds.jabref.org/cmdexport/

Looks good.

The patch has been merged and is available in the next development build of the master.
Therfore I close this.

Great, thanks! I have tested JabRef-3.8-dev--snapshot--2016-11-30--master--9c91dbb.jar and can confirm that exports via the command line now work as expected. The console output of

java -jar JabRef-3.8-dev--snapshot--2016-11-30--master--9c91dbb.jar -n -o references.html,tablerefsabsbib references.bib

is

09:14:46.793 [AWT-EventQueue-0] INFO  net.sf.jabref.logic.importer.OpenDatabase - Opening: references.bib
Exporting: references.html

The resulting html file is identical to the one generated from an export via the GUI.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Siedlerchr picture Siedlerchr  路  4Comments

simonharrer picture simonharrer  路  3Comments

humbleambition picture humbleambition  路  3Comments

a-torgovitsky picture a-torgovitsky  路  3Comments

Siedlerchr picture Siedlerchr  路  3Comments