Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix XMP Exctrator not returning empty optional #6578

Merged
merged 3 commits into from
Jun 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed an issue where the "Attach file" dialog, in the right-click menu for an entry, started on the working directory instead of the user's main directory. [#4995](https://github.com/JabRef/jabref/issues/4995)
- We fixed an issue where the JabRef Icon in the macOS launchpad was not displayed correctly [#5003](https://github.com/JabRef/jabref/issues/5003)
- We fixed an issue where the "Search for unlinked local files" would throw an exception when parsing the content of a PDF-file with missing "series" information [#5128](https://github.com/JabRef/jabref/issues/5128)
- We fixed an issue where the XMP Importer would incorrectly return an empty default entry when importing pdfs [#6577](https://github.com/JabRef/jabref/issues/6577)

### Removed

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/jabref/logic/xmp/DublinCoreExtractor.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private void extractEditor() {
private void extractAuthor() {
List<String> creators = dcSchema.getCreators();
if ((creators != null) && !creators.isEmpty()) {
bibEntry.setField(StandardField.AUTHOR, String.join(" and ", creators));
bibEntry.setField(StandardField.AUTHOR, String.join(" and ", creators));
}
}

Expand Down Expand Up @@ -242,10 +242,10 @@ public Optional<BibEntry> extractBibtexEntry() {
this.extractTitle();
this.extractType();

if (bibEntry.getType() == null) {
bibEntry.setType(BibEntry.DEFAULT_TYPE);
// we pass a new BibEntry in the constructor which is never empty as it already consists of "@misc"
if (bibEntry.getFieldMap().isEmpty()) {
return Optional.empty();
}

return Optional.of(bibEntry);
}

Expand Down