Skip to content

Commit 85873c2

Browse files
committed
Merge remote-tracking branch 'upstream/main' into oo-architecture
* 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
2 parents c7acad8 + ea00fe6 commit 85873c2

File tree

83 files changed

+536
-257
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+536
-257
lines changed

.github/workflows/deployment-arm64.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ jobs:
6666
submodules: 'true'
6767
show-progress: 'false'
6868
- name: Install GitVersion
69-
uses: gittools/actions/gitversion/setup@v1.1.1
69+
uses: gittools/actions/gitversion/setup@v1.2.0
7070
with:
7171
versionSpec: "5.x"
7272
- name: Run GitVersion
7373
id: gitversion
74-
uses: gittools/actions/gitversion/execute@v1.1.1
74+
uses: gittools/actions/gitversion/execute@v1.2.0
7575
- name: Setup JDK
7676
uses: actions/setup-java@v4
7777
with:

.github/workflows/deployment-jdk-ea.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,12 @@ jobs:
8484
packages: pigz
8585
version: 1.0
8686
- name: Install GitVersion
87-
uses: gittools/actions/gitversion/setup@v1.1.1
87+
uses: gittools/actions/gitversion/setup@v1.2.0
8888
with:
8989
versionSpec: "5.x"
9090
- name: Run GitVersion
9191
id: gitversion
92-
uses: gittools/actions/gitversion/execute@v1.1.1
92+
uses: gittools/actions/gitversion/execute@v1.2.0
9393

9494
# JDK
9595
- name: 'Set up JDK ${{ matrix.jdk }}'

.github/workflows/deployment.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ jobs:
7979
packages: pigz
8080
version: 1.0
8181
- name: Install GitVersion
82-
uses: gittools/actions/gitversion/setup@v1.1.1
82+
uses: gittools/actions/gitversion/setup@v1.2.0
8383
with:
8484
versionSpec: "5.x"
8585
- name: Run GitVersion
8686
id: gitversion
87-
uses: gittools/actions/gitversion/execute@v1.1.1
87+
uses: gittools/actions/gitversion/execute@v1.2.0
8888
- name: Setup JDK
8989
uses: actions/setup-java@v4
9090
with:

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,18 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
1212
### Added
1313

1414
- 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.
15+
- 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)
16+
- 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)
17+
- 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)
1518

1619
### Changed
1720

21+
- 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)
22+
1823
### Fixed
1924

25+
- 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)
26+
2027
### Removed
2128

2229

build.gradle

+5-5
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ dependencies {
168168
implementation group: 'org.apache.commons', name: 'commons-csv', version: '1.11.0'
169169
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.14.0'
170170
implementation group: 'org.apache.commons', name: 'commons-text', version: '1.12.0'
171-
implementation 'commons-logging:commons-logging:1.3.2'
171+
implementation 'commons-logging:commons-logging:1.3.3'
172172
implementation 'com.h2database:h2-mvstore:2.2.224'
173173

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

200200
// Support unix socket connection types
201-
implementation 'com.kohlschutter.junixsocket:junixsocket-core:2.9.1'
202-
implementation 'com.kohlschutter.junixsocket:junixsocket-mysql:2.9.1'
201+
implementation 'com.kohlschutter.junixsocket:junixsocket-core:2.10.0'
202+
implementation 'com.kohlschutter.junixsocket:junixsocket-mysql:2.10.0'
203203

204204
implementation ('com.oracle.ojdbc:ojdbc10:19.3.0.0') {
205205
// causing module issues
@@ -240,7 +240,7 @@ dependencies {
240240

241241
implementation 'org.controlsfx:controlsfx:11.2.1'
242242

243-
implementation 'org.jsoup:jsoup:1.17.2'
243+
implementation 'org.jsoup:jsoup:1.18.1'
244244
implementation 'com.konghq:unirest-java-core:4.4.0'
245245
implementation 'com.konghq:unirest-modules-gson:4.4.0'
246246
implementation 'org.apache.httpcomponents.client5:httpclient5:5.3.1'
@@ -328,7 +328,7 @@ dependencies {
328328
xjc group: 'org.glassfish.jaxb', name: 'jaxb-xjc', version: '3.0.2'
329329
xjc group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '3.0.2'
330330

331-
rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:2.14.0"))
331+
rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:2.15.0"))
332332
rewrite("org.openrewrite.recipe:rewrite-static-analysis")
333333
rewrite("org.openrewrite.recipe:rewrite-logging-frameworks")
334334
rewrite("org.openrewrite.recipe:rewrite-testing-frameworks")

docs/code-howtos/faq.md

+27-5
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,36 @@ parent: Code Howtos
77

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

10-
* `org.jabref.architecture.MainArchitectureTest` `restrictStandardStreams` <span style="color:red">FAILED</span>
11-
* <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).
10+
* Failing <b>Checkstyle</b> tests:
11+
* <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.
1212

13-
* `org.jabref.architecture.MainArchitectureTest` `doNotUseLogicInModel` <span style="color:red">FAILED</span>
14-
* <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/```).
13+
* Failing <b>OpenRewrite</b> tests:
14+
* <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>
15+
![Executing Gradle task rewriteRun](../images/rewriteRun.png)<br>
1516

1617
* `org.jabref.logic.l10n.LocalizationConsistencyTest` `findMissingLocalizationKeys` <span style="color:red">FAILED</span>
17-
* <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).
18+
* <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).
1819
Read more about the background and format of localization in JabRef [here](https://devdocs.jabref.org/code-howtos/localization.html).
1920

21+
* `org.jabref.logic.l10n.LocalizationConsistencyTest` `findObsoleteLocalizationKeys` <span style="color:red">FAILED</span>
22+
* <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.
23+
Read more about the background and format of localization in JabRef [here](https://devdocs.jabref.org/code-howtos/localization.html).
24+
25+
* `org.jabref.logic.citationstyle.CitationStyle` `discoverCitationStyles` <span style="color:red">ERROR: Could not find any citation style. Tried with /ieee.csl.</span>
26+
* <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>.
27+
28+
* `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>
29+
* <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>.
30+
31+
* `org.jabref.architecture.MainArchitectureTest` `restrictStandardStreams` <span style="color:red">FAILED</span>
32+
* <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).
33+
34+
* `org.jabref.architecture.MainArchitectureTest` `doNotUseLogicInModel` <span style="color:red">FAILED</span>
35+
* <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>
36+
![Moving a file using refactor](../images/refactor-moving.png)<br>
37+
38+
* `ANTLR Tool version 4.12.0 used for code generation does not match the current runtime version 4.13.1`
39+
* <span style="color:green">Fix</span>: Execute the Gradle task `clean` from the `build` group of the Gradle Tool Window in IntelliJ:<br>
40+
![Executing Gradle task clean](../images/clean.png)<br>
41+
2042
<!-- markdownlint-disable-file MD033 -->

docs/images/clean.png

62.2 KB
Loading

docs/images/refactor-moving.png

139 KB
Loading

docs/images/rewriteRun.png

47 KB
Loading

gradle/wrapper/gradle-wrapper.jar

51 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionSha256Sum=a4b4158601f8636cdeeab09bd76afb640030bb5b144aafe261a5e8af027dc612
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
3+
distributionSha256Sum=d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
55
networkTimeout=10000
66
validateDistributionUrl=true
77
zipStoreBase=GRADLE_USER_HOME

gradlew

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717
#
18+
# SPDX-License-Identifier: Apache-2.0
19+
#
1820

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

8992
# Use the maximum available, or set MAX_FD != -1 to use that value.
9093
MAX_FD=maximum

gradlew.bat

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
@rem See the License for the specific language governing permissions and
1414
@rem limitations under the License.
1515
@rem
16+
@rem SPDX-License-Identifier: Apache-2.0
17+
@rem
1618

1719
@if "%DEBUG%"=="" @echo off
1820
@rem ##########################################################################
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package org.jabref.architecture;
2+
3+
/**
4+
* Annotation to indicate that this logic class can use class.getResource().
5+
* Mostly, because {@link java.nio.file.Path} is not used.
6+
* See <a href="graal#7682">https://github.com/oracle/graal/issues/7682</a> for a longer discussion.
7+
*/
8+
public @interface AllowedToUseClassGetResource {
9+
// The rationale
10+
String value();
11+
}

src/main/java/org/jabref/architecture/AllowedToUseSwing.java

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* Annotation to indicate that this logic class can access swing
55
*/
66
public @interface AllowedToUseSwing {
7-
87
// The rationale
98
String value();
109
}

src/main/java/org/jabref/gui/entryeditor/EntryEditor.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ public EntryEditor(LibraryTab libraryTab, UndoAction undoAction, RedoAction redo
147147
activeTab.notifyAboutFocus(currentlyEditedEntry);
148148
}
149149
});
150-
EasyBind.listen(preferencesService.getPreviewPreferences().showPreviewAsExtraTabProperty(),
151-
(obs, oldValue, newValue) -> adaptVisibleTabs());
152150
}
153151

154152
private void setupDragAndDrop(LibraryTab libraryTab) {
@@ -386,6 +384,9 @@ public void setCurrentlyEditedEntry(BibEntry currentlyEditedEntry) {
386384
getSelectedTab().notifyAboutFocus(currentlyEditedEntry);
387385
});
388386

387+
EasyBind.listen(preferencesService.getPreviewPreferences().showPreviewAsExtraTabProperty(),
388+
(obs, oldValue, newValue) -> adaptVisibleTabs());
389+
389390
adaptVisibleTabs();
390391
setupToolBar();
391392

src/main/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtil.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import java.util.ArrayList;
77
import java.util.List;
88
import java.util.Optional;
9-
import java.util.stream.Collectors;
109

1110
import org.jabref.gui.externalfiletype.ExternalFileType;
1211
import org.jabref.gui.externalfiletype.ExternalFileTypes;
@@ -52,6 +51,7 @@ public List<IOException> getFileExceptions() {
5251
}
5352

5453
private static final Logger LOGGER = LoggerFactory.getLogger(AutoSetFileLinksUtil.class);
54+
5555
private final List<Path> directories;
5656
private final AutoLinkPreferences autoLinkPreferences;
5757
private final FilePreferences filePreferences;
@@ -106,7 +106,9 @@ public LinkFilesResult linkAssociatedFiles(List<BibEntry> entries, NamedCompound
106106
public List<LinkedFile> findAssociatedNotLinkedFiles(BibEntry entry) throws IOException {
107107
List<LinkedFile> linkedFiles = new ArrayList<>();
108108

109-
List<String> extensions = filePreferences.getExternalFileTypes().stream().map(ExternalFileType::getExtension).collect(Collectors.toList());
109+
List<String> extensions = filePreferences.getExternalFileTypes().stream().map(ExternalFileType::getExtension).toList();
110+
111+
LOGGER.debug("Searching for extensions {} in directories {}", extensions, directories);
110112

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

src/main/java/org/jabref/gui/externalfiles/DateRange.java

+11-3
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,19 @@ public enum DateRange {
1111

1212
private final String dateRange;
1313

14-
DateRange(String dateRange) {
14+
DateRange(String dateRange) {
1515
this.dateRange = dateRange;
1616
}
1717

18+
public static DateRange parse(String name) {
19+
try {
20+
return DateRange.valueOf(name);
21+
} catch (IllegalArgumentException e) {
22+
return ALL_TIME;
23+
}
24+
}
25+
1826
public String getDateRange() {
19-
return dateRange;
20-
}
27+
return dateRange;
28+
}
2129
}

src/main/java/org/jabref/gui/externalfiles/ExternalFileSorter.java

+8
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ public enum ExternalFileSorter {
1313
this.sorter = sorter;
1414
}
1515

16+
public static ExternalFileSorter parse(String name) {
17+
try {
18+
return ExternalFileSorter.valueOf(name);
19+
} catch (IllegalArgumentException e) {
20+
return DEFAULT;
21+
}
22+
}
23+
1624
public String getSorter() {
1725
return sorter;
1826
}

src/main/java/org/jabref/gui/externalfiles/FileExtensionViewModel.java

+6
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,22 @@
1515

1616
public class FileExtensionViewModel {
1717

18+
private final String name;
1819
private final String description;
1920
private final List<String> extensions;
2021
private final FilePreferences filePreferences;
2122

2223
FileExtensionViewModel(FileType fileType, FilePreferences filePreferences) {
24+
this.name = fileType.getName();
2325
this.description = Localization.lang("%0 file", fileType.getName());
2426
this.extensions = fileType.getExtensionsWithAsteriskAndDot();
2527
this.filePreferences = filePreferences;
2628
}
2729

30+
public String getName() {
31+
return this.name;
32+
}
33+
2834
public String getDescription() {
2935
return this.description + extensions.stream().collect(Collectors.joining(", ", " (", ")"));
3036
}

0 commit comments

Comments
 (0)