Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into replace_deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
calixtus committed Feb 27, 2020
2 parents 16409e3 + 1d4efaa commit da1b689
Show file tree
Hide file tree
Showing 124 changed files with 6,198 additions and 685 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/gradle-wrapper-validation.yml

This file was deleted.

8 changes: 8 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,11 @@ jobs:
CI: "false" # we pretend to run locally - even if tests fail on the CI, they count towards test coverage
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
DBMS: "postgresql"
# This is https://github.com/marketplace/actions/gradle-wrapper-validation
# It ensures that the jar file is from gradle and not by a strange third party.
gradlevalidation:
name: "Validate Gradle Wrapper"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We fixed an issue where the most bottom group in the list got lost, if it was dragged on itself. [#5983](https://github.com/JabRef/jabref/issues/5983)
- We fixed an issue where changing entry type doesn't always work when biblatex source is shown. [#5905](https://github.com/JabRef/jabref/issues/5905)
- We fixed an issue where the group and the link column were not updated after changing the entry in the main table. [#5985](https://github.com/JabRef/jabref/issues/5985)
- We fixed an issue where reordering the groups was not possible after inserting an article. [#6008](https://github.com/JabRef/jabref/issues/6008)

### Removed

Expand Down
219 changes: 120 additions & 99 deletions build.gradle

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@

This page presents all development informatation around JabRef. For users documentation see <https://docs.jabref.org>.

## Excersises

Uni Basel offers a German (🇩🇪) Software Engineering course which uses JabRef as one example.
Look at [Exercise 5](https://github.com/unibas-marcelluethi/software-engineering/blob/master/docs/week5/exercises/practical-exercises.md) for an exercise where some important points of JabRef are touched.

## How tos

- [Sync your fork with the JabRef repository](https://help.github.com/articles/syncing-a-fork/)
- External: [Sync your fork with the JabRef repository](https://help.github.com/articles/syncing-a-fork/)
- External (🇩🇪): Branches and pull requests: <https://github.com/unibas-marcelluethi/software-engineering/blob/master/docs/week2/exercises/practical-exercises.md>

## Command Line

Expand Down
4 changes: 2 additions & 2 deletions docs/code-quality.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

We monitor the general source code quality at three places:

* [Teamscale](https://www.cqse.eu/de/produkte/teamscale/landing/) is a popular German product analyzing code quality. The analysis results are available at <https://demo.teamscale.com/dashboard.html#show//?id=kinnen%2FJabref%20Overview>.
* [codacy](https://www.codacy.com/) is a hosted service to monitor code quality. The code quality analysis for JabRef is available at <https://www.codacy.com/app/simonharrer/jabref/dashboard>.
* [codacy](https://www.codacy.com/) is a hosted service to monitor code quality. It thereby combines the results of available open source code quality checkers such as [Checkstyle](https://checkstyle.sourceforge.io/) or [PMD](https://pmd.github.io/). The code quality analysis for JabRef is available at <https://app.codacy.com/gh/JabRef/jabref/dashboard>, especially the [list of open issues](https://app.codacy.com/gh/JabRef/jabref/issues/index). In case a rule feels wrong, it is most likely a PMD rule. The JabRef team can change the configuration at <https://app.codacy.com/p/306789/patterns/list?engine=9ed24812-b6ee-4a58-9004-0ed183c45b8f>.
* [codecov](https://codecov.io/) is a solution to check code coverage of test cases. The code coverage metrics for JabRef are available at <https://codecov.io/github/JabRef/jabref>.
* [Teamscale](https://www.cqse.eu/de/produkte/teamscale/landing/) is a popular German product analyzing code quality. The analysis results are available at <https://demo.teamscale.com/findings.html#/jabref/?>.

We strongly recommend to read following two books on code quality:

Expand Down
6 changes: 4 additions & 2 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
requires java.sql;

// JavaFX
requires javafx.base;
requires javafx.graphics;
requires javafx.swing;
requires javafx.controls;
Expand All @@ -17,6 +18,7 @@
requires de.jensd.fx.fontawesomefx.commons;
requires de.jensd.fx.fontawesomefx.materialdesignicons;
requires org.controlsfx.controls;
requires org.fxmisc.richtext;

provides com.airhacks.afterburner.views.ResourceLocator
with org.jabref.gui.util.JabRefResourceLocator;
Expand Down Expand Up @@ -62,7 +64,6 @@
requires org.graalvm.js;
requires org.apache.xmpbox;
requires de.saxsys.mvvmfx.validation;
requires richtextfx;
requires com.google.gson;
requires unirest.java;
requires org.apache.httpcomponents.httpclient;
Expand All @@ -72,9 +73,10 @@
requires java.string.similarity;
requires ojdbc10;
requires org.postgresql.jdbc;
requires org.mariadb.jdbc;
uses org.mariadb.jdbc.credential.CredentialPlugin;
requires org.apache.commons.lang3;
requires org.antlr.antlr4.runtime;
requires flowless;
requires org.apache.tika.core;
requires javafx.base;
}
5 changes: 5 additions & 0 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ private MenuBar createMenu() {
Menu edit = new Menu(Localization.lang("Edit"));
Menu library = new Menu(Localization.lang("Library"));
Menu quality = new Menu(Localization.lang("Quality"));
Menu lookup = new Menu(Localization.lang("Lookup"));
Menu view = new Menu(Localization.lang("View"));
Menu tools = new Menu(Localization.lang("Tools"));
Menu options = new Menu(Localization.lang("Options"));
Expand Down Expand Up @@ -773,6 +774,10 @@ private MenuBar createMenu() {
factory.createMenuItem(StandardActions.SET_FILE_LINKS, new AutoLinkFilesAction(this, prefs, stateManager, undoManager, Globals.TASK_EXECUTOR))
);

lookup.getItems().addAll(
factory.createMenuItem(StandardActions.FIND_DUPLICATES, new DuplicateSearch(this, dialogService, stateManager))
);

// PushToApplication
final PushToApplicationAction pushToApplicationAction = pushToApplicationsManager.getPushToApplicationAction();
final MenuItem pushToApplicationMenuItem = factory.createMenuItem(pushToApplicationAction.getActionInformation(), pushToApplicationAction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public LatexCitationsTabViewModel(BibDatabaseContext databaseContext, Preference
this.preferencesService = preferencesService;
this.taskExecutor = taskExecutor;
this.dialogService = dialogService;
this.directory = new SimpleObjectProperty<>(databaseContext.getMetaData().getLaTexFileDirectory(preferencesService.getUser())
this.directory = new SimpleObjectProperty<>(databaseContext.getMetaData().getLatexFileDirectory(preferencesService.getUser())
.orElseGet(preferencesService::getWorkingDir));
this.citationList = FXCollections.observableArrayList();
this.status = new SimpleObjectProperty<>(Status.IN_PROGRESS);
Expand Down Expand Up @@ -126,7 +126,7 @@ private void cancelSearch() {
}

private Collection<Citation> searchAndParse(String citeKey) throws IOException {
Path newDirectory = databaseContext.getMetaData().getLaTexFileDirectory(preferencesService.getUser())
Path newDirectory = databaseContext.getMetaData().getLatexFileDirectory(preferencesService.getUser())
.orElseGet(preferencesService::getWorkingDir);

if (texParserResult == null || !newDirectory.equals(directory.get())) {
Expand Down Expand Up @@ -168,7 +168,7 @@ public void setLatexDirectory() {
.withInitialDirectory(directory.get()).build();

dialogService.showDirectorySelectionDialog(directoryDialogConfiguration).ifPresent(selectedDirectory ->
databaseContext.getMetaData().setLaTexFileDirectory(preferencesService.getUser(), selectedDirectory.toAbsolutePath()));
databaseContext.getMetaData().setLatexFileDirectory(preferencesService.getUser(), selectedDirectory.toAbsolutePath()));

init(currentEntry);
}
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/org/jabref/gui/fieldeditors/URLUtil.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.jabref.gui.fieldeditors;

import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLDecoder;
Expand Down Expand Up @@ -53,15 +52,15 @@ public static String cleanGoogleSearchURL(String url) {
if (pair.startsWith("url=")) {
String value = pair.substring(pair.indexOf('=') + 1);

String decode = URLDecoder.decode(value, StandardCharsets.UTF_8.name());
String decode = URLDecoder.decode(value, StandardCharsets.UTF_8);
// url?
if (decode.matches(URL_EXP)) {
return decode;
}
}
}
return url;
} catch (UnsupportedEncodingException | MalformedURLException e) {
} catch (MalformedURLException e) {
return url;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ public void openHelpPage() {
private List<Path> getFileDirectoriesAsPaths() {
List<Path> fileDirs = new ArrayList<>();
MetaData metaData = currentDatabase.getMetaData();
metaData.getLaTexFileDirectory(preferencesService.getFilePreferences().getUser()).ifPresent(fileDirs::add);
metaData.getLatexFileDirectory(preferencesService.getFilePreferences().getUser()).ifPresent(fileDirs::add);

return fileDirs;
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/jabref/gui/groups/GroupTreeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ public void initialize() {
}
}

if (groupsToMove.size() > 0) {
localDragboard.clearAll();
}

// Put the group nodes as content
Dragboard dragboard = treeTable.startDragAndDrop(TransferMode.MOVE);
// Display the group when dragging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@
<Button text="%Browse" GridPane.columnIndex="2" GridPane.rowIndex="5"
onAction="#browseUserSpecificFileDirectory"/>

<Label text="%LaTex file directory" GridPane.columnIndex="0" GridPane.rowIndex="6"/>
<Label text="%LaTeX file directory" GridPane.columnIndex="0" GridPane.rowIndex="6"/>
<TextField fx:id="laTexFileDirectory" GridPane.columnIndex="1" GridPane.rowIndex="6"/>
<Button text="%Browse" onAction="#browseLaTexFileDirectory" GridPane.columnIndex="2"
<Button text="%Browse" onAction="#browseLatexFileDirectory" GridPane.columnIndex="2"
GridPane.rowIndex="6"/>
</GridPane>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ public void browseUserSpecificFileDirectory(ActionEvent event) {
}

@FXML
void browseLaTexFileDirectory(ActionEvent event) {
viewModel.browseLaTexDir();
void browseLatexFileDirectory(ActionEvent event) {
viewModel.browseLatexDir();
}

private void storeSettings() {
Expand Down Expand Up @@ -143,9 +143,9 @@ private void storeSettings() {

text = viewModel.laTexFileDirectoryProperty().getValue();
if (text.isEmpty()) {
metaData.clearLaTexFileDirectory(preferencesService.getUser());
metaData.clearLatexFileDirectory(preferencesService.getUser());
} else {
metaData.setLaTexFileDirectory(preferencesService.getUser(), Paths.get(text));
metaData.setLatexFileDirectory(preferencesService.getUser(), Paths.get(text));
}

if (viewModel.libraryProtectedProperty().getValue()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class LibraryPropertiesDialogViewModel {

private final String oldUserSpecificFileDir;
private final String oldGeneralFileDir;
private final String oldLaTexFileDir;
private final String oldLatexFileDir;
private final boolean oldLibraryProtected;

public LibraryPropertiesDialogViewModel(BasePanel panel, DialogService dialogService, PreferencesService preferencesService) {
Expand All @@ -67,11 +67,11 @@ public LibraryPropertiesDialogViewModel(BasePanel panel, DialogService dialogSer
Optional<String> fileDI = metaData.getUserFileDirectory(preferencesService.getUser());
fileDI.ifPresent(userSpecificFileDirectoryProperty::setValue);

metaData.getLaTexFileDirectory(preferencesService.getUser()).map(Path::toString).ifPresent(laTexFileDirectoryProperty::setValue);
metaData.getLatexFileDirectory(preferencesService.getUser()).map(Path::toString).ifPresent(laTexFileDirectoryProperty::setValue);

oldUserSpecificFileDir = generalFileDirectoryProperty.getValue();
oldGeneralFileDir = userSpecificFileDirectoryProperty.getValue();
oldLaTexFileDir = laTexFileDirectoryProperty.getValue();
oldLatexFileDir = laTexFileDirectoryProperty.getValue();

libraryProtectedProperty.setValue(metaData.isProtected());
oldLibraryProtected = libraryProtectedProperty.getValue();
Expand Down Expand Up @@ -117,7 +117,7 @@ public void browseUserDir() {
dialogService.showDirectorySelectionDialog(directoryDialogConfiguration).ifPresent(dir -> userSpecificFileDirectoryProperty.setValue(dir.toAbsolutePath().toString()));
}

public void browseLaTexDir() {
public void browseLatexDir() {
dialogService.showDirectorySelectionDialog(directoryDialogConfiguration).ifPresent(dir -> laTexFileDirectoryProperty.setValue(dir.toAbsolutePath().toString()));
}

Expand All @@ -134,7 +134,7 @@ public boolean userFileDirChanged() {
}

public boolean laTexFileDirChanged() {
return !oldLaTexFileDir.equals(laTexFileDirectoryProperty.getValue());
return !oldLatexFileDir.equals(laTexFileDirectoryProperty.getValue());
}

public boolean protectedValueChanged() {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/jabref/gui/openoffice/Bootstrap.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.net.URLClassLoader;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
Expand Down Expand Up @@ -360,7 +361,7 @@ private static void pipe(final InputStream in, final PrintStream out, final Stri
@Override
public void run() {
try {
BufferedReader r = new BufferedReader(new InputStreamReader(in, "UTF-8"));
BufferedReader r = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8));

for (;;) {
String s = r.readLine();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public ParseTexDialogViewModel(BibDatabaseContext databaseContext, DialogService
this.taskExecutor = taskExecutor;
this.preferencesService = preferencesService;
this.fileMonitor = fileMonitor;
this.texDirectory = new SimpleStringProperty(databaseContext.getMetaData().getLaTexFileDirectory(preferencesService.getUser())
this.texDirectory = new SimpleStringProperty(databaseContext.getMetaData().getLatexFileDirectory(preferencesService.getUser())
.orElseGet(preferencesService::getWorkingDir)
.toAbsolutePath().toString());
this.root = new SimpleObjectProperty<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public List<String> getDifferences(JabRefPreferences preferences) {
if (!Objects.equals(originalMetaData.getUserFileDirectories(), newMetaData.getUserFileDirectories())) {
changes.add(Localization.lang("User-specific file directory"));
}
if (!Objects.equals(originalMetaData.getLaTexFileDirectories(), newMetaData.getLaTexFileDirectories())) {
changes.add(Localization.lang("LaTex file directory"));
if (!Objects.equals(originalMetaData.getLatexFileDirectories(), newMetaData.getLatexFileDirectories())) {
changes.add(Localization.lang("LaTeX file directory"));
}
if (!Objects.equals(originalMetaData.getDefaultCiteKeyPattern(), newMetaData.getDefaultCiteKeyPattern())) {
changes.add(Localization.lang("Default pattern"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static Map<String, String> getSerializedStringMap(MetaData metaData,
path -> stringyMetaData.put(MetaData.FILE_DIRECTORY, Collections.singletonList(path.trim())));
metaData.getUserFileDirectories().forEach((user, path) -> stringyMetaData
.put(MetaData.FILE_DIRECTORY + '-' + user, Collections.singletonList(path.trim())));
metaData.getLaTexFileDirectories().forEach((user, path) -> stringyMetaData
metaData.getLatexFileDirectories().forEach((user, path) -> stringyMetaData
.put(MetaData.FILE_DIRECTORY + "Latex-" + user, Collections.singletonList(path.toString().trim())));

for (ContentSelector selector: metaData.getContentSelectorList()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.jabref.logic.formatter.bibtexfields;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.regex.Matcher;
Expand Down Expand Up @@ -40,13 +39,7 @@ public String format(String value) {
if (matcher.find()) {
toDecode = matcher.group(1);
}
try {
decodedLink = URLDecoder.decode(toDecode, StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
LOGGER.warn("Used unsupported character encoding", e);
}

return decodedLink;
return URLDecoder.decode(toDecode, StandardCharsets.UTF_8);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.jabref.model.cleanup.Formatter;

/**
* This class transforms ordinal numbers into LaTex superscripts.
* This class transforms ordinal numbers into LaTeX superscripts.
*/
public class OrdinalsToSuperscriptFormatter extends Formatter {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public MetaData parse(MetaData metaData, Map<String, String> data, Character key
// The user name comes directly after "FILE_DIRECTORYLatex-"
String user = entry.getKey().substring(MetaData.FILE_DIRECTORY.length() + 6);
Path path = Paths.get(getSingleItem(value)).normalize();
metaData.setLaTexFileDirectory(user, path);
metaData.setLatexFileDirectory(user, path);
continue;
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/jabref/logic/xmp/XmpUtilWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,12 @@ private static String generateXmpStringWithXmpDeclaration(List<BibEntry> entries
try (ByteArrayOutputStream os = new ByteArrayOutputStream()) {
XmpSerializer serializer = new XmpSerializer();
serializer.serialize(meta, os, true);
return os.toString(StandardCharsets.UTF_8.name());
return os.toString(StandardCharsets.UTF_8);
} catch (TransformerException e) {
LOGGER.warn("Tranformation into xmp not possible: " + e.getMessage(), e);
LOGGER.warn("Transformation into XMP not possible: " + e.getMessage(), e);
return "";
} catch (UnsupportedEncodingException e) {
LOGGER.warn("Unsupported encoding to UTF-8 of bib entries in xmp metadata.", e);
LOGGER.warn("Unsupported encoding to UTF-8 of bib entries in XMP metadata.", e);
return "";
} catch (IOException e) {
LOGGER.warn("IO Exception thrown by closing the output stream.", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.util.Set;

/**
* Standard BibTeX and BibLaTex fields
* Standard BibTeX and BibLaTeX fields
*/
public enum StandardField implements Field {

Expand Down
Loading

0 comments on commit da1b689

Please sign in to comment.