Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into oo-architecture
Browse files Browse the repository at this point in the history
* upstream/main:
  Fix NPE when saving preferences (JabRef#11509)
  Switch to stream-based loading (JabRef#11479)
  Save unlinked local files dialog prefs (JabRef#11493)
  Add minimal support for biblatex data annotations (JabRef#11506)
  Fix handling of relative-file storage and auto linking (JabRef#11492)
  New Crowdin updates (JabRef#11504)
  Add missing issue numbers
  CSL4LibreOffice - A [GSoC '24] (JabRef#11477)
  Bump src/main/resources/csl-styles from `b2be5ae` to `fd6cb3e` (JabRef#11501)
  Bump gittools/actions from 1.1.1 to 1.2.0 (JabRef#11500)
  Bump com.kohlschutter.junixsocket:junixsocket-core from 2.9.1 to 2.10.0 (JabRef#11498)
  Bump commons-logging:commons-logging from 1.3.2 to 1.3.3 (JabRef#11499)
  Bump org.jsoup:jsoup from 1.17.2 to 1.18.1 (JabRef#11497)
  Bump com.kohlschutter.junixsocket:junixsocket-mysql from 2.9.1 to 2.10.0 (JabRef#11496)
  Bump org.openrewrite.recipe:rewrite-recipe-bom from 2.14.0 to 2.15.0 (JabRef#11495)
  FAQ updates (JabRef#11486)
  Update Gradle Wrapper from 8.8 to 8.9.
  Fix Chocolate.bib (JabRef#11491)

# Conflicts:
#	src/main/java/org/jabref/gui/openoffice/OOBibBase.java
#	src/main/java/org/jabref/gui/openoffice/OpenOfficePanel.java
#	src/main/java/org/jabref/gui/openoffice/StyleSelectDialogView.java
#	src/main/java/org/jabref/gui/openoffice/StyleSelectDialogViewModel.java
#	src/main/java/org/jabref/preferences/JabRefPreferences.java
  • Loading branch information
Siedlerchr committed Jul 19, 2024
2 parents c7acad8 + ea00fe6 commit 85873c2
Show file tree
Hide file tree
Showing 83 changed files with 536 additions and 257 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deployment-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ jobs:
submodules: 'true'
show-progress: 'false'
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v1.1.1
uses: gittools/actions/gitversion/setup@v1.2.0
with:
versionSpec: "5.x"
- name: Run GitVersion
id: gitversion
uses: gittools/actions/gitversion/execute@v1.1.1
uses: gittools/actions/gitversion/execute@v1.2.0
- name: Setup JDK
uses: actions/setup-java@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deployment-jdk-ea.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ jobs:
packages: pigz
version: 1.0
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v1.1.1
uses: gittools/actions/gitversion/setup@v1.2.0
with:
versionSpec: "5.x"
- name: Run GitVersion
id: gitversion
uses: gittools/actions/gitversion/execute@v1.1.1
uses: gittools/actions/gitversion/execute@v1.2.0

# JDK
- name: 'Set up JDK ${{ matrix.jdk }}'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ jobs:
packages: pigz
version: 1.0
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v1.1.1
uses: gittools/actions/gitversion/setup@v1.2.0
with:
versionSpec: "5.x"
- name: Run GitVersion
id: gitversion
uses: gittools/actions/gitversion/execute@v1.1.1
uses: gittools/actions/gitversion/execute@v1.2.0
- name: Setup JDK
uses: actions/setup-java@v4
with:
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,18 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
### Added

- We added support for selecting and using CSL Styles in JabRef's OpenOffice/LibreOffice integration for inserting bibliographic and in-text citations into a document.
- We added support for selecting and using CSL Styles in JabRef's OpenOffice/LibreOffice integration for inserting bibliographic and in-text citations into a document. [#2146](https://github.com/JabRef/jabref/issues/2146), [#8893](https://github.com/JabRef/jabref/issues/8893)
- Added minimal support for [biblatex data annotation](https://mirrors.ctan.org/macros/latex/contrib/biblatex/doc/biblatex.pdf#subsection.3.7) fields in .layout files. [#11505](https://github.com/JabRef/jabref/issues/11505)
- Added saving of selected options in the [Lookup -> Search for unlinked local files dialog](https://docs.jabref.org/collect/findunlinkedfiles#link-the-pdfs-to-your-bib-library). [#11439](https://github.com/JabRef/jabref/issues/11439)

### Changed

- JabRef respects the [configuration for storing files relative to the .bib file](https://docs.jabref.org/finding-sorting-and-cleaning-entries/filelinks#directories-for-files) in more cases. [#11492](https://github.com/JabRef/jabref/pull/11492)

### Fixed

- We fixed an issue where an exception was thrown after changing "show preview as a tab" in the preferences. [#11509](https://github.com/JabRef/jabref/pull/11509)

### Removed


Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ dependencies {
implementation group: 'org.apache.commons', name: 'commons-csv', version: '1.11.0'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.14.0'
implementation group: 'org.apache.commons', name: 'commons-text', version: '1.12.0'
implementation 'commons-logging:commons-logging:1.3.2'
implementation 'commons-logging:commons-logging:1.3.3'
implementation 'com.h2database:h2-mvstore:2.2.224'

// required for reading write-protected PDFs - see https://github.com/JabRef/jabref/pull/942#issuecomment-209252635
Expand Down Expand Up @@ -198,8 +198,8 @@ dependencies {
implementation 'org.postgresql:postgresql:42.7.3'

// Support unix socket connection types
implementation 'com.kohlschutter.junixsocket:junixsocket-core:2.9.1'
implementation 'com.kohlschutter.junixsocket:junixsocket-mysql:2.9.1'
implementation 'com.kohlschutter.junixsocket:junixsocket-core:2.10.0'
implementation 'com.kohlschutter.junixsocket:junixsocket-mysql:2.10.0'

implementation ('com.oracle.ojdbc:ojdbc10:19.3.0.0') {
// causing module issues
Expand Down Expand Up @@ -240,7 +240,7 @@ dependencies {

implementation 'org.controlsfx:controlsfx:11.2.1'

implementation 'org.jsoup:jsoup:1.17.2'
implementation 'org.jsoup:jsoup:1.18.1'
implementation 'com.konghq:unirest-java-core:4.4.0'
implementation 'com.konghq:unirest-modules-gson:4.4.0'
implementation 'org.apache.httpcomponents.client5:httpclient5:5.3.1'
Expand Down Expand Up @@ -328,7 +328,7 @@ dependencies {
xjc group: 'org.glassfish.jaxb', name: 'jaxb-xjc', version: '3.0.2'
xjc group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '3.0.2'

rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:2.14.0"))
rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:2.15.0"))
rewrite("org.openrewrite.recipe:rewrite-static-analysis")
rewrite("org.openrewrite.recipe:rewrite-logging-frameworks")
rewrite("org.openrewrite.recipe:rewrite-testing-frameworks")
Expand Down
32 changes: 27 additions & 5 deletions docs/code-howtos/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,36 @@ parent: Code Howtos

Following is a list of common errors encountered by developers which lead to failing tests, with their common solutions:

* `org.jabref.architecture.MainArchitectureTest` `restrictStandardStreams` <span style="color:red">FAILED</span>
* <span style="color:green">Fix</span> : Check if you've used ```System.out.println(...)``` (the standard output stream) to log anything into the console. This is an architectural violation, as you should use the Logger instead for logging. More details on how to log can be found [here](https://devdocs.jabref.org/code-howtos/logging.html).
* Failing <b>Checkstyle</b> tests:
* <span style="color:green">Fix</span>: JabRef follows a pre-defined style of code for uniformity and maintainability that must be adhered to during development. To set up warnings and auto-fixes conforming to these style rules in your IDE, follow [Step 3](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/intellij-13-code-style.html) of the process to set up a local workspace in the documentation. Ideally, follow all the [set up rules](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/) in the documentation end-to-end to avoid typical set-up errors.<br> <b>Note</b>: The steps provided in the documentation are for IntelliJ, which is the preferred IDE for Java development. The `checkstyle.xml` is also available for VSCode, in the same directory as mentioned in the steps.

* `org.jabref.architecture.MainArchitectureTest` `doNotUseLogicInModel` <span style="color:red">FAILED</span>
* <span style="color:green">Fix</span> : One common case when this test fails is when you put any class purely containing business logic at some level inside the ```model``` directory (```org/jabref/model/```). To fix this, shift the class to a subdirectory within the ```logic``` directory (```org/jabref/logic/```).
* Failing <b>OpenRewrite</b> tests:
* <span style="color:green">Fix</span>: [OpenRewrite](https://docs.openrewrite.org/) is an automated refactoring ecosystem for source code. Execute the Gradle task `rewriteRun` from the `rewrite` group of the Gradle Tool window in IntelliJ to apply the automated refactoring and pass the test.<br>
![Executing Gradle task rewriteRun](../images/rewriteRun.png)<br>

* `org.jabref.logic.l10n.LocalizationConsistencyTest` `findMissingLocalizationKeys` <span style="color:red">FAILED</span>
* <span style="color:green">Fix</span> : You have probably used Strings that are visible on the UI (to the user) but not wrapped them using ```Localization.lang(...)``` and added them to the [localization properties file](https://github.com/JabRef/jabref/blob/main/src/main/resources/l10n/JabRef_en.properties).
* <span style="color:green">Fix</span>: You have probably used Strings that are visible on the UI (to the user) but not wrapped them using `Localization.lang(...)` and added them to the [localization properties file](https://github.com/JabRef/jabref/blob/main/src/main/resources/l10n/JabRef_en.properties).
Read more about the background and format of localization in JabRef [here](https://devdocs.jabref.org/code-howtos/localization.html).

* `org.jabref.logic.l10n.LocalizationConsistencyTest` `findObsoleteLocalizationKeys` <span style="color:red">FAILED</span>
* <span style="color:green">Fix</span>: There are localization keys [localization properties file](https://github.com/JabRef/jabref/blob/main/src/main/resources/l10n/JabRef_en.properties) that are not used in the code, probably due to the removal of existing code. Navigate to the unused key-value pairs in the file and remove them. You can always click on the details of the failing test to pinpoint which keys are unused.
Read more about the background and format of localization in JabRef [here](https://devdocs.jabref.org/code-howtos/localization.html).

* `org.jabref.logic.citationstyle.CitationStyle` `discoverCitationStyles` <span style="color:red">ERROR: Could not find any citation style. Tried with /ieee.csl.</span>
* <span style="color:green">Fix</span>: Check the directory `src/main/resources/csl-styles`. If it is missing or empty, run `git submodule update`. Now, check inside if `ieee.csl` exists. If it does not, run `git reset --hard` <b>inside that directory</b>.

* `java.lang.IllegalArgumentException`: Unable to load locale en-US<br> <span style="color:red">ERROR: Could not generate BibEntry citation. The CSL engine could not create a preview for your item.</span>
* <span style="color:green">Fix</span>: Check the directory `src/main/resources/csl-locales`. If it is missing or empty, run `git submodule update`. If still not fixed, run `git reset --hard` <b>inside that directory</b>.

* `org.jabref.architecture.MainArchitectureTest` `restrictStandardStreams` <span style="color:red">FAILED</span>
* <span style="color:green">Fix</span>: Check if you've used `System.out.println(...)` (the standard output stream) to log anything into the console. This is an architectural violation, as you should use the Logger instead for logging. More details on how to log can be found [here](https://devdocs.jabref.org/code-howtos/logging.html).

* `org.jabref.architecture.MainArchitectureTest` `doNotUseLogicInModel` <span style="color:red">FAILED</span>
* <span style="color:green">Fix</span>: One common case when this test fails is when you put any class purely containing business logic inside the `model` package (i.e., inside the directory `org/jabref/model/`). To fix this, shift the class to a sub-package within the `logic` package (i.e., the directory`org/jabref/logic/`). An efficient way to do this is to use IntelliJ's built-in refactoring capabilities - right-click on the file, go to "Refactor" and use "Move Class". The import statement for all the classes using this class will be automatically adjusted according to the new location.<br>
![Moving a file using refactor](../images/refactor-moving.png)<br>

* `ANTLR Tool version 4.12.0 used for code generation does not match the current runtime version 4.13.1`
* <span style="color:green">Fix</span>: Execute the Gradle task `clean` from the `build` group of the Gradle Tool Window in IntelliJ:<br>
![Executing Gradle task clean](../images/clean.png)<br>

<!-- markdownlint-disable-file MD033 -->
Binary file added docs/images/clean.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/refactor-moving.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/rewriteRun.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=a4b4158601f8636cdeeab09bd76afb640030bb5b144aafe261a5e8af027dc612
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionSha256Sum=d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
5 changes: 4 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.jabref.architecture;

/**
* Annotation to indicate that this logic class can use class.getResource().
* Mostly, because {@link java.nio.file.Path} is not used.
* See <a href="graal#7682">https://github.com/oracle/graal/issues/7682</a> for a longer discussion.
*/
public @interface AllowedToUseClassGetResource {
// The rationale
String value();
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* Annotation to indicate that this logic class can access swing
*/
public @interface AllowedToUseSwing {

// The rationale
String value();
}
5 changes: 3 additions & 2 deletions src/main/java/org/jabref/gui/entryeditor/EntryEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ public EntryEditor(LibraryTab libraryTab, UndoAction undoAction, RedoAction redo
activeTab.notifyAboutFocus(currentlyEditedEntry);
}
});
EasyBind.listen(preferencesService.getPreviewPreferences().showPreviewAsExtraTabProperty(),
(obs, oldValue, newValue) -> adaptVisibleTabs());
}

private void setupDragAndDrop(LibraryTab libraryTab) {
Expand Down Expand Up @@ -386,6 +384,9 @@ public void setCurrentlyEditedEntry(BibEntry currentlyEditedEntry) {
getSelectedTab().notifyAboutFocus(currentlyEditedEntry);
});

EasyBind.listen(preferencesService.getPreviewPreferences().showPreviewAsExtraTabProperty(),
(obs, oldValue, newValue) -> adaptVisibleTabs());

adaptVisibleTabs();
setupToolBar();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

import org.jabref.gui.externalfiletype.ExternalFileType;
import org.jabref.gui.externalfiletype.ExternalFileTypes;
Expand Down Expand Up @@ -52,6 +51,7 @@ public List<IOException> getFileExceptions() {
}

private static final Logger LOGGER = LoggerFactory.getLogger(AutoSetFileLinksUtil.class);

private final List<Path> directories;
private final AutoLinkPreferences autoLinkPreferences;
private final FilePreferences filePreferences;
Expand Down Expand Up @@ -106,7 +106,9 @@ public LinkFilesResult linkAssociatedFiles(List<BibEntry> entries, NamedCompound
public List<LinkedFile> findAssociatedNotLinkedFiles(BibEntry entry) throws IOException {
List<LinkedFile> linkedFiles = new ArrayList<>();

List<String> extensions = filePreferences.getExternalFileTypes().stream().map(ExternalFileType::getExtension).collect(Collectors.toList());
List<String> extensions = filePreferences.getExternalFileTypes().stream().map(ExternalFileType::getExtension).toList();

LOGGER.debug("Searching for extensions {} in directories {}", extensions, directories);

// Run the search operation
FileFinder fileFinder = FileFinders.constructFromConfiguration(autoLinkPreferences);
Expand Down Expand Up @@ -134,6 +136,7 @@ public List<LinkedFile> findAssociatedNotLinkedFiles(BibEntry entry) throws IOEx
Path relativeFilePath = FileUtil.relativize(foundFile, directories);
LinkedFile linkedFile = new LinkedFile("", relativeFilePath, strType);
linkedFiles.add(linkedFile);
LOGGER.debug("Found file {} for entry {}", linkedFile, entry.getCitationKey());
}
}

Expand Down
14 changes: 11 additions & 3 deletions src/main/java/org/jabref/gui/externalfiles/DateRange.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,19 @@ public enum DateRange {

private final String dateRange;

DateRange(String dateRange) {
DateRange(String dateRange) {
this.dateRange = dateRange;
}

public static DateRange parse(String name) {
try {
return DateRange.valueOf(name);
} catch (IllegalArgumentException e) {
return ALL_TIME;
}
}

public String getDateRange() {
return dateRange;
}
return dateRange;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ public enum ExternalFileSorter {
this.sorter = sorter;
}

public static ExternalFileSorter parse(String name) {
try {
return ExternalFileSorter.valueOf(name);
} catch (IllegalArgumentException e) {
return DEFAULT;
}
}

public String getSorter() {
return sorter;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,22 @@

public class FileExtensionViewModel {

private final String name;
private final String description;
private final List<String> extensions;
private final FilePreferences filePreferences;

FileExtensionViewModel(FileType fileType, FilePreferences filePreferences) {
this.name = fileType.getName();
this.description = Localization.lang("%0 file", fileType.getName());
this.extensions = fileType.getExtensionsWithAsteriskAndDot();
this.filePreferences = filePreferences;
}

public String getName() {
return this.name;
}

public String getDescription() {
return this.description + extensions.stream().collect(Collectors.joining(", ", " (", ")"));
}
Expand Down
Loading

0 comments on commit 85873c2

Please sign in to comment.