Skip to content

Commit 779c009

Browse files
tobiasdiezLinusDietz
authored andcommitted
Fix MathSciNet fetcher (#3402)
1 parent f5842ef commit 779c009

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/main/java/org/jabref/logic/importer/fetcher/MathSciNet.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import java.util.regex.Pattern;
1313
import java.util.stream.Collectors;
1414

15+
import org.jabref.logic.cleanup.DoiCleanup;
1516
import org.jabref.logic.cleanup.MoveFieldCleanup;
1617
import org.jabref.logic.formatter.bibtexfields.ClearFormatter;
1718
import org.jabref.logic.importer.EntryBasedParserFetcher;
@@ -50,7 +51,7 @@ public String getName() {
5051
*/
5152
@Override
5253
public URL getURLForEntry(BibEntry entry) throws URISyntaxException, MalformedURLException, FetcherException {
53-
URIBuilder uriBuilder = new URIBuilder("http://www.ams.org/mrlookup");
54+
URIBuilder uriBuilder = new URIBuilder("https://mathscinet.ams.org/mrlookup");
5455
uriBuilder.addParameter("format", "bibtex");
5556

5657
entry.getFieldOrAlias(FieldName.TITLE).ifPresent(title -> uriBuilder.addParameter("ti", title));
@@ -63,7 +64,7 @@ public URL getURLForEntry(BibEntry entry) throws URISyntaxException, MalformedUR
6364

6465
@Override
6566
public URL getURLForQuery(String query) throws URISyntaxException, MalformedURLException, FetcherException {
66-
URIBuilder uriBuilder = new URIBuilder("http://www.ams.org/mathscinet/search/publications.html");
67+
URIBuilder uriBuilder = new URIBuilder("https://mathscinet.ams.org/mathscinet/search/publications.html");
6768
uriBuilder.addParameter("pg7", "ALLF"); // search all fields
6869
uriBuilder.addParameter("s7", query); // query
6970
uriBuilder.addParameter("r", "1"); // start index
@@ -74,7 +75,7 @@ public URL getURLForQuery(String query) throws URISyntaxException, MalformedURLE
7475

7576
@Override
7677
public URL getURLForID(String identifier) throws URISyntaxException, MalformedURLException, FetcherException {
77-
URIBuilder uriBuilder = new URIBuilder("http://www.ams.org/mathscinet/search/publications.html");
78+
URIBuilder uriBuilder = new URIBuilder("https://mathscinet.ams.org/mathscinet/search/publications.html");
7879
uriBuilder.addParameter("pg1", "MR"); // search MR number
7980
uriBuilder.addParameter("s1", identifier); // identifier
8081
uriBuilder.addParameter("fmt", "bibtex"); // BibTeX format
@@ -107,6 +108,7 @@ public void doPostCleanup(BibEntry entry) {
107108
new MoveFieldCleanup("fjournal", FieldName.JOURNAL).cleanup(entry);
108109
new MoveFieldCleanup("mrclass", FieldName.KEYWORDS).cleanup(entry);
109110
new FieldFormatterCleanup("mrreviewer", new ClearFormatter()).cleanup(entry);
111+
new DoiCleanup().cleanup(entry);
110112
new FieldFormatterCleanup(FieldName.URL, new ClearFormatter()).cleanup(entry);
111113

112114
// Remove comments: MathSciNet prepends a <pre> html tag

src/test/java/org/jabref/logic/importer/fetcher/MathSciNetTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,17 @@ public void searchByEntryFindsEntry() throws Exception {
6363

6464
@Test
6565
public void searchByQueryFindsEntry() throws Exception {
66-
// CI has no subscription to zbMath and thus gets 401 response
66+
// CI has no subscription to MathSciNet and thus gets 401 response
6767
Assume.assumeFalse(DevEnvironment.isCIServer());
6868

6969
List<BibEntry> fetchedEntries = fetcher.performSearch("Existence and uniqueness theorems Two-Dimensional Ericksen Leslie System");
7070
assertFalse(fetchedEntries.isEmpty());
71-
assertEquals(ratiuEntry, fetchedEntries.get(0));
71+
assertEquals(ratiuEntry, fetchedEntries.get(1));
7272
}
7373

7474
@Test
7575
public void searchByIdFindsEntry() throws Exception {
76-
// CI has no subscription to zbMath and thus gets 401 response
76+
// CI has no subscription to MathSciNet and thus gets 401 response
7777
Assume.assumeFalse(DevEnvironment.isCIServer());
7878

7979
Optional<BibEntry> fetchedEntry = fetcher.performSearchById("3537908");

0 commit comments

Comments
 (0)