diff --git a/CHANGELOG.md b/CHANGELOG.md index fc348415f51..30870947c39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -116,11 +116,14 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - We fixed an issue where the RIS import would overwite the article date with the value of the acessed date [#4816](https://github.com/JabRef/jabref/issues/4816) - We fixed an issue where an NullPointer exception was thrown when a referenced entry in an Open/Libre Office document was no longer present in the library. Now an error message with the reference marker of the missing entry is shown. [#4932](https://github.com/JabRef/jabref/issues/4932) - We fixed an issue where a database exception related to a missing timezone was too big. [#4827](https://github.com/JabRef/jabref/issues/4827) +- We fixed an issue where the IEEE fetcher returned an error if no keywords were present in the result from the IEEE website [#4997](https://github.com/JabRef/jabref/issues/4997) - We fixed an issue where the command line help text had several errors, and arguments and descriptions have been rewritten to simplify and detail them better. [#4932](https://github.com/JabRef/jabref/issues/2016) - We fixed an issue where the same menu for changing entry type had two different sizes and weights. [#4977](https://github.com/JabRef/jabref/issues/4977) - 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) + + ### Removed - The feature to "mark entries" was removed and merged with the groups functionality. For migration, a group is created for every value of the `__markedentry` field and the entry is added to this group. - The number column was removed. diff --git a/src/main/java/org/jabref/gui/importer/fetcher/WebSearchPane.java b/src/main/java/org/jabref/gui/importer/fetcher/WebSearchPane.java index b3851939465..c855506211d 100644 --- a/src/main/java/org/jabref/gui/importer/fetcher/WebSearchPane.java +++ b/src/main/java/org/jabref/gui/importer/fetcher/WebSearchPane.java @@ -35,7 +35,7 @@ public class WebSearchPane extends SidePaneComponent { public WebSearchPane(SidePaneManager sidePaneManager, JabRefPreferences preferences, JabRefFrame frame) { super(sidePaneManager, IconTheme.JabRefIcons.WWW, Localization.lang("Web search")); this.preferences = preferences; - this.viewModel = new WebSearchPaneViewModel(preferences.getImportFormatPreferences(), frame, preferences); + this.viewModel = new WebSearchPaneViewModel(preferences.getImportFormatPreferences(), frame, preferences, frame.getDialogService()); } @Override diff --git a/src/main/java/org/jabref/gui/importer/fetcher/WebSearchPaneViewModel.java b/src/main/java/org/jabref/gui/importer/fetcher/WebSearchPaneViewModel.java index dba5c3352da..b88a0cd5fe7 100644 --- a/src/main/java/org/jabref/gui/importer/fetcher/WebSearchPaneViewModel.java +++ b/src/main/java/org/jabref/gui/importer/fetcher/WebSearchPaneViewModel.java @@ -12,6 +12,7 @@ import javafx.collections.FXCollections; import javafx.collections.ObservableList; +import org.jabref.gui.DialogService; import org.jabref.gui.JabRefFrame; import org.jabref.gui.importer.ImportEntriesDialog; import org.jabref.gui.util.BackgroundTask; @@ -25,21 +26,19 @@ import org.jabref.preferences.JabRefPreferences; import org.fxmisc.easybind.EasyBind; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class WebSearchPaneViewModel { - private static final Logger LOGGER = LoggerFactory.getLogger(WebSearchPaneViewModel.class); - private final ObjectProperty selectedFetcher = new SimpleObjectProperty<>(); private final ListProperty fetchers = new SimpleListProperty<>(FXCollections.observableArrayList()); private final StringProperty query = new SimpleStringProperty(); private final JabRefFrame frame; + private final DialogService dialogService; - public WebSearchPaneViewModel(ImportFormatPreferences importPreferences, JabRefFrame frame, JabRefPreferences preferences) { + public WebSearchPaneViewModel(ImportFormatPreferences importPreferences, JabRefFrame frame, JabRefPreferences preferences, DialogService dialogService) { // TODO: Rework so that we don't rely on JabRefFrame and not the complete preferences this.frame = frame; + this.dialogService = dialogService; List allFetchers = WebFetchers.getSearchBasedFetchers(importPreferences); allFetchers.sort(Comparator.comparing(WebFetcher::getName)); @@ -84,12 +83,12 @@ public StringProperty queryProperty() { public void search() { if (StringUtil.isBlank(getQuery())) { - frame.getDialogService().notify(Localization.lang("Please enter a search string")); + dialogService.notify(Localization.lang("Please enter a search string")); return; } if (frame.getCurrentBasePanel() == null) { - frame.getDialogService().notify(Localization.lang("Please open or start a new library before searching")); + dialogService.notify(Localization.lang("Please open or start a new library before searching")); return; } @@ -98,6 +97,8 @@ public void search() { BackgroundTask> task = BackgroundTask.wrap(() -> activeFetcher.performSearch(getQuery().trim())) .withInitialMessage(Localization.lang("Processing %0", getQuery())); + task.onFailure(ex -> dialogService.showErrorDialogAndWait(ex)); + ImportEntriesDialog dialog = new ImportEntriesDialog(frame.getCurrentBasePanel().getBibDatabaseContext(), task); dialog.setTitle(activeFetcher.getName()); dialog.showAndWait(); diff --git a/src/main/java/org/jabref/logic/importer/fetcher/IEEE.java b/src/main/java/org/jabref/logic/importer/fetcher/IEEE.java index ac8192a2360..fc5d33ddeff 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/IEEE.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/IEEE.java @@ -85,10 +85,9 @@ private static BibEntry parseJsonRespone(JSONObject jsonEntry, Character keyword final List authors = new ArrayList<>(); JSONObject authorsContainer = jsonEntry.optJSONObject("authors"); authorsContainer.getJSONArray("authors").forEach(authorPure -> { - JSONObject author = (JSONObject) authorPure; - authors.add(author.optString("full_name")); - } - ); + JSONObject author = (JSONObject) authorPure; + authors.add(author.optString("full_name")); + }); entry.setField(FieldName.AUTHOR, authors.stream().collect(Collectors.joining(" and "))); entry.setField(FieldName.LOCATION, jsonEntry.optString("conference_location")); entry.setField(FieldName.DOI, jsonEntry.optString("doi")); @@ -96,14 +95,18 @@ private static BibEntry parseJsonRespone(JSONObject jsonEntry, Character keyword JSONObject keywordsContainer = jsonEntry.optJSONObject("index_terms"); if (keywordsContainer != null) { - keywordsContainer.getJSONObject("ieee_terms").getJSONArray("terms").forEach(data -> { - String keyword = (String) data; - entry.addKeyword(keyword, keywordSeparator); - }); - keywordsContainer.getJSONObject("author_terms").getJSONArray("terms").forEach(data -> { - String keyword = (String) data; - entry.addKeyword(keyword, keywordSeparator); - }); + if (keywordsContainer.has("ieee_terms")) { + keywordsContainer.getJSONObject("ieee_terms").getJSONArray("terms").forEach(data -> { + String keyword = (String) data; + entry.addKeyword(keyword, keywordSeparator); + }); + } + if (keywordsContainer.has("author_terms")) { + keywordsContainer.getJSONObject("author_terms").getJSONArray("terms").forEach(data -> { + String keyword = (String) data; + entry.addKeyword(keyword, keywordSeparator); + }); + } } entry.setField(FieldName.ISBN, jsonEntry.optString("isbn")); diff --git a/src/test/java/org/jabref/logic/importer/fetcher/IEEETest.java b/src/test/java/org/jabref/logic/importer/fetcher/IEEETest.java index 775218df1e1..80f87293288 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/IEEETest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/IEEETest.java @@ -6,9 +6,11 @@ import java.util.List; import java.util.Optional; +import org.jabref.logic.importer.FetcherException; import org.jabref.logic.importer.ImportFormatPreferences; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.BibtexEntryTypes; +import org.jabref.model.entry.FieldName; import org.jabref.support.DisabledOnCIServer; import org.jabref.testutils.category.FetcherTest; @@ -38,39 +40,31 @@ void setUp() { void findByDOI() throws IOException { entry.setField("doi", "10.1109/ACCESS.2016.2535486"); - assertEquals( - Optional.of( - new URL("https://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931")), - fetcher.findFullText(entry)); + assertEquals(Optional.of(new URL("https://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931&ref=")), + fetcher.findFullText(entry)); } @Test void findByDocumentUrl() throws IOException { entry.setField("url", "https://ieeexplore.ieee.org/document/7421926/"); - assertEquals( - Optional.of( - new URL("https://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931")), - fetcher.findFullText(entry)); + assertEquals(Optional.of(new URL("https://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931&ref=")), + fetcher.findFullText(entry)); } @Test void findByURL() throws IOException { - entry.setField("url", "https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=7421926"); + entry.setField("url", "https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=7421926&ref="); - assertEquals( - Optional.of( - new URL("https://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931")), - fetcher.findFullText(entry)); + assertEquals(Optional.of(new URL("https://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931&ref=")), + fetcher.findFullText(entry)); } @Test void findByOldURL() throws IOException { entry.setField("url", "https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=7421926"); - assertEquals( - Optional.of( - new URL("https://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931")), - fetcher.findFullText(entry)); + assertEquals(Optional.of(new URL("https://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931&ref=")), + fetcher.findFullText(entry)); } @Test @@ -78,10 +72,8 @@ void findByDOIButNotURL() throws IOException { entry.setField("doi", "10.1109/ACCESS.2016.2535486"); entry.setField("url", "http://dx.doi.org/10.1109/ACCESS.2016.2535486"); - assertEquals( - Optional.of( - new URL("https://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931")), - fetcher.findFullText(entry)); + assertEquals(Optional.of(new URL("https://ieeexplore.ieee.org/ielx7/6287639/7419931/07421926.pdf?tp=&arnumber=7421926&isnumber=7419931&ref=")), + fetcher.findFullText(entry)); } @Test @@ -99,23 +91,47 @@ void notFoundByDOI() throws IOException { assertEquals(Optional.empty(), fetcher.findFullText(entry)); } + @Test + void searchResultHasNoKeywordTerms() throws FetcherException { + BibEntry expected = new BibEntry(BibtexEntryTypes.ARTICLE); + + expected.setField("author", "Shatakshi Jha and Ikhlaq Hussain and Bhim Singh and Sukumar Mishra"); + expected.setField("date", "25 2 2019"); + expected.setField("doi", "10.1049/iet-rpg.2018.5648"); + expected.setField("file", ":https\\://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=8636659:PDF"); + expected.setField("issn", "1752-1416"); + expected.setField("issue", "3"); + expected.setField("journaltitle", "IET Renewable Power Generation"); + expected.setField("pages", "418--426"); + expected.setField("publisher", "IET"); + expected.setField("title", "Optimal operation of PV-DG-battery based microgrid with power quality conditioner"); + expected.setField("volume", "13"); + + List fetchedEntries = fetcher.performSearch("8636659"); //article number + fetchedEntries.stream().forEach(entry -> entry.clearField(FieldName.ABSTRACT)); //Remove abstract due to copyright); + assertEquals(Collections.singletonList(expected), fetchedEntries); + + } + @Test void searchByQueryFindsEntry() throws Exception { BibEntry expected = new BibEntry(BibtexEntryTypes.INPROCEEDINGS); expected.setField("author", "Igor Steinmacher and Tayana Uchoa Conte and Christoph Treude and Marco Aurélio Gerosa"); + expected.setField("date", "14-22 May 2016"); expected.setField("eventdate", "14-22 May 2016"); expected.setField("eventtitleaddon", "Austin, TX"); expected.setField("location", "Austin, TX"); expected.setField("doi", "10.1145/2884781.2884806"); - expected.setField("isbn", "New-2005_Electronic_978-1-4503-3900-1"); + expected.setField("isbn", "978-1-4503-3900-1"); + expected.setField("issn", "1558-1225"); expected.setField("journaltitle", "2016 IEEE/ACM 38th International Conference on Software Engineering (ICSE)"); expected.setField("pages", "273--284"); expected.setField("publisher", "IEEE"); - expected.setField("keywords", "Computer bugs, Documentation, Industries, Joining processes, Open source software, Portals, Barriers, Beginners, Joining Process, Newbies, Newcomers, Novices, Obstacles, Onboarding, Open Source Software"); + expected.setField("keywords", "Portals, Documentation, Computer bugs, Joining processes, Industries, Open source software, Newcomers, Newbies, Novices, Beginners, Open Source Software, Barriers, Obstacles, Onboarding, Joining Process"); expected.setField("title", "Overcoming Open Source Project Entry Barriers with a Portal for Newcomers"); - expected.setField("file", ":https\\://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=7886910:PDF"); + expected.setField("file", ":https\\://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=7886910:PDF"); expected.setField("abstract", "Community-based Open Source Software (OSS) projects are usually self-organized and dynamic, receiving contributions from distributed volunteers. Newcomer are important to the survival, long-term success, and continuity of these communities. However, newcomers face many barriers when making their first contribution to an OSS project, leading in many cases to dropouts. Therefore, a major challenge for OSS projects is to provide ways to support newcomers during their first contribution. In this paper, we propose and evaluate FLOSScoach, a portal created to support newcomers to OSS projects. FLOSScoach was designed based on a conceptual model of barriers created in our previous work. To evaluate the portal, we conducted a study with 65 students, relying on qualitative data from diaries, self-efficacy questionnaires, and the Technology Acceptance Model. The results indicate that FLOSScoach played an important role in guiding newcomers and in lowering barriers related to the orientation and contribution process, whereas it was not effective in lowering technical barriers. We also found that FLOSScoach is useful, easy to use, and increased newcomers' confidence to contribute. Our results can help project maintainers on deciding the points that need more attention in order to help OSS project newcomers overcome entry barriers."); - List fetchedEntries = fetcher.performSearch("JabRef Social Barriers Steinmacher Redmiles Austin"); + List fetchedEntries = fetcher.performSearch("Overcoming Open Source Project Entry Barriers with a Portal for Newcomers"); assertEquals(Collections.singletonList(expected), fetchedEntries); } }