From c711a7fdf5d2f1eb1204014fe8f1a13a62ee7360 Mon Sep 17 00:00:00 2001 From: Christoph Date: Sun, 11 Jun 2017 21:50:34 +0200 Subject: [PATCH] Fix exception when no citekey is present (#2904) --- CHANGELOG.md | 1 + src/main/java/org/jabref/logic/pdf/FileAnnotationCache.java | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f2d4cd5fcd..eb7155d5fc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - We fixed a bug that only allowed parsing positive timezones from a FileAnnotation [#2839](https://github.com/JabRef/jabref/issues/2839) - We fixed a bug that did not allow the correct re-export of the MS-Office XML field `msbib-accessed` with a different date format [#2859](https://github.com/JabRef/jabref/issues/2859). - We fixed some bugs that prevented the display of FileAnnotations that were created using the Foxit Reader. [#2839, comment](https://github.com/JabRef/jabref/issues/2839#issuecomment-302058227). +- We fixed an error that prevented the FileAnnotation tab to load when the entry had no bibtexkey [#2903](https://github.com/JabRef/jabref/issues/2903). ### Removed diff --git a/src/main/java/org/jabref/logic/pdf/FileAnnotationCache.java b/src/main/java/org/jabref/logic/pdf/FileAnnotationCache.java index 75a024e205e..33baadedd6b 100644 --- a/src/main/java/org/jabref/logic/pdf/FileAnnotationCache.java +++ b/src/main/java/org/jabref/logic/pdf/FileAnnotationCache.java @@ -38,12 +38,12 @@ public Map> load(BibEntry entry) throws Exception { * @return Map containing a list of annotations in a list for each file */ public Map> getFromCache(BibEntry entry) { - LOGGER.debug(String.format("Loading Bibentry '%s' from cache.", entry.getField(BibEntry.KEY_FIELD).get())); + LOGGER.debug(String.format("Loading Bibentry '%s' from cache.", entry.getCiteKeyOptional().orElse(entry.getId()))); return annotationCache.getUnchecked(entry); } public void remove(BibEntry entry) { - LOGGER.debug(String.format("Deleted Bibentry '%s' from cache.", entry.getField(BibEntry.KEY_FIELD).get())); + LOGGER.debug(String.format("Deleted Bibentry '%s' from cache.", entry.getCiteKeyOptional().orElse(entry.getId()))); annotationCache.invalidate(entry); } }