Skip to content

Commit

Permalink
Incorporate feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor committed Dec 12, 2016
1 parent 7e57775 commit d38bd97
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public BibEntry toBibEntry(Character keywordDelimiter) {
abstractText.ifPresent(abstractContent -> bibEntry.setField(FieldName.ABSTRACT, abstractContent));
getDate().ifPresent(date -> bibEntry.setField(FieldName.DATE, date));
primaryCategory.ifPresent(category -> bibEntry.setField(FieldName.EPRINTCLASS, category));
journalReferenceText.ifPresent(journal -> bibEntry.setField(FieldName.JOURNAL, journal));
journalReferenceText.ifPresent(journal -> bibEntry.setField(FieldName.JOURNALTITLE, journal));
getPdfUrl().ifPresent(url -> bibEntry
.setFiles(Collections.singletonList(new ParsedFileField("online", url, "PDF"))));
return bibEntry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,20 @@
import net.sf.jabref.model.entry.EntryConverter;
import net.sf.jabref.model.entry.FieldName;

/**
* This checker checks whether the entry does not contain any field appearing only in BibLaTeX (and not in BibTex)
*/
public class NoBibtexFieldChecker implements Checker {

@Override
public List<IntegrityMessage> check(BibEntry entry) {
SortedSet<String> allBibLaTeXOnlyFields = new TreeSet<>();
allBibLaTeXOnlyFields.addAll(EntryConverter.FIELD_ALIASES_LTX_TO_TEX.keySet());

// file is both in bibtex and biblatex
// file is both in BibTeX and BibLaTeX
allBibLaTeXOnlyFields.remove(FieldName.FILE);

// this exists in BibLaTeX only (and is no aliassed field)
// this exists in BibLaTeX only (and is no aliased field)
allBibLaTeXOnlyFields.add(FieldName.JOURNALSUBTITLE);

return entry.getFieldNames().stream()
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/net/sf/jabref/model/entry/BibEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -836,8 +836,7 @@ public Optional<FieldChange> setFiles(List<ParsedFileField> files) {
return Optional.empty();
}

this.setField(FieldName.FILE, newValue);
return Optional.of(new FieldChange(this, FieldName.FILE, oldValue.orElse(""), newValue));
return this.setField(FieldName.FILE, newValue);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public void searchEntryByOldId() throws Exception {
expected.setField("eprintclass", "hep-ex");
expected.setField("keywords", "hep-ex");
expected.setField("doi", "10.1140/epjc/s2003-01326-x");
expected.setField("journal", "Eur.Phys.J.C31:17-29,2003");
expected.setField("journaltitle", "Eur.Phys.J.C31:17-29,2003");

assertEquals(Optional.of(expected), finder.performSearchById("hep-ex/0307015"));
}
Expand Down

0 comments on commit d38bd97

Please sign in to comment.