diff --git a/CHANGELOG.md b/CHANGELOG.md index 98b3a24c19e..0e07b758cde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve ### Changed +- Now all the entries with no empty citationkey will be detected by "Check integrity",and a test of it has been added. - The file column in the main table now shows the corresponding defined icon for the linked file [8930](https://github.com/JabRef/jabref/issues/8930). - We improved the color of the selected entries and the color of the summary in the Import Entries Dialog in the dark theme. [#7927](https://github.com/JabRef/jabref/issues/7927) - We upgraded to Lucene 9.2 for the fulltext search. @@ -38,6 +39,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve ### Fixed +- We fixed an issue where A particular empty entry can be added without warning message [#8645](https://github.com/JabRef/jabref/issues/8645) - We fixed an issue where linked files with the filetype "application/pdf" in an entry were not shown with the correct PDF-Icon in the main table [8930](https://github.com/JabRef/jabref/issues/8930) - We fixed an issue where "open folder" for linked files did not open the folder and did not select the file unter certain Linux desktop environments [#8679](https://github.com/JabRef/jabref/issues/8679), [#8849](https://github.com/JabRef/jabref/issues/8849) - We fixed an issue where the content of a big shared database library is not shown [#8788](https://github.com/JabRef/jabref/issues/8788) diff --git a/src/main/java/org/jabref/logic/integrity/CitationKeyChecker.java b/src/main/java/org/jabref/logic/integrity/CitationKeyChecker.java index 931bdd1a52e..6b7593d49fb 100644 --- a/src/main/java/org/jabref/logic/integrity/CitationKeyChecker.java +++ b/src/main/java/org/jabref/logic/integrity/CitationKeyChecker.java @@ -11,7 +11,8 @@ import org.jabref.model.strings.StringUtil; /** - * Currently only checks the key if there is an author, year, and title present. + * In the past only checks the key if there is an author, year, and title present. + * Currently checks the key all the time. */ public class CitationKeyChecker implements EntryChecker { @@ -20,12 +21,10 @@ public List check(BibEntry entry) { Optional author = entry.getField(StandardField.AUTHOR); Optional title = entry.getField(StandardField.TITLE); Optional year = entry.getField(StandardField.YEAR); - if (author.isEmpty() || title.isEmpty() || year.isEmpty()) { - return Collections.emptyList(); - } if (StringUtil.isBlank(entry.getCitationKey())) { String authorTitleYear = entry.getAuthorTitleYear(100); + return Collections.singletonList(new IntegrityMessage( Localization.lang("empty citation key") + ": " + authorTitleYear, entry, InternalField.KEY_FIELD)); } diff --git a/src/main/java/org/jabref/preferences/JabRefPreferences.java b/src/main/java/org/jabref/preferences/JabRefPreferences.java index d204f2f8900..d4bc8c12539 100644 --- a/src/main/java/org/jabref/preferences/JabRefPreferences.java +++ b/src/main/java/org/jabref/preferences/JabRefPreferences.java @@ -653,7 +653,7 @@ private JabRefPreferences() { // default time stamp follows ISO-8601. Reason: https://xkcd.com/1179/ defaults.put(TIME_STAMP_FORMAT, "yyyy-MM-dd"); - defaults.put(GENERATE_KEYS_BEFORE_SAVING, Boolean.FALSE); + defaults.put(GENERATE_KEYS_BEFORE_SAVING, Boolean.TRUE); defaults.put(USE_REMOTE_SERVER, Boolean.TRUE); defaults.put(REMOTE_SERVER_PORT, 6050); diff --git a/src/test/java/org/jabref/logic/integrity/CitationKeyCheckerTest.java b/src/test/java/org/jabref/logic/integrity/CitationKeyCheckerTest.java index 44d0ce9e979..4c16c290148 100644 --- a/src/test/java/org/jabref/logic/integrity/CitationKeyCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/CitationKeyCheckerTest.java @@ -40,6 +40,14 @@ void acceptsKeyFromTitleAndYear() { assertEquals(Collections.emptyList(), checker.check(entry)); } + @Test + void emptyCitationKeyFromAuthorAndTitle() { + BibEntry entry = new BibEntry().withField(StandardField.AUTHOR, "Brown") + .withField(StandardField.TITLE, "The Title"); + List expected = Collections.singletonList(new IntegrityMessage(Localization.lang("empty citation key") + ": " + entry.getAuthorTitleYear(100), entry, InternalField.KEY_FIELD)); + assertEquals(expected, checker.check(entry)); + } + @Test void emptyCitationKey() { BibEntry entry = new BibEntry().withField(StandardField.AUTHOR, "Brown")