Skip to content

Commit

Permalink
Replace all IEEE URLs with https #3930
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-kolb committed Apr 10, 2018
1 parent fe90b1a commit 6942f8b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
public class IEEEXploreFetcher implements EntryFetcher {

private static final Logger LOGGER = LoggerFactory.getLogger(IEEEXploreFetcher.class);
private static final String URL_SEARCH = "http://ieeexplore.ieee.org/rest/search?reload=true";
private static final String URL_BIBTEX_START = "http://ieeexplore.ieee.org/xpl/downloadCitations?reload=true&recordIds=";
private static final String URL_SEARCH = "https://ieeexplore.ieee.org/rest/search?reload=true";
private static final String URL_BIBTEX_START = "https://ieeexplore.ieee.org/xpl/downloadCitations?reload=true&recordIds=";
private static final String URL_BIBTEX_END = "&download-format=download-bibtex&x=0&y=0";
private static final String DIALOG_TITLE = Localization.lang("Search %0", "IEEEXplore");
private static final int MAX_FETCH = 100;
Expand Down Expand Up @@ -106,7 +106,7 @@ public boolean processQuery(String query, ImportInspector dialog, OutputPrinter
//add request header
dl.addHeader("Accept", "application/json");
dl.addHeader("Content-Type", "application/json");
dl.addHeader("Referer", "http://ieeexplore.ieee.org/search/searchresult.jsp");
dl.addHeader("Referer", "https://ieeexplore.ieee.org/search/searchresult.jsp");

// set post data
dl.setPostData(postData);
Expand Down Expand Up @@ -478,7 +478,7 @@ private BibEntry cleanup(BibEntry entry) {

// Clean up url
entry.getField(FieldName.URL)
.ifPresent(url -> entry.setField(FieldName.URL, "http://ieeexplore.ieee.org" + url.replace("tp=&", "")));
.ifPresent(url -> entry.setField(FieldName.URL, "https://ieeexplore.ieee.org" + url.replace("tp=&", "")));

// Replace ; as keyword separator
entry.getField(FieldName.KEYWORDS).ifPresent(keys -> entry.setField(FieldName.KEYWORDS,
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/org/jabref/logic/importer/fetcher/IEEE.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,16 @@

/**
* Class for finding PDF URLs for entries on IEEE
* Will first look for URLs of the type http://ieeexplore.ieee.org/stamp/stamp.jsp?[tp=&]arnumber=...
* Will first look for URLs of the type https://ieeexplore.ieee.org/stamp/stamp.jsp?[tp=&]arnumber=...
* If not found, will resolve the DOI, if it starts with 10.1109, and try to find a similar link on the HTML page
*/
public class IEEE implements FulltextFetcher {

private static final Logger LOGGER = LoggerFactory.getLogger(IEEE.class);
private static final Pattern STAMP_PATTERN = Pattern.compile("(/stamp/stamp.jsp\\?t?p?=?&?arnumber=[0-9]+)");
private static final Pattern PDF_PATTERN = Pattern
.compile("\"(http://ieeexplore.ieee.org/ielx[0-9/]+\\.pdf[^\"]+)\"");
private static final Pattern PDF_PATTERN = Pattern.compile("\"(https://ieeexplore.ieee.org/ielx[0-9/]+\\.pdf[^\"]+)\"");
private static final String IEEE_DOI = "10.1109";
private static final String BASE_URL = "http://ieeexplore.ieee.org";
private static final String BASE_URL = "https://ieeexplore.ieee.org";

@Override
public Optional<URL> findFullText(BibEntry entry) throws IOException {
Expand Down
12 changes: 6 additions & 6 deletions src/test/java/org/jabref/logic/importer/fetcher/IEEETest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,27 @@ void findByDOI() throws IOException {

assertEquals(
Optional.of(
new URL("http://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931")),
new URL("https://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931")),
finder.findFullText(entry));
}

@Test
void findByURL() throws IOException {
entry.setField("url", "http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=7421926");
entry.setField("url", "https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=7421926");

assertEquals(
Optional.of(
new URL("http://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931")),
new URL("https://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931")),
finder.findFullText(entry));
}

@Test
void findByOldURL() throws IOException {
entry.setField("url", "http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=7421926");
entry.setField("url", "https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=7421926");

assertEquals(
Optional.of(
new URL("http://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931")),
new URL("https://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931")),
finder.findFullText(entry));
}

Expand All @@ -61,7 +61,7 @@ void findByDOIButNotURL() throws IOException {

assertEquals(
Optional.of(
new URL("http://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931")),
new URL("https://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931")),
finder.findFullText(entry));
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/testbib/crossref.bib
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ @Proceedings{DBLP:conf/wicsa/2015
biburl = {http://dblp.uni-trier.de/rec/bib/conf/wicsa/2015},
isbn = {978-1-4799-1922-2},
timestamp = {Fri, 24 Jul 2015 13:18:35 +0200},
url = {http://ieeexplore.ieee.org/xpl/mostRecentIssue.jsp?punumber=7158223},
url = {https://ieeexplore.ieee.org/xpl/mostRecentIssue.jsp?punumber=7158223},
}

@Comment{jabref-meta: databaseType:bibtex;}
4 changes: 2 additions & 2 deletions src/test/resources/testbib/jabref-authors.bib
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ @InProceedings{SheikhGustafsson2010
bibsource = {dblp computer science bibliography, http://dblp.org},
biburl = {http://dblp.uni-trier.de/rec/bib/conf/eusipco/SheikhG10},
timestamp = {Mon, 05 Oct 2015 10:46:48 +0200},
url = {http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=7096541},
url = {https://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=7096541},
}

@Article{BladGustafsson2010,
Expand Down Expand Up @@ -1112,7 +1112,7 @@ @InProceedings{GustafssonJohanssonWanhammar2000
bibsource = {dblp computer science bibliography, http://dblp.org},
biburl = {http://dblp.uni-trier.de/rec/bib/conf/eusipco/GustafssonJW00},
timestamp = {Fri, 06 May 2016 11:05:57 +0200},
url = {http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=7075430},
url = {https://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=7075430},
}

@InProceedings{GustafssonWanhammar1999,
Expand Down

0 comments on commit 6942f8b

Please sign in to comment.