From 2a4d378f4a3d87a1b45b774c00550d47020c0597 Mon Sep 17 00:00:00 2001 From: Allan Yip Date: Mon, 25 Sep 2023 00:46:20 +0100 Subject: [PATCH 0001/1502] change name to extension comparison in fromString and toStringList --- .../jabref/gui/externalfiletype/ExternalFileTypes.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/jabref/gui/externalfiletype/ExternalFileTypes.java b/src/main/java/org/jabref/gui/externalfiletype/ExternalFileTypes.java index c3a7ebf3d46..25e2bfaa088 100644 --- a/src/main/java/org/jabref/gui/externalfiletype/ExternalFileTypes.java +++ b/src/main/java/org/jabref/gui/externalfiletype/ExternalFileTypes.java @@ -148,10 +148,10 @@ public static String toStringList(Collection fileTypes) { for (ExternalFileType type : fileTypes) { results.add(type); - // See if we can find a type with matching name in the default type list: + // See if we can find a type with matching extension in the default type list: ExternalFileType found = null; for (ExternalFileType defType : defTypes) { - if (defType.getName().equals(type.getName())) { + if (defType.getExtension().equals(type.getExtension())) { found = defType; break; } @@ -221,11 +221,11 @@ public static Set fromString(String storedFileTypes) { } else { // A new or modified entry type. Construct it from the string array: ExternalFileType type = CustomExternalFileType.buildFromArgs(val); - // Check if there is a default type with the same name. If so, this is a + // Check if there is a default type with the same extension. If so, this is a // modification of that type, so remove the default one: ExternalFileType toRemove = null; for (ExternalFileType defType : types) { - if (type.getName().equals(defType.getName())) { + if (type.getExtension().equals(defType.getExtension())) { toRemove = defType; break; } From 04e05bcbb92e1a3cde54cc18a71fd8bad2c096b5 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Tue, 26 Sep 2023 19:44:54 +0200 Subject: [PATCH 0002/1502] Add TeXShop (macOS only) Fixes https://discourse.jabref.org/t/push-to-texshop-mac/2699 --- CHANGELOG.md | 1 + .../jabref/gui/push/PushToApplications.java | 4 +- .../jabref/gui/push/PushToSublimeText.java | 1 - .../org/jabref/gui/push/PushToTexShop.java | 79 +++++++++++++++++++ 4 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 src/main/java/org/jabref/gui/push/PushToTexShop.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 67deb76ec92..fb885b7c7a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We added a link "Get more themes..." in the preferences to that points to [themes.jabref.org](https://themes.jabref.org) allowing the user to download new themes. [#10243](https://github.com/JabRef/jabref/issues/10243) - We added a fetcher for [LOBID](https://lobid.org/resources/api) resources. [koppor#386](https://github.com/koppor/jabref/issues/386) - When in `biblatex` mode, the [integrity check](https://docs.jabref.org/finding-sorting-and-cleaning-entries/checkintegrity) for journal titles now also checks the field `journal`. +- We added support for pushing citations to [TeXShop](https://pages.uoregon.edu/koch/texshop/) on macOS [forum#2699](https://discourse.jabref.org/t/push-to-texshop-mac/2699). ### Changed diff --git a/src/main/java/org/jabref/gui/push/PushToApplications.java b/src/main/java/org/jabref/gui/push/PushToApplications.java index 3550bbac28b..633be606f39 100644 --- a/src/main/java/org/jabref/gui/push/PushToApplications.java +++ b/src/main/java/org/jabref/gui/push/PushToApplications.java @@ -16,6 +16,7 @@ public class PushToApplications { public static final String VIM = "Vim"; public static final String WIN_EDT = "WinEdt"; public static final String SUBLIME_TEXT = "Sublime Text"; + public static final String TEXSHOP = "TeXShop"; private static final List APPLICATIONS = new ArrayList<>(); @@ -34,7 +35,8 @@ public static List getAllApplications(DialogService dialogSer new PushToTexmaker(dialogService, preferencesService), new PushToTeXstudio(dialogService, preferencesService), new PushToVim(dialogService, preferencesService), - new PushToWinEdt(dialogService, preferencesService))); + new PushToWinEdt(dialogService, preferencesService), + new PushToTexShop(dialogService,preferencesService))); return APPLICATIONS; } diff --git a/src/main/java/org/jabref/gui/push/PushToSublimeText.java b/src/main/java/org/jabref/gui/push/PushToSublimeText.java index 2096ae1e8bb..437354b10ed 100644 --- a/src/main/java/org/jabref/gui/push/PushToSublimeText.java +++ b/src/main/java/org/jabref/gui/push/PushToSublimeText.java @@ -53,7 +53,6 @@ public void pushEntries(BibDatabaseContext database, List entries, Str return; } try { - LOGGER.debug("Sublime string: {}", String.join(" ", getCommandLine(keyString))); ProcessBuilder processBuilder = new ProcessBuilder(getCommandLine(keyString)); processBuilder.inheritIO(); diff --git a/src/main/java/org/jabref/gui/push/PushToTexShop.java b/src/main/java/org/jabref/gui/push/PushToTexShop.java new file mode 100644 index 00000000000..8fb4ab5ffcb --- /dev/null +++ b/src/main/java/org/jabref/gui/push/PushToTexShop.java @@ -0,0 +1,79 @@ +package org.jabref.gui.push; + +import java.io.IOException; +import java.util.List; + +import org.jabref.gui.DialogService; +import org.jabref.gui.JabRefExecutorService; +import org.jabref.gui.icon.IconTheme; +import org.jabref.gui.icon.JabRefIcon; +import org.jabref.gui.util.StreamGobbler; +import org.jabref.logic.l10n.Localization; +import org.jabref.logic.util.OS; +import org.jabref.model.database.BibDatabaseContext; +import org.jabref.model.entry.BibEntry; +import org.jabref.preferences.PreferencesService; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class PushToTexShop extends AbstractPushToApplication { + + public static final String NAME = PushToApplications.TEXSHOP; + + private static final Logger LOGGER = LoggerFactory.getLogger(PushToTexShop.class); + + public PushToTexShop(DialogService dialogService, PreferencesService preferencesService) { + super(dialogService, preferencesService); + } + + @Override + public String getDisplayName() { + return NAME; + } + + @Override + public JabRefIcon getApplicationIcon() { + return IconTheme.JabRefIcons.APPLICATION_GENERIC; + } + + @Override + public void pushEntries(BibDatabaseContext database, List entries, String keyString) { + couldNotPush = false; + couldNotCall = false; + notDefined = false; + + commandPath = preferencesService.getPushToApplicationPreferences().getCommandPaths().get(this.getDisplayName()); + + try { + LOGGER.debug("TexShop string: {}", String.join(" ", getCommandLine(keyString))); + ProcessBuilder processBuilder = new ProcessBuilder(getCommandLine(keyString)); + processBuilder.inheritIO(); + Process process = processBuilder.start(); + StreamGobbler streamGobblerInput = new StreamGobbler(process.getInputStream(), LOGGER::info); + StreamGobbler streamGobblerError = new StreamGobbler(process.getErrorStream(), LOGGER::info); + + JabRefExecutorService.INSTANCE.execute(streamGobblerInput); + JabRefExecutorService.INSTANCE.execute(streamGobblerError); + } catch (IOException excep) { + LOGGER.warn("Error: Could not call executable '{}'", commandPath, excep); + couldNotCall = true; + } + } + + @Override + protected String[] getCommandLine(String keyString) { + String osascriptTexShop = "osascript -e 'tell application \"TeXShop\"\n" + + "activate\n" + + "set TheString to \"" + getCitePrefix() + keyString + getCiteSuffix() + "\"\n" + + "set content of selection of front document to TheString\n" + + "end tell'"; + + if (OS.OS_X) { + return new String[] {"sh", "-c", osascriptTexShop}; + } else { + dialogService.showInformationDialogAndWait(Localization.lang("Push to application"), Localization.lang("Pushing citations to TeXShop is only possible on macOS!")); + return new String[] {}; + } + } +} From a9a7a4b8af8ec996dec82020b5a4f2d0c17bbf74 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Tue, 26 Sep 2023 19:47:42 +0200 Subject: [PATCH 0003/1502] fix checkstyle and l10n --- src/main/java/org/jabref/gui/push/PushToApplications.java | 2 +- src/main/resources/l10n/JabRef_en.properties | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/push/PushToApplications.java b/src/main/java/org/jabref/gui/push/PushToApplications.java index 633be606f39..91d087f84fd 100644 --- a/src/main/java/org/jabref/gui/push/PushToApplications.java +++ b/src/main/java/org/jabref/gui/push/PushToApplications.java @@ -36,7 +36,7 @@ public static List getAllApplications(DialogService dialogSer new PushToTeXstudio(dialogService, preferencesService), new PushToVim(dialogService, preferencesService), new PushToWinEdt(dialogService, preferencesService), - new PushToTexShop(dialogService,preferencesService))); + new PushToTexShop(dialogService, preferencesService))); return APPLICATIONS; } diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index d0533a0aa11..9dcc9a4b334 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -2597,3 +2597,5 @@ Error\ while\ fetching\ citing\ entries\:\ %0=Error while fetching citing entrie Jump\ to\ entry\ in\ database=Jump to entry in database Help\ on\ external\ applications=Help on external applications Identifier-based\ Web\ Search=Identifier-based Web Search + +Pushing\ citations\ to\ TeXShop\ is\ only\ possible\ on\ macOS\!=Pushing citations to TeXShop is only possible on macOS! From 0305c1073166f3859cf58697dff6f5dbca7757af Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Wed, 27 Sep 2023 19:08:21 +0200 Subject: [PATCH 0004/1502] fix escaping of slashes --- src/main/java/org/jabref/gui/push/PushToTexShop.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/push/PushToTexShop.java b/src/main/java/org/jabref/gui/push/PushToTexShop.java index 8fb4ab5ffcb..dcc39cf8b9a 100644 --- a/src/main/java/org/jabref/gui/push/PushToTexShop.java +++ b/src/main/java/org/jabref/gui/push/PushToTexShop.java @@ -63,9 +63,15 @@ public void pushEntries(BibDatabaseContext database, List entries, Str @Override protected String[] getCommandLine(String keyString) { + String citeCommand = getCitePrefix(); + // we need to escape the extra slashses + if (getCitePrefix().contains("\\")) { + citeCommand = "\"\\" + getCitePrefix(); + } + String osascriptTexShop = "osascript -e 'tell application \"TeXShop\"\n" + "activate\n" + - "set TheString to \"" + getCitePrefix() + keyString + getCiteSuffix() + "\"\n" + + "set TheString to " + citeCommand + keyString + getCiteSuffix() + "\"\n" + "set content of selection of front document to TheString\n" + "end tell'"; From 148e947c4ddc748eeba044cae7b473cdb4390c75 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Wed, 27 Sep 2023 19:20:34 +0200 Subject: [PATCH 0005/1502] fix checkstyle --- src/main/java/org/jabref/gui/push/PushToTexShop.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/push/PushToTexShop.java b/src/main/java/org/jabref/gui/push/PushToTexShop.java index dcc39cf8b9a..24fadcf1b8f 100644 --- a/src/main/java/org/jabref/gui/push/PushToTexShop.java +++ b/src/main/java/org/jabref/gui/push/PushToTexShop.java @@ -71,7 +71,7 @@ protected String[] getCommandLine(String keyString) { String osascriptTexShop = "osascript -e 'tell application \"TeXShop\"\n" + "activate\n" + - "set TheString to " + citeCommand + keyString + getCiteSuffix() + "\"\n" + + "set TheString to " + citeCommand + keyString + getCiteSuffix() + "\"\n" + "set content of selection of front document to TheString\n" + "end tell'"; From 00c01a5f6ed3553a5bcde3aa4907c4e5bcf243b7 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Mon, 2 Oct 2023 16:05:49 +0200 Subject: [PATCH 0006/1502] Accept LaTeX errors in comment field (#10436) * Merge tests in AmpersandCheckerTest * Add link * More comments (and some more tests) * Merge tests in AmpersandCheckerTest * Simplify test * Make "comment" and "review" verbatim (to exclude them from certain checks) * URI is also external * Modernize code LatexIntegrityChecker * Add support for textgreater, textless, textbackslash, textbar --- .../logic/integrity/AmpersandChecker.java | 2 + .../integrity/LatexIntegrityChecker.java | 81 +++++++----- .../model/entry/field/StandardField.java | 6 +- .../logic/integrity/AmpersandCheckerTest.java | 52 +++----- .../integrity/LatexIntegrityCheckerTest.java | 116 ++++++++++-------- 5 files changed, 135 insertions(+), 122 deletions(-) diff --git a/src/main/java/org/jabref/logic/integrity/AmpersandChecker.java b/src/main/java/org/jabref/logic/integrity/AmpersandChecker.java index 243fbbddea4..ac8f4cb6748 100644 --- a/src/main/java/org/jabref/logic/integrity/AmpersandChecker.java +++ b/src/main/java/org/jabref/logic/integrity/AmpersandChecker.java @@ -18,6 +18,8 @@ /** * Checks if the BibEntry contains unescaped ampersands. * This is done in nonverbatim fields. Similar to {@link HTMLCharacterChecker} + * + * The {@link LatexIntegrityChecker} is not able to check unescaped ampersands. Therefore, this separate checker is required. */ public class AmpersandChecker implements EntryChecker { // matches for an & preceded by any number of \ diff --git a/src/main/java/org/jabref/logic/integrity/LatexIntegrityChecker.java b/src/main/java/org/jabref/logic/integrity/LatexIntegrityChecker.java index f667dee8368..115a43d022d 100644 --- a/src/main/java/org/jabref/logic/integrity/LatexIntegrityChecker.java +++ b/src/main/java/org/jabref/logic/integrity/LatexIntegrityChecker.java @@ -2,12 +2,14 @@ import java.io.IOException; import java.text.MessageFormat; -import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.ResourceBundle; import java.util.Set; +import java.util.stream.Stream; + +import javafx.util.Pair; import org.jabref.logic.l10n.Localization; import org.jabref.model.entry.BibEntry; @@ -20,60 +22,73 @@ import uk.ac.ed.ph.snuggletex.InputError; import uk.ac.ed.ph.snuggletex.SnuggleEngine; import uk.ac.ed.ph.snuggletex.SnuggleInput; +import uk.ac.ed.ph.snuggletex.SnugglePackage; import uk.ac.ed.ph.snuggletex.SnuggleSession; import uk.ac.ed.ph.snuggletex.definitions.CoreErrorCode; import uk.ac.ed.ph.snuggletex.definitions.CoreErrorGroup; +import static uk.ac.ed.ph.snuggletex.definitions.Globals.TEXT_MODE_ONLY; + +/** + * Similar check to {@link HTMLCharacterChecker}. + * Here, we use SnuggleTeX, in the {@link HTMLCharacterChecker}, it is searched for HTML characters. + * + * Unescaped ampersands cannot be checked by SnuggleTeX, therefore the {@link AmpersandChecker} is available additionaly. + */ public class LatexIntegrityChecker implements EntryChecker { private static final Logger LOGGER = LoggerFactory.getLogger(SnuggleSession.class); private static final SnuggleEngine ENGINE = new SnuggleEngine(); - private static final SnuggleSession SESSION = ENGINE.createSession(); + private static final SnuggleSession SESSION; private static final ResourceBundle ERROR_MESSAGES = ENGINE.getPackages().get(0).getErrorMessageBundle(); private static final Set EXCLUDED_ERRORS = new HashSet<>(); static { - // Static configuration. + SnugglePackage snugglePackage = ENGINE.getPackages().get(0); + snugglePackage.addComplexCommand("textgreater", false, 0, TEXT_MODE_ONLY, null, null, null); + snugglePackage.addComplexCommand("textless", false, 0, TEXT_MODE_ONLY, null, null, null); + snugglePackage.addComplexCommand("textbackslash", false, 0, TEXT_MODE_ONLY, null, null, null); + snugglePackage.addComplexCommand("textbar", false, 0, TEXT_MODE_ONLY, null, null, null); + // ENGINE.getPackages().get(0).addComplexCommandOneArg() + // engine.getPackages().get(0).addComplexCommandOneArg("text", false, ALL_MODES,LR, StyleDeclarationInterpretation.NORMALSIZE, null, TextFlowContext.ALLOW_INLINE); + + SESSION = ENGINE.createSession(); SESSION.getConfiguration().setFailingFast(true); // '#' only allowed inside and command/environment definitions. EXCLUDED_ERRORS.add(CoreErrorCode.TTEG04); } - /** - * Similar check to {@link HTMLCharacterChecker#check(BibEntry)}. - * Here, we use SnuggleTeX, there it is searched for HTML characters. - */ @Override public List check(BibEntry entry) { - List results = new ArrayList<>(); + return entry.getFieldMap().entrySet().stream() + .filter(field -> !field.getKey().getProperties().contains(FieldProperty.VERBATIM)) + .flatMap(LatexIntegrityChecker::getUnescapedAmpersandsWithCount) + // Exclude all DOM building errors as this functionality is not used. + .filter(pair -> !pair.getValue().getErrorCode().getErrorGroup().equals(CoreErrorGroup.TDE)) + .filter(pair -> !EXCLUDED_ERRORS.contains(pair.getValue().getErrorCode())) + .map(pair -> + new IntegrityMessage(errorMessageFormatHelper(pair.getValue().getErrorCode(), pair.getValue().getArguments()), entry, pair.getKey())) + .toList(); + } - for (Map.Entry field : entry.getFieldMap().entrySet()) { - if (field.getKey().getProperties().contains(FieldProperty.VERBATIM)) { - continue; - } - SnuggleInput input = new SnuggleInput(field.getValue()); - try { - SESSION.parseInput(input); - } catch (IOException e) { - LOGGER.error("Error at parsing", e); - } - if (!SESSION.getErrors().isEmpty()) { - // Retrieve the first error only because it is likely to be more meaningful. - // Displaying all (subsequent) faults may lead to confusion. - // We further get a slight performance benefit from failing fast (see static config in class header). - InputError error = SESSION.getErrors().get(0); - ErrorCode errorCode = error.getErrorCode(); - // Exclude all DOM building errors as this functionality is not used. - // Further, exclude individual errors. - if (!errorCode.getErrorGroup().equals(CoreErrorGroup.TDE) && !EXCLUDED_ERRORS.contains(errorCode)) { - String jabrefMessageWrapper = errorMessageFormatHelper(errorCode, error.getArguments()); - results.add(new IntegrityMessage(jabrefMessageWrapper, entry, field.getKey())); - } - } - SESSION.reset(); + private static Stream> getUnescapedAmpersandsWithCount(Map.Entry entry) { + SESSION.reset(); + SnuggleInput input = new SnuggleInput(entry.getValue()); + try { + SESSION.parseInput(input); + } catch (IOException e) { + LOGGER.error("Error at parsing", e); + return Stream.empty(); + } + if (SESSION.getErrors().isEmpty()) { + return Stream.empty(); } - return results; + // Retrieve the first error only because it is likely to be more meaningful. + // Displaying all (subsequent) faults may lead to confusion. + // We further get a slight performance benefit from failing fast (see static config in class header). + InputError error = SESSION.getErrors().get(0); + return Stream.of(new Pair<>(entry.getKey(), error)); } public static String errorMessageFormatHelper(ErrorCode snuggleTexErrorCode, Object... arguments) { diff --git a/src/main/java/org/jabref/model/entry/field/StandardField.java b/src/main/java/org/jabref/model/entry/field/StandardField.java index ff939f9f722..2762ff1d49c 100644 --- a/src/main/java/org/jabref/model/entry/field/StandardField.java +++ b/src/main/java/org/jabref/model/entry/field/StandardField.java @@ -31,7 +31,7 @@ public enum StandardField implements Field { BOOKTITLEADDON("booktitleaddon"), CHAPTER("chapter"), COMMENTATOR("commentator", FieldProperty.PERSON_NAMES), - COMMENT("comment", FieldProperty.COMMENT, FieldProperty.MULTILINE_TEXT), + COMMENT("comment", FieldProperty.COMMENT, FieldProperty.MULTILINE_TEXT, FieldProperty.VERBATIM), CROSSREF("crossref", FieldProperty.SINGLE_ENTRY_LINK), DATE("date", FieldProperty.DATE), DAY("day"), @@ -102,7 +102,7 @@ public enum StandardField implements Field { PRIMARYCLASS("primaryclass"), RELATED("related", FieldProperty.MULTIPLE_ENTRY_LINK), REPORTNO("reportno"), - REVIEW("review", FieldProperty.MULTILINE_TEXT), + REVIEW("review", FieldProperty.MULTILINE_TEXT, FieldProperty.VERBATIM), REVISION("revision"), SCHOOL("school"), SERIES("series"), @@ -116,7 +116,7 @@ public enum StandardField implements Field { TITLEADDON("titleaddon"), TRANSLATOR("translator", FieldProperty.PERSON_NAMES), TYPE("type", FieldProperty.TYPE), - URI("uri", "URI"), + URI("uri", "URI", FieldProperty.EXTERNAL, FieldProperty.VERBATIM), URL("url", "URL", FieldProperty.EXTERNAL, FieldProperty.VERBATIM), URLDATE("urldate", FieldProperty.DATE), VENUE("venue"), diff --git a/src/test/java/org/jabref/logic/integrity/AmpersandCheckerTest.java b/src/test/java/org/jabref/logic/integrity/AmpersandCheckerTest.java index 1efdd5ae82d..1e568793f70 100644 --- a/src/test/java/org/jabref/logic/integrity/AmpersandCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/AmpersandCheckerTest.java @@ -1,6 +1,5 @@ package org.jabref.logic.integrity; -import java.util.Collections; import java.util.List; import java.util.stream.Stream; @@ -8,7 +7,6 @@ import org.jabref.model.entry.field.Field; import org.jabref.model.entry.field.StandardField; -import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; @@ -22,19 +20,23 @@ public class AmpersandCheckerTest { @ParameterizedTest @MethodSource("provideAcceptedInputs") - void acceptsAllowedInputs(List expected, Field field, String value) { + void acceptsAllowedInputs(Field field, String value) { entry.setField(field, value); - assertEquals(expected, checker.check(entry)); + assertEquals(List.of(), checker.check(entry)); } private static Stream provideAcceptedInputs() { return Stream.of( - Arguments.of(Collections.emptyList(), StandardField.TITLE, "No ampersand at all"), - Arguments.of(Collections.emptyList(), StandardField.FOREWORD, "Properly escaped \\&"), - Arguments.of(Collections.emptyList(), StandardField.AUTHOR, "\\& Multiple properly escaped \\&"), - Arguments.of(Collections.emptyList(), StandardField.BOOKTITLE, "\\\\\\& With multiple backslashes"), - Arguments.of(Collections.emptyList(), StandardField.COMMENT, "\\\\\\& With multiple backslashes multiple times \\\\\\\\\\&"), - Arguments.of(Collections.emptyList(), StandardField.NOTE, "In the \\& middle of \\\\\\& something") + Arguments.of(StandardField.TITLE, "No ampersand at all"), + Arguments.of(StandardField.FOREWORD, "Properly escaped \\&"), + Arguments.of(StandardField.AUTHOR, "\\& Multiple properly escaped \\&"), + Arguments.of(StandardField.BOOKTITLE, "\\\\\\& With multiple backslashes"), + Arguments.of(StandardField.COMMENT, "\\\\\\& With multiple backslashes multiple times \\\\\\\\\\&"), + Arguments.of(StandardField.NOTE, "In the \\& middle of \\\\\\& something"), + + // Verbatim fields + Arguments.of(StandardField.FILE, "one & another.pdf"), + Arguments.of(StandardField.URL, "https://example.org?key=value&key2=value2") ); } @@ -50,33 +52,13 @@ private static Stream provideUnacceptedInputs() { Arguments.of("Found 1 unescaped '&'", StandardField.SUBTITLE, "A single &"), Arguments.of("Found 2 unescaped '&'", StandardField.ABSTRACT, "Multiple \\\\& not properly & escaped"), Arguments.of("Found 1 unescaped '&'", StandardField.AUTHOR, "To many backslashes \\\\&"), - Arguments.of("Found 2 unescaped '&'", StandardField.LABEL, "\\\\\\\\& Multiple times \\\\& multiple backslashes") - ); - } - - @Test - void entryWithEscapedAndUnescapedAmpersand() { - entry.setField(StandardField.TITLE, "Jack \\& Jill & more"); - assertEquals(List.of(new IntegrityMessage("Found 1 unescaped '&'", entry, StandardField.TITLE)), checker.check(entry)); - } + Arguments.of("Found 2 unescaped '&'", StandardField.LABEL, "\\\\\\\\& Multiple times \\\\& multiple backslashes"), - @Test - void entryWithMultipleEscapedAndUnescapedAmpersands() { - entry.setField(StandardField.AFTERWORD, "May the force be with you & live long \\\\& prosper \\& to infinity \\\\\\& beyond & assemble \\\\\\\\& excelsior!"); - assertEquals(List.of(new IntegrityMessage("Found 4 unescaped '&'", entry, StandardField.AFTERWORD)), checker.check(entry)); - } + // entryWithEscapedAndUnescapedAmpersand + Arguments.of("Found 1 unescaped '&'", StandardField.TITLE, "Jack \\& Jill & more"), - static Stream entryWithVerabitmFieldsNotCausingMessages() { - return Stream.of( - Arguments.of(StandardField.FILE, "one & another.pdf"), - Arguments.of(StandardField.URL, "https://example.org?key=value&key2=value2") + // entryWithMultipleEscapedAndUnescapedAmpersands + Arguments.of("Found 4 unescaped '&'", StandardField.AFTERWORD, "May the force be with you & live long \\\\& prosper \\& to infinity \\\\\\& beyond & assemble \\\\\\\\& excelsior!") ); } - - @ParameterizedTest - @MethodSource - void entryWithVerabitmFieldsNotCausingMessages(Field field, String value) { - entry.setField(field, value); - assertEquals(List.of(), checker.check(entry)); - } } diff --git a/src/test/java/org/jabref/logic/integrity/LatexIntegrityCheckerTest.java b/src/test/java/org/jabref/logic/integrity/LatexIntegrityCheckerTest.java index 9107b523356..2964cc13a66 100644 --- a/src/test/java/org/jabref/logic/integrity/LatexIntegrityCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/LatexIntegrityCheckerTest.java @@ -1,6 +1,5 @@ package org.jabref.logic.integrity; -import java.util.Collections; import java.util.List; import java.util.stream.Stream; @@ -22,9 +21,9 @@ public class LatexIntegrityCheckerTest { @ParameterizedTest @MethodSource("provideAcceptedInputs") - void acceptsAllowedInputs(List expected, Field field, String value) { + void acceptsAllowedInputs(Field field, String value) { entry.setField(field, value); - assertEquals(expected, checker.check(entry)); + assertEquals(List.of(), checker.check(entry)); } /** @@ -34,88 +33,103 @@ void acceptsAllowedInputs(List expected, Field field, String v private static Stream provideAcceptedInputs() { return Stream.of( // Basic text inputs - Arguments.of(Collections.emptyList(), StandardField.TITLE, "Simple Text"), + Arguments.of(StandardField.TITLE, "Simple Text"), // Simple commands - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\section{X}"), - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\newline"), - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\par"), + Arguments.of(StandardField.TITLE, "\\section{X}"), + Arguments.of(StandardField.TITLE, "\\newline"), + Arguments.of(StandardField.TITLE, "\\par"), // Text decorations - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\underline{Underlined}"), - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\texttt{Monospace}"), - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\textit{Italic}"), + Arguments.of(StandardField.TITLE, "\\underline{Underlined}"), + Arguments.of(StandardField.TITLE, "\\texttt{Monospace}"), + Arguments.of(StandardField.TITLE, "\\textit{Italic}"), // Special characters and symbols - Arguments.of(Collections.emptyList(), StandardField.TITLE, "Café"), - Arguments.of(Collections.emptyList(), StandardField.TITLE, "αβγδε"), - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\# \\$ \\% \\& \\{ \\} \\_ \\^ \\\\"), + Arguments.of(StandardField.TITLE, "Café"), + Arguments.of(StandardField.TITLE, "αβγδε"), + Arguments.of(StandardField.TITLE, "\\# \\$ \\% \\& \\{ \\} \\_ \\^ \\\\"), // Fonts and sizes - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\tiny Tiny Text"), - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\small Small Text"), - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\large Large Text"), + Arguments.of(StandardField.TITLE, "\\tiny Tiny Text"), + Arguments.of(StandardField.TITLE, "\\small Small Text"), + Arguments.of(StandardField.TITLE, "\\large Large Text"), // Verbatim and special characters - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\verb|Verbatim|"), - Arguments.of(Collections.emptyList(), StandardField.TITLE, "$\\widetilde{i}$"), - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\ldots"), + Arguments.of(StandardField.TITLE, "\\verb|Verbatim|"), + Arguments.of(StandardField.TITLE, "$\\widetilde{i}$"), + Arguments.of(StandardField.TITLE, "\\ldots"), // Simple environments - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\begin{quote}Quoted Text\\end{quote}\n"), - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\begin{center}Centered Text\\end{center}\n"), + Arguments.of(StandardField.TITLE, "\\begin{quote}Quoted Text\\end{quote}\n"), + Arguments.of(StandardField.TITLE, "\\begin{center}Centered Text\\end{center}\n"), // Math environment inputs - Arguments.of(Collections.emptyList(), StandardField.TITLE, "$x + y = z$"), - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\(a^2 + b^2 = c^2\\)"), - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\[E = mc^2\\]"), - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\begin{math} V = I \\cdot R \\end{math}"), + Arguments.of(StandardField.TITLE, "$x + y = z$"), + Arguments.of(StandardField.TITLE, "\\(a^2 + b^2 = c^2\\)"), + Arguments.of(StandardField.TITLE, "\\[E = mc^2\\]"), + Arguments.of(StandardField.TITLE, "\\begin{math} V = I \\cdot R \\end{math}"), // Equations and alignment // Currently Unsupported - // Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\begin{align} x + y &= z \\\\ a &= b + c \\end{align}"), - // Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\begin{align*} A &:= B \\\\ C &\\rightarrow D \\end{align*}"), - // Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\begin{equation} E = mc^2 \\end{equation}"), - // Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\begin{align*} x + y &= z \\\\ a &= b + c \\\\ p &= \\frac{q}{r} \\end{align*}"), - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\begin{eqnarray} x + y &= z \\\\ a &= b + c \\\\ p &= \\frac{q}{r} \\end{eqnarray}"), + // Arguments.of(StandardField.TITLE, "\\begin{align} x + y &= z \\\\ a &= b + c \\end{align}"), + // Arguments.of(StandardField.TITLE, "\\begin{align*} A &:= B \\\\ C &\\rightarrow D \\end{align*}"), + // Arguments.of(StandardField.TITLE, "\\begin{equation} E = mc^2 \\end{equation}"), + // Arguments.of(StandardField.TITLE, "\\begin{align*} x + y &= z \\\\ a &= b + c \\\\ p &= \\frac{q}{r} \\end{align*}"), + Arguments.of(StandardField.TITLE, "\\begin{eqnarray} x + y &= z \\\\ a &= b + c \\\\ p &= \\frac{q}{r} \\end{eqnarray}"), // Equations and matrices - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\[ \\begin{pmatrix} a & b \\\\ c & d \\end{pmatrix} \\]"), - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\[ \\begin{bmatrix} x & y & z \\\\ u & v & w \\end{bmatrix} \\]"), + Arguments.of(StandardField.TITLE, "\\[ \\begin{pmatrix} a & b \\\\ c & d \\end{pmatrix} \\]"), + Arguments.of(StandardField.TITLE, "\\[ \\begin{bmatrix} x & y & z \\\\ u & v & w \\end{bmatrix} \\]"), // Tables - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\begin{tabular}{|c|c|} \\hline 1 & 2 \\\\ 3 & 4 \\\\ \\hline \\end{tabular}"), - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\begin{tabular}{cc} A & B \\\\ C & D \\end{tabular}"), - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\begin{tabular}{|l|r|} \\hline Item & Quantity \\\\ \\hline Apple & 3 \\\\ Banana & 5 \\\\ \\hline \\end{tabular}"), + Arguments.of(StandardField.TITLE, "\\begin{tabular}{|c|c|} \\hline 1 & 2 \\\\ 3 & 4 \\\\ \\hline \\end{tabular}"), + Arguments.of(StandardField.TITLE, "\\begin{tabular}{cc} A & B \\\\ C & D \\end{tabular}"), + Arguments.of(StandardField.TITLE, "\\begin{tabular}{|l|r|} \\hline Item & Quantity \\\\ \\hline Apple & 3 \\\\ Banana & 5 \\\\ \\hline \\end{tabular}"), // Lists and enumerations - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\begin{itemize} \\item Item 1 \\item Item 2 \\item Item 3 \\end{itemize}"), - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\begin{enumerate} \\item First \\item Second \\item Third \\end{enumerate}"), + Arguments.of(StandardField.TITLE, "\\begin{itemize} \\item Item 1 \\item Item 2 \\item Item 3 \\end{itemize}"), + Arguments.of(StandardField.TITLE, "\\begin{enumerate} \\item First \\item Second \\item Third \\end{enumerate}"), // Line breaks and spacing - Arguments.of(Collections.emptyList(), StandardField.TITLE, "First Line \\\\ Second Line"), - Arguments.of(Collections.emptyList(), StandardField.TITLE, "Some \\hspace{2cm} Space"), + Arguments.of(StandardField.TITLE, "First Line \\\\ Second Line"), + Arguments.of(StandardField.TITLE, "Some \\hspace{2cm} Space"), // Currently Unsupported - // Arguments.of(Collections.emptyList(), StandardField.TITLE, "Some \\vspace{1cm} Space"), + // Arguments.of(StandardField.TITLE, "Some \\vspace{1cm} Space"), // Multiple commands and environments - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\textbf{\\emph{Bold and Emphasized Text}} $5-3_k$"), - Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\begin{itemize} \\item\\begin{quote} \\textbf{Quoted} \\emph{Text} \\end{quote} \\end{itemize}") + Arguments.of(StandardField.TITLE, "\\textbf{\\emph{Bold and Emphasized Text}} $5-3_k$"), + Arguments.of(StandardField.TITLE, "\\begin{itemize} \\item\\begin{quote} \\textbf{Quoted} \\emph{Text} \\end{quote} \\end{itemize}"), // More currently unsupported operations // Figures and Graphics - // Arguments.of(Collections.emptyList(), StandardField.TITLE, } "\\includegraphics[width=0.5\\textwidth]{image.jpg}"), - // Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\begin{figure} \\centering \\includegraphics[width=0.8\\textwidth]{plot.png} \\caption{Plot Caption} \\label{fig:plot} \\end{figure}"), + // Arguments.of(StandardField.TITLE, } "\\includegraphics[width=0.5\\textwidth]{image.jpg}"), + // Arguments.of(StandardField.TITLE, "\\begin{figure} \\centering \\includegraphics[width=0.8\\textwidth]{plot.png} \\caption{Plot Caption} \\label{fig:plot} \\end{figure}"), // Citations and references - // Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\cite{key}"), - // Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\label{sec:intro}"), - // Arguments.of(Collections.emptyList(), StandardField.TITLE, "As shown in \\ref{fig:plot}"), - - // Arguments.of(Collections.emptyList(), StandardField.TITLE, "\\input{chapter1.tex}"), - // Arguments.of(Collections.emptyList(), StandardField.TITLE, "Footnote\\footnote{This is a footnote}"), - // Arguments.of(Collections.emptyList(), StandardField.TITLE, "$\text{in math}$"), + // Arguments.of(StandardField.TITLE, "\\cite{key}"), + // Arguments.of(StandardField.TITLE, "\\label{sec:intro}"), + // Arguments.of(StandardField.TITLE, "As shown in \\ref{fig:plot}"), + + // Arguments.of(StandardField.TITLE, "\\input{chapter1.tex}"), + // Arguments.of(StandardField.TITLE, "Footnote\\footnote{This is a footnote}"), + // Arguments.of(StandardField.TITLE, "$\text{in math}$"), + + // Comments should not raise any error, because they are not typeset using LaTeX + Arguments.of(StandardField.COMMENT, "\\undefinedCommand"), + + // Some commands not supported by SnuggleTeX as default + // Source: https://github.com/JabRef/jabref/issues/8712#issuecomment-1730441206 + Arguments.of(StandardField.ABSTRACT, "\\textless{}xml\\textgreater{} \\textbar something \textbackslash"), + + // Mirrored from org.jabref.logic.integrity.AmpersandCheckerTest.provideAcceptedInputs + Arguments.of(StandardField.TITLE, "No ampersand at all"), + Arguments.of(StandardField.FOREWORD, "Properly escaped \\&"), + Arguments.of(StandardField.AUTHOR, "\\& Multiple properly escaped \\&"), + Arguments.of(StandardField.BOOKTITLE, "\\\\\\& With multiple backslashes"), + Arguments.of(StandardField.COMMENT, "\\\\\\& With multiple backslashes multiple times \\\\\\\\\\&"), + Arguments.of(StandardField.NOTE, "In the \\& middle of \\\\\\& something") ); } From 708dded8801c14a81399044c22fe604e468a02be Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 14:28:29 +0000 Subject: [PATCH 0007/1502] Bump com.dlsc.gemsfx:gemsfx from 1.77.0 to 1.82.0 Bumps [com.dlsc.gemsfx:gemsfx](https://github.com/dlsc-software-consulting-gmbh/GemsFX) from 1.77.0 to 1.82.0. - [Release notes](https://github.com/dlsc-software-consulting-gmbh/GemsFX/releases) - [Changelog](https://github.com/dlsc-software-consulting-gmbh/GemsFX/blob/master/CHANGELOG.md) - [Commits](https://github.com/dlsc-software-consulting-gmbh/GemsFX/compare/v1.77.0...v1.82.0) --- updated-dependencies: - dependency-name: com.dlsc.gemsfx:gemsfx dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index d6a99e84c57..6aeeb4f7aae 100644 --- a/build.gradle +++ b/build.gradle @@ -170,7 +170,7 @@ dependencies { implementation('com.tobiasdiez:easybind:2.2.1-SNAPSHOT') implementation 'org.fxmisc.flowless:flowless:0.7.1' implementation 'org.fxmisc.richtext:richtextfx:0.11.1' - implementation (group: 'com.dlsc.gemsfx', name: 'gemsfx', version: '1.77.0') { + implementation (group: 'com.dlsc.gemsfx', name: 'gemsfx', version: '1.82.0') { exclude module: 'javax.inject' // Split package, use only jakarta.inject exclude group: 'org.apache.logging.log4j' } From 486bb97d103d8affaf772f91792571c6d480df59 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 14:28:41 +0000 Subject: [PATCH 0008/1502] Bump org.apache.lucene:lucene-core from 9.7.0 to 9.8.0 Bumps org.apache.lucene:lucene-core from 9.7.0 to 9.8.0. --- updated-dependencies: - dependency-name: org.apache.lucene:lucene-core dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index d6a99e84c57..9f5acb03527 100644 --- a/build.gradle +++ b/build.gradle @@ -115,7 +115,7 @@ dependencies { implementation 'org.apache.pdfbox:fontbox:3.0.0' implementation 'org.apache.pdfbox:xmpbox:3.0.0' - implementation 'org.apache.lucene:lucene-core:9.7.0' + implementation 'org.apache.lucene:lucene-core:9.8.0' implementation 'org.apache.lucene:lucene-queryparser:9.7.0' implementation 'org.apache.lucene:lucene-queries:9.7.0' implementation 'org.apache.lucene:lucene-analysis-common:9.7.0' From d67438535ffb66c4c860f458ec39e46542dbe5d7 Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com> Date: Tue, 3 Oct 2023 12:17:38 +0200 Subject: [PATCH 0009/1502] Update all of lucene --- build.gradle | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 9f5acb03527..a6a46235188 100644 --- a/build.gradle +++ b/build.gradle @@ -116,10 +116,10 @@ dependencies { implementation 'org.apache.pdfbox:xmpbox:3.0.0' implementation 'org.apache.lucene:lucene-core:9.8.0' - implementation 'org.apache.lucene:lucene-queryparser:9.7.0' - implementation 'org.apache.lucene:lucene-queries:9.7.0' - implementation 'org.apache.lucene:lucene-analysis-common:9.7.0' - implementation 'org.apache.lucene:lucene-highlighter:9.7.0' + implementation 'org.apache.lucene:lucene-queryparser:9.8.0' + implementation 'org.apache.lucene:lucene-queries:9.8.0' + implementation 'org.apache.lucene:lucene-analysis-common:9.8.0' + implementation 'org.apache.lucene:lucene-highlighter:9.8.0' implementation group: 'org.apache.commons', name: 'commons-csv', version: '1.10.0' implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.13.0' From 32faf764fa13930418a4dd03418e4e7d848b4bfd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Oct 2023 10:57:00 +0000 Subject: [PATCH 0010/1502] Bump org.openrewrite.rewrite from 6.3.11 to 6.3.16 (#10442) Bumps org.openrewrite.rewrite from 6.3.11 to 6.3.16. --- updated-dependencies: - dependency-name: org.openrewrite.rewrite dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 6aeeb4f7aae..b72001b0477 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ plugins { id 'idea' - id 'org.openrewrite.rewrite' version '6.3.11' + id 'org.openrewrite.rewrite' version '6.3.16' } // Enable following for debugging From 303281e223170583a3bb03bd816568e1d16e7961 Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com> Date: Tue, 3 Oct 2023 14:34:37 +0200 Subject: [PATCH 0011/1502] Fixed SpringerFetcherTest and ACMPortalFetcherTest (#10445) * Fixed SpringerFetcherTest * Fixed ACMPortalFetcherTest --- .../fetcher/ACMPortalFetcherTest.java | 2 +- .../importer/fetcher/SpringerFetcherTest.java | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/jabref/logic/importer/fetcher/ACMPortalFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/ACMPortalFetcherTest.java index 65c379836c8..6fe85359049 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/ACMPortalFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/ACMPortalFetcherTest.java @@ -34,7 +34,7 @@ void setUp() { @Test void searchByQueryFindsEntry() throws Exception { BibEntry searchEntry = new BibEntry(StandardEntryType.Conference) - .withField(StandardField.AUTHOR, "Tobias Olsson and Morgan Ericsson and Anna Wingkvist") + .withField(StandardField.AUTHOR, "Olsson, Tobias and Ericsson, Morgan and Wingkvist, Anna") .withField(StandardField.YEAR, "2017") .withField(StandardField.MONTH, "9") .withField(StandardField.DAY, "11") diff --git a/src/test/java/org/jabref/logic/importer/fetcher/SpringerFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/SpringerFetcherTest.java index 7e65f95309f..275642794f3 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/SpringerFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/SpringerFetcherTest.java @@ -39,6 +39,23 @@ void setUp() { @Test void searchByQueryFindsEntry() throws Exception { + + BibEntry articleTagThatIssue = new BibEntry(StandardEntryType.Article) + .withField(StandardField.AUTHOR, "Santos, Fabio and Vargovich, Joseph and Trinkenreich, Bianca and Santos, Italo and Penney, Jacob and Britto, Ricardo and Pimentel, João Felipe and Wiese, Igor and Steinmacher, Igor and Sarma, Anita and Gerosa, Marco A.") + .withField(StandardField.DATE, "2023-08-31") + .withField(StandardField.DOI, "10.1007/s10664-023-10329-4") + .withField(StandardField.FILE, ":http\\://link.springer.com/openurl/pdf?id=doi\\:10.1007/s10664-023-10329-4:PDF") + .withField(StandardField.ISSN, "1382-3256") + .withField(StandardField.JOURNAL, "Empirical Software Engineering") + .withField(StandardField.MONTH, "#aug#") + .withField(StandardField.NUMBER, "5") + .withField(StandardField.PAGES, "1--52") + .withField(StandardField.PUBLISHER, "Springer") + .withField(StandardField.TITLE, "Tag that issue: applying API-domain labels in issue tracking systems") + .withField(StandardField.VOLUME, "28") + .withField(StandardField.YEAR, "2023") + .withField(StandardField.ABSTRACT, "Labeling issues with the skills required to complete them can help contributors to choose tasks in Open Source Software projects. However, manually labeling issues is time-consuming and error-prone, and current automated approaches are mostly limited to classifying issues as bugs/non-bugs. We investigate the feasibility and relevance of automatically labeling issues with what we call “API-domains,” which are high-level categories of APIs. Therefore, we posit that the APIs used in the source code affected by an issue can be a proxy for the type of skills (e.g., DB, security, UI) needed to work on the issue. We ran a user study (n=74) to assess API-domain labels’ relevancy to potential contributors, leveraged the issues’ descriptions and the project history to build prediction models, and validated the predictions with contributors (n=20) of the projects. Our results show that (i) newcomers to the project consider API-domain labels useful in choosing tasks, (ii) labels can be predicted with a precision of 84% and a recall of 78.6% on average, (iii) the results of the predictions reached up to 71.3% in precision and 52.5% in recall when training with a project and testing in another (transfer learning), and (iv) project contributors consider most of the predictions helpful in identifying needed skills. These findings suggest our approach can be applied in practice to automatically label issues, assisting developers in finding tasks that better match their skills."); + BibEntry firstArticle = new BibEntry(StandardEntryType.Article) .withField(StandardField.AUTHOR, "Steinmacher, Igor and Balali, Sogol and Trinkenreich, Bianca and Guizani, Mariam and Izquierdo-Cortazar, Daniel and Cuevas Zambrano, Griselda G. and Gerosa, Marco Aurelio and Sarma, Anita") .withField(StandardField.DATE, "2021-09-09") @@ -101,7 +118,7 @@ void searchByQueryFindsEntry() throws Exception { .withField(StandardField.ABSTRACT, "Several Open-Source Software (OSS) projects depend on the continuity of their development communities to remain sustainable. Understanding how developers become inactive or why they take breaks can help communities prevent abandonment and incentivize developers to come back. In this paper, we propose a novel method to identify developers’ inactive periods by analyzing the individual rhythm of contributions to the projects. Using this method, we quantitatively analyze the inactivity of core developers in 18 OSS organizations hosted on GitHub. We also survey core developers to receive their feedback about the identified breaks and transitions. Our results show that our method was effective for identifying developers’ breaks. About 94% of the surveyed core developers agreed with our state model of inactivity; 71% and 79% of them acknowledged their breaks and state transition, respectively. We also show that all core developers take breaks (at least once) and about a half of them (~45%) have completely disengaged from a project for at least one year. We also analyzed the probability of transitions to/from inactivity and found that developers who pause their activity have a ~35 to ~55% chance to return to an active state; yet, if the break lasts for a year or longer, then the probability of resuming activities drops to ~21–26%, with a ~54% chance of complete disengagement. These results may support the creation of policies and mechanisms to make OSS community managers aware of breaks and potential project abandonment."); List fetchedEntries = fetcher.performSearch("JabRef Social Barriers Steinmacher"); - assertEquals(List.of(fourthArticle, thirdArticle, firstArticle, secondArticle), fetchedEntries); + assertEquals(List.of(articleTagThatIssue, fourthArticle, thirdArticle, firstArticle, secondArticle), fetchedEntries); } @Test From a73bb070197d59f4b20fe861ae1a2df7463c342e Mon Sep 17 00:00:00 2001 From: Luggas <127773292+Luggas4you@users.noreply.github.com> Date: Tue, 3 Oct 2023 19:09:13 +0200 Subject: [PATCH 0012/1502] Fix PDF export (#10361) * Create PDF WIP * Create PDF WIP * Create PDF WIP * Add @Test to XmpPdfExporterTest WIP * Add Importer to XmpPdfExporterTest * WIP * Fix testRoundtripExportImport * Finish testRoundtripExportImport * Add @AfterEach to XmpPdfExporterTest.java * Change @Test to @ParameterizedTest * Delete IllegalArgumentException in XmpPdfExporter.java * add changelog and change message --------- Co-authored-by: Siedlerchr --- CHANGELOG.md | 2 + .../jabref/logic/exporter/XmpPdfExporter.java | 27 ++++++- .../logic/exporter/XmpPdfExporterTest.java | 72 ++++++++++++++++++- 3 files changed, 97 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 155e23266c1..b78c3cda0c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - The export formats `listrefs`, `tablerefs`, `tablerefsabsbib`, now use the ISO date format in the footer [#10383](https://github.com/JabRef/jabref/pull/10383). - When searching for an identifier in the "Web search", the title of the search window is now "Identifier-based Web Search". [#10391](https://github.com/JabRef/jabref/pull/10391) - The ampersand checker now skips verbatim fields (`file`, `url`, ...). [#10419](https://github.com/JabRef/jabref/pull/10419) +- If no existing document is selected for exporting "XMP annotated pdf" JabRef will now create a new PDF file with a sample text and the metadata. [#10102](https://github.com/JabRef/jabref/issues/10102) ### Fixed @@ -38,6 +39,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We fixed an issue where it was possible to create a group with no name or with a group separator inside the name [#9776](https://github.com/JabRef/jabref/issues/9776) - Biblatex's `journaltitle` is now also respected for showing the journal information. [#10397](https://github.com/JabRef/jabref/issues/10397) - JabRef does not hang anymore when exporting via CLI. [#10380](https://github.com/JabRef/jabref/issues/10380) +- We fixed an issue where exporting "XMP annotated pdf" without selecting an existing document would produce an exception. [#10102](https://github.com/JabRef/jabref/issues/10102) ### Removed diff --git a/src/main/java/org/jabref/logic/exporter/XmpPdfExporter.java b/src/main/java/org/jabref/logic/exporter/XmpPdfExporter.java index f6ece8646c2..21e671b7d4c 100644 --- a/src/main/java/org/jabref/logic/exporter/XmpPdfExporter.java +++ b/src/main/java/org/jabref/logic/exporter/XmpPdfExporter.java @@ -1,5 +1,7 @@ package org.jabref.logic.exporter; +import java.io.IOException; +import java.nio.file.Files; import java.nio.file.Path; import java.util.List; import java.util.Objects; @@ -11,6 +13,12 @@ import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; +import org.apache.pdfbox.pdmodel.PDDocument; +import org.apache.pdfbox.pdmodel.PDPage; +import org.apache.pdfbox.pdmodel.PDPageContentStream; +import org.apache.pdfbox.pdmodel.font.PDType1Font; +import org.apache.pdfbox.pdmodel.font.Standard14Fonts; + public class XmpPdfExporter extends Exporter { private final XmpPreferences xmpPreferences; @@ -26,7 +34,24 @@ public void export(BibDatabaseContext databaseContext, Path pdfFile, List(',')); + xmpPreferences = new XmpPreferences(false, Collections.emptySet(), new SimpleObjectProperty<>(',')); exporter = new XmpPdfExporter(xmpPreferences); + ImportFormatPreferences importFormatPreferences = mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS); + when(importFormatPreferences.fieldPreferences().getNonWrappableFields()).thenReturn(FXCollections.emptyObservableList()); + importer = new PdfXmpImporter(xmpPreferences); + databaseContext = new BibDatabaseContext(); BibDatabase dataBase = databaseContext.getDatabase(); @@ -111,6 +129,17 @@ void setUp() throws IOException { dataBase.insertEntry(vapnik2000); } + @AfterEach + void reset() throws IOException { + List expectedEntries = databaseContext.getEntries(); + for (BibEntry entry : expectedEntries) { + entry.clearField(StandardField.FILE); + } + LinkedFile linkedFile = createDefaultLinkedFile("existing.pdf", tempDir); + olly2018.setFiles(List.of(linkedFile)); + toral2006.setFiles(List.of(new LinkedFile("non-existing", "path/to/nowhere.pdf", "PDF"))); + } + @ParameterizedTest @MethodSource("provideBibEntriesWithValidPdfFileLinks") void successfulExportToAllFilesOfEntry(BibEntry bibEntryWithValidPdfFileLink) throws Exception { @@ -143,6 +172,39 @@ void unsuccessfulExportToFileByPath(Path path) throws Exception { assertFalse(exporter.exportToFileByPath(databaseContext, filePreferences, path, abbreviationRepository)); } + @ParameterizedTest + @MethodSource("providePathToNewPDFs") + public void testRoundtripExportImport(Path path) throws Exception { + try (PDDocument document = new PDDocument()) { + PDPage page = new PDPage(); + document.addPage(page); + + try (PDPageContentStream contentStream = new PDPageContentStream(document, page)) { + contentStream.beginText(); + contentStream.newLineAtOffset(25, 500); + contentStream.setFont(new PDType1Font(Standard14Fonts.FontName.HELVETICA), 12); + contentStream.showText("This PDF was created by JabRef. It demonstrates the embedding of XMP data in PDF files. Please open the file metadata view of your PDF viewer to see the attached files. Note that the normal usage is to embed the BibTeX data in an existing PDF."); + contentStream.endText(); + } + document.save(path.toString()); + } + new XmpUtilWriter(xmpPreferences).writeXmp(path, databaseContext.getEntries(), databaseContext.getDatabase()); + + List importedEntries = importer.importDatabase(path).getDatabase().getEntries(); + importedEntries.forEach(bibEntry -> new FieldFormatterCleanup(StandardField.AUTHOR, new NormalizeNamesFormatter()).cleanup(bibEntry)); + + List expectedEntries = databaseContext.getEntries(); + for (BibEntry entry : expectedEntries) { + entry.clearField(StandardField.FILE); + entry.addFile(createDefaultLinkedFile("original.pdf", tempDir)); + } + assertEquals(expectedEntries, importedEntries); + } + + public static Stream providePathToNewPDFs() { + return Stream.of(Arguments.of(tempDir.resolve("original.pdf").toAbsolutePath())); + } + public static Stream providePathsToValidPDFs() { return Stream.of(Arguments.of(tempDir.resolve("existing.pdf").toAbsolutePath())); } @@ -156,12 +218,16 @@ public static Stream providePathsToInvalidPDFs() throws IOException { } private static LinkedFile createDefaultLinkedFile(String fileName, Path tempDir) throws IOException { + return createDefaultLinkedFile("", fileName, tempDir); + } + + private static LinkedFile createDefaultLinkedFile(String description, String fileName, Path tempDir) throws IOException { Path pdfFile = tempDir.resolve(fileName); try (PDDocument pdf = new PDDocument()) { pdf.addPage(new PDPage()); pdf.save(pdfFile.toAbsolutePath().toString()); } - return new LinkedFile("A linked pdf", pdfFile, "PDF"); + return new LinkedFile("", pdfFile, "PDF"); } } From 16b5a3ca3669f48592e64bd23704e72fb5377ced Mon Sep 17 00:00:00 2001 From: Christoph Date: Tue, 3 Oct 2023 20:14:29 +0200 Subject: [PATCH 0013/1502] Add TexShop Icon (#10447) --- .../java/org/jabref/gui/icon/IconTheme.java | 2 +- .../gui/icon/JabRefMaterialDesignIcon.java | 3 ++- .../org/jabref/gui/push/PushToTexShop.java | 2 +- .../resources/fonts/JabRefMaterialDesign.ttf | Bin 7488 -> 8460 bytes 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/jabref/gui/icon/IconTheme.java b/src/main/java/org/jabref/gui/icon/IconTheme.java index 9833e46049c..05beb9a51f7 100644 --- a/src/main/java/org/jabref/gui/icon/IconTheme.java +++ b/src/main/java/org/jabref/gui/icon/IconTheme.java @@ -277,6 +277,7 @@ public enum JabRefIcons implements JabRefIcon { APPLICATION_VIM(JabRefMaterialDesignIcon.VIM), APPLICATION_WINEDT(JabRefMaterialDesignIcon.WINEDT), APPLICATION_SUBLIMETEXT(JabRefMaterialDesignIcon.SUBLIME_TEXT), + APPLICATION_TEXSHOP(JabRefMaterialDesignIcon.TEXSHOP), KEY_BINDINGS(MaterialDesignK.KEYBOARD), FIND_DUPLICATES(MaterialDesignC.CODE_EQUAL), CONNECT_DB(MaterialDesignC.CLOUD_UPLOAD), @@ -351,7 +352,6 @@ public enum JabRefIcons implements JabRefIcon { ACCEPT_LEFT(MaterialDesignS.SUBDIRECTORY_ARROW_LEFT), ACCEPT_RIGHT(MaterialDesignS.SUBDIRECTORY_ARROW_RIGHT), MERGE_GROUPS(MaterialDesignS.SOURCE_MERGE); - private final JabRefIcon icon; JabRefIcons(Ikon... icons) { diff --git a/src/main/java/org/jabref/gui/icon/JabRefMaterialDesignIcon.java b/src/main/java/org/jabref/gui/icon/JabRefMaterialDesignIcon.java index e6b63d609db..6f697cc1e4a 100644 --- a/src/main/java/org/jabref/gui/icon/JabRefMaterialDesignIcon.java +++ b/src/main/java/org/jabref/gui/icon/JabRefMaterialDesignIcon.java @@ -30,7 +30,8 @@ public enum JabRefMaterialDesignIcon implements Ikon { SET_ALL("jab-setall", '\ue90c'), VSCODE("jab-vsvode", '\ue90d'), CANCEL("jab-cancel", '\ue90e'), - SUBLIME_TEXT("jab-sublime-text", '\ue90f'); + SUBLIME_TEXT("jab-sublime-text", '\ue90f'), + TEXSHOP("jab-texshop", '\ue910'); private String description; private int code; diff --git a/src/main/java/org/jabref/gui/push/PushToTexShop.java b/src/main/java/org/jabref/gui/push/PushToTexShop.java index 24fadcf1b8f..72f8c66a7a1 100644 --- a/src/main/java/org/jabref/gui/push/PushToTexShop.java +++ b/src/main/java/org/jabref/gui/push/PushToTexShop.java @@ -34,7 +34,7 @@ public String getDisplayName() { @Override public JabRefIcon getApplicationIcon() { - return IconTheme.JabRefIcons.APPLICATION_GENERIC; + return IconTheme.JabRefIcons.APPLICATION_TEXSHOP; } @Override diff --git a/src/main/resources/fonts/JabRefMaterialDesign.ttf b/src/main/resources/fonts/JabRefMaterialDesign.ttf index 769fc1fe9e5dee818e05f3d3fe6d16d9fa4f27e1..1dad4686d10f5684a9fe64081c824557f19ea9da 100644 GIT binary patch delta 1270 zcmYjRO>7%g5PskL+g;ncYdhXu$MwdwH?hI79RItdX-pCHP>PBmAdnEPRYD__&`7OB zKnQc=!Ub|b;z&6ll>;Idgg~k|A;AeD?nNBAa^V2XbApeQ+xv88$v3BcbNB7nfBJUg zD)|SDmA7`br?0Ktea>Pm{+aTl9ST@Kh~F4nlH@P%?ACK*4%HfibymWR_8EFqd(1woWFkyyj=CdR$`+6gQugan{$qlreX9&|L7 zcReJvdZW963xpkYJA>f{k~WgYaNKC4F{qn;Zb>6Ii+Ujugqq4IXw~#_mkDx7&Cs2; zfU-nA7#SIZQNI^P9it!$`s+AW8=L0C&chz3ng#uysq9lR*>D^*hV9v03X#@ps|ZN1 zN&RmVLzWEc!wGt$ld?@rPSg`KrMvaP1yK8F9Q49&SP06n3fjz}=hBwY?-8Tmr%rxlYExOb7~G z-hE*T!MVWf(mJ$|D$Jw_Btaog?3R!zsm@f-73{o}j_F7Y?KW+ch9gDZ4$iMEYJ!iHecSP=MGXbqhwl2 zO+x@Pj(>hNT#@4&tXXqTV3opj0b0q7R)LXaR;yBJ%^#{!xXcy7;<#l_-*Fa{OwnC& zK{F9I$2)}NP+X?H5MLv7GeRgM{R6YnyU;ViQ%ZU=LoYlXa!!LnbMa{Dam8D4H=qcI zX9l3#|srZF%u$^iKx>50V! zKw1FE2hkkqIhAQ*LHjF!d?1$S$w*C1QF(jLn1Mlx1t@Qp0Tf_A#C#RVw*m51GIC2Q z+!$Eufcyj?KOiSR*)h>g$G!?EumLEbm77>mz#zl81IWJv?gMF0Q* From 3f53201dea6640bd2b0f903a257b8f772ba206a8 Mon Sep 17 00:00:00 2001 From: Houssem Nasri Date: Thu, 5 Oct 2023 10:47:56 +0100 Subject: [PATCH 0014/1502] Infer DOI from ArXiv identifier (#10449) * Infer DOI from ArXiv identifier * Update Changelog * Remove extra isPresent() check --- CHANGELOG.md | 1 + .../org/jabref/logic/cleanup/DoiCleanup.java | 19 +++++++++++++++--- .../entry/identifier/ArXivIdentifier.java | 20 +++++++++++++++++++ 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b78c3cda0c8..1c83e4b0910 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - When searching for an identifier in the "Web search", the title of the search window is now "Identifier-based Web Search". [#10391](https://github.com/JabRef/jabref/pull/10391) - The ampersand checker now skips verbatim fields (`file`, `url`, ...). [#10419](https://github.com/JabRef/jabref/pull/10419) - If no existing document is selected for exporting "XMP annotated pdf" JabRef will now create a new PDF file with a sample text and the metadata. [#10102](https://github.com/JabRef/jabref/issues/10102) +- We modified the DOI cleanup to infer the DOI from an ArXiV ID if it's present. [10426](https://github.com/JabRef/jabref/issues/10426) ### Fixed diff --git a/src/main/java/org/jabref/logic/cleanup/DoiCleanup.java b/src/main/java/org/jabref/logic/cleanup/DoiCleanup.java index 3657acabb5f..1cb3f2d04e3 100644 --- a/src/main/java/org/jabref/logic/cleanup/DoiCleanup.java +++ b/src/main/java/org/jabref/logic/cleanup/DoiCleanup.java @@ -13,17 +13,19 @@ import org.jabref.model.entry.field.Field; import org.jabref.model.entry.field.StandardField; import org.jabref.model.entry.field.UnknownField; +import org.jabref.model.entry.identifier.ArXivIdentifier; import org.jabref.model.entry.identifier.DOI; /** - * Formats the DOI (e.g. removes http part) and also moves DOIs from note, url or ee field to the doi field. + * Formats the DOI (e.g. removes http part) and also infers DOIs from the note, url, eprint or ee fields. */ public class DoiCleanup implements CleanupJob { /** * Fields to check for DOIs. */ - private static final List FIELDS = Arrays.asList(StandardField.NOTE, StandardField.URL, new UnknownField("ee")); + private static final List FIELDS = Arrays.asList(StandardField.NOTE, StandardField.URL, StandardField.EPRINT, + new UnknownField("ee")); @Override public List cleanup(BibEntry entry) { @@ -57,7 +59,9 @@ public List cleanup(BibEntry entry) { } else { // As the Doi field is empty we now check if note, url, or ee field contains a Doi for (Field field : FIELDS) { - Optional doi = entry.getField(field).flatMap(DOI::parse); + Optional fieldContentOpt = entry.getField(field); + + Optional doi = fieldContentOpt.flatMap(DOI::parse); if (doi.isPresent()) { // Update Doi @@ -65,6 +69,15 @@ public List cleanup(BibEntry entry) { change.ifPresent(changes::add); removeFieldValue(entry, field, changes); } + + if (StandardField.EPRINT == field) { + fieldContentOpt.flatMap(ArXivIdentifier::parse) + .flatMap(ArXivIdentifier::inferDOI) + .ifPresent(inferredDoi -> { + Optional change = entry.setField(StandardField.DOI, inferredDoi.getDOI()); + change.ifPresent(changes::add); + }); + } } } return changes; diff --git a/src/main/java/org/jabref/model/entry/identifier/ArXivIdentifier.java b/src/main/java/org/jabref/model/entry/identifier/ArXivIdentifier.java index 4db64bad268..01a9e74270f 100644 --- a/src/main/java/org/jabref/model/entry/identifier/ArXivIdentifier.java +++ b/src/main/java/org/jabref/model/entry/identifier/ArXivIdentifier.java @@ -9,10 +9,14 @@ import org.jabref.model.strings.StringUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + /** * Identifier for the arXiv. See https://arxiv.org/help/arxiv_identifier */ public class ArXivIdentifier extends EprintIdentifier { + private static final Logger LOGGER = LoggerFactory.getLogger(ArXivIdentifier.class); private static final String ARXIV_PREFIX = "http(s)?://arxiv.org/(abs|pdf)/|arxiv|arXiv"; private final String identifier; @@ -71,6 +75,22 @@ public Optional getClassification() { } } + /** + * ArXiV articles are assigned DOIs automatically, which starts with a DOI prefix '10.48550/' followed by the ArXiV + * ID (replacing the colon with a period). + *

+ * For more information: + * + * new-arxiv-articles-are-now-automatically-assigned-dois + * */ + public Optional inferDOI() { + if (StringUtil.isBlank(identifier)) { + return Optional.empty(); + } + + return DOI.parse("10.48550/arxiv." + identifier); + } + @Override public String toString() { return "ArXivIdentifier{" + From 3d672c00223d4adc36735a8ac3b17375dcba9ad6 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Fri, 6 Oct 2023 20:28:36 +0200 Subject: [PATCH 0015/1502] Fix saving on network drive under macOS Fixes #10452 Workaround for https://bugs.openjdk.org/browse/JDK-8167023 --- CHANGELOG.md | 1 + .../jabref/logic/exporter/AtomicFileOutputStream.java | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 155e23266c1..adf7c7074ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We fixed an issue where it was possible to create a group with no name or with a group separator inside the name [#9776](https://github.com/JabRef/jabref/issues/9776) - Biblatex's `journaltitle` is now also respected for showing the journal information. [#10397](https://github.com/JabRef/jabref/issues/10397) - JabRef does not hang anymore when exporting via CLI. [#10380](https://github.com/JabRef/jabref/issues/10380) +- We fixed an issue where it was not possible to save a library on a network share under macOS due to an exception when acquiring a file lock [#10452](https://github.com/JabRef/jabref/issues/10452) ### Removed diff --git a/src/main/java/org/jabref/logic/exporter/AtomicFileOutputStream.java b/src/main/java/org/jabref/logic/exporter/AtomicFileOutputStream.java index 249e7fa04bb..653e19b7b89 100644 --- a/src/main/java/org/jabref/logic/exporter/AtomicFileOutputStream.java +++ b/src/main/java/org/jabref/logic/exporter/AtomicFileOutputStream.java @@ -61,7 +61,7 @@ public class AtomicFileOutputStream extends FilterOutputStream { */ private final Path temporaryFile; - private final FileLock temporaryFileLock; + private FileLock temporaryFileLock; /** * A backup of the target file (if it exists), created when the stream is closed @@ -106,7 +106,12 @@ public AtomicFileOutputStream(Path path) throws IOException { try { // Lock files (so that at least not another JabRef instance writes at the same time to the same tmp file) if (out instanceof FileOutputStream stream) { - temporaryFileLock = stream.getChannel().lock(); + try { + temporaryFileLock = stream.getChannel().tryLock(); + } catch (IOException ex) { + LOGGER.warn("Could not acquire file lock. Maybe we are on a network drive?", ex); + temporaryFileLock = null; + } } else { temporaryFileLock = null; } From 9aeb791e97a170283c9eeb2bbfc004f5e0173439 Mon Sep 17 00:00:00 2001 From: Christoph Date: Sat, 7 Oct 2023 10:43:10 +0200 Subject: [PATCH 0016/1502] Update src/main/java/org/jabref/logic/exporter/AtomicFileOutputStream.java Co-authored-by: Oliver Kopp --- .../java/org/jabref/logic/exporter/AtomicFileOutputStream.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/org/jabref/logic/exporter/AtomicFileOutputStream.java b/src/main/java/org/jabref/logic/exporter/AtomicFileOutputStream.java index 653e19b7b89..c60323c6bc9 100644 --- a/src/main/java/org/jabref/logic/exporter/AtomicFileOutputStream.java +++ b/src/main/java/org/jabref/logic/exporter/AtomicFileOutputStream.java @@ -109,6 +109,7 @@ public AtomicFileOutputStream(Path path) throws IOException { try { temporaryFileLock = stream.getChannel().tryLock(); } catch (IOException ex) { + // workaround for https://bugs.openjdk.org/browse/JDK-8167023 LOGGER.warn("Could not acquire file lock. Maybe we are on a network drive?", ex); temporaryFileLock = null; } From 71a1cccdd201ea11a6e680db2c14f79b534b6880 Mon Sep 17 00:00:00 2001 From: Christoph Date: Sat, 7 Oct 2023 23:05:39 +0200 Subject: [PATCH 0017/1502] Mark download PDF test as fetcher test (#10457) Sometimes fails on CI --- .../org/jabref/gui/fieldeditors/LinkedFileViewModelTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/org/jabref/gui/fieldeditors/LinkedFileViewModelTest.java b/src/test/java/org/jabref/gui/fieldeditors/LinkedFileViewModelTest.java index 54d74b154fb..20839979607 100644 --- a/src/test/java/org/jabref/gui/fieldeditors/LinkedFileViewModelTest.java +++ b/src/test/java/org/jabref/gui/fieldeditors/LinkedFileViewModelTest.java @@ -330,6 +330,7 @@ void mimeTypeStringWithParameterIsReturnedAsWithoutParameter() { } @Test + @FetcherTest void downloadPdfFileWhenLinkedFilePointsToPdfUrl() throws MalformedURLException { linkedFile = new LinkedFile(new URL("http://arxiv.org/pdf/1207.0408v1"), "pdf"); // Needed Mockito stubbing methods to run test From 0a497f5d6fb88973b1a561be63d208ac788931f3 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Sun, 8 Oct 2023 14:25:10 +0200 Subject: [PATCH 0018/1502] Simplify code (#10460) --- .../LatexCitationsTabViewModel.java | 35 ++++++++----------- .../gui/util/DefaultFileUpdateMonitor.java | 2 +- .../logic/texparser/DefaultLatexParser.java | 16 ++++----- 3 files changed, 22 insertions(+), 31 deletions(-) diff --git a/src/main/java/org/jabref/gui/entryeditor/LatexCitationsTabViewModel.java b/src/main/java/org/jabref/gui/entryeditor/LatexCitationsTabViewModel.java index fc2ce8361fe..8d094f598fd 100644 --- a/src/main/java/org/jabref/gui/entryeditor/LatexCitationsTabViewModel.java +++ b/src/main/java/org/jabref/gui/entryeditor/LatexCitationsTabViewModel.java @@ -3,14 +3,10 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.util.ArrayList; import java.util.Collection; import java.util.List; -import java.util.Map; import java.util.Optional; import java.util.concurrent.Future; -import java.util.stream.Collectors; -import java.util.stream.Stream; import javafx.beans.property.ObjectProperty; import javafx.beans.property.ReadOnlyListWrapper; @@ -140,31 +136,28 @@ private Collection searchAndParse(String citeKey) throws IOException { throw new IOException(String.format("Current search directory does not exist: %s", newDirectory)); } - List texFiles = searchDirectory(newDirectory, new ArrayList<>()); + List texFiles = searchDirectory(newDirectory); + LOGGER.debug("Found tex files: {}", texFiles); latexParserResult = new DefaultLatexParser().parse(texFiles); } return latexParserResult.getCitationsByKey(citeKey); } - private List searchDirectory(Path directory, List texFiles) { - Map> fileListPartition; - try (Stream filesStream = Files.list(directory)) { - fileListPartition = filesStream.collect(Collectors.partitioningBy(path -> path.toFile().isDirectory())); + /** + * @param directory the directory to search for. It is recursively searched. + */ + private List searchDirectory(Path directory) { + LOGGER.debug("Searching directory {}", directory); + try { + return Files.walk(directory) + .filter(Files::isRegularFile) + .filter(path -> path.toString().endsWith(TEX_EXT)) + .toList(); } catch (IOException e) { - LOGGER.error(String.format("%s while searching files: %s", e.getClass().getName(), e.getMessage())); - return texFiles; + LOGGER.error("Error while searching files", e); + return List.of(); } - - List subDirectories = fileListPartition.get(true); - List files = fileListPartition.get(false) - .stream() - .filter(path -> path.toString().endsWith(TEX_EXT)) - .collect(Collectors.toList()); - texFiles.addAll(files); - subDirectories.forEach(subDirectory -> searchDirectory(subDirectory, texFiles)); - - return texFiles; } public void setLatexDirectory() { diff --git a/src/main/java/org/jabref/gui/util/DefaultFileUpdateMonitor.java b/src/main/java/org/jabref/gui/util/DefaultFileUpdateMonitor.java index 4c00eb13929..9d53439b90e 100644 --- a/src/main/java/org/jabref/gui/util/DefaultFileUpdateMonitor.java +++ b/src/main/java/org/jabref/gui/util/DefaultFileUpdateMonitor.java @@ -72,7 +72,7 @@ public void run() { JabRefException exception = new WatchServiceUnavailableException( e.getMessage(), e.getLocalizedMessage(), e.getCause()); filesystemMonitorFailure.set(Optional.of(exception)); - LOGGER.warn(exception.getLocalizedMessage(), e); + LOGGER.warn("Error during watching", e); } } diff --git a/src/main/java/org/jabref/logic/texparser/DefaultLatexParser.java b/src/main/java/org/jabref/logic/texparser/DefaultLatexParser.java index fd790491fe2..d5e6264c0b0 100644 --- a/src/main/java/org/jabref/logic/texparser/DefaultLatexParser.java +++ b/src/main/java/org/jabref/logic/texparser/DefaultLatexParser.java @@ -77,7 +77,7 @@ public LatexParserResult parse(List latexFiles) { for (Path file : latexFiles) { if (!file.toFile().exists()) { - LOGGER.error(String.format("File does not exist: %s", file)); + LOGGER.error("File does not exist: {}", file); continue; } @@ -151,17 +151,15 @@ private void matchBibFile(Path file, String line) { /** * Find inputs and includes along a specific line and store them for parsing later. */ - private void matchNestedFile(Path file, List texFiles, List referencedFiles, String line) { + private void matchNestedFile(Path texFile, List texFiles, List referencedFiles, String line) { Matcher includeMatch = INCLUDE_PATTERN.matcher(line); while (includeMatch.find()) { - String include = includeMatch.group(INCLUDE_GROUP); - - Path nestedFile = file.getParent().resolve( - include.endsWith(TEX_EXT) - ? include - : String.format("%s%s", include, TEX_EXT)); - + String filenamePassedToInclude = includeMatch.group(INCLUDE_GROUP); + String texFileName = filenamePassedToInclude.endsWith(TEX_EXT) + ? filenamePassedToInclude + : String.format("%s%s", filenamePassedToInclude, TEX_EXT); + Path nestedFile = texFile.getParent().resolve(texFileName); if (nestedFile.toFile().exists() && !texFiles.contains(nestedFile)) { referencedFiles.add(nestedFile); } From 220ae722cb8399a271d1b39aee3372a4e21dd806 Mon Sep 17 00:00:00 2001 From: Harish-2403 <131174256+Harish-2403@users.noreply.github.com> Date: Sun, 8 Oct 2023 22:57:25 +0530 Subject: [PATCH 0019/1502] Fixed ui in protected terms files as the 'enabled' checkbox was too small (#10438) * Fixed ui inprotect terms files as the 'enabled' checkbox was too small * remove max width * add changelog * remove space --------- Co-authored-by: Siedlerchr --- CHANGELOG.md | 2 ++ .../gui/preferences/protectedterms/ProtectedTermsTab.fxml | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c858e68928..5453f9ccea7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,8 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - JabRef does not hang anymore when exporting via CLI. [#10380](https://github.com/JabRef/jabref/issues/10380) - We fixed an issue where it was not possible to save a library on a network share under macOS due to an exception when acquiring a file lock [#10452](https://github.com/JabRef/jabref/issues/10452) - We fixed an issue where exporting "XMP annotated pdf" without selecting an existing document would produce an exception. [#10102](https://github.com/JabRef/jabref/issues/10102) +- We fixed an issue where the "Enabled" column in the "Protected terms files" tab in the preferences could not be resized [#10285](https://github.com/JabRef/jabref/issues/10285) + ### Removed diff --git a/src/main/java/org/jabref/gui/preferences/protectedterms/ProtectedTermsTab.fxml b/src/main/java/org/jabref/gui/preferences/protectedterms/ProtectedTermsTab.fxml index 29df0104da2..2e9f4383c88 100644 --- a/src/main/java/org/jabref/gui/preferences/protectedterms/ProtectedTermsTab.fxml +++ b/src/main/java/org/jabref/gui/preferences/protectedterms/ProtectedTermsTab.fxml @@ -15,11 +15,11 @@ - + - - + + From 7187b699659dcf464d5b88e626e8c45f8eb20b30 Mon Sep 17 00:00:00 2001 From: Allan Yip Date: Sun, 8 Oct 2023 19:30:07 +0100 Subject: [PATCH 0020/1502] fix problem of abort button still add external file type entry in EditExternalFileTypeEntryDialog class --- .../externalfiletypes/EditExternalFileTypeEntryDialog.java | 6 ++++++ .../externalfiletypes/ExternalFileTypesTabViewModel.java | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/preferences/externalfiletypes/EditExternalFileTypeEntryDialog.java b/src/main/java/org/jabref/gui/preferences/externalfiletypes/EditExternalFileTypeEntryDialog.java index e5aa3e55c03..5799a73cd1b 100644 --- a/src/main/java/org/jabref/gui/preferences/externalfiletypes/EditExternalFileTypeEntryDialog.java +++ b/src/main/java/org/jabref/gui/preferences/externalfiletypes/EditExternalFileTypeEntryDialog.java @@ -36,9 +36,12 @@ public class EditExternalFileTypeEntryDialog extends BaseDialog { private final ExternalFileTypeItemViewModel item; + private final boolean isNewItem; private EditExternalFileTypeViewModel viewModel; public EditExternalFileTypeEntryDialog(ExternalFileTypeItemViewModel item, String dialogTitle) { + this.isNewItem = (item.extensionProperty().get().equals("")) ? true : false; + this.item = item; this.setTitle(dialogTitle); @@ -50,6 +53,8 @@ public EditExternalFileTypeEntryDialog(ExternalFileTypeItemViewModel item, Strin this.setResultConverter(button -> { if (button == ButtonType.OK) { viewModel.storeSettings(); + } else { + name.setText(""); } return null; }); @@ -67,6 +72,7 @@ public void initialize() { btnBrowse.disableProperty().bind(viewModel.defaultApplicationSelectedProperty()); extension.textProperty().bindBidirectional(viewModel.extensionProperty()); + extension.setEditable(isNewItem); name.textProperty().bindBidirectional(viewModel.nameProperty()); mimeType.textProperty().bindBidirectional(viewModel.mimeTypeProperty()); selectedApplication.textProperty().bindBidirectional(viewModel.selectedApplicationProperty()); diff --git a/src/main/java/org/jabref/gui/preferences/externalfiletypes/ExternalFileTypesTabViewModel.java b/src/main/java/org/jabref/gui/preferences/externalfiletypes/ExternalFileTypesTabViewModel.java index b61818105f0..817e930b382 100644 --- a/src/main/java/org/jabref/gui/preferences/externalfiletypes/ExternalFileTypesTabViewModel.java +++ b/src/main/java/org/jabref/gui/preferences/externalfiletypes/ExternalFileTypesTabViewModel.java @@ -56,8 +56,10 @@ public void resetToDefaults() { public void addNewType() { ExternalFileTypeItemViewModel item = new ExternalFileTypeItemViewModel(); - fileTypes.add(item); showEditDialog(item, Localization.lang("Add new file type")); + if (item.getName() != "") { + fileTypes.add(item); + } } public ObservableList getFileTypes() { From 4b16884b2df7db3328b8e07c794687555b84f32d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 14:47:57 +0000 Subject: [PATCH 0021/1502] Bump org.openrewrite.rewrite from 6.3.16 to 6.3.18 Bumps org.openrewrite.rewrite from 6.3.16 to 6.3.18. --- updated-dependencies: - dependency-name: org.openrewrite.rewrite dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index cf2bb2bf448..8dc3ead1deb 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ plugins { id 'idea' - id 'org.openrewrite.rewrite' version '6.3.16' + id 'org.openrewrite.rewrite' version '6.3.18' } // Enable following for debugging From b57a8d64e9896341279365b1dc821a19225115d0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 14:48:09 +0000 Subject: [PATCH 0022/1502] Bump com.puppycrawl.tools:checkstyle from 10.12.3 to 10.12.4 Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle) from 10.12.3 to 10.12.4. - [Release notes](https://github.com/checkstyle/checkstyle/releases) - [Commits](https://github.com/checkstyle/checkstyle/compare/checkstyle-10.12.3...checkstyle-10.12.4) --- updated-dependencies: - dependency-name: com.puppycrawl.tools:checkstyle dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index cf2bb2bf448..9b90e145601 100644 --- a/build.gradle +++ b/build.gradle @@ -246,7 +246,7 @@ dependencies { testImplementation "org.testfx:testfx-junit5:4.0.16-alpha" testImplementation "org.hamcrest:hamcrest-library:2.2" - checkstyle 'com.puppycrawl.tools:checkstyle:10.12.3' + checkstyle 'com.puppycrawl.tools:checkstyle:10.12.4' // xjc needs the runtime as well for the ant task, otherwise it fails xjc group: 'org.glassfish.jaxb', name: 'jaxb-xjc', version: '3.0.2' xjc group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '3.0.2' From 5b62bcef70d6702cea0c7fe4de46476a8a1605d5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 14:48:19 +0000 Subject: [PATCH 0023/1502] Bump org.mockito:mockito-core from 5.5.0 to 5.6.0 Bumps [org.mockito:mockito-core](https://github.com/mockito/mockito) from 5.5.0 to 5.6.0. - [Release notes](https://github.com/mockito/mockito/releases) - [Commits](https://github.com/mockito/mockito/compare/v5.5.0...v5.6.0) --- updated-dependencies: - dependency-name: org.mockito:mockito-core dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index cf2bb2bf448..a72b17c988f 100644 --- a/build.gradle +++ b/build.gradle @@ -237,7 +237,7 @@ dependencies { testImplementation 'org.junit.jupiter:junit-jupiter:5.10.0' testImplementation 'org.junit.platform:junit-platform-launcher:1.10.0' - testImplementation 'org.mockito:mockito-core:5.5.0' + testImplementation 'org.mockito:mockito-core:5.6.0' testImplementation 'org.xmlunit:xmlunit-core:2.9.1' testImplementation 'org.xmlunit:xmlunit-matchers:2.9.1' testRuntimeOnly 'com.tngtech.archunit:archunit-junit5-engine:1.1.0' From 79d01f27fba287e1d2e6d3d3bb207db1b257f6c4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 14:48:26 +0000 Subject: [PATCH 0024/1502] Bump styfle/cancel-workflow-action from 0.11.0 to 0.12.0 Bumps [styfle/cancel-workflow-action](https://github.com/styfle/cancel-workflow-action) from 0.11.0 to 0.12.0. - [Release notes](https://github.com/styfle/cancel-workflow-action/releases) - [Commits](https://github.com/styfle/cancel-workflow-action/compare/0.11.0...0.12.0) --- updated-dependencies: - dependency-name: styfle/cancel-workflow-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/cleanup_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cleanup_pr.yml b/.github/workflows/cleanup_pr.yml index 31cdefde5ce..77a8874bc6b 100644 --- a/.github/workflows/cleanup_pr.yml +++ b/.github/workflows/cleanup_pr.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cancel deployment run - uses: styfle/cancel-workflow-action@0.11.0 + uses: styfle/cancel-workflow-action@0.12.0 with: ignore_sha: true workflow_id: 9813 # workflow "Deployment" From 24cc4cc75c64b9cb0e45bededd3faf0a72ffe539 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Mon, 9 Oct 2023 20:54:03 +0200 Subject: [PATCH 0025/1502] Fix git command --- .../guidelines-for-setting-up-a-local-workspace/pre-03-code.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/pre-03-code.md b/docs/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/pre-03-code.md index 726e6ead456..4a35a83d6de 100644 --- a/docs/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/pre-03-code.md +++ b/docs/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/pre-03-code.md @@ -29,6 +29,7 @@ git clone --depth=10 https://github.com/JabRef/jabref.git JabRef cd jabref git remote rename origin upstream git remote add origin https://github.com/YOUR_USERNAME/jabref.git +git fetch --all git branch --set-upstream-to=origin/main main ``` From c8f5905183d254ea22c83009dfd2e6ca8dd5e704 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Mon, 9 Oct 2023 20:58:35 +0200 Subject: [PATCH 0026/1502] Fix command --- .../pre-03-code.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/pre-03-code.md b/docs/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/pre-03-code.md index 4a35a83d6de..6077ce797e4 100644 --- a/docs/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/pre-03-code.md +++ b/docs/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/pre-03-code.md @@ -25,8 +25,8 @@ In the following, we will use `c:\git-repositories` as base folder: cd \ mkdir git-repositories cd git-repositories -git clone --depth=10 https://github.com/JabRef/jabref.git JabRef -cd jabref +git clone https://github.com/JabRef/jabref.git JabRef +cd JabRef git remote rename origin upstream git remote add origin https://github.com/YOUR_USERNAME/jabref.git git fetch --all @@ -48,9 +48,6 @@ git branch --set-upstream-to=origin/main main > To prevent this, first the `upstream` repository is cloned. > This repository seems to live in the caches of GitHub. > -> The `--depth--10` is used to limit the download to \~20 MB instead of downloading the complete history (\~800 MB). -> If you want to dig in our commit history, feel free to download everything. -> > Now, you have two remote repositories, where `origin` is yours and `upstream` is the one of the JabRef organization. > > You can see it with `git remote -v`: From af73f26a6fb9a34298858d8d465e719c3db998e0 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Mon, 9 Oct 2023 21:13:12 +0200 Subject: [PATCH 0027/1502] Quick hack to get merge queue running --- .github/workflows/automerge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 956dfe3f41a..7fc5a3ec186 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -24,4 +24,4 @@ jobs: run: gh pr merge --auto "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + GITHUB_TOKEN: ${{secrets.GH_TOKEN_UPDATE_GRADLE_WRAPPER}} From 2e23dd65cd219a21606f16f84515a34796f01a48 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 21:16:13 +0200 Subject: [PATCH 0028/1502] Bump org.openrewrite.recipe:rewrite-recipe-bom from 2.3.0 to 2.3.1 (#10467) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Siedlerchr --- build.gradle | 2 +- .../mergeentries/DiffHighlightingEllipsingTextFlow.java | 2 +- .../gui/preferences/keybindings/KeyBindingViewModel.java | 2 +- .../gui/preferences/preview/PreviewTabViewModel.java | 4 ++-- .../org/jabref/gui/util/ViewModelTreeCellFactory.java | 2 +- .../jabref/gui/util/component/TemporalAccessorPicker.java | 2 +- .../java/org/jabref/logic/formatter/casechanger/Word.java | 8 ++++---- .../logic/formatter/minifier/TruncateFormatter.java | 2 +- .../logic/importer/fileformat/RepecNepImporter.java | 6 +++--- src/main/java/org/jabref/logic/layout/format/Default.java | 2 +- .../org/jabref/logic/openoffice/action/EditMerge.java | 2 +- src/main/java/org/jabref/model/entry/BibEntry.java | 2 +- .../org/jabref/model/openoffice/ootext/OOTextIntoOO.java | 6 +++--- .../model/openoffice/rangesort/RangeOverlapWithin.java | 2 +- src/main/java/org/jabref/model/texparser/Citation.java | 6 +++--- .../logic/openoffice/style/OOBibStyleTestHelper.java | 2 +- 16 files changed, 26 insertions(+), 26 deletions(-) diff --git a/build.gradle b/build.gradle index 3296c609ccd..6fd0b982d39 100644 --- a/build.gradle +++ b/build.gradle @@ -251,7 +251,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.3.0")) + rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:2.3.1")) rewrite("org.openrewrite.recipe:rewrite-static-analysis") rewrite("org.openrewrite.recipe:rewrite-logging-frameworks") rewrite("org.openrewrite.recipe:rewrite-testing-frameworks") diff --git a/src/main/java/org/jabref/gui/mergeentries/DiffHighlightingEllipsingTextFlow.java b/src/main/java/org/jabref/gui/mergeentries/DiffHighlightingEllipsingTextFlow.java index ce2b61a612e..312fc30ca99 100644 --- a/src/main/java/org/jabref/gui/mergeentries/DiffHighlightingEllipsingTextFlow.java +++ b/src/main/java/org/jabref/gui/mergeentries/DiffHighlightingEllipsingTextFlow.java @@ -153,7 +153,7 @@ private String ellipseString(String s) { } public final void setEllipsisString(String value) { - ellipsisString.set((value == null) ? "" : value); + ellipsisString.set(value == null ? "" : value); } public String getEllipsisString() { diff --git a/src/main/java/org/jabref/gui/preferences/keybindings/KeyBindingViewModel.java b/src/main/java/org/jabref/gui/preferences/keybindings/KeyBindingViewModel.java index bf84b49303d..5caa9ca82e3 100644 --- a/src/main/java/org/jabref/gui/preferences/keybindings/KeyBindingViewModel.java +++ b/src/main/java/org/jabref/gui/preferences/keybindings/KeyBindingViewModel.java @@ -75,7 +75,7 @@ private void setBinding(String bind) { } private void setDisplayName() { - this.displayName.set((keyBinding == null) ? this.category.getName() : keyBinding.getLocalization()); + this.displayName.set(keyBinding == null ? this.category.getName() : keyBinding.getLocalization()); } public StringProperty nameProperty() { diff --git a/src/main/java/org/jabref/gui/preferences/preview/PreviewTabViewModel.java b/src/main/java/org/jabref/gui/preferences/preview/PreviewTabViewModel.java index 7a06975c0ab..9906b6afc42 100644 --- a/src/main/java/org/jabref/gui/preferences/preview/PreviewTabViewModel.java +++ b/src/main/java/org/jabref/gui/preferences/preview/PreviewTabViewModel.java @@ -241,7 +241,7 @@ public void selectedInChosenUp() { for (int oldIndex : selected) { boolean alreadyTaken = newIndices.contains(oldIndex - 1); - int newIndex = ((oldIndex > 0) && !alreadyTaken) ? oldIndex - 1 : oldIndex; + int newIndex = (oldIndex > 0) && !alreadyTaken ? oldIndex - 1 : oldIndex; chosenListProperty.add(newIndex, chosenListProperty.remove(oldIndex)); newIndices.add(newIndex); } @@ -263,7 +263,7 @@ public void selectedInChosenDown() { for (int i = selected.size() - 1; i >= 0; i--) { int oldIndex = selected.get(i); boolean alreadyTaken = newIndices.contains(oldIndex + 1); - int newIndex = ((oldIndex < (chosenListProperty.size() - 1)) && !alreadyTaken) ? oldIndex + 1 : oldIndex; + int newIndex = (oldIndex < (chosenListProperty.size() - 1)) && !alreadyTaken ? oldIndex + 1 : oldIndex; chosenListProperty.add(newIndex, chosenListProperty.remove(oldIndex)); newIndices.add(newIndex); } diff --git a/src/main/java/org/jabref/gui/util/ViewModelTreeCellFactory.java b/src/main/java/org/jabref/gui/util/ViewModelTreeCellFactory.java index b3b551d4fd6..8080afb6c1a 100644 --- a/src/main/java/org/jabref/gui/util/ViewModelTreeCellFactory.java +++ b/src/main/java/org/jabref/gui/util/ViewModelTreeCellFactory.java @@ -69,7 +69,7 @@ public TreeCell call(TreeView tree) { StringConverter> converter = new StringConverter>() { @Override public String toString(TreeItem treeItem) { - return (treeItem == null || treeItem.getValue() == null || toText == null) ? + return treeItem == null || treeItem.getValue() == null || toText == null ? "" : toText.call(treeItem.getValue()); } diff --git a/src/main/java/org/jabref/gui/util/component/TemporalAccessorPicker.java b/src/main/java/org/jabref/gui/util/component/TemporalAccessorPicker.java index bd572e2deb5..2ca9cf1e407 100644 --- a/src/main/java/org/jabref/gui/util/component/TemporalAccessorPicker.java +++ b/src/main/java/org/jabref/gui/util/component/TemporalAccessorPicker.java @@ -145,7 +145,7 @@ public String toString(LocalDate object) { TemporalAccessor value = getTemporalAccessorValue(); // Keeps the original text when it is an invalid date - return (value != null) ? getStringConverter().toString(value) : getEditor().getText(); + return value != null ? getStringConverter().toString(value) : getEditor().getText(); } @Override diff --git a/src/main/java/org/jabref/logic/formatter/casechanger/Word.java b/src/main/java/org/jabref/logic/formatter/casechanger/Word.java index d6cee8237b0..a78138affee 100644 --- a/src/main/java/org/jabref/logic/formatter/casechanger/Word.java +++ b/src/main/java/org/jabref/logic/formatter/casechanger/Word.java @@ -95,7 +95,7 @@ public void toLowerCase() { public void toUpperFirst() { for (int i = 0; i < chars.length; i++) { if (!protectedChars[i]) { - chars[i] = (i == 0) ? + chars[i] = i == 0 ? Character.toUpperCase(chars[i]) : Character.toLowerCase(chars[i]); } @@ -105,7 +105,7 @@ public void toUpperFirst() { public void toUpperFirstIgnoreHyphen() { for (int i = 0; i < chars.length; i++) { if (!protectedChars[i]) { - chars[i] = (i == 0 || (DASHES.contains(chars[i - 1]))) ? + chars[i] = i == 0 || (DASHES.contains(chars[i - 1])) ? Character.toUpperCase(chars[i]) : Character.toLowerCase(chars[i]); } @@ -115,7 +115,7 @@ public void toUpperFirstIgnoreHyphen() { public void toUpperFirstTitle() { for (int i = 0; i < chars.length; i++) { if (!protectedChars[i]) { - chars[i] = (i == 0 || (DASHES.contains(chars[i - 1]) && isConjunction(chars, i))) ? + chars[i] = i == 0 || (DASHES.contains(chars[i - 1]) && isConjunction(chars, i)) ? Character.toUpperCase(chars[i]) : Character.toLowerCase(chars[i]); } @@ -134,7 +134,7 @@ private boolean isConjunction(char[] chars, int i) { public void stripConsonants() { for (int i = 0; i < chars.length; i++) { if (!protectedChars[i]) { - chars[i] = (i == 0 || DASHES.contains(chars[i - 1])) ? + chars[i] = i == 0 || DASHES.contains(chars[i - 1]) ? Character.toUpperCase(chars[i]) : Character.toLowerCase(chars[i]); } diff --git a/src/main/java/org/jabref/logic/formatter/minifier/TruncateFormatter.java b/src/main/java/org/jabref/logic/formatter/minifier/TruncateFormatter.java index 07930cd2064..8ee8f76ffc1 100644 --- a/src/main/java/org/jabref/logic/formatter/minifier/TruncateFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/minifier/TruncateFormatter.java @@ -15,7 +15,7 @@ public class TruncateFormatter extends Formatter { * @param truncateIndex truncate a string after this index. */ public TruncateFormatter(final int truncateIndex) { - TRUNCATE_AFTER = (truncateIndex >= 0) ? truncateIndex : Integer.MAX_VALUE; + TRUNCATE_AFTER = truncateIndex >= 0 ? truncateIndex : Integer.MAX_VALUE; KEY = "truncate" + TRUNCATE_AFTER; } diff --git a/src/main/java/org/jabref/logic/importer/fileformat/RepecNepImporter.java b/src/main/java/org/jabref/logic/importer/fileformat/RepecNepImporter.java index 6e3d235a748..2b95e5da68b 100644 --- a/src/main/java/org/jabref/logic/importer/fileformat/RepecNepImporter.java +++ b/src/main/java/org/jabref/logic/importer/fileformat/RepecNepImporter.java @@ -276,16 +276,16 @@ private void parseAuthors(BibEntry be, BufferedReader in) throws IOException { authors.add(author); - if (institution.length() > 0) { + if (!institution.isEmpty()) { institutions.append( - (institutions.length() == 0) ? institution.toString() : " and " + institution.toString()); + institutions.length() == 0 ? institution.toString() : " and " + institution.toString()); } } if (!authors.isEmpty()) { be.setField(StandardField.AUTHOR, String.join(" and ", authors)); } - if (institutions.length() > 0) { + if (!institutions.isEmpty()) { be.setField(StandardField.INSTITUTION, institutions.toString()); } } diff --git a/src/main/java/org/jabref/logic/layout/format/Default.java b/src/main/java/org/jabref/logic/layout/format/Default.java index 6c2a5d6c60e..3467c378c95 100644 --- a/src/main/java/org/jabref/logic/layout/format/Default.java +++ b/src/main/java/org/jabref/logic/layout/format/Default.java @@ -17,6 +17,6 @@ public void setArgument(String arg) { @Override public String format(String fieldText) { - return ((fieldText == null) || fieldText.isEmpty()) ? defValue : fieldText; + return (fieldText == null) || fieldText.isEmpty() ? defValue : fieldText; } } diff --git a/src/main/java/org/jabref/logic/openoffice/action/EditMerge.java b/src/main/java/org/jabref/logic/openoffice/action/EditMerge.java index c958d53e5d2..66360dd62c8 100644 --- a/src/main/java/org/jabref/logic/openoffice/action/EditMerge.java +++ b/src/main/java/org/jabref/logic/openoffice/action/EditMerge.java @@ -186,7 +186,7 @@ private static boolean checkAddToGroup(ScanState state, CitationGroup group, XTe + " but %s", state.prevRange.getString(), currentRange.getString(), - ((textOrder == 0) + (textOrder == 0 ? "they start at the same position" : "the start of the latter precedes the start of the first")); LOGGER.warn(msg); diff --git a/src/main/java/org/jabref/model/entry/BibEntry.java b/src/main/java/org/jabref/model/entry/BibEntry.java index 022e64319ba..c5590a1348a 100644 --- a/src/main/java/org/jabref/model/entry/BibEntry.java +++ b/src/main/java/org/jabref/model/entry/BibEntry.java @@ -337,7 +337,7 @@ private Optional genericGetResolvedFieldOrAlias(Field field, BibDatabase } } - return ((database == null) || result.isEmpty()) ? + return (database == null) || result.isEmpty() ? result : Optional.of(database.resolveForStrings(result.get())); } diff --git a/src/main/java/org/jabref/model/openoffice/ootext/OOTextIntoOO.java b/src/main/java/org/jabref/model/openoffice/ootext/OOTextIntoOO.java index eb34293fe60..7e434495571 100644 --- a/src/main/java/org/jabref/model/openoffice/ootext/OOTextIntoOO.java +++ b/src/main/java/org/jabref/model/openoffice/ootext/OOTextIntoOO.java @@ -671,9 +671,9 @@ private static List> setCharLocale(String value) { throw new java.lang.IllegalArgumentException("setCharLocale \"\" or null"); } String[] parts = value.split("-"); - String language = (parts.length > 0) ? parts[0] : ""; - String country = (parts.length > 1) ? parts[1] : ""; - String variant = (parts.length > 2) ? parts[2] : ""; + String language = parts.length > 0 ? parts[0] : ""; + String country = parts.length > 1 ? parts[1] : ""; + String variant = parts.length > 2 ? parts[2] : ""; return setCharLocale(new Locale(language, country, variant)); } diff --git a/src/main/java/org/jabref/model/openoffice/rangesort/RangeOverlapWithin.java b/src/main/java/org/jabref/model/openoffice/rangesort/RangeOverlapWithin.java index 69ff4ca91d1..249f9484534 100644 --- a/src/main/java/org/jabref/model/openoffice/rangesort/RangeOverlapWithin.java +++ b/src/main/java/org/jabref/model/openoffice/rangesort/RangeOverlapWithin.java @@ -97,7 +97,7 @@ List> findOverlappingRanges(RangeSort.RangePartitions input, List valuesForOverlappingRanges = new ArrayList<>(); valuesForOverlappingRanges.add(aHolder); valuesForOverlappingRanges.add(bHolder); - result.add(new RangeOverlap<>((cmpResult == 0) + result.add(new RangeOverlap<>(cmpResult == 0 ? RangeOverlapKind.TOUCH : RangeOverlapKind.OVERLAP, valuesForOverlappingRanges)); diff --git a/src/main/java/org/jabref/model/texparser/Citation.java b/src/main/java/org/jabref/model/texparser/Citation.java index 13cf29494ce..690ee2fcbc9 100644 --- a/src/main/java/org/jabref/model/texparser/Citation.java +++ b/src/main/java/org/jabref/model/texparser/Citation.java @@ -59,16 +59,16 @@ public String getContext() { int center = (colStart + colEnd) / 2; int lineLength = lineText.length(); - int start = Math.max(0, (center + CONTEXT_WIDTH / 2 < lineLength) + int start = Math.max(0, center + CONTEXT_WIDTH / 2 < lineLength ? center - CONTEXT_WIDTH / 2 : lineLength - CONTEXT_WIDTH); int end = Math.min(lineLength, start + CONTEXT_WIDTH); // Add three dots when the string does not contain all the line. return String.format("%s%s%s", - (start > 0) ? "..." : "", + start > 0 ? "..." : "", lineText.substring(start, end).trim(), - (end < lineLength) ? "..." : ""); + end < lineLength ? "..." : ""); } @Override diff --git a/src/test/java/org/jabref/logic/openoffice/style/OOBibStyleTestHelper.java b/src/test/java/org/jabref/logic/openoffice/style/OOBibStyleTestHelper.java index e681b00753b..06c01c853c4 100644 --- a/src/test/java/org/jabref/logic/openoffice/style/OOBibStyleTestHelper.java +++ b/src/test/java/org/jabref/logic/openoffice/style/OOBibStyleTestHelper.java @@ -98,7 +98,7 @@ static String runGetNumCitationMarker2a(OOBibStyle style, int n = num.get(0); CitationMarkerNumericBibEntryImpl x = new CitationMarkerNumericBibEntryImpl("key", - (n == 0) ? Optional.empty() : Optional.of(n)); + n == 0 ? Optional.empty() : Optional.of(n)); return style.getNumCitationMarkerForBibliography(x).toString(); } else { List input = From ef90e2838b6ea55bbf9a0f4029c051fdbc9565e8 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Mon, 9 Oct 2023 21:53:53 +0200 Subject: [PATCH 0029/1502] Fix handling of comments and doi at LaTeX check (#10470) * Fix handling of comments and doi at LaTeX check * eprint is also verbatim --- .../jabref/logic/integrity/LatexIntegrityChecker.java | 2 +- .../org/jabref/model/entry/field/StandardField.java | 11 ++++++----- .../model/entry/field/UserSpecificCommentField.java | 2 +- src/main/resources/l10n/JabRef_en.properties | 2 +- .../logic/integrity/LatexIntegrityCheckerTest.java | 5 ++++- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/jabref/logic/integrity/LatexIntegrityChecker.java b/src/main/java/org/jabref/logic/integrity/LatexIntegrityChecker.java index 115a43d022d..41d8c57b70b 100644 --- a/src/main/java/org/jabref/logic/integrity/LatexIntegrityChecker.java +++ b/src/main/java/org/jabref/logic/integrity/LatexIntegrityChecker.java @@ -94,6 +94,6 @@ private static Stream> getUnescapedAmpersandsWithCount(M public static String errorMessageFormatHelper(ErrorCode snuggleTexErrorCode, Object... arguments) { String snuggletexMessagePattern = LatexIntegrityChecker.ERROR_MESSAGES.getString(snuggleTexErrorCode.getName()); String snuggletexErrorMessage = MessageFormat.format(snuggletexMessagePattern, arguments); - return Localization.lang("LaTeX Parsing Error: %0", snuggletexErrorMessage); + return Localization.lang("LaTeX Warning: %0", snuggletexErrorMessage); } } diff --git a/src/main/java/org/jabref/model/entry/field/StandardField.java b/src/main/java/org/jabref/model/entry/field/StandardField.java index 2762ff1d49c..0e568838fb5 100644 --- a/src/main/java/org/jabref/model/entry/field/StandardField.java +++ b/src/main/java/org/jabref/model/entry/field/StandardField.java @@ -31,12 +31,13 @@ public enum StandardField implements Field { BOOKTITLEADDON("booktitleaddon"), CHAPTER("chapter"), COMMENTATOR("commentator", FieldProperty.PERSON_NAMES), + // Comments of users are handled at {@link org.jabref.model.entry.field.UserSpecificCommentField} COMMENT("comment", FieldProperty.COMMENT, FieldProperty.MULTILINE_TEXT, FieldProperty.VERBATIM), CROSSREF("crossref", FieldProperty.SINGLE_ENTRY_LINK), DATE("date", FieldProperty.DATE), DAY("day"), DAYFILED("dayfiled"), - DOI("doi", "DOI", FieldProperty.DOI), + DOI("doi", "DOI", FieldProperty.DOI, FieldProperty.VERBATIM), EDITION("edition", FieldProperty.NUMERIC), EDITOR("editor", FieldProperty.PERSON_NAMES), EDITORA("editora", FieldProperty.PERSON_NAMES), @@ -48,7 +49,7 @@ public enum StandardField implements Field { EDITORCTYPE("editorctype", FieldProperty.EDITOR_TYPE), EID("eid"), ENTRYSET("entryset", FieldProperty.MULTIPLE_ENTRY_LINK), - EPRINT("eprint", FieldProperty.EPRINT), + EPRINT("eprint", FieldProperty.EPRINT, FieldProperty.VERBATIM), EPRINTCLASS("eprintclass"), EPRINTTYPE("eprinttype"), EVENTDATE("eventdate", FieldProperty.DATE), @@ -63,9 +64,9 @@ public enum StandardField implements Field { IDS("ids", FieldProperty.MULTIPLE_ENTRY_LINK), INSTITUTION("institution"), INTRODUCTION("introduction", FieldProperty.PERSON_NAMES), - ISBN("isbn", "ISBN", FieldProperty.ISBN), - ISRN("isrn", "ISRN"), - ISSN("issn", "ISSN"), + ISBN("isbn", "ISBN", FieldProperty.ISBN, FieldProperty.VERBATIM), + ISRN("isrn", "ISRN", FieldProperty.VERBATIM), + ISSN("issn", "ISSN", FieldProperty.VERBATIM), ISSUE("issue"), ISSUETITLE("issuetitle"), ISSUESUBTITLE("issuesubtitle"), diff --git a/src/main/java/org/jabref/model/entry/field/UserSpecificCommentField.java b/src/main/java/org/jabref/model/entry/field/UserSpecificCommentField.java index 236a894ed4e..56e45b7d11a 100644 --- a/src/main/java/org/jabref/model/entry/field/UserSpecificCommentField.java +++ b/src/main/java/org/jabref/model/entry/field/UserSpecificCommentField.java @@ -5,7 +5,7 @@ import java.util.Set; public class UserSpecificCommentField implements Field { - private static final Set PROPERTIES = EnumSet.of(FieldProperty.COMMENT, FieldProperty.MULTILINE_TEXT); + private static final Set PROPERTIES = EnumSet.of(FieldProperty.COMMENT, FieldProperty.MULTILINE_TEXT, FieldProperty.VERBATIM); private final String name; public UserSpecificCommentField(String username) { diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index 9dcc9a4b334..af568f745cb 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -1488,7 +1488,7 @@ changes\ all\ letters\ to\ lower\ case.=changes all letters to lower case. CHANGES\ ALL\ LETTERS\ TO\ UPPER\ CASE.=CHANGES ALL LETTERS TO UPPER CASE. Changes\ The\ First\ Letter\ Of\ All\ Words\ To\ Capital\ Case\ And\ The\ Remaining\ Letters\ To\ Lower\ Case.=Changes The First Letter Of All Words To Capital Case And The Remaining Letters To Lower Case. Cleans\ up\ LaTeX\ code.=Cleans up LaTeX code. -LaTeX\ Parsing\ Error\:\ %0=LaTeX Parsing Error: %0 +LaTeX\ Warning\:\ %0=LaTeX Warning: %0 Converts\ HTML\ code\ to\ LaTeX\ code.=Converts HTML code to LaTeX code. HTML\ to\ Unicode=HTML to Unicode Converts\ HTML\ code\ to\ Unicode.=Converts HTML code to Unicode. diff --git a/src/test/java/org/jabref/logic/integrity/LatexIntegrityCheckerTest.java b/src/test/java/org/jabref/logic/integrity/LatexIntegrityCheckerTest.java index 2964cc13a66..36c6e592651 100644 --- a/src/test/java/org/jabref/logic/integrity/LatexIntegrityCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/LatexIntegrityCheckerTest.java @@ -6,6 +6,7 @@ import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.Field; import org.jabref.model.entry.field.StandardField; +import org.jabref.model.entry.field.UserSpecificCommentField; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; @@ -129,7 +130,9 @@ private static Stream provideAcceptedInputs() { Arguments.of(StandardField.AUTHOR, "\\& Multiple properly escaped \\&"), Arguments.of(StandardField.BOOKTITLE, "\\\\\\& With multiple backslashes"), Arguments.of(StandardField.COMMENT, "\\\\\\& With multiple backslashes multiple times \\\\\\\\\\&"), - Arguments.of(StandardField.NOTE, "In the \\& middle of \\\\\\& something") + Arguments.of(StandardField.NOTE, "In the \\& middle of \\\\\\& something"), + Arguments.of(StandardField.DOI, "10.1007/0-387-22874-8_7"), + Arguments.of(new UserSpecificCommentField("test"), "_something_ which is triggers the integrity check ^^^ $") ); } From b68592afe49cce39a2527bf8586b8e491cc9dba5 Mon Sep 17 00:00:00 2001 From: Christoph Date: Mon, 9 Oct 2023 23:15:49 +0200 Subject: [PATCH 0030/1502] update gradle (#10471) * update gradle * checksum --- gradle/wrapper/gradle-wrapper.properties | 4 ++-- gradlew | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 864d6c47512..46671acb6e1 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=591855b517fc635b9e04de1d05d5e76ada3f89f5fc76f87978d1b245b4f69225 -distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip +distributionSha256Sum=3e1af3ae886920c3ac87f7a91f816c0c7c436f276a6eefdb3da152100fef72ae +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 0adc8e1a532..1aa94a42690 100755 --- a/gradlew +++ b/gradlew @@ -145,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -153,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -202,11 +202,11 @@ fi # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ From f35f86159f8e35dcb464285931c15b24913f6d35 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Tue, 10 Oct 2023 08:53:20 +0200 Subject: [PATCH 0031/1502] Polish AUX file import dialog (#10473) Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com> --- .../auximport/AuxParserResultViewModel.java | 18 +++++++++-------- .../jabref/gui/auximport/FromAuxDialog.fxml | 20 +++++++++++++++---- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/jabref/gui/auximport/AuxParserResultViewModel.java b/src/main/java/org/jabref/gui/auximport/AuxParserResultViewModel.java index d565151eb71..511ef2d168a 100644 --- a/src/main/java/org/jabref/gui/auximport/AuxParserResultViewModel.java +++ b/src/main/java/org/jabref/gui/auximport/AuxParserResultViewModel.java @@ -1,5 +1,7 @@ package org.jabref.gui.auximport; +import java.util.stream.Collectors; + import org.jabref.logic.auxparser.AuxParserResult; import org.jabref.logic.l10n.Localization; @@ -13,22 +15,22 @@ public AuxParserResultViewModel(AuxParserResult auxParserResult) { /** * Prints parsing statistics + * + * @param includeMissingEntries shows the missing entries as text (the GUI renderes them at another place) */ public String getInformation(boolean includeMissingEntries) { - StringBuilder result = new StringBuilder(); + String missingEntries = ""; + if (includeMissingEntries && (this.auxParserResult.getUnresolvedKeysCount() > 0)) { + missingEntries = this.auxParserResult.getUnresolvedKeys().stream().collect(Collectors.joining(", ", " (", ")")); + } + StringBuilder result = new StringBuilder(); result.append(Localization.lang("keys in library")).append(' ').append(this.auxParserResult.getMasterDatabase().getEntryCount()).append('\n') .append(Localization.lang("found in AUX file")).append(' ').append(this.auxParserResult.getFoundKeysInAux()).append('\n') .append(Localization.lang("resolved")).append(' ').append(this.auxParserResult.getResolvedKeysCount()).append('\n') - .append(Localization.lang("not found")).append(' ').append(this.auxParserResult.getUnresolvedKeysCount()).append('\n') + .append(Localization.lang("not found")).append(' ').append(this.auxParserResult.getUnresolvedKeysCount()).append(missingEntries).append('\n') .append(Localization.lang("crossreferenced entries included")).append(' ').append(this.auxParserResult.getCrossRefEntriesCount()).append('\n') .append(Localization.lang("strings included")).append(' ').append(this.auxParserResult.getInsertedStrings()).append('\n'); - - if (includeMissingEntries && (this.auxParserResult.getUnresolvedKeysCount() > 0)) { - for (String entry : this.auxParserResult.getUnresolvedKeys()) { - result.append(entry).append('\n'); - } - } if (this.auxParserResult.getNestedAuxCount() > 0) { result.append(Localization.lang("nested AUX files")).append(' ').append(this.auxParserResult.getNestedAuxCount()); } diff --git a/src/main/java/org/jabref/gui/auximport/FromAuxDialog.fxml b/src/main/java/org/jabref/gui/auximport/FromAuxDialog.fxml index 7b509209f36..7cdfefc611d 100644 --- a/src/main/java/org/jabref/gui/auximport/FromAuxDialog.fxml +++ b/src/main/java/org/jabref/gui/auximport/FromAuxDialog.fxml @@ -7,20 +7,32 @@ + + +