From 673e53bdfa3e9bb06d3ab2909caca21cf5773939 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sat, 7 Dec 2019 14:10:18 +0100 Subject: [PATCH 01/21] Fix import into currently open library (#5717) Remove unnecessary parallel execution of `addTab`, which fixes #5537. --- CHANGELOG.md | 1 + src/main/java/org/jabref/JabRefGUI.java | 67 ++++++++++--------- src/main/java/org/jabref/gui/JabRefFrame.java | 46 ++++++------- 3 files changed, 57 insertions(+), 57 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a75af1b603..e62873f5eed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,6 +62,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - The "Automatically set file links" feature now follows symbolic links. [#5664](https://github.com/JabRef/jabref/issues/5664) - After successful import of one or multiple bib entries the main table scrolls to the first imported entry [#5383](https://github.com/JabRef/jabref/issues/5383) - We fixed an exception which occurred when an invalid jstyle was loaded. [#5452](https://github.com/JabRef/jabref/issues/5452) +- We fixed an issue where the command line arguments `importBibtex` and `importToOpen` did not import into the currently open library, but opened a new one. [#5537](https://github.com/JabRef/jabref/issues/5537) - We fixed an error where the preview theme did not adapt to the "Dark" mode [#5463](https://github.com/JabRef/jabref/issues/5463) - We fixed an issue where the merge dialog showed the wrong text colour in "Dark" mode [#5516](https://github.com/JabRef/jabref/issues/5516) - We fixed visibility issues with the scrollbar and group selection highlight in "Dark" mode, and enabled "Dark" mode for the OpenOffice preview in the style selection window. [#5522](https://github.com/JabRef/jabref/issues/5522) diff --git a/src/main/java/org/jabref/JabRefGUI.java b/src/main/java/org/jabref/JabRefGUI.java index e5070ca912b..4ddd788eff9 100644 --- a/src/main/java/org/jabref/JabRefGUI.java +++ b/src/main/java/org/jabref/JabRefGUI.java @@ -3,8 +3,8 @@ import java.io.File; import java.sql.SQLException; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; +import java.util.stream.Collectors; import javafx.application.Platform; import javafx.scene.Scene; @@ -97,6 +97,13 @@ private void openDatabases() { openLastEditedDatabases(); } + // Remove invalid databases + List invalidDatabases = bibDatabases.stream() + .filter(ParserResult::isInvalid) + .collect(Collectors.toList()); + failed.addAll(invalidDatabases); + bibDatabases.removeAll(invalidDatabases); + // passed file (we take the first one) should be focused String focusedFile = bibDatabases.stream() .findFirst() @@ -106,40 +113,34 @@ private void openDatabases() { // Add all bibDatabases databases to the frame: boolean first = false; - if (!bibDatabases.isEmpty()) { - for (Iterator parserResultIterator = bibDatabases.iterator(); parserResultIterator.hasNext();) { - ParserResult pr = parserResultIterator.next(); - // Define focused tab - if (pr.getFile().filter(path -> path.getAbsolutePath().equals(focusedFile)).isPresent()) { - first = true; - } + for (ParserResult pr : bibDatabases) { + // Define focused tab + if (pr.getFile().filter(path -> path.getAbsolutePath().equals(focusedFile)).isPresent()) { + first = true; + } - if (pr.isInvalid()) { - failed.add(pr); - parserResultIterator.remove(); - } else if (pr.getDatabase().isShared()) { - try { - new SharedDatabaseUIManager(mainFrame).openSharedDatabaseFromParserResult(pr); - } catch (SQLException | DatabaseNotSupportedException | InvalidDBMSConnectionPropertiesException | - NotASharedDatabaseException e) { - pr.getDatabaseContext().clearDatabaseFile(); // do not open the original file - pr.getDatabase().clearSharedDatabaseID(); - - LOGGER.error("Connection error", e); - mainFrame.getDialogService().showErrorDialogAndWait( - Localization.lang("Connection error"), - Localization.lang("A local copy will be opened."), - e); - } - toOpenTab.add(pr); - } else if (pr.toOpenTab()) { - // things to be appended to an opened tab should be done after opening all tabs - // add them to the list - toOpenTab.add(pr); - } else { - mainFrame.addParserResult(pr, first); - first = false; + if (pr.getDatabase().isShared()) { + try { + new SharedDatabaseUIManager(mainFrame).openSharedDatabaseFromParserResult(pr); + } catch (SQLException | DatabaseNotSupportedException | InvalidDBMSConnectionPropertiesException | + NotASharedDatabaseException e) { + pr.getDatabaseContext().clearDatabaseFile(); // do not open the original file + pr.getDatabase().clearSharedDatabaseID(); + + LOGGER.error("Connection error", e); + mainFrame.getDialogService().showErrorDialogAndWait( + Localization.lang("Connection error"), + Localization.lang("A local copy will be opened."), + e); } + toOpenTab.add(pr); + } else if (pr.toOpenTab()) { + // things to be appended to an opened tab should be done after opening all tabs + // add them to the list + toOpenTab.add(pr); + } else { + mainFrame.addParserResult(pr, first); + first = false; } } diff --git a/src/main/java/org/jabref/gui/JabRefFrame.java b/src/main/java/org/jabref/gui/JabRefFrame.java index 39c5c3c72b3..541da4646e2 100644 --- a/src/main/java/org/jabref/gui/JabRefFrame.java +++ b/src/main/java/org/jabref/gui/JabRefFrame.java @@ -972,37 +972,35 @@ public void updateAllTabTitles() { } public void addTab(BasePanel basePanel, boolean raisePanel) { - DefaultTaskExecutor.runInJavaFXThread(() -> { - // add tab - Tab newTab = new Tab(basePanel.getTabTitle(), basePanel); - tabbedPane.getTabs().add(newTab); - newTab.setOnCloseRequest(event -> { - closeTab((BasePanel) newTab.getContent()); - event.consume(); - }); + // add tab + Tab newTab = new Tab(basePanel.getTabTitle(), basePanel); + tabbedPane.getTabs().add(newTab); + newTab.setOnCloseRequest(event -> { + closeTab((BasePanel) newTab.getContent()); + event.consume(); + }); - // update all tab titles - updateAllTabTitles(); + // update all tab titles + updateAllTabTitles(); - if (raisePanel) { - tabbedPane.getSelectionModel().select(newTab); - } + if (raisePanel) { + tabbedPane.getSelectionModel().select(newTab); + } - // Register undo/redo listener - basePanel.getUndoManager().registerListener(new UndoRedoEventManager()); + // Register undo/redo listener + basePanel.getUndoManager().registerListener(new UndoRedoEventManager()); - BibDatabaseContext context = basePanel.getBibDatabaseContext(); + BibDatabaseContext context = basePanel.getBibDatabaseContext(); - if (readyForAutosave(context)) { - AutosaveManager autosaver = AutosaveManager.start(context); - autosaver.registerListener(new AutosaveUIManager(basePanel)); - } + if (readyForAutosave(context)) { + AutosaveManager autosaver = AutosaveManager.start(context); + autosaver.registerListener(new AutosaveUIManager(basePanel)); + } - BackupManager.start(context, Globals.entryTypesManager, prefs); + BackupManager.start(context, Globals.entryTypesManager, prefs); - // Track opening - trackOpenNewDatabase(basePanel); - }); + // Track opening + trackOpenNewDatabase(basePanel); } private void trackOpenNewDatabase(BasePanel basePanel) { From 4f9ac1948501a4a6d858e87b638d4e59f354da5a Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sun, 8 Dec 2019 14:05:00 +0100 Subject: [PATCH 02/21] Try to fix csl update (#5718) --- .github/failure-csl-update | 5 +++++ .github/workflows/refresh-csl-subtrees.yml | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 .github/failure-csl-update diff --git a/.github/failure-csl-update b/.github/failure-csl-update new file mode 100644 index 00000000000..0b9ab11c20f --- /dev/null +++ b/.github/failure-csl-update @@ -0,0 +1,5 @@ +--- +title: Error while updating citation styles +labels: code-quality, dependencies +--- +[Update of citation styles failed!](https://github.com/JabRef/jabref/actions?query=workflow%3A%22Refresh+Citation+Style+Language+Files%22) diff --git a/.github/workflows/refresh-csl-subtrees.yml b/.github/workflows/refresh-csl-subtrees.yml index ef0d6bd1eff..e3b45237672 100644 --- a/.github/workflows/refresh-csl-subtrees.yml +++ b/.github/workflows/refresh-csl-subtrees.yml @@ -11,7 +11,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout source - uses: actions/checkout@v1 + uses: actions/checkout@v2-beta + with: + ref: master - name: Add csl-styles remote run: git remote add -f csl-styles https://github.com/citation-style-language/styles.git - name: Update csl-styles @@ -23,3 +25,10 @@ jobs: - uses: ad-m/github-push-action@master with: github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Report issues + if: failure() + uses: JasonEtco/create-an-issue@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + filename: .github/failure-csl-update.md From a86b0bff1debca863c593dfc80d2e4868de170d4 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Sun, 8 Dec 2019 15:43:49 +0100 Subject: [PATCH 03/21] Fix upload to GitHub artifacts (#5712) --- .github/workflows/deployment.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index fbb322b4bac..55c2c44a690 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -94,11 +94,6 @@ jobs: export BADASS_JLINK_JPACKAGE_HOME="${GITHUB_WORKSPACE}${{ matrix.jdk14Path }}" ./gradlew -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jpackage shell: bash - - name: Add installer as artifact - uses: actions/upload-artifact@master - with: - name: JabRef-${{ matrix.displayName }} - path: build/distribution - name: Package application image run: ${{ matrix.archivePortable }} shell: bash @@ -115,6 +110,11 @@ jobs: get-childitem -Path build/distribution/* | rename-item -NewName {$_.name -replace "${{ steps.gitversion.outputs.AssemblySemVer }}","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}"} get-childitem -Path build/distribution/* | rename-item -NewName {$_.name -replace "portable","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}-portable"} shell: pwsh + - name: Upload to GitHub workflow artifacts store + uses: actions/upload-artifact@master + with: + name: JabRef-${{ matrix.displayName }} + path: build/distribution - name: Upload to builds.jabref.org uses: garygrossgarten/github-action-scp@release with: From 5fef4a422b6e69f88f1bd0a0644d58bf73632f80 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2019 07:18:05 +0000 Subject: [PATCH 04/21] Bump tika-core from 1.22 to 1.23 Bumps [tika-core](https://github.com/apache/tika) from 1.22 to 1.23. - [Release notes](https://github.com/apache/tika/releases) - [Changelog](https://github.com/apache/tika/blob/master/CHANGES.txt) - [Commits](https://github.com/apache/tika/compare/1.22...1.23) Signed-off-by: dependabot-preview[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 052646af9f8..3f797f4998f 100644 --- a/build.gradle +++ b/build.gradle @@ -116,7 +116,7 @@ dependencies { compile group: 'org.apache.commons', name: 'commons-csv', version: '1.7' - compile group: 'org.apache.tika', name: 'tika-core', version: '1.22' + compile group: 'org.apache.tika', name: 'tika-core', version: '1.23' // required for reading write-protected PDFs - see https://github.com/JabRef/jabref/pull/942#issuecomment-209252635 compile 'org.bouncycastle:bcprov-jdk15on:1.64' From 58ce0d3f723b7378ef4372e9b103f38df8fbc4dc Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2019 07:18:31 +0000 Subject: [PATCH 05/21] Bump postgresql from 42.2.8 to 42.2.9 Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.2.8 to 42.2.9. - [Release notes](https://github.com/pgjdbc/pgjdbc/releases) - [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md) - [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.2.8...REL42.2.9) Signed-off-by: dependabot-preview[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 052646af9f8..bb89ca7acb2 100644 --- a/build.gradle +++ b/build.gradle @@ -142,7 +142,7 @@ dependencies { compile group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '2.5.2' - compile 'org.postgresql:postgresql:42.2.8' + compile 'org.postgresql:postgresql:42.2.9' compile ('com.oracle.ojdbc:ojdbc10:19.3.0.0') { // causing module issues From 5f3cc8a34632f2515d750ab06179cb3b0e8d4a0a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2019 07:18:57 +0000 Subject: [PATCH 06/21] Bump unirest-java from 3.2.00 to 3.3.00 Bumps [unirest-java](https://github.com/Kong/unirest-java) from 3.2.00 to 3.3.00. - [Release notes](https://github.com/Kong/unirest-java/releases) - [Changelog](https://github.com/Kong/unirest-java/blob/master/CHANGELOG.md) - [Commits](https://github.com/Kong/unirest-java/compare/v3.2.00...v3.3.00) Signed-off-by: dependabot-preview[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 052646af9f8..c262180ddd0 100644 --- a/build.gradle +++ b/build.gradle @@ -169,7 +169,7 @@ dependencies { compile 'org.controlsfx:controlsfx:11.0.1' compile 'org.jsoup:jsoup:1.12.1' - compile 'com.konghq:unirest-java:3.2.00' + compile 'com.konghq:unirest-java:3.3.00' compile 'org.slf4j:slf4j-api:2.0.0-alpha1' compile group: 'org.apache.logging.log4j', name: 'log4j-jcl', version: '3.0.0-SNAPSHOT' From d43c31d872061b62c156225c3c431f3a58dc14ed Mon Sep 17 00:00:00 2001 From: Christoph Date: Mon, 9 Dec 2019 14:07:21 +0100 Subject: [PATCH 07/21] New translations JabRef_en.properties (French) --- src/main/resources/l10n/JabRef_fr.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/l10n/JabRef_fr.properties b/src/main/resources/l10n/JabRef_fr.properties index db4e5962b54..50765b187f8 100644 --- a/src/main/resources/l10n/JabRef_fr.properties +++ b/src/main/resources/l10n/JabRef_fr.properties @@ -933,7 +933,7 @@ Value\ set\ externally=Valeur paramétrée externalement verify\ that\ LyX\ is\ running\ and\ that\ the\ lyxpipe\ is\ valid=vérifier que LyX tourne et que le canal de transmission LyX est valide -View=Aperçu +View=Affichage Vim\ server\ name=Nom du serveur Vim Warn\ about\ unresolved\ duplicates\ when\ closing\ inspection\ window=Avertir des doublons non résolus lors de la fermeture de la fenêtre d'inspection From 936eedf433288490313b5365e86215c82dfe0ecc Mon Sep 17 00:00:00 2001 From: Kai Takac Date: Mon, 9 Dec 2019 21:43:49 +0100 Subject: [PATCH 08/21] Fix #5603 - account for file extension in file name length (#5726) * Fix #5603 - account for file extension in file name length * Update changelog --- CHANGELOG.md | 1 + src/main/java/org/jabref/logic/util/io/FileUtil.java | 2 +- src/test/java/org/jabref/logic/util/io/FileUtilTest.java | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e62873f5eed..6b28e1370db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,6 +71,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - We fixed an issue where the side pane was not remembering its position. [#5615](https://github.com/JabRef/jabref/issues/5615) - We fixed an issue where JabRef could not interact with [Oracle XE](https://www.oracle.com/de/database/technologies/appdev/xe.html) in the [shared SQL database setup](https://docs.jabref.org/collaborative-work/sqldatabase). - We fixed an issue where the toolbar icons were hidden on smaller screens. +- We fixed an issue where renaming referenced files for bib entries with long titles was not possible. [#5603](https://github.com/JabRef/jabref/issues/5603) ### Removed diff --git a/src/main/java/org/jabref/logic/util/io/FileUtil.java b/src/main/java/org/jabref/logic/util/io/FileUtil.java index bbaa00159e3..1a489720431 100644 --- a/src/main/java/org/jabref/logic/util/io/FileUtil.java +++ b/src/main/java/org/jabref/logic/util/io/FileUtil.java @@ -79,7 +79,7 @@ public static String getValidFileName(String fileName) { if (nameWithoutExtension.length() > MAXIMUM_FILE_NAME_LENGTH) { Optional extension = getFileExtension(fileName); - String shortName = nameWithoutExtension.substring(0, MAXIMUM_FILE_NAME_LENGTH); + String shortName = nameWithoutExtension.substring(0, MAXIMUM_FILE_NAME_LENGTH - extension.map(s -> s.length() + 1).orElse(0)); LOGGER.info(String.format("Truncated the too long filename '%s' (%d characters) to '%s'.", fileName, fileName.length(), shortName)); return extension.map(s -> shortName + "." + s).orElse(shortName); } diff --git a/src/test/java/org/jabref/logic/util/io/FileUtilTest.java b/src/test/java/org/jabref/logic/util/io/FileUtilTest.java index 803eec50de0..be50604045f 100644 --- a/src/test/java/org/jabref/logic/util/io/FileUtilTest.java +++ b/src/test/java/org/jabref/logic/util/io/FileUtilTest.java @@ -343,7 +343,7 @@ void validFilenameWithoutExtension() { @Test void validFilenameShouldBeMaximum255Chars() { - String longestValidFilename = Stream.generate(() -> String.valueOf('1')).limit(FileUtil.MAXIMUM_FILE_NAME_LENGTH).collect(Collectors.joining()) + ".pdf"; + String longestValidFilename = Stream.generate(() -> String.valueOf('1')).limit(FileUtil.MAXIMUM_FILE_NAME_LENGTH - 4).collect(Collectors.joining()) + ".pdf"; String longerFilename = Stream.generate(() -> String.valueOf('1')).limit(260).collect(Collectors.joining()) + ".pdf"; assertEquals(longestValidFilename, FileUtil.getValidFileName(longerFilename)); } From 473774caa93392ae68156958540cd867cab99d2a Mon Sep 17 00:00:00 2001 From: Luis Romero Date: Tue, 10 Dec 2019 17:11:42 -0700 Subject: [PATCH 09/21] Fixed untranslated Strings issue #5701 --- .../jabref/gui/bibtexkeypattern/BibtexKeyPatternTable.fxml | 4 ++-- src/main/java/org/jabref/gui/groups/GroupTree.fxml | 2 +- .../java/org/jabref/gui/preferences/BibtexKeyPatternTab.fxml | 2 +- src/main/java/org/jabref/gui/preferences/TableColumnsTab.fxml | 2 +- src/main/resources/l10n/JabRef_en.properties | 3 +++ 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/jabref/gui/bibtexkeypattern/BibtexKeyPatternTable.fxml b/src/main/java/org/jabref/gui/bibtexkeypattern/BibtexKeyPatternTable.fxml index a905a82060b..5b2924eb764 100644 --- a/src/main/java/org/jabref/gui/bibtexkeypattern/BibtexKeyPatternTable.fxml +++ b/src/main/java/org/jabref/gui/bibtexkeypattern/BibtexKeyPatternTable.fxml @@ -7,8 +7,8 @@ xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.jabref.gui.bibtexkeypattern.BibtexKeyPatternTableView"> - - + + diff --git a/src/main/java/org/jabref/gui/groups/GroupTree.fxml b/src/main/java/org/jabref/gui/groups/GroupTree.fxml index ea9b692ef1b..4d5302c133f 100644 --- a/src/main/java/org/jabref/gui/groups/GroupTree.fxml +++ b/src/main/java/org/jabref/gui/groups/GroupTree.fxml @@ -42,7 +42,7 @@ - + diff --git a/src/main/java/org/jabref/gui/preferences/BibtexKeyPatternTab.fxml b/src/main/java/org/jabref/gui/preferences/BibtexKeyPatternTab.fxml index 7e587331443..fef824f86b5 100644 --- a/src/main/java/org/jabref/gui/preferences/BibtexKeyPatternTab.fxml +++ b/src/main/java/org/jabref/gui/preferences/BibtexKeyPatternTab.fxml @@ -56,6 +56,6 @@ -