Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into tinylog
Browse files Browse the repository at this point in the history
* upstream/main:
  Fix xmp import (#8311)
  New Crowdin updates (#8308)
  Fix file-filter in XMP Export (#8307)
  New Crowdin updates (#8306)
  Bump h2-mvstore from 1.4.200 to 2.0.202 (#8302)
  Remove bytebuddy (#8300)
  Bump postgresql from 42.2.24 to 42.3.1 (#8301)
  Update Gradle Wrapper from 7.3 to 7.3.1. (#8299)
  Apply search string to open library when keep search string is selected (#8294)
  • Loading branch information
Siedlerchr committed Dec 10, 2021
2 parents c061b88 + 74a4edb commit 6fc081a
Show file tree
Hide file tree
Showing 38 changed files with 339 additions and 388 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed an issue where right-clicking on a tab and selecting close will close the focused tab even if it is not the tab we right-clicked [#8193](https://github.com/JabRef/jabref/pull/8193)
- We fixed an issue where selecting a citation style in the preferences would sometimes produce an exception [#7860](https://github.com/JabRef/jabref/issues/7860)
- We fixed an issue where an exception would occur when clicking on a DOI link in the preview pane [#7706](https://github.com/JabRef/jabref/issues/7706)
- We fixed an issue where XMP and embedded BibTeX export would not work [#8278](https://github.com/JabRef/jabref/issues/8278)
- We fixed an issue where the XMP and embedded BibTeX import of a file containing multiple schemas failed [#8278](https://github.com/JabRef/jabref/issues/8278)

### Removed

Expand Down
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ dependencies {
implementation 'org.apache.pdfbox:xmpbox:2.0.24'

implementation group: 'org.apache.commons', name: 'commons-csv', version: '1.9.0'
implementation 'com.h2database:h2-mvstore:1.4.200'
implementation 'com.h2database:h2-mvstore:2.0.202'

implementation group: 'org.apache.tika', name: 'tika-core', version: '2.1.0'

Expand Down Expand Up @@ -149,7 +149,7 @@ dependencies {

implementation group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '2.7.4'

implementation 'org.postgresql:postgresql:42.2.24'
implementation 'org.postgresql:postgresql:42.3.1'

implementation ('com.oracle.ojdbc:ojdbc10:19.3.0.0') {
// causing module issues
Expand Down Expand Up @@ -207,7 +207,6 @@ dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
testImplementation 'org.junit.platform:junit-platform-launcher:1.8.1'

testImplementation 'net.bytebuddy:byte-buddy-parent:1.12.2'
testRuntimeOnly group: 'org.apache.logging.log4j', name: 'log4j-core', version: '3.0.0-SNAPSHOT'
testRuntimeOnly group: 'org.apache.logging.log4j', name: 'log4j-jul', version: '3.0.0-SNAPSHOT'
testImplementation 'org.mockito:mockito-core:4.1.0'
Expand Down
6 changes: 3 additions & 3 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ repositories {
}

dependencies {
implementation 'com.h2database:h2-mvstore:1.4.200'
implementation 'org.apache.commons:commons-csv:1.8'
implementation 'org.slf4j:slf4j-api:2.0.0-alpha1'
implementation 'com.h2database:h2-mvstore:2.0.202'
implementation 'org.apache.commons:commons-csv:1.9.0'
implementation 'org.slf4j:slf4j-api:2.0.0-alpha5'
}

sourceSets{
Expand Down
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionSha256Sum=9afb3ca688fc12c761a0e9e4321e4d24e977a4a8916c8a768b1fe05ddb4d6b66
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
10 changes: 5 additions & 5 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,10 +32,10 @@
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,12 @@ public void init() {
stateManager.setSelectedEntries(libraryTab.getSelectedEntries());

// Update active search query when switching between databases
stateManager.activeSearchQueryProperty().set(libraryTab.getCurrentSearchQuery());
if (prefs.getSearchPreferences().shouldKeepSearchString() && libraryTab.getCurrentSearchQuery().isEmpty() && stateManager.activeSearchQueryProperty().get().isPresent()) {
// apply search query also when opening a new library and keep search string is activated
libraryTab.setCurrentSearchQuery(stateManager.activeSearchQueryProperty().get());
} else {
stateManager.activeSearchQueryProperty().set(libraryTab.getCurrentSearchQuery());
}

// Update search autocompleter with information for the correct database:
libraryTab.updateSearchManager();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/actions/StandardActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public enum StandardActions implements Action {

PARSE_LATEX(Localization.lang("Search for citations in LaTeX files..."), IconTheme.JabRefIcons.LATEX_CITATIONS),
NEW_SUB_LIBRARY_FROM_AUX(Localization.lang("New sublibrary based on AUX file") + "...", Localization.lang("New BibTeX sublibrary") + Localization.lang("This feature generates a new library based on which entries are needed in an existing LaTeX document."), IconTheme.JabRefIcons.NEW),
WRITE_METADATA_TO_PDF(Localization.lang("Write XMP metadata to PDFs"), Localization.lang("Will write XMP metadata to the PDFs linked from selected entries."), KeyBinding.WRITE_XMP),
WRITE_METADATA_TO_PDF(Localization.lang("Write metadata to PDF files"), Localization.lang("Will write metadata to the PDFs linked from selected entries."), KeyBinding.WRITE_METADATA_TO_PDF),
START_NEW_STUDY(Localization.lang("Start new systematic literature review")),
SEARCH_FOR_EXISTING_STUDY(Localization.lang("Perform search for existing systematic literature review")),
OPEN_DATABASE_FOLDER(Localization.lang("Reveal in file explorer")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.jabref.logic.bibtex.FieldWriterPreferences;
import org.jabref.logic.exporter.EmbeddedBibFilePdfExporter;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.StandardFileType;
import org.jabref.logic.util.io.FileUtil;
import org.jabref.logic.xmp.XmpPreferences;
import org.jabref.logic.xmp.XmpUtilWriter;
Expand Down Expand Up @@ -133,7 +132,7 @@ private void writeMetadata() {
.map(file -> file.findIn(stateManager.getActiveDatabase().get(), filePreferences))
.filter(Optional::isPresent)
.map(Optional::get)
.filter(path -> StandardFileType.PDF.getExtensions().contains(FileUtil.getFileExtension(path)))
.filter(path -> FileUtil.isPDFFile(path))
.collect(Collectors.toList());

Platform.runLater(() -> optionsDialog.getProgressArea()
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/keyboard/KeyBinding.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public enum KeyBinding {
UNABBREVIATE("Unabbreviate", Localization.lang("Unabbreviate"), "ctrl+alt+shift+A", KeyBindingCategory.TOOLS),
UNDO("Undo", Localization.lang("Undo"), "ctrl+Z", KeyBindingCategory.EDIT),
WEB_SEARCH("Web search", Localization.lang("Web search"), "alt+4", KeyBindingCategory.SEARCH),
WRITE_XMP("Write XMP", Localization.lang("Write XMP"), "F6", KeyBindingCategory.TOOLS),
WRITE_METADATA_TO_PDF("Write metadata to PDF files", Localization.lang("Write metadata to PDF files"), "F6", KeyBindingCategory.TOOLS),
CLEAR_SEARCH("Clear search", Localization.lang("Clear search"), "ESCAPE", KeyBindingCategory.SEARCH),
CLEAR_READ_STATUS("Clear read status", Localization.lang("Clear read status"), "", KeyBindingCategory.EDIT),
READ("Set read status to read", Localization.lang("Set read status to read"), "", KeyBindingCategory.EDIT),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.jabref.gui.maintable.columns.SpecialFieldColumn;
import org.jabref.gui.preview.PreviewViewer;
import org.jabref.gui.util.BaseDialog;
import org.jabref.logic.l10n.Localization;
import org.jabref.preferences.PreferencesService;

import com.airhacks.afterburner.views.ViewLoader;
Expand All @@ -39,6 +40,7 @@ public GlobalSearchResultDialog(ExternalFileTypes externalFileTypes, UndoManager
this.undoManager = undoManager;
this.externalFileTypes = externalFileTypes;

setTitle(Localization.lang("Search results from open libraries"));
ViewLoader.view(this)
.load()
.setAsDialogPane(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void export(BibDatabaseContext databaseContext, Path file, Charset encodi
}

private void embedBibTex(String bibTeX, Path file, Charset encoding) throws IOException {
if (!Files.exists(file) || !StandardFileType.PDF.getExtensions().contains(FileUtil.getFileExtension(file).orElse(""))) {
if (!Files.exists(file) || !FileUtil.isPDFFile(file)) {
return;
}
try (PDDocument document = PDDocument.load(file.toFile())) {
Expand All @@ -80,7 +80,15 @@ private void embedBibTex(String bibTeX, Path file, Charset encoding) throws IOEx
document.getDocumentCatalog().setNames(nameDictionary);
} else {
efTree = nameDictionary.getEmbeddedFiles();
if (efTree == null) {
efTree = new PDEmbeddedFilesNameTreeNode();
nameDictionary.setEmbeddedFiles(efTree);
}
names = efTree.getNames();
if (names == null) {
names = new HashMap<>();
efTree.setNames(names);
}
}

if (efTree != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,11 @@ private List<BibEntry> getEmbeddedBibFileEntries(PDDocument document) throws IOE
allParsedEntries.addAll(extractAndParseFiles(names));
} else {
List<PDNameTreeNode<PDComplexFileSpecification>> kids = efTree.getKids();
for (PDNameTreeNode<PDComplexFileSpecification> node : kids) {
names = node.getNames();
allParsedEntries.addAll(extractAndParseFiles(names));
if (kids != null) {
for (PDNameTreeNode<PDComplexFileSpecification> node : kids) {
names = node.getNames();
allParsedEntries.addAll(extractAndParseFiles(names));
}
}
}
}
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/org/jabref/logic/journals/AbbreviationFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ private AbbreviationFormat() {
}

public static CSVFormat getCSVFormat() {
return CSVFormat.DEFAULT
.withIgnoreEmptyLines(true)
.withDelimiter(DELIMITER)
.withEscape(ESCAPE)
.withQuote(QUOTE)
.withTrim();
return CSVFormat.DEFAULT.builder()
.setIgnoreEmptyLines(true)
.setDelimiter(DELIMITER)
.setEscape(ESCAPE)
.setQuote(QUOTE)
.setTrim(true)
.build();
}
}
12 changes: 10 additions & 2 deletions src/main/java/org/jabref/logic/xmp/XmpUtilReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@
import org.apache.pdfbox.pdmodel.common.PDMetadata;
import org.apache.xmpbox.XMPMetadata;
import org.apache.xmpbox.schema.DublinCoreSchema;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class XmpUtilReader {

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

private static final String START_TAG = "<rdf:Description";
private static final String END_TAG = "</rdf:Description>";

Expand Down Expand Up @@ -120,7 +124,7 @@ private static List<XMPMetadata> getXmpMetadata(PDDocument document) throws IOEx
int startDescriptionSection = xmp.indexOf(START_TAG);
int endDescriptionSection = xmp.lastIndexOf(END_TAG) + END_TAG.length();

if (startDescriptionSection < 0 || startDescriptionSection > endDescriptionSection || endDescriptionSection == END_TAG.length() - 1) {
if ((startDescriptionSection < 0) || (startDescriptionSection > endDescriptionSection) || (endDescriptionSection == (END_TAG.length() - 1))) {
return metaList;
}

Expand All @@ -134,7 +138,11 @@ private static List<XMPMetadata> getXmpMetadata(PDDocument document) throws IOEx
for (String s : descriptionsArray) {
// END_TAG is appended, because of the split operation above
String xmpMetaString = start + s + END_TAG + end;
metaList.add(XmpUtilShared.parseXmpMetadata(new ByteArrayInputStream(xmpMetaString.getBytes())));
try {
metaList.add(XmpUtilShared.parseXmpMetadata(new ByteArrayInputStream(xmpMetaString.getBytes())));
} catch (IOException ex) {
LOGGER.error("Problem parsing XMP schema. Continuing with other schemas.", ex);
}
}
return metaList;
}
Expand Down
Binary file modified src/main/resources/journals/journalList.mv
Binary file not shown.
10 changes: 1 addition & 9 deletions src/main/resources/l10n/JabRef_da.properties
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,6 @@ Edit\ file\ type=Rediger filtype
Edit\ group=Rediger gruppe
Edit\ preamble=Rediger præambel
Edit\ strings=Rediger tekststrenge
empty\ library=tom library
Expand Down Expand Up @@ -605,8 +603,6 @@ Replace\ string=Erstat streng
Required\ fields=Obligatoriske felter
Reset\ all=Nulstil alle
Resolve\ strings\ for\ all\ fields\ except=Slå strenge op for alle felter undtagen
Resolve\ strings\ for\ standard\ BibTeX\ fields\ only=Slå kun strenge op for standard BibTeX-felter
Expand All @@ -627,13 +623,10 @@ Save\ before\ closing=Gem før libraryn lukkes
Save\ library=Gem library
Save\ library\ as...=Gem library som ...
Saved\ selected\ to\ '%0'.=Gemte valgte i '%0'.
Saving=Gemmer
Saving\ all\ libraries...=Gemmer alle libraryr...
Saving\ library=Gemmer library
Saved\ selected\ to\ '%0'.=Gemte valgte i '%0'.
Search=Søg
Expand Down Expand Up @@ -692,7 +685,6 @@ Special\ name\ formatters=Specielle navneformateringer
Statically\ group\ entries\ by\ manual\ assignment=Grupper poster statisk ved manuel tildeling
Strings\ for\ library=Strenge for library
Switches\ between\ full\ and\ abbreviated\ journal\ name\ if\ the\ journal\ name\ is\ known.=Skifter mellem fuldt og forkortet tidsskriftsnavn hvis navnet er kendt.
Expand Down
Loading

0 comments on commit 6fc081a

Please sign in to comment.