Skip to content

Commit

Permalink
fixes JabRef#8396
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlin committed May 10, 2022
1 parent 177d5ec commit 830282a
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.jabref.gui.entryeditor;

import java.util.Collections;
import java.util.HashSet;
import java.util.Optional;
import java.util.Set;

Expand Down Expand Up @@ -53,7 +54,14 @@ public DeprecatedFieldsTab(BibDatabaseContext databaseContext,
protected Set<Field> determineFieldsToShow(BibEntry entry) {
Optional<BibEntryType> entryType = entryTypesManager.enrich(entry.getType(), databaseContext.getMode());
if (entryType.isPresent()) {
return entryType.get().getDeprecatedFields();
Set<Field> validDeprecatedFields = new HashSet<>();
for (Field field : entryType.get().getDeprecatedFields()) {
Optional<String> fieldValue = entry.getField(field);
if (fieldValue.isPresent()) {
validDeprecatedFields.add(field);
}
}
return validDeprecatedFields;
} else {
// Entry type unknown -> treat all fields as required
return Collections.emptySet();
Expand Down

0 comments on commit 830282a

Please sign in to comment.