From 0cb7f5f3a0a440d65219b61a37f222215d05de4e Mon Sep 17 00:00:00 2001 From: Prasan Yapa Date: Thu, 22 Aug 2019 13:03:25 +0530 Subject: [PATCH] Bugfix/5045 : Modified the existing logic to comply crossref resolution with biblatex specification (#5086) * bugfix/5045 :Modified the existing logic to comply crossref resolution with biblatex specification * bugfix/5045: Modified the logic to comply crossref resolution with biblatex spec * bugfix/5045: Organizes imports * bugfix/5045: Organized imports. --- .../java/org/jabref/model/entry/BibEntry.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jabref/model/entry/BibEntry.java b/src/main/java/org/jabref/model/entry/BibEntry.java index 5a6b8db770a..b7e13ed723c 100644 --- a/src/main/java/org/jabref/model/entry/BibEntry.java +++ b/src/main/java/org/jabref/model/entry/BibEntry.java @@ -134,12 +134,24 @@ public Optional getResolvedFieldOrAlias(Field field, BibDatabase databas } Optional result = getFieldOrAlias(field); - // If this field is not set, and the entry has a crossref, try to look up the // field in the referred entry: Do not do this for the bibtex key. if (!result.isPresent() && (database != null)) { Optional referred = database.getReferencedEntry(this); - result = referred.flatMap(entry -> entry.getFieldOrAlias(field)); + if (referred.isPresent()) { + result = referred.get().getFieldOrAlias(field); + if (!result.isPresent() && type.equals(StandardEntryType.InProceedings)) { + if (field == StandardField.BOOKTITLE) { + result = referred.get().getFieldOrAlias(StandardField.TITLE); + } + else if (field == StandardField.BOOKSUBTITLE) { + result = referred.get().getFieldOrAlias(StandardField.SUBTITLE); + } + else if (field == StandardField.BOOKAUTHOR) { + result = referred.get().getFieldOrAlias(StandardField.AUTHOR); + } + } + } } return result.map(resultText -> BibDatabase.getText(resultText, database)); }