Skip to content

Commit

Permalink
Fixes #7660 (#7663)
Browse files Browse the repository at this point in the history
1. Run EprintCleanup on a copy of the entry the ArXiv fetcher is fetching before getting arXiv id from the eprint field;
2. Add two test method. One finds full text with title containing colon and journal, while another finds full text with title containing colon and url.
  • Loading branch information
JavuesZhang authored Apr 23, 2021
1 parent 429b3d0 commit f815050
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed an issue with opacity of disabled icon-buttons [#7195](https://github.com/JabRef/jabref/issues/7195)
- We fixed an issue where journal abbreviations in UTF-8 were not recognized [#5850](https://github.com/JabRef/jabref/issues/5850)
- We fixed an issue where the article title with curly brackets fails to download the arXiv link (pdf file). [#7633](https://github.com/JabRef/jabref/issues/7633)
- We fixed an issue where the article title with colon fails to download the arXiv link (pdf file). [#7660](https://github.com/JabRef/issues/7660)

### Removed

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/jabref/logic/importer/fetcher/ArXiv.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.jabref.logic.cleanup.CleanupJob;
import org.jabref.logic.cleanup.EprintCleanup;
import org.jabref.logic.help.HelpFile;
import org.jabref.logic.importer.FetcherException;
import org.jabref.logic.importer.FulltextFetcher;
Expand Down Expand Up @@ -116,6 +118,9 @@ private Optional<ArXivEntry> searchForEntryById(String id) throws FetcherExcepti
}

private List<ArXivEntry> searchForEntries(BibEntry entry) throws FetcherException {
entry = (BibEntry) entry.clone();
CleanupJob cleanupJob = new EprintCleanup();
cleanupJob.cleanup(entry);
// 1. Eprint
Optional<String> identifier = entry.getField(StandardField.EPRINT);
if (StringUtil.isNotBlank(identifier)) {
Expand Down
16 changes: 16 additions & 0 deletions src/test/java/org/jabref/logic/importer/fetcher/ArXivTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,22 @@ void findFullTextByTitleWithCurlyBracket() throws IOException {
assertEquals(Optional.of(new URL("https://arxiv.org/pdf/2010.15942v2")), fetcher.findFullText(entry));
}

@Test
void findFullTextByTitleWithColonAndJournalWithoutEprint() throws IOException {
entry.setField(StandardField.TITLE, "Bayes-TrEx: a Bayesian Sampling Approach to Model Transparency by Example");
entry.setField(StandardField.JOURNAL, "arXiv:2002.10248v4 [cs]");

assertEquals(Optional.of(new URL("http://arxiv.org/pdf/2002.10248v4")), fetcher.findFullText(entry));
}

@Test
void findFullTextByTitleWithColonAndUrlWithoutEprint() throws IOException {
entry.setField(StandardField.TITLE, "Bayes-TrEx: a Bayesian Sampling Approach to Model Transparency by Example");
entry.setField(StandardField.URL, "http://arxiv.org/abs/2002.10248v4");

assertEquals(Optional.of(new URL("http://arxiv.org/pdf/2002.10248v4")), fetcher.findFullText(entry));
}

@Test
void findFullTextByTitleAndPartOfAuthor() throws IOException {
entry.setField(StandardField.TITLE, "Pause Point Spectra in DNA Constant-Force Unzipping");
Expand Down

0 comments on commit f815050

Please sign in to comment.