Skip to content

Treat CrossRef titles as optional #3378

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

Merged
merged 1 commit into from
Oct 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We fixed an issue where JabRef would not show the translated content at some points, although there existed a translation
- We fixed an issue where editing in the source tab would override content of other entries [#3352](https://github.com/JabRef/jabref/issues/3352#issue-268580818)
- We fixed several issues with the automatic linking of files in the entry editor where files were not found or not correctly saved in the bibtex source [#3346](https://github.com/JabRef/jabref/issues/3346)
- We fixed an issue where fetching entries from crossref that had no titles caused an error [#3376](https://github.com/JabRef/jabref/issues/3376)

### Removed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ private BibEntry jsonItemToBibEntry(JSONObject item) throws ParseException {
try {
BibEntry entry = new BibEntry();
entry.setType(convertType(item.getString("type")));
entry.setField(FieldName.TITLE, item.getJSONArray("title").optString(0));
entry.setField(FieldName.TITLE,
Optional.ofNullable(item.optJSONArray("title"))
.map(array -> array.optString(0)).orElse(""));
entry.setField(FieldName.SUBTITLE,
Optional.ofNullable(item.optJSONArray("subtitle"))
.map(array -> array.optString(0)).orElse(""));
Expand Down