diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index 6905dd174a18..d57f19c68535 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -4,6 +4,8 @@ "http://www.checkstyle.org/dtds/configuration_1_3.dtd"> + + @@ -21,6 +23,9 @@ + + + @@ -42,16 +47,27 @@ - - - + + + + value="IMPORT, STATIC_IMPORT, CLASS_DEF, INTERFACE_DEF, ENUM_DEF, STATIC_INIT, INSTANCE_INIT, METHOD_DEF, CTOR_DEF"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/org/jabref/JabRefExecutorService.java b/src/main/java/org/jabref/JabRefExecutorService.java index 10fd1ee19cce..762d0dd66d2e 100644 --- a/src/main/java/org/jabref/JabRefExecutorService.java +++ b/src/main/java/org/jabref/JabRefExecutorService.java @@ -136,7 +136,7 @@ public void submit(TimerTask timerTask, long millisecondsDelay) { public void shutdownEverything() { // those threads will be allowed to finish this.executorService.shutdown(); - //those threads will be interrupted in their current task + // those threads will be interrupted in their current task this.lowPriorityExecutorService.shutdownNow(); // kill the remote thread stopRemoteThread(); diff --git a/src/main/java/org/jabref/JabRefGUI.java b/src/main/java/org/jabref/JabRefGUI.java index 19be513cf871..cef5e7d66561 100644 --- a/src/main/java/org/jabref/JabRefGUI.java +++ b/src/main/java/org/jabref/JabRefGUI.java @@ -65,7 +65,7 @@ private void openWindow(Stage mainStage) { if (Globals.prefs.getBoolean(JabRefPreferences.WINDOW_MAXIMISED)) { mainStage.setMaximized(true); } else if (Screen.getScreens().size() == 1 && isWindowPositionOutOfBounds()) { - //corrects the Window, if its outside of the mainscreen + // corrects the Window, if its outside of the mainscreen LOGGER.debug("The Jabref Window is outside the Main Monitor\n"); mainStage.setX(0); mainStage.setY(0); @@ -94,8 +94,8 @@ private void openWindow(Stage mainStage) { mainStage.setOnCloseRequest(event -> { if (!correctedWindowPos) { - //saves the window position only if its not corrected -> the window will rest at the old Position, - //if the external Screen is connected again. + // saves the window position only if its not corrected -> the window will rest at the old Position, + // if the external Screen is connected again. saveWindowState(mainStage); } boolean reallyQuit = mainFrame.quit(); diff --git a/src/main/java/org/jabref/cli/ArgumentProcessor.java b/src/main/java/org/jabref/cli/ArgumentProcessor.java index 16f0ede5aea3..fda5b35c0afb 100644 --- a/src/main/java/org/jabref/cli/ArgumentProcessor.java +++ b/src/main/java/org/jabref/cli/ArgumentProcessor.java @@ -241,8 +241,8 @@ private List processArguments() { private boolean exportMatches(List loaded) { String[] data = cli.getExportMatches().split(","); - String searchTerm = data[0].replace("\\$", " "); //enables blanks within the search term: - //$ stands for a blank + String searchTerm = data[0].replace("\\$", " "); // enables blanks within the search term: + // $ stands for a blank ParserResult pr = loaded.get(loaded.size() - 1); BibDatabaseContext databaseContext = pr.getDatabaseContext(); BibDatabase dataBase = pr.getDatabase(); @@ -252,17 +252,17 @@ private boolean exportMatches(List loaded) { searchPreferences.isRegularExpression()); List matches = new DatabaseSearcher(query, dataBase).getMatches(); - //export matches + // export matches if (!matches.isEmpty()) { String formatName; - //read in the export format, take default format if no format entered + // read in the export format, take default format if no format entered switch (data.length) { case 3: formatName = data[2]; break; case 2: - //default exporter: HTML table (with Abstract & BibTeX) + // default exporter: HTML table (with Abstract & BibTeX) formatName = "tablerefsabsbib"; break; default: @@ -272,7 +272,7 @@ private boolean exportMatches(List loaded) { return false; } - //export new database + // export new database Optional exporter = Globals.exportFactory.getExporterByName(formatName); if (!exporter.isPresent()) { System.err.println(Localization.lang("Unknown export format") + ": " + formatName); diff --git a/src/main/java/org/jabref/gui/AbstractViewModel.java b/src/main/java/org/jabref/gui/AbstractViewModel.java index ff9f1fca633f..d294a280d449 100644 --- a/src/main/java/org/jabref/gui/AbstractViewModel.java +++ b/src/main/java/org/jabref/gui/AbstractViewModel.java @@ -1,5 +1,5 @@ package org.jabref.gui; public class AbstractViewModel { - //empty + // empty } diff --git a/src/main/java/org/jabref/gui/EntryTypeView.java b/src/main/java/org/jabref/gui/EntryTypeView.java index d7d45501a8ee..e7ffea9fe142 100644 --- a/src/main/java/org/jabref/gui/EntryTypeView.java +++ b/src/main/java/org/jabref/gui/EntryTypeView.java @@ -69,7 +69,7 @@ public EntryTypeView(BasePanel basePanel, DialogService dialogService, JabRefPre ControlHelper.setAction(generateButton, this.getDialogPane(), event -> viewModel.runFetcherWorker()); setResultConverter(button -> { - //The buttonType will always be cancel, even if we pressed one of the entry type buttons + // The buttonType will always be cancel, even if we pressed one of the entry type buttons return type; }); @@ -112,8 +112,8 @@ public void initialize() { new ViewModelListCellFactory().withText(item -> item.getName()).install(idBasedFetchers); - //we set the managed property so that they will only be rendered when they are visble so that the Nodes only take the space when visible - //avoids removing and adding from the scence graph + // we set the managed property so that they will only be rendered when they are visble so that the Nodes only take the space when visible + // avoids removing and adding from the scence graph bibTexTitlePane.managedProperty().bind(bibTexTitlePane.visibleProperty()); ieeeTranTitlePane.managedProperty().bind(ieeeTranTitlePane.visibleProperty()); biblatexTitlePane.managedProperty().bind(biblatexTitlePane.visibleProperty()); diff --git a/src/main/java/org/jabref/gui/JabRefFrame.java b/src/main/java/org/jabref/gui/JabRefFrame.java index ed9431c31214..077e8388d951 100644 --- a/src/main/java/org/jabref/gui/JabRefFrame.java +++ b/src/main/java/org/jabref/gui/JabRefFrame.java @@ -293,7 +293,7 @@ public void setWindowTitle() { // no database open if (panel == null) { - //setTitle(FRAME_TITLE); + // setTitle(FRAME_TITLE); return; } @@ -307,9 +307,9 @@ public void setWindowTitle() { .getDatabasePath() .map(Path::toString) .orElse(Localization.lang("untitled")); - //setTitle(FRAME_TITLE + " - " + databaseFile + changeFlag + modeInfo); + // setTitle(FRAME_TITLE + " - " + databaseFile + changeFlag + modeInfo); } else if (panel.getBibDatabaseContext().getLocation() == DatabaseLocation.SHARED) { - //setTitle(FRAME_TITLE + " - " + panel.getBibDatabaseContext().getDBMSSynchronizer().getDBName() + " [" + // setTitle(FRAME_TITLE + " - " + panel.getBibDatabaseContext().getDBMSSynchronizer().getDBName() + " [" // + Localization.lang("shared") + "]" + modeInfo); } } @@ -343,7 +343,7 @@ public JabRefPreferences prefs() { * set to true */ private void tearDownJabRef(List filenames) { - //prefs.putBoolean(JabRefPreferences.WINDOW_MAXIMISED, getExtendedState() == Frame.MAXIMIZED_BOTH); + // prefs.putBoolean(JabRefPreferences.WINDOW_MAXIMISED, getExtendedState() == Frame.MAXIMIZED_BOTH); if (prefs.getBoolean(JabRefPreferences.OPEN_LAST_EDITED)) { // Here we store the names of all current files. If @@ -554,10 +554,10 @@ public void init() { initDragAndDrop(); - //setBounds(GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds()); - //WindowLocation pw = new WindowLocation(this, JabRefPreferences.POS_X, JabRefPreferences.POS_Y, JabRefPreferences.SIZE_X, + // setBounds(GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds()); + // WindowLocation pw = new WindowLocation(this, JabRefPreferences.POS_X, JabRefPreferences.POS_Y, JabRefPreferences.SIZE_X, // JabRefPreferences.SIZE_Y); - //pw.displayWindowAtStoredLocation(); + // pw.displayWindowAtStoredLocation(); // Bind global state stateManager.activeDatabaseProperty().bind( @@ -595,9 +595,9 @@ public void init() { stateManager.activeSearchQueryProperty().set(newBasePanel.getCurrentSearchQuery()); // groupSidePane.getToggleCommand().setSelected(sidePaneManager.isComponentVisible(GroupSidePane.class)); - //previewToggle.setSelected(Globals.prefs.getPreviewPreferences().isPreviewPanelEnabled()); - //generalFetcher.getToggleCommand().setSelected(sidePaneManager.isComponentVisible(WebSearchPane.class)); - //openOfficePanel.getToggleCommand().setSelected(sidePaneManager.isComponentVisible(OpenOfficeSidePanel.class)); + // previewToggle.setSelected(Globals.prefs.getPreviewPreferences().isPreviewPanelEnabled()); + // generalFetcher.getToggleCommand().setSelected(sidePaneManager.isComponentVisible(WebSearchPane.class)); + // openOfficePanel.getToggleCommand().setSelected(sidePaneManager.isComponentVisible(OpenOfficeSidePanel.class)); setWindowTitle(); // Update search autocompleter with information for the correct database: @@ -743,7 +743,7 @@ private MenuBar createMenu() { ); } - //@formatter:off + // @formatter:off library.getItems().addAll( factory.createMenuItem(StandardActions.NEW_ENTRY, new NewEntryAction(this, dialogService, Globals.prefs, stateManager)), factory.createMenuItem(StandardActions.NEW_ENTRY_FROM_PLAIN_TEXT, new ExtractBibtexAction(stateManager)), @@ -883,7 +883,7 @@ private MenuBar createMenu() { factory.createMenuItem(StandardActions.ABOUT, new AboutAction()) ); - //@formatter:on + // @formatter:on MenuBar menu = new MenuBar(); menu.getStyleClass().add("mainMenu"); menu.getMenus().addAll( diff --git a/src/main/java/org/jabref/gui/actions/JabRefAction.java b/src/main/java/org/jabref/gui/actions/JabRefAction.java index aba36dfe2e97..4a7aefcd4aa2 100644 --- a/src/main/java/org/jabref/gui/actions/JabRefAction.java +++ b/src/main/java/org/jabref/gui/actions/JabRefAction.java @@ -58,7 +58,7 @@ private String getActionName(Action action, Command command) { return action.getText(); } else { String commandName = command.getClass().getSimpleName(); - if ( commandName.contains("EditAction") + if (commandName.contains("EditAction") || commandName.contains("CopyMoreAction") || commandName.contains("CopyCitationAction") || commandName.contains("PreviewSwitchAction") diff --git a/src/main/java/org/jabref/gui/bibtexextractor/ExtractBibtexDialog.java b/src/main/java/org/jabref/gui/bibtexextractor/ExtractBibtexDialog.java index 2354ef88cc55..86f22264ee94 100644 --- a/src/main/java/org/jabref/gui/bibtexextractor/ExtractBibtexDialog.java +++ b/src/main/java/org/jabref/gui/bibtexextractor/ExtractBibtexDialog.java @@ -52,7 +52,7 @@ public ExtractBibtexDialog() { @FXML private void initialize() { BibDatabaseContext database = stateManager.getActiveDatabase().orElseThrow(() -> new NullPointerException("Database null")); - this.viewModel = new BibtexExtractorViewModel(database, dialogService, JabRefPreferences.getInstance(), fileUpdateMonitor, taskExecutor,undoManager,stateManager); + this.viewModel = new BibtexExtractorViewModel(database, dialogService, JabRefPreferences.getInstance(), fileUpdateMonitor, taskExecutor, undoManager, stateManager); input.textProperty().bindBidirectional(viewModel.inputTextProperty()); } } diff --git a/src/main/java/org/jabref/gui/bibtexkeypattern/BibtexKeyPatternPanel.java b/src/main/java/org/jabref/gui/bibtexkeypattern/BibtexKeyPatternPanel.java index 7a5123476bb3..6637e5327f24 100644 --- a/src/main/java/org/jabref/gui/bibtexkeypattern/BibtexKeyPatternPanel.java +++ b/src/main/java/org/jabref/gui/bibtexkeypattern/BibtexKeyPatternPanel.java @@ -68,7 +68,7 @@ private void buildGUI() { Label keyPattern = new Label(Localization.lang("Key pattern")); gridPane.add(label, ++columnIndex, rowIndex); gridPane.add(keyPattern, ++columnIndex, rowIndex); - ++columnIndex; //3 + columnIndex++; } rowIndex++; diff --git a/src/main/java/org/jabref/gui/collab/ChangeDisplayDialog.java b/src/main/java/org/jabref/gui/collab/ChangeDisplayDialog.java index 47d2de3d873d..1eba9b1c2477 100644 --- a/src/main/java/org/jabref/gui/collab/ChangeDisplayDialog.java +++ b/src/main/java/org/jabref/gui/collab/ChangeDisplayDialog.java @@ -79,19 +79,19 @@ public ChangeDisplayDialog(BibDatabaseContext database, List { if (button == dismissChanges) { return false; - } else { // Perform all accepted changes NamedCompound ce = new NamedCompound(Localization.lang("Merged external changes")); for (DatabaseChangeViewModel change : changes) { if (change instanceof EntryChangeViewModel) { - change.makeChange(database, ce); //We don't have a checkbox for accept and always get the correct merged entry, the accept property in this special case only controls the radio buttons selection + // We don't have a checkbox for accept and always get the correct merged entry, the accept property in this special case only controls the radio buttons selection + change.makeChange(database, ce); } else if (change.isAccepted()) { change.makeChange(database, ce); } } ce.end(); - //TODO: panel.getUndoManager().addEdit(ce); + // TODO: panel.getUndoManager().addEdit(ce); return true; } diff --git a/src/main/java/org/jabref/gui/commonfxcontrols/BibtexKeyPatternPanel.java b/src/main/java/org/jabref/gui/commonfxcontrols/BibtexKeyPatternPanel.java index a6f96bb25b5d..b4c8db1605c5 100644 --- a/src/main/java/org/jabref/gui/commonfxcontrols/BibtexKeyPatternPanel.java +++ b/src/main/java/org/jabref/gui/commonfxcontrols/BibtexKeyPatternPanel.java @@ -80,13 +80,21 @@ private void initialize() { this.itemsProperty().bindBidirectional(viewModel.patternListProperty()); } - public void setValues() { viewModel.setValues(); } + public void setValues() { + viewModel.setValues(); + } - public void resetAll() { viewModel.resetAll(); } + public void resetAll() { + viewModel.resetAll(); + } - public ListProperty patternListProperty() { return viewModel.patternListProperty(); } + public ListProperty patternListProperty() { + return viewModel.patternListProperty(); + } - public ObjectProperty defaultKeyPatternProperty() { return viewModel.defaultKeyPatternProperty(); } + public ObjectProperty defaultKeyPatternProperty() { + return viewModel.defaultKeyPatternProperty(); + } private void jumpToSearchKey(KeyEvent keypressed) { if (keypressed.getCharacter() == null) { diff --git a/src/main/java/org/jabref/gui/commonfxcontrols/BibtexKeyPatternPanelItemModel.java b/src/main/java/org/jabref/gui/commonfxcontrols/BibtexKeyPatternPanelItemModel.java index f65180bd6a16..5e6777ef62f9 100644 --- a/src/main/java/org/jabref/gui/commonfxcontrols/BibtexKeyPatternPanelItemModel.java +++ b/src/main/java/org/jabref/gui/commonfxcontrols/BibtexKeyPatternPanelItemModel.java @@ -20,9 +20,13 @@ public BibtexKeyPatternPanelItemModel(EntryType entryType, String pattern) { this.pattern.setValue(pattern); } - public EntryType getEntryType() { return entryType.getValue(); } + public EntryType getEntryType() { + return entryType.getValue(); + } - public ObjectProperty entryType() { return entryType; } + public ObjectProperty entryType() { + return entryType; + } public void setPattern(String pattern) { this.pattern.setValue(pattern); @@ -32,8 +36,12 @@ public String getPattern() { return pattern.getValue(); } - public StringProperty pattern() { return pattern; } + public StringProperty pattern() { + return pattern; + } @Override - public String toString() { return "[" + entryType.getValue().getName() + "," + pattern.getValue() + "]"; } + public String toString() { + return "[" + entryType.getValue().getName() + "," + pattern.getValue() + "]"; + } } diff --git a/src/main/java/org/jabref/gui/commonfxcontrols/BibtexKeyPatternPanelViewModel.java b/src/main/java/org/jabref/gui/commonfxcontrols/BibtexKeyPatternPanelViewModel.java index ccd765635bf8..6e271e18f90c 100644 --- a/src/main/java/org/jabref/gui/commonfxcontrols/BibtexKeyPatternPanelViewModel.java +++ b/src/main/java/org/jabref/gui/commonfxcontrols/BibtexKeyPatternPanelViewModel.java @@ -25,7 +25,7 @@ public class BibtexKeyPatternPanelViewModel { if (itemOneName.equals(itemTwoName)) { return 0; - } else if (itemOneName.equals(ENTRY_TYPE_DEFAULT_NAME)) { + } else if (itemOneName.equals(ENTRY_TYPE_DEFAULT_NAME)) { return -1; } else if (itemTwoName.equals(ENTRY_TYPE_DEFAULT_NAME)) { return 1; @@ -80,15 +80,23 @@ public void resetAll() { defaultItemProperty.getValue().setPattern((String) preferences.defaults.get(JabRefPreferences.DEFAULT_BIBTEX_KEY_PATTERN)); } - public ListProperty patternListProperty() { return patternListProperty; } + public ListProperty patternListProperty() { + return patternListProperty; + } - public ObjectProperty defaultKeyPatternProperty() { return defaultItemProperty; } + public ObjectProperty defaultKeyPatternProperty() { + return defaultItemProperty; + } public static class DefaultEntryType implements EntryType { @Override - public String getName() { return ENTRY_TYPE_DEFAULT_NAME; } + public String getName() { + return ENTRY_TYPE_DEFAULT_NAME; + } @Override - public String getDisplayName() { return Localization.lang("Default pattern"); } + public String getDisplayName() { + return Localization.lang("Default pattern"); + } } } diff --git a/src/main/java/org/jabref/gui/copyfiles/CopyFilesResultListDependency.java b/src/main/java/org/jabref/gui/copyfiles/CopyFilesResultListDependency.java index 10f09fb27f14..5a1f1487afcd 100644 --- a/src/main/java/org/jabref/gui/copyfiles/CopyFilesResultListDependency.java +++ b/src/main/java/org/jabref/gui/copyfiles/CopyFilesResultListDependency.java @@ -12,7 +12,7 @@ public class CopyFilesResultListDependency { private List results = new ArrayList<>(); public CopyFilesResultListDependency() { - //empty, workaround for injection into FXML controller + // empty, workaround for injection into FXML controller } public CopyFilesResultListDependency(List results) { diff --git a/src/main/java/org/jabref/gui/copyfiles/CopySingleFileAction.java b/src/main/java/org/jabref/gui/copyfiles/CopySingleFileAction.java index aa00a3945241..60671662148a 100644 --- a/src/main/java/org/jabref/gui/copyfiles/CopySingleFileAction.java +++ b/src/main/java/org/jabref/gui/copyfiles/CopySingleFileAction.java @@ -48,12 +48,10 @@ private void copyFileToDestination(Path exportPath) { boolean success = FileUtil.copyFile(fileToExport.get(), newFile, false); if (success) { dialogService.showInformationDialogAndWait(Localization.lang("Copy linked file"), Localization.lang("Sucessfully copied file to %0", newPath.map(Path::getParent).map(Path::toString).orElse(""))); - } - else { + } else { dialogService.showErrorDialogAndWait(Localization.lang("Copy linked file"), Localization.lang("Could not copy file to %0, maybe the file is already existing?", newPath.map(Path::getParent).map(Path::toString).orElse(""))); } - } - else { + } else { dialogService.showErrorDialogAndWait(Localization.lang("Could not resolve the file %0", fileToExport.map(Path::getParent).map(Path::toString).orElse(""))); } diff --git a/src/main/java/org/jabref/gui/customentrytypes/CustomEntryTypeDialogViewModel.java b/src/main/java/org/jabref/gui/customentrytypes/CustomEntryTypeDialogViewModel.java index fbe2a206c913..ccb53b5b13c4 100644 --- a/src/main/java/org/jabref/gui/customentrytypes/CustomEntryTypeDialogViewModel.java +++ b/src/main/java/org/jabref/gui/customentrytypes/CustomEntryTypeDialogViewModel.java @@ -208,7 +208,7 @@ public void apply() { entryTypesManager.removeCustomOrModifiedEntryType(type, mode); } preferencesService.saveCustomEntryTypes(); - //Reload types from preferences to make sure any modifications are present when reopening the dialog + // Reload types from preferences to make sure any modifications are present when reopening the dialog entryTypesManager.addCustomOrModifiedTypes(preferencesService.loadBibEntryTypes(BibDatabaseMode.BIBTEX), preferencesService.loadBibEntryTypes(BibDatabaseMode.BIBLATEX)); } diff --git a/src/main/java/org/jabref/gui/customentrytypes/CustomizeEntryTypeDialogView.java b/src/main/java/org/jabref/gui/customentrytypes/CustomizeEntryTypeDialogView.java index f978102f4b1a..8c63148b8493 100644 --- a/src/main/java/org/jabref/gui/customentrytypes/CustomizeEntryTypeDialogView.java +++ b/src/main/java/org/jabref/gui/customentrytypes/CustomizeEntryTypeDialogView.java @@ -86,7 +86,8 @@ private void initialize() { private void setupTable() { - fields.setEditable(true); //Table View must be editable, otherwise the change of the Radiobuttons does not propagate the commit event + // Table View must be editable, otherwise the change of the Radiobuttons does not propagate the commit event + fields.setEditable(true); entryTypColumn.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(cellData.getValue().getType().getDisplayName())); entryTypes.itemsProperty().bind(viewModel.entryTypes()); entryTypes.getSelectionModel().selectFirst(); diff --git a/src/main/java/org/jabref/gui/customizefields/CustomizeGeneralFieldsDialogViewModel.java b/src/main/java/org/jabref/gui/customizefields/CustomizeGeneralFieldsDialogViewModel.java index 47229fa6248e..521b9ac1d76d 100644 --- a/src/main/java/org/jabref/gui/customizefields/CustomizeGeneralFieldsDialogViewModel.java +++ b/src/main/java/org/jabref/gui/customizefields/CustomizeGeneralFieldsDialogViewModel.java @@ -77,8 +77,8 @@ public void saveFields() { public void resetFields() { StringBuilder sb = new StringBuilder(); - Map customTabNamesFields = preferences.getCustomTabsNamesAndFields(); - for (Map.Entryentry : customTabNamesFields.entrySet()) { + Map customTabNamesFields = preferences.getCustomTabsNamesAndFields(); + for (Map.Entry entry : customTabNamesFields.entrySet()) { sb.append(entry.getKey()); sb.append(':'); sb.append(entry.getValue()); diff --git a/src/main/java/org/jabref/gui/desktop/JabRefDesktop.java b/src/main/java/org/jabref/gui/desktop/JabRefDesktop.java index 78a679cc39e4..59c0dc0611de 100644 --- a/src/main/java/org/jabref/gui/desktop/JabRefDesktop.java +++ b/src/main/java/org/jabref/gui/desktop/JabRefDesktop.java @@ -154,8 +154,8 @@ private static void openExternalFilePlatformIndependent(Optional generateImage = BackgroundTask .wrap(() -> renderPage(initialPage)) .onSuccess(image -> { diff --git a/src/main/java/org/jabref/gui/documentviewer/DocumentViewerViewModel.java b/src/main/java/org/jabref/gui/documentviewer/DocumentViewerViewModel.java index 61ac47eb2efa..fb5299a3859a 100644 --- a/src/main/java/org/jabref/gui/documentviewer/DocumentViewerViewModel.java +++ b/src/main/java/org/jabref/gui/documentviewer/DocumentViewerViewModel.java @@ -38,7 +38,6 @@ public class DocumentViewerViewModel extends AbstractViewModel { private final ObjectProperty currentPage = new SimpleObjectProperty<>(); private final IntegerProperty maxPages = new SimpleIntegerProperty(); - public DocumentViewerViewModel(StateManager stateManager) { this.stateManager = Objects.requireNonNull(stateManager); diff --git a/src/main/java/org/jabref/gui/edit/ManageKeywordsViewModel.java b/src/main/java/org/jabref/gui/edit/ManageKeywordsViewModel.java index c071e652033e..2c4e3e01e6a1 100644 --- a/src/main/java/org/jabref/gui/edit/ManageKeywordsViewModel.java +++ b/src/main/java/org/jabref/gui/edit/ManageKeywordsViewModel.java @@ -110,7 +110,7 @@ public void saveChanges() { } NamedCompound ce = updateKeywords(entries, keywordsToAdd, keywordsToRemove); - //TODO: bp.getUndoManager().addEdit(ce); + // TODO: bp.getUndoManager().addEdit(ce); } private NamedCompound updateKeywords(List entries, KeywordList keywordsToAdd, diff --git a/src/main/java/org/jabref/gui/exporter/CreateModifyExporterDialogViewModel.java b/src/main/java/org/jabref/gui/exporter/CreateModifyExporterDialogViewModel.java index 4fd067f02ae3..df1ab4ffbb83 100644 --- a/src/main/java/org/jabref/gui/exporter/CreateModifyExporterDialogViewModel.java +++ b/src/main/java/org/jabref/gui/exporter/CreateModifyExporterDialogViewModel.java @@ -46,7 +46,7 @@ public CreateModifyExporterDialogViewModel(ExporterViewModel exporter, DialogSer this.preferences = preferences; this.loader = loader; - //Set text of each of the boxes + // Set text of each of the boxes if (exporter != null) { name.setValue(exporter.name().get()); layoutFile.setValue(exporter.layoutFileName().get()); diff --git a/src/main/java/org/jabref/gui/exporter/ExportCommand.java b/src/main/java/org/jabref/gui/exporter/ExportCommand.java index 77b3a8430def..fd355b5a6b10 100644 --- a/src/main/java/org/jabref/gui/exporter/ExportCommand.java +++ b/src/main/java/org/jabref/gui/exporter/ExportCommand.java @@ -56,7 +56,7 @@ public void execute() { SavePreferences savePreferences = preferences.loadForExportFromPreferences(); XmpPreferences xmpPreferences = preferences.getXMPPreferences(); - //Get list of exporters and sort before adding to file dialog + // Get list of exporters and sort before adding to file dialog List exporters = Globals.exportFactory.getExporters().stream() .sorted(Comparator.comparing(Exporter::getName)) .collect(Collectors.toList()); diff --git a/src/main/java/org/jabref/gui/exporter/ExportToClipboardAction.java b/src/main/java/org/jabref/gui/exporter/ExportToClipboardAction.java index 606706a89da4..3505738d7d6e 100644 --- a/src/main/java/org/jabref/gui/exporter/ExportToClipboardAction.java +++ b/src/main/java/org/jabref/gui/exporter/ExportToClipboardAction.java @@ -67,7 +67,7 @@ public void execute() { .filter(exporter -> SUPPORTED_FILETYPES.containsAll(exporter.getFileType().getExtensions())) .collect(Collectors.toList()); - //Find default choice, if any + // Find default choice, if any Exporter defaultChoice = exporters.stream() .filter(exporter -> exporter.getName().equals(Globals.prefs.get(JabRefPreferences.LAST_USED_EXPORT))) .findAny() @@ -88,7 +88,7 @@ private ExportResult exportToClipboard(Exporter exporter) throws Exception { // (This is an ugly hack!) Globals.prefs.fileDirForDatabase = panel.getBibDatabaseContext().getFileDirectoriesAsPaths(Globals.prefs.getFilePreferences()).stream().map(Path::toString).collect(Collectors.toList()); - //Add chosen export type to last used pref, to become default + // Add chosen export type to last used pref, to become default Globals.prefs.put(JabRefPreferences.LAST_USED_EXPORT, exporter.getName()); Path tmp = null; diff --git a/src/main/java/org/jabref/gui/externalfiles/ImportHandler.java b/src/main/java/org/jabref/gui/externalfiles/ImportHandler.java index 2739d9239457..8400239f2da5 100644 --- a/src/main/java/org/jabref/gui/externalfiles/ImportHandler.java +++ b/src/main/java/org/jabref/gui/externalfiles/ImportHandler.java @@ -72,7 +72,7 @@ public void importAsNewEntries(List files) { // First try xmp import, if empty try pdf import, otherwise create empty entry if (!xmpEntriesInFile.isEmpty()) { if (!pdfResult.isEmpty()) { - //FIXME: Show merge dialog? + // FIXME: Show merge dialog? entriesToAdd = xmpEntriesInFile; } else { entriesToAdd = xmpEntriesInFile; @@ -105,8 +105,8 @@ private BibEntry createEmptyEntryWithLink(Path file) { } public void importEntries(List entries) { - //TODO: Add undo/redo - //undoManager.addEdit(new UndoableInsertEntries(panel.getDatabase(), entries)); + // TODO: Add undo/redo + // undoManager.addEdit(new UndoableInsertEntries(panel.getDatabase(), entries)); database.getDatabase().insertEntries(entries); @@ -128,10 +128,10 @@ private void addToGroups(List entries, Collection group GroupEntryChanger entryChanger = (GroupEntryChanger) node.getGroup(); List undo = entryChanger.add(entries); // TODO: Add undo - //if (!undo.isEmpty()) { + // if (!undo.isEmpty()) { // ce.addEdit(UndoableChangeEntriesOfGroup.getUndoableEdit(new GroupTreeNodeViewModel(node), // undo)); - //} + // } } } } diff --git a/src/main/java/org/jabref/gui/externalfiletype/EditExternalFileTypeViewModel.java b/src/main/java/org/jabref/gui/externalfiletype/EditExternalFileTypeViewModel.java index dc573aa2c36b..220032732c48 100644 --- a/src/main/java/org/jabref/gui/externalfiletype/EditExternalFileTypeViewModel.java +++ b/src/main/java/org/jabref/gui/externalfiletype/EditExternalFileTypeViewModel.java @@ -27,8 +27,7 @@ public EditExternalFileTypeViewModel(CustomExternalFileType fileType) { if (fileType.getOpenWithApplication().isEmpty()) { defaultApplicationSelectedProperty.setValue(true); - } - else { + } else { customApplicationSelectedProperty.setValue(true); } diff --git a/src/main/java/org/jabref/gui/externalfiletype/ExternalFileMenuItem.java b/src/main/java/org/jabref/gui/externalfiletype/ExternalFileMenuItem.java deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/src/main/java/org/jabref/gui/externalfiletype/ExternalFileTypes.java b/src/main/java/org/jabref/gui/externalfiletype/ExternalFileTypes.java index 7e7d2836f1b4..1c24f739ffd0 100644 --- a/src/main/java/org/jabref/gui/externalfiletype/ExternalFileTypes.java +++ b/src/main/java/org/jabref/gui/externalfiletype/ExternalFileTypes.java @@ -17,7 +17,7 @@ import org.jabref.model.util.FileHelper; import org.jabref.preferences.JabRefPreferences; -//Do not make this class final, as it otherwise can't be mocked for tests +// Do not make this class final, as it otherwise can't be mocked for tests public class ExternalFileTypes { // This String is used in the encoded list in prefs of external file type diff --git a/src/main/java/org/jabref/gui/fieldeditors/JournalEditorViewModel.java b/src/main/java/org/jabref/gui/fieldeditors/JournalEditorViewModel.java index af942d99c5e6..4f3f20e94f67 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/JournalEditorViewModel.java +++ b/src/main/java/org/jabref/gui/fieldeditors/JournalEditorViewModel.java @@ -28,7 +28,7 @@ public void toggleAbbreviation() { if (nextAbbreviation.isPresent()) { text.set(nextAbbreviation.get()); // TODO: Add undo - //panel.getUndoManager().addEdit(new UndoableFieldChange(entry, editor.getName(), text, nextAbbreviation)); + // panel.getUndoManager().addEdit(new UndoableFieldChange(entry, editor.getName(), text, nextAbbreviation)); } } } diff --git a/src/main/java/org/jabref/gui/fieldeditors/LinkedEntriesEditorViewModel.java b/src/main/java/org/jabref/gui/fieldeditors/LinkedEntriesEditorViewModel.java index 81453aa5ff0c..19af58758fea 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/LinkedEntriesEditorViewModel.java +++ b/src/main/java/org/jabref/gui/fieldeditors/LinkedEntriesEditorViewModel.java @@ -39,7 +39,7 @@ public LinkedEntriesEditorViewModel(Field field, AutoCompleteSuggestionProvider< @Override @SuppressWarnings("unchecked") public Collection complete(AutoCompletionBinding.ISuggestionRequest request) { - //We have to cast the BibEntries from the BibEntrySuggestionProvider to ParsedEntryLink + // We have to cast the BibEntries from the BibEntrySuggestionProvider to ParsedEntryLink Collection bibEntries = (Collection) super.complete(request); return bibEntries.stream().map(ParsedEntryLink::new).collect(Collectors.toList()); } @@ -72,9 +72,9 @@ public void jumpToEntry(ParsedEntryLink parsedEntryLink) { // This feature was removed while converting the linked entries editor to JavaFX // Right now there is no nice way to re-implement it as we have no good interface to control the focus of the main table // (except directly using the JabRefFrame class as below) - //parsedEntryLink.getLinkedEntry().ifPresent( + // parsedEntryLink.getLinkedEntry().ifPresent( // e -> frame.getCurrentBasePanel().highlightEntry(e) - //); + // ); } } diff --git a/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java b/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java index 263c8c8ad0c2..537a17fff081 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java +++ b/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java @@ -92,7 +92,7 @@ private void handleOnDragDetected(@SuppressWarnings("unused") LinkedFileViewMode if (selectedItem != null) { ClipboardContent content = new ClipboardContent(); Dragboard dragboard = listView.startDragAndDrop(TransferMode.MOVE); - //We have to use the model class here, as the content of the dragboard must be serializable + // We have to use the model class here, as the content of the dragboard must be serializable content.put(DragAndDropDataFormats.LINKED_FILE, selectedItem); dragboard.setContent(content); } diff --git a/src/main/java/org/jabref/gui/fieldeditors/MapBasedEditorViewModel.java b/src/main/java/org/jabref/gui/fieldeditors/MapBasedEditorViewModel.java index 24df92ecc61f..9fce68893e19 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/MapBasedEditorViewModel.java +++ b/src/main/java/org/jabref/gui/fieldeditors/MapBasedEditorViewModel.java @@ -35,7 +35,7 @@ public String toString(T object) { if (object == null) { return null; } else { - return getItemMap().inverse().getOrDefault(object, object.toString()); //if the object is not found we simply return itself as string + return getItemMap().inverse().getOrDefault(object, object.toString()); // if the object is not found we simply return itself as string } } diff --git a/src/main/java/org/jabref/gui/filelist/LinkedFilesEditDialogViewModel.java b/src/main/java/org/jabref/gui/filelist/LinkedFilesEditDialogViewModel.java index bfa7eb0ee97f..1d2f80b11ff9 100644 --- a/src/main/java/org/jabref/gui/filelist/LinkedFilesEditDialogViewModel.java +++ b/src/main/java/org/jabref/gui/filelist/LinkedFilesEditDialogViewModel.java @@ -93,7 +93,7 @@ public void setValues(LinkedFile linkedFile) { description.set(linkedFile.getDescription()); if (linkedFile.isOnlineLink()) { - link.setValue(linkedFile.getLink()); //Might be an URL + link.setValue(linkedFile.getLink()); // Might be an URL } else { link.setValue(relativize(Paths.get(linkedFile.getLink()))); } diff --git a/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java b/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java index 4f40d4bb670f..8fe28d2bf8bf 100644 --- a/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java +++ b/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java @@ -108,10 +108,10 @@ private GroupNodeViewModel toViewModel(GroupTreeNode child) { public List addEntriesToGroup(List entries) { // TODO: warn if assignment has undesired side effects (modifies a field != keywords) - //if (!WarnAssignmentSideEffects.warnAssignmentSideEffects(group, groupSelector.frame)) - //{ + // if (!WarnAssignmentSideEffects.warnAssignmentSideEffects(group, groupSelector.frame)) + // { // return; // user aborted operation - //} + // } var changes = groupNode.addEntriesToGroup(entries); @@ -298,13 +298,13 @@ public boolean acceptableDrop(Dragboard dragboard) { public void moveTo(GroupNodeViewModel target) { // TODO: Add undo and display message - //MoveGroupChange undo = new MoveGroupChange(((GroupTreeNodeViewModel)source.getParent()).getNode(), + // MoveGroupChange undo = new MoveGroupChange(((GroupTreeNodeViewModel)source.getParent()).getNode(), // source.getNode().getPositionInParent(), target.getNode(), target.getChildCount()); getGroupNode().moveTo(target.getGroupNode()); - //panel.getUndoManager().addEdit(new UndoableMoveGroup(this.groupsRoot, moveChange)); - //panel.markBaseChanged(); - //frame.output(Localization.lang("Moved group \"%0\".", node.getNode().getGroup().getName())); + // panel.getUndoManager().addEdit(new UndoableMoveGroup(this.groupsRoot, moveChange)); + // panel.markBaseChanged(); + // frame.output(Localization.lang("Moved group \"%0\".", node.getNode().getGroup().getName())); } public void moveTo(GroupTreeNode target, int targetIndex) { diff --git a/src/main/java/org/jabref/gui/groups/GroupTreeView.java b/src/main/java/org/jabref/gui/groups/GroupTreeView.java index 0e96156f96d4..0e9809dce2b4 100644 --- a/src/main/java/org/jabref/gui/groups/GroupTreeView.java +++ b/src/main/java/org/jabref/gui/groups/GroupTreeView.java @@ -220,7 +220,7 @@ public void initialize() { if ((event.getGestureSource() != row) && (row.getItem() != null) && row.getItem().acceptableDrop(dragboard)) { event.acceptTransferModes(TransferMode.MOVE, TransferMode.LINK); - //expand node and all children on drag over + // expand node and all children on drag over dragExpansionHandler.expandGroup(row.getTreeItem()); if (localDragboard.hasBibEntries()) { @@ -358,20 +358,20 @@ private ContextMenu createContextMenuForGroup(GroupNodeViewModel group) { menu.getItems().add(sortAlphabetically); // TODO: Disable some actions under certain conditions - //if (group.canBeEdited()) { - //editGroupPopupAction.setEnabled(false); - //addGroupPopupAction.setEnabled(false); - //removeGroupAndSubgroupsPopupAction.setEnabled(false); - //removeGroupKeepSubgroupsPopupAction.setEnabled(false); - //} else { - //editGroupPopupAction.setEnabled(true); - //addGroupPopupAction.setEnabled(true); - //addGroupPopupAction.setNode(node); - //removeGroupAndSubgroupsPopupAction.setEnabled(true); - //removeGroupKeepSubgroupsPopupAction.setEnabled(true); - //} - //sortSubmenu.setEnabled(!node.isLeaf()); - //removeSubgroupsPopupAction.setEnabled(!node.isLeaf()); + // if (group.canBeEdited()) { + // editGroupPopupAction.setEnabled(false); + // addGroupPopupAction.setEnabled(false); + // removeGroupAndSubgroupsPopupAction.setEnabled(false); + // removeGroupKeepSubgroupsPopupAction.setEnabled(false); + // } else { + // editGroupPopupAction.setEnabled(true); + // addGroupPopupAction.setEnabled(true); + // addGroupPopupAction.setNode(node); + // removeGroupAndSubgroupsPopupAction.setEnabled(true); + // removeGroupKeepSubgroupsPopupAction.setEnabled(true); + // } + // sortSubmenu.setEnabled(!node.isLeaf()); + // removeSubgroupsPopupAction.setEnabled(!node.isLeaf()); return menu; } diff --git a/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java b/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java index d0b77597aad1..6f8a189bced9 100644 --- a/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java +++ b/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java @@ -156,11 +156,11 @@ public void addNewSubgroup(GroupNodeViewModel parent) { parent.addSubgroup(group); // TODO: Add undo - //UndoableAddOrRemoveGroup undo = new UndoableAddOrRemoveGroup(parent, new GroupTreeNodeViewModel(newGroupNode), UndoableAddOrRemoveGroup.ADD_NODE); - //panel.getUndoManager().addEdit(undo); + // UndoableAddOrRemoveGroup undo = new UndoableAddOrRemoveGroup(parent, new GroupTreeNodeViewModel(newGroupNode), UndoableAddOrRemoveGroup.ADD_NODE); + // panel.getUndoManager().addEdit(undo); // TODO: Expand parent to make new group visible - //parent.expand(); + // parent.expand(); dialogService.notify(Localization.lang("Added group \"%0\".", group.getName())); writeGroupChangesToMetaData(); @@ -205,16 +205,16 @@ public void editGroup(GroupNodeViewModel oldGroup) { // UndoableModifyGroup undo = new UndoableModifyGroup(GroupSelector.this, groupsRoot, node, newGroup); // if (undoAddPreviousEntries == null) { // panel.getUndoManager().addEdit(undo); - //} else { + // } else { // NamedCompound nc = new NamedCompound("Modify Group"); // nc.addEdit(undo); // nc.addEdit(undoAddPreviousEntries); // nc.end();/ // panel.getUndoManager().addEdit(nc); - //} - //if (!addChange.isEmpty()) { + // } + // if (!addChange.isEmpty()) { // undoAddPreviousEntries = UndoableChangeEntriesOfGroup.getUndoableEdit(null, addChange); - //} + // } dialogService.notify(Localization.lang("Modified group \"%0\".", group.getName())); writeGroupChangesToMetaData(); @@ -231,8 +231,8 @@ public void removeSubgroups(GroupNodeViewModel group) { Localization.lang("Remove all subgroups of \"%0\"?", group.getDisplayName())); if (confirmation) { /// TODO: Add undo - //final UndoableModifySubtree undo = new UndoableModifySubtree(getGroupTreeRoot(), node, "Remove subgroups"); - //panel.getUndoManager().addEdit(undo); + // final UndoableModifySubtree undo = new UndoableModifySubtree(getGroupTreeRoot(), node, "Remove subgroups"); + // panel.getUndoManager().addEdit(undo); group.getGroupNode().removeAllChildren(); dialogService.notify(Localization.lang("Removed all subgroups of group \"%0\".", group.getDisplayName())); writeGroupChangesToMetaData(); @@ -246,8 +246,8 @@ public void removeGroupKeepSubgroups(GroupNodeViewModel group) { if (confirmation) { // TODO: Add undo - //final UndoableAddOrRemoveGroup undo = new UndoableAddOrRemoveGroup(groupsRoot, node, UndoableAddOrRemoveGroup.REMOVE_NODE_KEEP_CHILDREN); - //panel.getUndoManager().addEdit(undo); + // final UndoableAddOrRemoveGroup undo = new UndoableAddOrRemoveGroup(groupsRoot, node, UndoableAddOrRemoveGroup.REMOVE_NODE_KEEP_CHILDREN); + // panel.getUndoManager().addEdit(undo); GroupTreeNode groupNode = group.getGroupNode(); groupNode.getParent() .ifPresent(parent -> groupNode.moveAllChildrenTo(parent, parent.getIndexOfChild(groupNode).get())); @@ -268,8 +268,8 @@ public void removeGroupAndSubgroups(GroupNodeViewModel group) { Localization.lang("Remove")); if (confirmed) { // TODO: Add undo - //final UndoableAddOrRemoveGroup undo = new UndoableAddOrRemoveGroup(groupsRoot, node, UndoableAddOrRemoveGroup.REMOVE_NODE_AND_CHILDREN); - //panel.getUndoManager().addEdit(undo); + // final UndoableAddOrRemoveGroup undo = new UndoableAddOrRemoveGroup(groupsRoot, node, UndoableAddOrRemoveGroup.REMOVE_NODE_AND_CHILDREN); + // panel.getUndoManager().addEdit(undo); removeGroupsAndSubGroupsFromEntries(group); @@ -305,11 +305,11 @@ public void addSelectedEntries(GroupNodeViewModel group) { // panel.getUndoManager().addEdit(undoAll); // TODO Display massages - //if (undo == null) { + // if (undo == null) { // frame.output(Localization.lang("The group \"%0\" already contains the selection.", // node.getGroup().getName())); // return; - //} + // } // panel.getUndoManager().addEdit(undo); // final String groupName = node.getGroup().getName(); // if (assignedEntries == 1) { @@ -317,7 +317,7 @@ public void addSelectedEntries(GroupNodeViewModel group) { // } else { // frame.output(Localization.lang("Assigned %0 entries to group \"%1\".", String.valueOf(assignedEntries), // groupName)); - //} + // } } public void removeSelectedEntries(GroupNodeViewModel group) { diff --git a/src/main/java/org/jabref/gui/groups/UndoableModifySubtree.java b/src/main/java/org/jabref/gui/groups/UndoableModifySubtree.java index 1f04933adde7..c1f2ad3897ed 100644 --- a/src/main/java/org/jabref/gui/groups/UndoableModifySubtree.java +++ b/src/main/java/org/jabref/gui/groups/UndoableModifySubtree.java @@ -42,7 +42,7 @@ public void undo() { // remember modified children for redo m_modifiedSubtree.clear(); // get node to edit - final GroupTreeNode subtreeRoot = m_groupRoot.getDescendant(m_subtreeRootPath).get(); //TODO: NULL + final GroupTreeNode subtreeRoot = m_groupRoot.getDescendant(m_subtreeRootPath).get(); // TODO: NULL m_modifiedSubtree.addAll(subtreeRoot.getChildren()); // keep subtree handle, but restore everything else from backup subtreeRoot.removeAllChildren(); @@ -54,7 +54,7 @@ public void undo() { @Override public void redo() { super.redo(); - final GroupTreeNode subtreeRoot = m_groupRoot.getDescendant(m_subtreeRootPath).get(); //TODO: NULL + final GroupTreeNode subtreeRoot = m_groupRoot.getDescendant(m_subtreeRootPath).get(); // TODO: NULL subtreeRoot.removeAllChildren(); for (GroupTreeNode modifiedNode : m_modifiedSubtree) { modifiedNode.moveTo(subtreeRoot); diff --git a/src/main/java/org/jabref/gui/groups/UndoableMoveGroup.java b/src/main/java/org/jabref/gui/groups/UndoableMoveGroup.java index 93cb4bba6f85..2a0996bec5ac 100644 --- a/src/main/java/org/jabref/gui/groups/UndoableMoveGroup.java +++ b/src/main/java/org/jabref/gui/groups/UndoableMoveGroup.java @@ -19,7 +19,6 @@ class UndoableMoveGroup extends AbstractUndoableJabRefEdit { private final List pathToOldParent; private final int oldChildIndex; - public UndoableMoveGroup(GroupTreeNodeViewModel root, MoveGroupChange moveChange) { this.root = Objects.requireNonNull(root); Objects.requireNonNull(moveChange); @@ -38,9 +37,9 @@ public String getPresentationName() { public void undo() { super.undo(); - GroupTreeNode newParent = root.getNode().getDescendant(pathToNewParent).get(); //TODO: NULL - GroupTreeNode node = newParent.getChildAt(newChildIndex).get(); //TODO: Null - //TODO: NULL + GroupTreeNode newParent = root.getNode().getDescendant(pathToNewParent).get(); // TODO: NULL + GroupTreeNode node = newParent.getChildAt(newChildIndex).get(); // TODO: Null + // TODO: NULL node.moveTo(root.getNode().getDescendant(pathToOldParent).get(), oldChildIndex); } @@ -48,9 +47,9 @@ public void undo() { public void redo() { super.redo(); - GroupTreeNode oldParent = root.getNode().getDescendant(pathToOldParent).get(); //TODO: NULL - GroupTreeNode node = oldParent.getChildAt(oldChildIndex).get(); //TODO:Null - //TODO: NULL + GroupTreeNode oldParent = root.getNode().getDescendant(pathToOldParent).get(); // TODO: NULL + GroupTreeNode node = oldParent.getChildAt(oldChildIndex).get(); // TODO:Null + // TODO: NULL node.moveTo(root.getNode().getDescendant(pathToNewParent).get(), newChildIndex); } } diff --git a/src/main/java/org/jabref/gui/icon/IconTheme.java b/src/main/java/org/jabref/gui/icon/IconTheme.java index 3e7efb6cd8a0..f7143eb71555 100644 --- a/src/main/java/org/jabref/gui/icon/IconTheme.java +++ b/src/main/java/org/jabref/gui/icon/IconTheme.java @@ -192,49 +192,49 @@ public enum JabRefIcons implements JabRefIcon { RANK3(MaterialDesignIcon.STAR, MaterialDesignIcon.STAR, MaterialDesignIcon.STAR, MaterialDesignIcon.STAR_OUTLINE, MaterialDesignIcon.STAR_OUTLINE), RANK4(MaterialDesignIcon.STAR, MaterialDesignIcon.STAR, MaterialDesignIcon.STAR, MaterialDesignIcon.STAR, MaterialDesignIcon.STAR_OUTLINE), RANK5(MaterialDesignIcon.STAR, MaterialDesignIcon.STAR, MaterialDesignIcon.STAR, MaterialDesignIcon.STAR, MaterialDesignIcon.STAR), - WWW(MaterialDesignIcon.WEB) /*css: web*/, - GROUP_INCLUDING(MaterialDesignIcon.FILTER_OUTLINE) /*css: filter-outline*/, - GROUP_REFINING(MaterialDesignIcon.FILTER) /*css: filter*/, - AUTO_GROUP(MaterialDesignIcon.AUTO_FIX), /*css: auto-fix*/ + WWW(MaterialDesignIcon.WEB), + GROUP_INCLUDING(MaterialDesignIcon.FILTER_OUTLINE), + GROUP_REFINING(MaterialDesignIcon.FILTER), + AUTO_GROUP(MaterialDesignIcon.AUTO_FIX), GROUP_INTERSECTION(JabRefMaterialDesignIcon.SET_CENTER), GROUP_UNION(JabRefMaterialDesignIcon.SET_ALL), - EMAIL(MaterialDesignIcon.EMAIL) /*css: email*/, - EXPORT_TO_CLIPBOARD(MaterialDesignIcon.CLIPBOARD_ARROW_LEFT) /*css: clipboard-arrow-left */, - ATTACH_FILE(MaterialDesignIcon.PAPERCLIP) /*css: paperclip*/, - AUTO_FILE_LINK(MaterialDesignIcon.FILE_FIND) /*css: file-find */, - AUTO_LINKED_FILE(MaterialDesignIcon.BRIEFCASE_CHECK) /*css: briefcase-check */, - QUALITY_ASSURED(MaterialDesignIcon.CERTIFICATE), /*css: certificate */ - QUALITY(MaterialDesignIcon.CERTIFICATE), /*css: certificate */ - OPEN(MaterialDesignIcon.FOLDER_OUTLINE) /*css: folder */, - ADD_ROW(MaterialDesignIcon.SERVER_PLUS) /* css: server-plus*/, - REMOVE_ROW(MaterialDesignIcon.SERVER_MINUS) /*css: server-minus */, - PICTURE(MaterialDesignIcon.FILE_IMAGE) /*css: file-image */, - READ_STATUS_READ(Color.rgb(111, 204, 117, 1), MaterialDesignIcon.EYE), /*css: eye */ - READ_STATUS_SKIMMED(Color.ORANGE, MaterialDesignIcon.EYE), /*css: eye */ - READ_STATUS(MaterialDesignIcon.EYE), /*css: eye */ - RELEVANCE(MaterialDesignIcon.STAR_CIRCLE), /*css: star-circle */ - MERGE_ENTRIES(MaterialDesignIcon.COMPARE), /* css: compare */ - CONNECT_OPEN_OFFICE(MaterialDesignIcon.OPEN_IN_APP) /*css: open-in-app */, - PLAIN_TEXT_IMPORT_TODO(MaterialDesignIcon.CHECKBOX_BLANK_CIRCLE_OUTLINE) /* css: checkbox-blank-circle-outline*/, - PLAIN_TEXT_IMPORT_DONE(MaterialDesignIcon.CHECKBOX_MARKED_CIRCLE_OUTLINE) /* checkbox-marked-circle-outline */, - DONATE(MaterialDesignIcon.GIFT), /* css: gift */ - MOVE_TAB_ARROW(MaterialDesignIcon.ARROW_UP_BOLD), /*css: arrow-up-bold */ - OPTIONAL(MaterialDesignIcon.LABEL_OUTLINE), /*css: label-outline */ - REQUIRED(MaterialDesignIcon.LABEL), /*css: label */ - INTEGRITY_FAIL(Color.RED, MaterialDesignIcon.CLOSE_CIRCLE), /*css: close-circle */ - INTEGRITY_INFO(MaterialDesignIcon.INFORMATION), /*css: information */ - INTEGRITY_WARN(MaterialDesignIcon.ALERT_CIRCLE), /*css alert-circle */ - INTEGRITY_SUCCESS(MaterialDesignIcon.CHECKBOX_MARKED_CIRCLE_OUTLINE) /*css: checkbox-marked-circle-outline */, - GITHUB(MaterialDesignIcon.GITHUB_CIRCLE), /*css: github-circle*/ - TOGGLE_ENTRY_PREVIEW(MaterialDesignIcon.LIBRARY_BOOKS), /*css: library-books */ - TOGGLE_GROUPS(MaterialDesignIcon.VIEW_LIST), /*css: view-list */ - SHOW_PREFERENCES_LIST(MaterialDesignIcon.VIEW_LIST), /*css: view-list */ - WRITE_XMP(MaterialDesignIcon.IMPORT), /* css: import */ - FILE_WORD(MaterialDesignIcon.FILE_WORD), /*css: file-word */ - FILE_EXCEL(MaterialDesignIcon.FILE_EXCEL), /*css: file-excel */ - FILE_POWERPOINT(MaterialDesignIcon.FILE_POWERPOINT), /*css: file-powerpoint */ - FILE_TEXT(MaterialDesignIcon.FILE_DOCUMENT), /*css: file-document */ - FILE_MULTIPLE(MaterialDesignIcon.FILE_MULTIPLE), /*css: file-multiple */ + EMAIL(MaterialDesignIcon.EMAIL), + EXPORT_TO_CLIPBOARD(MaterialDesignIcon.CLIPBOARD_ARROW_LEFT), + ATTACH_FILE(MaterialDesignIcon.PAPERCLIP), + AUTO_FILE_LINK(MaterialDesignIcon.FILE_FIND), + AUTO_LINKED_FILE(MaterialDesignIcon.BRIEFCASE_CHECK), + QUALITY_ASSURED(MaterialDesignIcon.CERTIFICATE), + QUALITY(MaterialDesignIcon.CERTIFICATE), + OPEN(MaterialDesignIcon.FOLDER_OUTLINE), + ADD_ROW(MaterialDesignIcon.SERVER_PLUS), + REMOVE_ROW(MaterialDesignIcon.SERVER_MINUS), + PICTURE(MaterialDesignIcon.FILE_IMAGE), + READ_STATUS_READ(Color.rgb(111, 204, 117, 1), MaterialDesignIcon.EYE), + READ_STATUS_SKIMMED(Color.ORANGE, MaterialDesignIcon.EYE), + READ_STATUS(MaterialDesignIcon.EYE), + RELEVANCE(MaterialDesignIcon.STAR_CIRCLE), + MERGE_ENTRIES(MaterialDesignIcon.COMPARE), + CONNECT_OPEN_OFFICE(MaterialDesignIcon.OPEN_IN_APP), + PLAIN_TEXT_IMPORT_TODO(MaterialDesignIcon.CHECKBOX_BLANK_CIRCLE_OUTLINE), + PLAIN_TEXT_IMPORT_DONE(MaterialDesignIcon.CHECKBOX_MARKED_CIRCLE_OUTLINE), + DONATE(MaterialDesignIcon.GIFT), + MOVE_TAB_ARROW(MaterialDesignIcon.ARROW_UP_BOLD), + OPTIONAL(MaterialDesignIcon.LABEL_OUTLINE), + REQUIRED(MaterialDesignIcon.LABEL), + INTEGRITY_FAIL(Color.RED, MaterialDesignIcon.CLOSE_CIRCLE), + INTEGRITY_INFO(MaterialDesignIcon.INFORMATION), + INTEGRITY_WARN(MaterialDesignIcon.ALERT_CIRCLE), + INTEGRITY_SUCCESS(MaterialDesignIcon.CHECKBOX_MARKED_CIRCLE_OUTLINE), + GITHUB(MaterialDesignIcon.GITHUB_CIRCLE), + TOGGLE_ENTRY_PREVIEW(MaterialDesignIcon.LIBRARY_BOOKS), + TOGGLE_GROUPS(MaterialDesignIcon.VIEW_LIST), + SHOW_PREFERENCES_LIST(MaterialDesignIcon.VIEW_LIST), + WRITE_XMP(MaterialDesignIcon.IMPORT), + FILE_WORD(MaterialDesignIcon.FILE_WORD), + FILE_EXCEL(MaterialDesignIcon.FILE_EXCEL), + FILE_POWERPOINT(MaterialDesignIcon.FILE_POWERPOINT), + FILE_TEXT(MaterialDesignIcon.FILE_DOCUMENT), + FILE_MULTIPLE(MaterialDesignIcon.FILE_MULTIPLE), FILE_OPENOFFICE(JabRefMaterialDesignIcon.OPEN_OFFICE), APPLICATION_EMACS(JabRefMaterialDesignIcon.EMACS), APPLICATION_LYX(JabRefMaterialDesignIcon.LYX), @@ -242,21 +242,21 @@ public enum JabRefIcons implements JabRefIcon { APPLICATION_TEXMAKER(JabRefMaterialDesignIcon.TEX_MAKER), APPLICATION_VIM(JabRefMaterialDesignIcon.VIM), APPLICATION_WINEDT(JabRefMaterialDesignIcon.WINEDT), - KEY_BINDINGS(MaterialDesignIcon.KEYBOARD), /*css: keyboard */ - FIND_DUPLICATES(MaterialDesignIcon.CODE_EQUAL), /*css: code-equal */ - CONNECT_DB(MaterialDesignIcon.CLOUD_UPLOAD), /*cloud-upload*/ + KEY_BINDINGS(MaterialDesignIcon.KEYBOARD), + FIND_DUPLICATES(MaterialDesignIcon.CODE_EQUAL), + CONNECT_DB(MaterialDesignIcon.CLOUD_UPLOAD), SUCCESS(MaterialDesignIcon.CHECK_CIRCLE), - CHECK(MaterialDesignIcon.CHECK) /*css: check */, + CHECK(MaterialDesignIcon.CHECK), WARNING(MaterialDesignIcon.ALERT), ERROR(MaterialDesignIcon.ALERT_CIRCLE), - CASE_SENSITIVE(MaterialDesignIcon.ALPHABETICAL), /* css: mdi-alphabetical */ - REG_EX(MaterialDesignIcon.REGEX), /*css: mdi-regex */ - CONSOLE(MaterialDesignIcon.CONSOLE), /*css: console */ - FORUM(MaterialDesignIcon.FORUM), /* css: forum */ - FACEBOOK(MaterialDesignIcon.FACEBOOK), /* css: facebook */ - TWITTER(MaterialDesignIcon.TWITTER), /* css: twitter */ - BLOG(MaterialDesignIcon.RSS), /* css: rss */ - DATE_PICKER(MaterialDesignIcon.CALENDAR), /* css: calendar */ + CASE_SENSITIVE(MaterialDesignIcon.ALPHABETICAL), + REG_EX(MaterialDesignIcon.REGEX), + CONSOLE(MaterialDesignIcon.CONSOLE), + FORUM(MaterialDesignIcon.FORUM), + FACEBOOK(MaterialDesignIcon.FACEBOOK), + TWITTER(MaterialDesignIcon.TWITTER), + BLOG(MaterialDesignIcon.RSS), + DATE_PICKER(MaterialDesignIcon.CALENDAR), DEFAULT_GROUP_ICON_COLORED(MaterialDesignIcon.PLAY), DEFAULT_GROUP_ICON(MaterialDesignIcon.LABEL_OUTLINE), ALL_ENTRIES_GROUP_ICON(MaterialDesignIcon.DATABASE), diff --git a/src/main/java/org/jabref/gui/importer/ImportAction.java b/src/main/java/org/jabref/gui/importer/ImportAction.java index 8395d3bac924..2c08c0e16ba4 100644 --- a/src/main/java/org/jabref/gui/importer/ImportAction.java +++ b/src/main/java/org/jabref/gui/importer/ImportAction.java @@ -70,7 +70,7 @@ public void automatedImport(List filenames) { // TODO: show parserwarnings, if any (not here) // for (ImportFormatReader.UnknownFormatImport p : imports) { // ParserResultWarningDialog.showParserResultWarningDialog(p.parserResult, frame); - //} + // } if (bibtexResult.isEmpty()) { if (importError == null) { // TODO: No control flow using exceptions diff --git a/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java b/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java index 3d2be86cfd78..1561e170a089 100644 --- a/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java +++ b/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java @@ -236,7 +236,7 @@ public void resolveDuplicate(BibEntry entry) { // TODO: Remove old entry. Or... add it to a list of entries // to be deleted. We only delete // it after Ok is clicked. - //entriesToDelete.add(other.get()); + // entriesToDelete.add(other.get()); // Replace entry by merged entry entries.add(dialog.getMergedEntry()); diff --git a/src/main/java/org/jabref/gui/importer/UnlinkedPDFFileFilter.java b/src/main/java/org/jabref/gui/importer/UnlinkedPDFFileFilter.java index e387a6bd758a..6404e716c8d1 100644 --- a/src/main/java/org/jabref/gui/importer/UnlinkedPDFFileFilter.java +++ b/src/main/java/org/jabref/gui/importer/UnlinkedPDFFileFilter.java @@ -23,7 +23,6 @@ public class UnlinkedPDFFileFilter implements FileFilter { private final DatabaseFileLookup lookup; private final FileFilter fileFilter; - public UnlinkedPDFFileFilter(FileFilter fileFilter, BibDatabaseContext databaseContext) { this.fileFilter = fileFilter; this.lookup = new DatabaseFileLookup(databaseContext, Globals.prefs.getFilePreferences()); diff --git a/src/main/java/org/jabref/gui/importer/actions/OpenDatabaseAction.java b/src/main/java/org/jabref/gui/importer/actions/OpenDatabaseAction.java index 7515921fa030..e03376c59df7 100644 --- a/src/main/java/org/jabref/gui/importer/actions/OpenDatabaseAction.java +++ b/src/main/java/org/jabref/gui/importer/actions/OpenDatabaseAction.java @@ -141,7 +141,7 @@ public void openFiles(List filesToOpen, boolean raisePanel) { final List theFiles = Collections.unmodifiableList(filesToOpen); for (Path theFile : theFiles) { - //This method will execute the concrete file opening and loading in a background thread + // This method will execute the concrete file opening and loading in a background thread openTheFile(theFile, raisePanel); } diff --git a/src/main/java/org/jabref/gui/keyboard/KeyBinding.java b/src/main/java/org/jabref/gui/keyboard/KeyBinding.java index d2f8db9e8750..414bcd64b146 100644 --- a/src/main/java/org/jabref/gui/keyboard/KeyBinding.java +++ b/src/main/java/org/jabref/gui/keyboard/KeyBinding.java @@ -21,7 +21,7 @@ public enum KeyBinding { COPY_BIBTEX_KEY_AND_LINK("Copy BibTeX key and link", Localization.lang("Copy BibTeX key and link"), "ctrl+alt+K", KeyBindingCategory.EDIT), COPY_PREVIEW("Copy preview", Localization.lang("Copy preview"), "ctrl+shift+C", KeyBindingCategory.VIEW), CUT("Cut", Localization.lang("Cut"), "ctrl+X", KeyBindingCategory.EDIT), - //We have to put Entry Editor Previous before, because otherwise the decrease font size is found first + // We have to put Entry Editor Previous before, because otherwise the decrease font size is found first ENTRY_EDITOR_PREVIOUS_PANEL_2("Entry editor, previous panel 2", Localization.lang("Entry editor, previous panel 2"), "ctrl+MINUS", KeyBindingCategory.VIEW), DELETE_ENTRY("Delete entry", Localization.lang("Delete entry"), "DELETE", KeyBindingCategory.BIBTEX), DEFAULT_DIALOG_ACTION("Execute default action in dialog", Localization.lang("Execute default action in dialog"), "ctrl+ENTER", KeyBindingCategory.VIEW), diff --git a/src/main/java/org/jabref/gui/maintable/CellFactory.java b/src/main/java/org/jabref/gui/maintable/CellFactory.java index 357d84e6dc50..29b164f657e8 100644 --- a/src/main/java/org/jabref/gui/maintable/CellFactory.java +++ b/src/main/java/org/jabref/gui/maintable/CellFactory.java @@ -24,82 +24,82 @@ public class CellFactory { public CellFactory(ExternalFileTypes externalFileTypes, UndoManager undoManager) { JabRefIcon icon; icon = IconTheme.JabRefIcons.PDF_FILE; - //icon.setToo(Localization.lang("Open") + " PDF"); + // icon.setToo(Localization.lang("Open") + " PDF"); TABLE_ICONS.put(StandardField.PDF, icon); icon = IconTheme.JabRefIcons.WWW; - //icon.setToolTipText(Localization.lang("Open") + " URL"); + // icon.setToolTipText(Localization.lang("Open") + " URL"); TABLE_ICONS.put(StandardField.URL, icon); icon = IconTheme.JabRefIcons.WWW; - //icon.setToolTipText(Localization.lang("Open") + " CiteSeer URL"); + // icon.setToolTipText(Localization.lang("Open") + " CiteSeer URL"); TABLE_ICONS.put(new UnknownField("citeseerurl"), icon); icon = IconTheme.JabRefIcons.WWW; - //icon.setToolTipText(Localization.lang("Open") + " ArXiv URL"); + // icon.setToolTipText(Localization.lang("Open") + " ArXiv URL"); TABLE_ICONS.put(StandardField.EPRINT, icon); icon = IconTheme.JabRefIcons.DOI; - //icon.setToolTipText(Localization.lang("Open") + " DOI " + Localization.lang("web link")); + // icon.setToolTipText(Localization.lang("Open") + " DOI " + Localization.lang("web link")); TABLE_ICONS.put(StandardField.DOI, icon); icon = IconTheme.JabRefIcons.FILE; - //icon.setToolTipText(Localization.lang("Open") + " PS"); + // icon.setToolTipText(Localization.lang("Open") + " PS"); TABLE_ICONS.put(StandardField.PS, icon); icon = IconTheme.JabRefIcons.FOLDER; - //icon.setToolTipText(Localization.lang("Open folder")); + // icon.setToolTipText(Localization.lang("Open folder")); TABLE_ICONS.put(StandardField.FOLDER, icon); icon = IconTheme.JabRefIcons.FILE; - //icon.setToolTipText(Localization.lang("Open file")); + // icon.setToolTipText(Localization.lang("Open file")); TABLE_ICONS.put(StandardField.FILE, icon); for (ExternalFileType fileType : externalFileTypes.getExternalFileTypeSelection()) { icon = fileType.getIcon(); - //icon.setToolTipText(Localization.lang("Open %0 file", fileType.getName())); + // icon.setToolTipText(Localization.lang("Open %0 file", fileType.getName())); TABLE_ICONS.put(fileType.getField(), icon); } SpecialFieldViewModel relevanceViewModel = new SpecialFieldViewModel(SpecialField.RELEVANCE, undoManager); icon = relevanceViewModel.getIcon(); - //icon.setToolTipText(relevanceViewModel.getLocalization()); + // icon.setToolTipText(relevanceViewModel.getLocalization()); TABLE_ICONS.put(SpecialField.RELEVANCE, icon); SpecialFieldViewModel qualityViewModel = new SpecialFieldViewModel(SpecialField.QUALITY, undoManager); icon = qualityViewModel.getIcon(); - //icon.setToolTipText(qualityViewModel.getLocalization()); + // icon.setToolTipText(qualityViewModel.getLocalization()); TABLE_ICONS.put(SpecialField.QUALITY, icon); // Ranking item in the menu uses one star SpecialFieldViewModel rankViewModel = new SpecialFieldViewModel(SpecialField.RANKING, undoManager); icon = rankViewModel.getIcon(); - //icon.setToolTipText(rankViewModel.getLocalization()); + // icon.setToolTipText(rankViewModel.getLocalization()); TABLE_ICONS.put(SpecialField.RANKING, icon); // Priority icon used for the menu SpecialFieldViewModel priorityViewModel = new SpecialFieldViewModel(SpecialField.PRIORITY, undoManager); icon = priorityViewModel.getIcon(); - //icon.setToolTipText(priorityViewModel.getLocalization()); + // icon.setToolTipText(priorityViewModel.getLocalization()); TABLE_ICONS.put(SpecialField.PRIORITY, icon); // Read icon used for menu SpecialFieldViewModel readViewModel = new SpecialFieldViewModel(SpecialField.READ_STATUS, undoManager); icon = readViewModel.getIcon(); - //icon.setToolTipText(readViewModel.getLocalization()); + // icon.setToolTipText(readViewModel.getLocalization()); TABLE_ICONS.put(SpecialField.READ_STATUS, icon); // Print icon used for menu SpecialFieldViewModel printedViewModel = new SpecialFieldViewModel(SpecialField.PRINTED, undoManager); icon = printedViewModel.getIcon(); - //icon.setToolTipText(printedViewModel.getLocalization()); + // icon.setToolTipText(printedViewModel.getLocalization()); TABLE_ICONS.put(SpecialField.PRINTED, icon); } public Node getTableIcon(Field field) { JabRefIcon icon = TABLE_ICONS.get(field); if (icon == null) { - //LOGGER.info("Error: no table icon defined for type '" + field + "'."); + // LOGGER.info("Error: no table icon defined for type '" + field + "'."); return null; } else { // node should be generated for each call, as nodes can be added to the scene graph only once diff --git a/src/main/java/org/jabref/gui/maintable/MainTable.java b/src/main/java/org/jabref/gui/maintable/MainTable.java index f182dbaf07dc..e15ac98e4cea 100644 --- a/src/main/java/org/jabref/gui/maintable/MainTable.java +++ b/src/main/java/org/jabref/gui/maintable/MainTable.java @@ -116,7 +116,7 @@ public MainTable(MainTableDataModel model, JabRefFrame frame, new PersistenceVisualStateTable(this, Globals.prefs); // TODO: Float marked entries - //model.updateMarkingState(Globals.prefs.getBoolean(JabRefPreferences.FLOAT_MARKED_ENTRIES)); + // model.updateMarkingState(Globals.prefs.getBoolean(JabRefPreferences.FLOAT_MARKED_ENTRIES)); setupKeyBindings(keyBindingRepository); @@ -242,8 +242,8 @@ private void handleOnDragDetected(TableRow row, BibEntry List entries = getSelectionModel().getSelectedItems().stream().map(BibEntryTableViewModel::getEntry).collect(Collectors.toList()); - //The following is necesary to initiate the drag and drop in javafx, although we don't need the contents - //It doesn't work without + // The following is necesary to initiate the drag and drop in javafx, although we don't need the contents + // It doesn't work without ClipboardContent content = new ClipboardContent(); Dragboard dragboard = startDragAndDrop(TransferMode.MOVE); content.put(DragAndDropDataFormats.ENTRIES, ""); @@ -275,15 +275,15 @@ private void handleOnDragDropped(TableRow row, BibEntryT BibEntry entry = target.getEntry(); switch (event.getTransferMode()) { case LINK: - LOGGER.debug("Mode LINK"); //shift on win or no modifier + LOGGER.debug("Mode LINK"); // shift on win or no modifier importHandler.getLinker().addFilesToEntry(entry, files); break; case MOVE: - LOGGER.debug("Mode MOVE"); //alt on win + LOGGER.debug("Mode MOVE"); // alt on win importHandler.getLinker().moveFilesToFileDirAndAddToEntry(entry, files); break; case COPY: - LOGGER.debug("Mode Copy"); //ctrl on win + LOGGER.debug("Mode Copy"); // ctrl on win importHandler.getLinker().copyFilesToFileDirAndAddToEntry(entry, files); break; } diff --git a/src/main/java/org/jabref/gui/maintable/MainTableColumnModel.java b/src/main/java/org/jabref/gui/maintable/MainTableColumnModel.java index ab6a2b40ff35..708d9cdfac1e 100644 --- a/src/main/java/org/jabref/gui/maintable/MainTableColumnModel.java +++ b/src/main/java/org/jabref/gui/maintable/MainTableColumnModel.java @@ -38,7 +38,7 @@ public enum Type { NORMALFIELD("field"), SPECIALFIELD("special", Localization.lang("Special")); - public static final EnumSet ICON_COLUMNS = EnumSet.of(EXTRAFILE,FILES,GROUPS,LINKED_IDENTIFIER); + public static final EnumSet ICON_COLUMNS = EnumSet.of(EXTRAFILE, FILES, GROUPS, LINKED_IDENTIFIER); private String name; private String displayName; diff --git a/src/main/java/org/jabref/gui/mergeentries/MergeEntries.java b/src/main/java/org/jabref/gui/mergeentries/MergeEntries.java index 4494773b1518..08a407a0e414 100644 --- a/src/main/java/org/jabref/gui/mergeentries/MergeEntries.java +++ b/src/main/java/org/jabref/gui/mergeentries/MergeEntries.java @@ -272,7 +272,7 @@ private void setupEntryTypeRow(GridPane mergePanel) { mergePanel.add(button, 2 + k, rowIndex); } if (defaultRadioButtonSelectionMode == DefaultRadioButtonSelectionMode.RIGHT) { - typeRadioButtons.get(1).setSelected(true); //This Radio Button list does not have a third option as compared to the fields, so do not use the constants here + typeRadioButtons.get(1).setSelected(true); // This Radio Button list does not have a third option as compared to the fields, so do not use the constants here rightRadioButtons.add(typeRadioButtons.get(1)); } else { typeRadioButtons.get(0).setSelected(true); diff --git a/src/main/java/org/jabref/gui/openoffice/Bootstrap.java b/src/main/java/org/jabref/gui/openoffice/Bootstrap.java index 285959272513..3cf88df29657 100644 --- a/src/main/java/org/jabref/gui/openoffice/Bootstrap.java +++ b/src/main/java/org/jabref/gui/openoffice/Bootstrap.java @@ -300,7 +300,7 @@ public static final XComponentContext bootstrap(String[] argArray, URLClassLoade } // create call with arguments - //We need a socket, pipe does not work. https://api.libreoffice.org/examples/examples.html + // We need a socket, pipe does not work. https://api.libreoffice.org/examples/examples.html String[] cmdArray = new String[argArray.length + 2]; cmdArray[0] = fOffice.getPath(); cmdArray[1] = ("--accept=socket,host=localhost,port=2083" + ";urp;"); diff --git a/src/main/java/org/jabref/gui/openoffice/OOBibBase.java b/src/main/java/org/jabref/gui/openoffice/OOBibBase.java index d22362b79731..0b980933425f 100644 --- a/src/main/java/org/jabref/gui/openoffice/OOBibBase.java +++ b/src/main/java/org/jabref/gui/openoffice/OOBibBase.java @@ -153,7 +153,7 @@ public boolean isConnectedToDocument() { public XTextDocument selectComponent(List list) { List viewModel = list.stream().map(DocumentTitleViewModel::new).collect(Collectors.toList()); - //this whole method is part of a background task when autodecting instances, so we need to show dialog in FX thread + // this whole method is part of a background task when autodecting instances, so we need to show dialog in FX thread Optional selectedDocument = dialogService.showChoiceDialogAndWait(Localization.lang("Select document"), Localization.lang("Found documents:"), Localization.lang("Use selected document"), viewModel); return selectedDocument.map(DocumentTitleViewModel::getXtextDocument).orElse(null); } @@ -237,12 +237,12 @@ private XDesktop simpleBootstrap(List jarUrls) URL[] urls = jarUrls.toArray(new URL[1]); URLClassLoader loader = new URLClassLoader(urls, null); - //Get the office component context: + // Get the office component context: XComponentContext xContext = org.jabref.gui.openoffice.Bootstrap.bootstrap(loader); - //Get the office service manager: + // Get the office service manager: XMultiComponentFactory xServiceManager = xContext.getServiceManager(); - //Create the desktop, which is the root frame of the - //hierarchy of frames that contain viewable components: + // Create the desktop, which is the root frame of the + // hierarchy of frames that contain viewable components: Object desktop; try { desktop = xServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", xContext); diff --git a/src/main/java/org/jabref/gui/preferences/AbstractPreferenceTabView.java b/src/main/java/org/jabref/gui/preferences/AbstractPreferenceTabView.java index cf8b4e69c4c4..f68f871ac527 100644 --- a/src/main/java/org/jabref/gui/preferences/AbstractPreferenceTabView.java +++ b/src/main/java/org/jabref/gui/preferences/AbstractPreferenceTabView.java @@ -21,17 +21,27 @@ public abstract class AbstractPreferenceTabView getRestartWarnings() { return viewModel.getRestartWarnings(); } + public List getRestartWarnings() { + return viewModel.getRestartWarnings(); + } } diff --git a/src/main/java/org/jabref/gui/preferences/AdvancedTabView.java b/src/main/java/org/jabref/gui/preferences/AdvancedTabView.java index 0da5d97b869e..5462b442096a 100644 --- a/src/main/java/org/jabref/gui/preferences/AdvancedTabView.java +++ b/src/main/java/org/jabref/gui/preferences/AdvancedTabView.java @@ -59,7 +59,9 @@ public AdvancedTabView(JabRefPreferences preferences) { } @Override - public String getTabName() { return Localization.lang("Advanced"); } + public String getTabName() { + return Localization.lang("Advanced"); + } public void initialize() { this.viewModel = new AdvancedTabViewModel(dialogService, preferences); diff --git a/src/main/java/org/jabref/gui/preferences/AdvancedTabViewModel.java b/src/main/java/org/jabref/gui/preferences/AdvancedTabViewModel.java index e573cc379dec..ca0655c3a7b5 100644 --- a/src/main/java/org/jabref/gui/preferences/AdvancedTabViewModel.java +++ b/src/main/java/org/jabref/gui/preferences/AdvancedTabViewModel.java @@ -189,15 +189,25 @@ private Optional getPortAsInt(String value) { } } - public ValidationStatus remotePortValidationStatus() { return remotePortValidator.getValidationStatus(); } + public ValidationStatus remotePortValidationStatus() { + return remotePortValidator.getValidationStatus(); + } - public ValidationStatus proxyHostnameValidationStatus() { return proxyHostnameValidator.getValidationStatus(); } + public ValidationStatus proxyHostnameValidationStatus() { + return proxyHostnameValidator.getValidationStatus(); + } - public ValidationStatus proxyPortValidationStatus() { return proxyPortValidator.getValidationStatus(); } + public ValidationStatus proxyPortValidationStatus() { + return proxyPortValidator.getValidationStatus(); + } - public ValidationStatus proxyUsernameValidationStatus() { return proxyUsernameValidator.getValidationStatus(); } + public ValidationStatus proxyUsernameValidationStatus() { + return proxyUsernameValidator.getValidationStatus(); + } - public ValidationStatus proxyPasswordValidationStatus() { return proxyPasswordValidator.getValidationStatus(); } + public ValidationStatus proxyPasswordValidationStatus() { + return proxyPasswordValidator.getValidationStatus(); + } public boolean validateSettings() { CompositeValidator validator = new CompositeValidator(); @@ -226,27 +236,51 @@ public boolean validateSettings() { } @Override - public List getRestartWarnings() { return restartWarning; } + public List getRestartWarnings() { + return restartWarning; + } - public BooleanProperty remoteServerProperty() { return remoteServerProperty; } + public BooleanProperty remoteServerProperty() { + return remoteServerProperty; + } - public StringProperty remotePortProperty() { return remotePortProperty; } + public StringProperty remotePortProperty() { + return remotePortProperty; + } - public BooleanProperty useIEEELatexAbbreviationsProperty() { return useIEEELatexAbbreviationsProperty; } + public BooleanProperty useIEEELatexAbbreviationsProperty() { + return useIEEELatexAbbreviationsProperty; + } - public BooleanProperty useCaseKeeperProperty() { return useCaseKeeperProperty; } + public BooleanProperty useCaseKeeperProperty() { + return useCaseKeeperProperty; + } - public BooleanProperty useUnitFormatterProperty() { return useUnitFormatterProperty; } + public BooleanProperty useUnitFormatterProperty() { + return useUnitFormatterProperty; + } - public BooleanProperty proxyUseProperty() { return proxyUseProperty; } + public BooleanProperty proxyUseProperty() { + return proxyUseProperty; + } - public StringProperty proxyHostnameProperty() { return proxyHostnameProperty; } + public StringProperty proxyHostnameProperty() { + return proxyHostnameProperty; + } - public StringProperty proxyPortProperty() { return proxyPortProperty; } + public StringProperty proxyPortProperty() { + return proxyPortProperty; + } - public BooleanProperty proxyUseAuthenticationProperty() { return proxyUseAuthenticationProperty; } + public BooleanProperty proxyUseAuthenticationProperty() { + return proxyUseAuthenticationProperty; + } - public StringProperty proxyUsernameProperty() { return proxyUsernameProperty; } + public StringProperty proxyUsernameProperty() { + return proxyUsernameProperty; + } - public StringProperty proxyPasswordProperty() { return proxyPasswordProperty; } + public StringProperty proxyPasswordProperty() { + return proxyPasswordProperty; + } } diff --git a/src/main/java/org/jabref/gui/preferences/AppearanceTabView.java b/src/main/java/org/jabref/gui/preferences/AppearanceTabView.java index d2d13f3199ce..1d97c4e0acfe 100644 --- a/src/main/java/org/jabref/gui/preferences/AppearanceTabView.java +++ b/src/main/java/org/jabref/gui/preferences/AppearanceTabView.java @@ -27,14 +27,16 @@ public AppearanceTabView(JabRefPreferences preferences) { this.preferences = preferences; ViewLoader.view(this) - .root(this) - .load(); + .root(this) + .load(); } @Override - public String getTabName() { return Localization.lang("Appearance"); } + public String getTabName() { + return Localization.lang("Appearance"); + } - public void initialize () { + public void initialize() { this.viewModel = new AppearanceTabViewModel(dialogService, preferences); fontOverride.selectedProperty().bindBidirectional(viewModel.fontOverrideProperty()); diff --git a/src/main/java/org/jabref/gui/preferences/AppearanceTabViewModel.java b/src/main/java/org/jabref/gui/preferences/AppearanceTabViewModel.java index 46acbc077b5b..6602791e2613 100644 --- a/src/main/java/org/jabref/gui/preferences/AppearanceTabViewModel.java +++ b/src/main/java/org/jabref/gui/preferences/AppearanceTabViewModel.java @@ -94,7 +94,9 @@ public void storeSettings() { } } - public ValidationStatus fontSizeValidationStatus() { return fontSizeValidator.getValidationStatus(); } + public ValidationStatus fontSizeValidationStatus() { + return fontSizeValidator.getValidationStatus(); + } @Override public boolean validateSettings() { @@ -107,14 +109,23 @@ public boolean validateSettings() { } @Override - public List getRestartWarnings() { return restartWarnings; } - - public BooleanProperty fontOverrideProperty() { return fontOverrideProperty; } + public List getRestartWarnings() { + return restartWarnings; + } - public StringProperty fontSizeProperty() { return fontSizeProperty; } + public BooleanProperty fontOverrideProperty() { + return fontOverrideProperty; + } - public BooleanProperty themeLightProperty() { return themeLightProperty; } + public StringProperty fontSizeProperty() { + return fontSizeProperty; + } - public BooleanProperty themeDarkProperty() { return themeDarkProperty; } + public BooleanProperty themeLightProperty() { + return themeLightProperty; + } + public BooleanProperty themeDarkProperty() { + return themeDarkProperty; + } } diff --git a/src/main/java/org/jabref/gui/preferences/BibtexKeyPatternTabView.java b/src/main/java/org/jabref/gui/preferences/BibtexKeyPatternTabView.java index 139c9bed6e78..20e22c01ac57 100644 --- a/src/main/java/org/jabref/gui/preferences/BibtexKeyPatternTabView.java +++ b/src/main/java/org/jabref/gui/preferences/BibtexKeyPatternTabView.java @@ -46,9 +46,11 @@ public BibtexKeyPatternTabView(JabRefPreferences preferences) { } @Override - public String getTabName() { return Localization.lang("BibTeX key generator"); } + public String getTabName() { + return Localization.lang("BibTeX key generator"); + } - public void initialize () { + public void initialize() { this.viewModel = new BibtexKeyPatternTabViewModel(dialogService, preferences); overwriteAllow.selectedProperty().bindBidirectional(viewModel.overwriteAllowProperty()); diff --git a/src/main/java/org/jabref/gui/preferences/EntryEditorTabView.java b/src/main/java/org/jabref/gui/preferences/EntryEditorTabView.java index 78b30681fcc7..669205b6ab2c 100644 --- a/src/main/java/org/jabref/gui/preferences/EntryEditorTabView.java +++ b/src/main/java/org/jabref/gui/preferences/EntryEditorTabView.java @@ -29,16 +29,17 @@ public class EntryEditorTabView extends AbstractPreferenceTabView defaultFileNamePatternsProperty = new SimpleListProperty<>(FXCollections.observableArrayList(DEFAULT_FILENAME_PATTERNS)); private final StringProperty fileNamePatternProperty = new SimpleStringProperty(); diff --git a/src/main/java/org/jabref/gui/preferences/NameFormatterTabView.java b/src/main/java/org/jabref/gui/preferences/NameFormatterTabView.java index ffb38f2d2252..6e1858fa3cdc 100644 --- a/src/main/java/org/jabref/gui/preferences/NameFormatterTabView.java +++ b/src/main/java/org/jabref/gui/preferences/NameFormatterTabView.java @@ -42,7 +42,7 @@ public NameFormatterTabView(JabRefPreferences preferences) { @Override public String getTabName() { return Localization.lang("Name formatter"); } - public void initialize () { + public void initialize() { this.viewModel = new NameFormatterTabViewModel(dialogService, preferences); formatterNameColumn.setSortable(true); diff --git a/src/main/java/org/jabref/gui/preferences/PreviewTabViewModel.java b/src/main/java/org/jabref/gui/preferences/PreviewTabViewModel.java index 1ff3f88a73b7..5d5a841047a1 100644 --- a/src/main/java/org/jabref/gui/preferences/PreviewTabViewModel.java +++ b/src/main/java/org/jabref/gui/preferences/PreviewTabViewModel.java @@ -205,7 +205,7 @@ public void storeSettings() { for (BasePanel basePanel : JabRefGUI.getMainFrame().getBasePanelList()) { // TODO: Find a better way to update preview basePanel.closeBottomPane(); - //basePanel.getPreviewPanel().updateLayout(preferences.getPreviewPreferences()); + // basePanel.getPreviewPanel().updateLayout(preferences.getPreviewPreferences()); } } diff --git a/src/main/java/org/jabref/gui/preview/CopyCitationAction.java b/src/main/java/org/jabref/gui/preview/CopyCitationAction.java index ce7cbba25d6d..0edabf2af5bd 100644 --- a/src/main/java/org/jabref/gui/preview/CopyCitationAction.java +++ b/src/main/java/org/jabref/gui/preview/CopyCitationAction.java @@ -175,7 +175,7 @@ protected static ClipboardContent processHtml(List citations) { private void setClipBoardContent(List citations) { // if it's not a citation style take care of the preview - if (!(style instanceof CitationStylePreviewLayout)) { + if (!(style instanceof CitationStylePreviewLayout)) { clipBoardManager.setContent(processPreview(citations)); } else { // if it's generated by a citation style take care of each output format diff --git a/src/main/java/org/jabref/gui/preview/PreviewPanel.java b/src/main/java/org/jabref/gui/preview/PreviewPanel.java index 3c8f9b69c6f0..3e61d92ca519 100644 --- a/src/main/java/org/jabref/gui/preview/PreviewPanel.java +++ b/src/main/java/org/jabref/gui/preview/PreviewPanel.java @@ -79,15 +79,15 @@ public PreviewPanel(BibDatabaseContext database, DialogService dialogService, Ex List files = event.getDragboard().getFiles().stream().map(File::toPath).collect(Collectors.toList()); if (event.getTransferMode() == TransferMode.MOVE) { - LOGGER.debug("Mode MOVE"); //shift on win or no modifier + LOGGER.debug("Mode MOVE"); // shift on win or no modifier fileLinker.moveFilesToFileDirAndAddToEntry(entry, files); } if (event.getTransferMode() == TransferMode.LINK) { - LOGGER.debug("Node LINK"); //alt on win + LOGGER.debug("Node LINK"); // alt on win fileLinker.addFilesToEntry(entry, files); } if (event.getTransferMode() == TransferMode.COPY) { - LOGGER.debug("Mode Copy"); //ctrl on win, no modifier on Xubuntu + LOGGER.debug("Mode Copy"); // ctrl on win, no modifier on Xubuntu fileLinker.copyFilesToFileDirAndAddToEntry(entry, files); } success = true; diff --git a/src/main/java/org/jabref/gui/push/AbstractPushToApplication.java b/src/main/java/org/jabref/gui/push/AbstractPushToApplication.java index bbd621967731..19b861a67e0b 100644 --- a/src/main/java/org/jabref/gui/push/AbstractPushToApplication.java +++ b/src/main/java/org/jabref/gui/push/AbstractPushToApplication.java @@ -81,13 +81,9 @@ public void pushEntries(BibDatabaseContext database, List entries, Str ProcessBuilder processBuilder = new ProcessBuilder(getCommandLine(keyString)); processBuilder.start(); } - } - - // In case it did not work - catch (IOException excep) { + } catch (IOException excep) { + LOGGER.warn("Error: Could not call executable '{}'", commandPath, excep); couldNotCall = true; - - LOGGER.warn("Error: Could not call executable '" + commandPath + "'.", excep); } } diff --git a/src/main/java/org/jabref/gui/search/GlobalSearchBar.java b/src/main/java/org/jabref/gui/search/GlobalSearchBar.java index 4820df720d67..341ff97cc929 100644 --- a/src/main/java/org/jabref/gui/search/GlobalSearchBar.java +++ b/src/main/java/org/jabref/gui/search/GlobalSearchBar.java @@ -316,7 +316,7 @@ private void updateResults(int matched, TextFlow description, boolean grammarBas // searchIcon.setIcon(IconTheme.JabRefIcon.ADVANCED_SEARCH.getIcon()); } else { // TODO: switch Icon color - //searchIcon.setIcon(IconTheme.JabRefIcon.SEARCH.getIcon()); + // searchIcon.setIcon(IconTheme.JabRefIcon.SEARCH.getIcon()); } setHintTooltip(description); @@ -424,7 +424,7 @@ public AutoCompletePopup getSkinnable() { @Override public void dispose() { - //empty + // empty } } } diff --git a/src/main/java/org/jabref/gui/shared/SharedDatabaseLoginDialogView.java b/src/main/java/org/jabref/gui/shared/SharedDatabaseLoginDialogView.java index d3a4a69376c1..b8c604f0bbbb 100644 --- a/src/main/java/org/jabref/gui/shared/SharedDatabaseLoginDialogView.java +++ b/src/main/java/org/jabref/gui/shared/SharedDatabaseLoginDialogView.java @@ -60,7 +60,7 @@ public SharedDatabaseLoginDialogView(JabRefFrame frame) { ControlHelper.setAction(connectButton, this.getDialogPane(), event -> openDatabase()); Button btnConnect = (Button) this.getDialogPane().lookupButton(connectButton); - //must be set here, because in initialize the button is still null + // must be set here, because in initialize the button is still null btnConnect.disableProperty().bind(viewModel.formValidation().validProperty().not()); btnConnect.textProperty().bind(EasyBind.map(viewModel.loadingProperty(), loading -> (loading) ? Localization.lang("Connecting...") : Localization.lang("Connect"))); } @@ -103,7 +103,7 @@ private void initialize() { passwordKeystore.disableProperty().bind(viewModel.useSSLProperty().not()); passwordKeystore.textProperty().bindBidirectional(viewModel.keyStorePasswordProperty()); - //Must be executed after the initialization of the view, otherwise it doesn't work + // Must be executed after the initialization of the view, otherwise it doesn't work Platform.runLater(() -> { visualizer.initVisualization(viewModel.dbValidation(), database, true); visualizer.initVisualization(viewModel.hostValidation(), host, true); diff --git a/src/main/java/org/jabref/gui/undo/NamedCompound.java b/src/main/java/org/jabref/gui/undo/NamedCompound.java index 1d663bc887b6..55be19a96e37 100644 --- a/src/main/java/org/jabref/gui/undo/NamedCompound.java +++ b/src/main/java/org/jabref/gui/undo/NamedCompound.java @@ -10,7 +10,6 @@ public class NamedCompound extends CompoundEdit { private final String name; private boolean hasEdits; - public NamedCompound(String name) { super(); this.name = name; diff --git a/src/main/java/org/jabref/gui/util/DirectoryDialogConfiguration.java b/src/main/java/org/jabref/gui/util/DirectoryDialogConfiguration.java index aa82819a9bb8..d390676c4b5d 100644 --- a/src/main/java/org/jabref/gui/util/DirectoryDialogConfiguration.java +++ b/src/main/java/org/jabref/gui/util/DirectoryDialogConfiguration.java @@ -28,12 +28,12 @@ public DirectoryDialogConfiguration build() { public Builder withInitialDirectory(Path directory) { directory = directory.toAbsolutePath(); - //Dir must be a folder, not a file + // Dir must be a folder, not a file if (!Files.isDirectory(directory)) { directory = directory.getParent(); } - //The lines above work also if the dir does not exist at all! - //NULL is accepted by the filechooser as no inital path + // The lines above work also if the dir does not exist at all! + // NULL is accepted by the filechooser as no inital path if (!Files.exists(directory)) { diff --git a/src/main/java/org/jabref/gui/util/FileDialogConfiguration.java b/src/main/java/org/jabref/gui/util/FileDialogConfiguration.java index 05edd7a05aad..c1e7d1b1f0d9 100644 --- a/src/main/java/org/jabref/gui/util/FileDialogConfiguration.java +++ b/src/main/java/org/jabref/gui/util/FileDialogConfiguration.java @@ -65,15 +65,15 @@ public FileDialogConfiguration build() { } public Builder withInitialDirectory(Path directory) { - if (directory == null) { //It could be that somehow the path is null, for example if it got deleted in the meantime + if (directory == null) { // It could be that somehow the path is null, for example if it got deleted in the meantime initialDirectory = null; - } else { //Dir must be a folder, not a file + } else { // Dir must be a folder, not a file if (!Files.isDirectory(directory)) { directory = directory.getParent(); } - //The lines above work also if the dir does not exist at all! - //NULL is accepted by the filechooser as no inital path - //Explicit null check, if somehow the parent is null, as Files.exists throws an NPE otherwise + // The lines above work also if the dir does not exist at all! + // NULL is accepted by the filechooser as no inital path + // Explicit null check, if somehow the parent is null, as Files.exists throws an NPE otherwise if ((directory != null) && !Files.exists(directory)) { directory = null; } diff --git a/src/main/java/org/jabref/gui/util/component/DiffHighlightingTextPane.java b/src/main/java/org/jabref/gui/util/component/DiffHighlightingTextPane.java index 496feb1e5eee..de341c3cc5e9 100644 --- a/src/main/java/org/jabref/gui/util/component/DiffHighlightingTextPane.java +++ b/src/main/java/org/jabref/gui/util/component/DiffHighlightingTextPane.java @@ -11,7 +11,6 @@ public class DiffHighlightingTextPane extends TextFlow { private static final String CONTENT_TYPE = "text/html"; - public DiffHighlightingTextPane() { super(); // setContentType(CONTENT_TYPE); diff --git a/src/main/java/org/jabref/logic/autosaveandbackup/BackupManager.java b/src/main/java/org/jabref/logic/autosaveandbackup/BackupManager.java index d58ba62cf1b2..9970dc32730e 100644 --- a/src/main/java/org/jabref/logic/autosaveandbackup/BackupManager.java +++ b/src/main/java/org/jabref/logic/autosaveandbackup/BackupManager.java @@ -131,8 +131,10 @@ private Optional determineBackupPath() { private void performBackup(Path backupPath) { try { Charset charset = bibDatabaseContext.getMetaData().getEncoding().orElse(preferences.getDefaultEncoding()); - SavePreferences savePreferences = preferences.loadForSaveFromPreferences().withEncoding - (charset).withMakeBackup(false); + SavePreferences savePreferences = preferences + .loadForSaveFromPreferences() + .withEncoding(charset) + .withMakeBackup(false); new BibtexDatabaseWriter(new AtomicFileWriter(backupPath, savePreferences.getEncoding()), savePreferences, entryTypesManager) .saveDatabase(bibDatabaseContext); } catch (IOException e) { diff --git a/src/main/java/org/jabref/logic/bibtex/FieldWriter.java b/src/main/java/org/jabref/logic/bibtex/FieldWriter.java index c7ce8ea8a105..15e65163f679 100644 --- a/src/main/java/org/jabref/logic/bibtex/FieldWriter.java +++ b/src/main/java/org/jabref/logic/bibtex/FieldWriter.java @@ -60,7 +60,7 @@ private static void checkBraces(String text) throws InvalidFieldValueException { // Then we throw an exception if the error criteria are met. if (!(right == 0) && (left == 0)) { - LOGGER.error("Unescaped '}' character without opening bracket ends string prematurely. Field value: {}", text ); + LOGGER.error("Unescaped '}' character without opening bracket ends string prematurely. Field value: {}", text); throw new InvalidFieldValueException("Unescaped '}' character without opening bracket ends string prematurely. Field value: " + text); } if (!(right == 0) && (right < left)) { diff --git a/src/main/java/org/jabref/logic/bibtex/comparator/BibDatabaseDiff.java b/src/main/java/org/jabref/logic/bibtex/comparator/BibDatabaseDiff.java index e663702d7a3a..e3435b7ac7b1 100644 --- a/src/main/java/org/jabref/logic/bibtex/comparator/BibDatabaseDiff.java +++ b/src/main/java/org/jabref/logic/bibtex/comparator/BibDatabaseDiff.java @@ -110,7 +110,7 @@ private static List compareEntries(List originalEntries, differences.add(new BibEntryDiff(originalEntry, null)); } } - + // Finally, look if there are still untouched entries in the new database. These may have been added. for (int i = 0; i < newEntries.size(); i++) { if (!used.contains(i)) { diff --git a/src/main/java/org/jabref/logic/bibtex/comparator/BibtexStringComparator.java b/src/main/java/org/jabref/logic/bibtex/comparator/BibtexStringComparator.java index 312a4f51af6e..c8fcda144d72 100644 --- a/src/main/java/org/jabref/logic/bibtex/comparator/BibtexStringComparator.java +++ b/src/main/java/org/jabref/logic/bibtex/comparator/BibtexStringComparator.java @@ -9,7 +9,6 @@ public class BibtexStringComparator implements Comparator { private final boolean considerRefs; - /** * @param considerRefs Indicates whether the strings should be * sorted according to internal references in addition to diff --git a/src/main/java/org/jabref/logic/bibtex/comparator/FieldComparatorStack.java b/src/main/java/org/jabref/logic/bibtex/comparator/FieldComparatorStack.java index fdfc5568f5ea..b7c9526e1cd4 100644 --- a/src/main/java/org/jabref/logic/bibtex/comparator/FieldComparatorStack.java +++ b/src/main/java/org/jabref/logic/bibtex/comparator/FieldComparatorStack.java @@ -12,7 +12,6 @@ public class FieldComparatorStack implements Comparator { private final List> comparators; - public FieldComparatorStack(List> comparators) { this.comparators = comparators; } diff --git a/src/main/java/org/jabref/logic/bibtexkeypattern/BibtexKeyGenerator.java b/src/main/java/org/jabref/logic/bibtexkeypattern/BibtexKeyGenerator.java index 8a03e9d09660..d887ac16a155 100644 --- a/src/main/java/org/jabref/logic/bibtexkeypattern/BibtexKeyGenerator.java +++ b/src/main/java/org/jabref/logic/bibtexkeypattern/BibtexKeyGenerator.java @@ -102,7 +102,7 @@ public static String removeUnwantedCharacters(String key, boolean enforceLegalKe } public static String cleanKey(String key, boolean enforceLegalKey) { - return removeUnwantedCharacters(key, enforceLegalKey).replaceAll("\\s",""); + return removeUnwantedCharacters(key, enforceLegalKey).replaceAll("\\s", ""); } public String generateKey(BibEntry entry) { diff --git a/src/main/java/org/jabref/logic/bibtexkeypattern/BracketedPattern.java b/src/main/java/org/jabref/logic/bibtexkeypattern/BracketedPattern.java index 5b2b15eb964a..8c0d7ff3a83e 100644 --- a/src/main/java/org/jabref/logic/bibtexkeypattern/BracketedPattern.java +++ b/src/main/java/org/jabref/logic/bibtexkeypattern/BracketedPattern.java @@ -108,7 +108,7 @@ public static String expandBrackets(String pattern, Character keywordDelimiter, Objects.requireNonNull(pattern); Objects.requireNonNull(entry); StringBuilder sb = new StringBuilder(); - StringTokenizer st = new StringTokenizer(pattern,"\\[]",true); + StringTokenizer st = new StringTokenizer(pattern, "\\[]", true); while (st.hasMoreTokens()) { String token = st.nextToken(); @@ -203,9 +203,8 @@ public static String getFieldValue(BibEntry entry, String value, Character keywo return allAuthors(authString); } else if ("authorsAlpha".equals(val)) { return authorsAlpha(authString); - } - // Last author's last name - else if ("authorLast".equals(val)) { + } else if ("authorLast".equals(val)) { + // Last author's last name return lastAuthor(authString); } else if ("authorLastForeIni".equals(val)) { return lastAuthorForenameInitials(authString); @@ -227,6 +226,7 @@ else if ("authorLast".equals(val)) { return authNofMth(authString, Integer.parseInt(nums[0]), Integer.parseInt(nums[1])); } else if (val.matches("auth\\d+")) { + // authN. First N chars of the first author's last name. int num = Integer.parseInt(val.substring(4)); return authN(authString, num, isEnforceLegalKey); } else if (val.matches("authors\\d+")) { @@ -264,10 +264,7 @@ else if ("authorLast".equals(val)) { return authAuthEa(entry.getResolvedFieldOrAlias(StandardField.EDITOR, database).orElse("")); } else if ("edtrshort".equals(val)) { return authshort(entry.getResolvedFieldOrAlias(StandardField.EDITOR, database).orElse("")); - } - // authN. First N chars of the first author's last - // name. - else if (val.matches("edtr\\d+")) { + } else if (val.matches("edtr\\d+")) { String fa = firstAuthor(entry.getResolvedFieldOrAlias(StandardField.EDITOR, database).orElse("")); int num = Integer.parseInt(val.substring(4)); if (num > fa.length()) { @@ -351,8 +348,7 @@ else if (val.matches("edtr\\d+")) { // we haven't seen any special demands return entry.getResolvedFieldOrAlias(FieldFactory.parseField(val), database).orElse(""); } - } - catch (NullPointerException ex) { + } catch (NullPointerException ex) { LOGGER.debug("Problem making expanding bracketed expression", ex); return ""; } diff --git a/src/main/java/org/jabref/logic/bst/BibtexCaseChanger.java b/src/main/java/org/jabref/logic/bst/BibtexCaseChanger.java index 7c1dc1ab81a2..4704b0e36c9b 100644 --- a/src/main/java/org/jabref/logic/bst/BibtexCaseChanger.java +++ b/src/main/java/org/jabref/logic/bst/BibtexCaseChanger.java @@ -30,13 +30,13 @@ public enum FORMAT_MODE { // However, we decided against it and will probably do the other way round: https://github.com/JabRef/jabref/pull/215#issuecomment-146981624 // Each word should start with a capital letter - //EACH_FIRST_UPPERS('f'), + // EACH_FIRST_UPPERS('f'), // Converts all words to upper case, but converts articles, prepositions, and conjunctions to lower case // Capitalizes first and last word // Does not change words starting with "{" // DIFFERENCE to old CaseChangers.TITLE: last word is NOT capitalized in all cases - //TITLE_UPPERS('T'); + // TITLE_UPPERS('T'); private final char asChar; diff --git a/src/main/java/org/jabref/logic/bst/ChangeCaseFunction.java b/src/main/java/org/jabref/logic/bst/ChangeCaseFunction.java index ab602be398a2..d24a4ba56ac3 100644 --- a/src/main/java/org/jabref/logic/bst/ChangeCaseFunction.java +++ b/src/main/java/org/jabref/logic/bst/ChangeCaseFunction.java @@ -35,7 +35,6 @@ public class ChangeCaseFunction implements BstFunction { private final VM vm; - public ChangeCaseFunction(VM vm) { this.vm = vm; } diff --git a/src/main/java/org/jabref/logic/bst/FormatNameFunction.java b/src/main/java/org/jabref/logic/bst/FormatNameFunction.java index 75a8189159d2..b2845c89be7c 100644 --- a/src/main/java/org/jabref/logic/bst/FormatNameFunction.java +++ b/src/main/java/org/jabref/logic/bst/FormatNameFunction.java @@ -27,7 +27,6 @@ public class FormatNameFunction implements BstFunction { private final VM vm; - public FormatNameFunction(VM vm) { this.vm = vm; } diff --git a/src/main/java/org/jabref/logic/cleanup/Cleanups.java b/src/main/java/org/jabref/logic/cleanup/Cleanups.java index 7a9e510c7b7f..d5bbc7055235 100644 --- a/src/main/java/org/jabref/logic/cleanup/Cleanups.java +++ b/src/main/java/org/jabref/logic/cleanup/Cleanups.java @@ -67,7 +67,7 @@ public static List parse(String formatterString) { List actions = new ArrayList<>(); - //read concrete actions + // read concrete actions int startIndex = 0; // first remove all newlines for easier parsing @@ -82,7 +82,7 @@ public static List parse(String formatterString) { int endIndex = remainingString.indexOf(']'); startIndex += endIndex + 1; - //read each formatter + // read each formatter int tokenIndex = remainingString.indexOf(','); do { boolean doBreak = false; diff --git a/src/main/java/org/jabref/logic/cleanup/UpgradePdfPsToFileCleanup.java b/src/main/java/org/jabref/logic/cleanup/UpgradePdfPsToFileCleanup.java index f2769cfa39cc..188dc80d0600 100644 --- a/src/main/java/org/jabref/logic/cleanup/UpgradePdfPsToFileCleanup.java +++ b/src/main/java/org/jabref/logic/cleanup/UpgradePdfPsToFileCleanup.java @@ -22,7 +22,6 @@ public class UpgradePdfPsToFileCleanup implements CleanupJob { // Field name and file type name (from ExternalFileTypes) private final Map fields = new HashMap<>(); - public UpgradePdfPsToFileCleanup() { fields.put(StandardField.PDF, "PDF"); fields.put(StandardField.PS, "PostScript"); diff --git a/src/main/java/org/jabref/logic/exporter/BibDatabaseWriter.java b/src/main/java/org/jabref/logic/exporter/BibDatabaseWriter.java index 67beb678b17c..4492d052095d 100644 --- a/src/main/java/org/jabref/logic/exporter/BibDatabaseWriter.java +++ b/src/main/java/org/jabref/logic/exporter/BibDatabaseWriter.java @@ -119,7 +119,7 @@ public static List getSortedEntries(BibDatabaseContext bibDatabaseCont Objects.requireNonNull(bibDatabaseContext); Objects.requireNonNull(entriesToSort); - //if no meta data are present, simply return in original order + // if no meta data are present, simply return in original order if (bibDatabaseContext.getMetaData() == null) { return new LinkedList<>(entriesToSort); } @@ -215,7 +215,7 @@ public void savePartOfDatabase(BibDatabaseContext bibDatabaseContext, List void parse(T entryType, BibEntry bibEntry, Entry entry) { } } - //set the entryType to the entry + // set the entryType to the entry List entryMethods = getListOfSetMethods(entry); for (Method method : entryMethods) { String methodWithoutSet = method.getName().replace("set", ""); diff --git a/src/main/java/org/jabref/logic/exporter/GroupSerializer.java b/src/main/java/org/jabref/logic/exporter/GroupSerializer.java index 3e1c9d9fa03c..635532c2f46d 100644 --- a/src/main/java/org/jabref/logic/exporter/GroupSerializer.java +++ b/src/main/java/org/jabref/logic/exporter/GroupSerializer.java @@ -117,13 +117,13 @@ private String serializeGroup(AbstractGroup group) { if (group instanceof AllEntriesGroup) { return serializeAllEntriesGroup(); } else if (group instanceof ExplicitGroup) { - return serializeExplicitGroup((ExplicitGroup)group); + return serializeExplicitGroup((ExplicitGroup) group); } else if (group instanceof KeywordGroup) { - return serializeKeywordGroup((KeywordGroup)group); + return serializeKeywordGroup((KeywordGroup) group); } else if (group instanceof SearchGroup) { - return serializeSearchGroup((SearchGroup)group); + return serializeSearchGroup((SearchGroup) group); } else if (group instanceof AutomaticKeywordGroup) { - return serializeAutomaticKeywordGroup((AutomaticKeywordGroup)group); + return serializeAutomaticKeywordGroup((AutomaticKeywordGroup) group); } else if (group instanceof AutomaticPersonsGroup) { return serializeAutomaticPersonsGroup((AutomaticPersonsGroup) group); } else if (group instanceof TexGroup) { diff --git a/src/main/java/org/jabref/logic/exporter/MetaDataSerializer.java b/src/main/java/org/jabref/logic/exporter/MetaDataSerializer.java index 5876ee29ee1b..4cfa57ce175b 100644 --- a/src/main/java/org/jabref/logic/exporter/MetaDataSerializer.java +++ b/src/main/java/org/jabref/logic/exporter/MetaDataSerializer.java @@ -23,7 +23,7 @@ private MetaDataSerializer() { } /** - * Writes all data in the format . + * Writes all data in the format <key, serialized data>. */ public static Map getSerializedStringMap(MetaData metaData, GlobalBibtexKeyPattern globalCiteKeyPattern) { @@ -80,7 +80,7 @@ private static Map serializeMetaData(Map> s for (String dataItem : metaItem.getValue()) { stringBuilder.append(StringUtil.quote(dataItem, MetaData.SEPARATOR_STRING, MetaData.ESCAPE_CHARACTER)).append(MetaData.SEPARATOR_STRING); - //in case of save actions, add an additional newline after the enabled flag + // in case of save actions, add an additional newline after the enabled flag if (metaItem.getKey().equals(MetaData.SAVE_ACTIONS) && (FieldFormatterCleanups.ENABLED.equals(dataItem) || FieldFormatterCleanups.DISABLED.equals(dataItem))) { diff --git a/src/main/java/org/jabref/logic/exporter/ModsExporter.java b/src/main/java/org/jabref/logic/exporter/ModsExporter.java index 7e80a699dddd..7d3523797484 100644 --- a/src/main/java/org/jabref/logic/exporter/ModsExporter.java +++ b/src/main/java/org/jabref/logic/exporter/ModsExporter.java @@ -155,7 +155,7 @@ private void createMarshallerAndWriteToFile(Path file, JAXBElement element = new JAXBElement<>(new QName(MODS_NAMESPACE_URI, "namePart"), @@ -390,12 +390,12 @@ private void addOriginInformation(Field field, String value, OriginInfoDefinitio originInfo.getPlaceOrPublisherOrDateIssued().add(element); } else if (field.equals(StandardField.ADDRESS)) { PlaceDefinition placeDefinition = new PlaceDefinition(); - //There can be more than one place, so we split to get all places and add them + // There can be more than one place, so we split to get all places and add them String[] places = value.split(", "); for (String place : places) { PlaceTermDefinition placeTerm = new PlaceTermDefinition(); - //There's no possibility to see from a bib entry whether it is code or text, but since it is in the bib entry - //we assume that it is text + // There's no possibility to see from a bib entry whether it is code or text, but since it is in the bib entry + // we assume that it is text placeTerm.setType(CodeOrText.TEXT); placeTerm.setValue(place); placeDefinition.getPlaceTerm().add(placeTerm); diff --git a/src/main/java/org/jabref/logic/exporter/OOCalcDatabase.java b/src/main/java/org/jabref/logic/exporter/OOCalcDatabase.java index ee84935708d3..cce171008052 100644 --- a/src/main/java/org/jabref/logic/exporter/OOCalcDatabase.java +++ b/src/main/java/org/jabref/logic/exporter/OOCalcDatabase.java @@ -31,7 +31,6 @@ class OOCalcDatabase { private final List entries; - public OOCalcDatabase(BibDatabase bibtex, List entries) { // Make a list of comparators for sorting the entries: List comparators = new ArrayList<>(); @@ -61,7 +60,7 @@ public Document getDOMrepresentation() { DocumentBuilder dbuild = DocumentBuilderFactory.newInstance().newDocumentBuilder(); result = dbuild.newDocument(); Element collection = result.createElement("office:document-content"); - //collection.setAttribute("xmlns", "http://openoffice.org/2000/office"); + // collection.setAttribute("xmlns", "http://openoffice.org/2000/office"); collection.setAttribute("xmlns:office", "http://openoffice.org/2000/office"); collection.setAttribute("xmlns:style", "http://openoffice.org/2000/style"); collection.setAttribute("xmlns:text", "http://openoffice.org/2000/text"); @@ -145,7 +144,7 @@ public Document getDOMrepresentation() { addTableCell(result, row, new GetOpenOfficeType().format(e.getType().getName())); addTableCell(result, row, getField(e, StandardField.ISBN)); addTableCell(result, row, getField(e, InternalField.KEY_FIELD)); - addTableCell(result, row, getField(e, StandardField.AUTHOR));//new AuthorLastFirst().format(getField(e, StandardField.AUTHOR_FIELD))); + addTableCell(result, row, getField(e, StandardField.AUTHOR)); // new AuthorLastFirst().format(getField(e, StandardField.AUTHOR_FIELD))); addTableCell(result, row, new RemoveWhitespace().format(new RemoveBrackets().format(getField(e, StandardField.TITLE)))); addTableCell(result, row, getField(e, StandardField.JOURNAL)); addTableCell(result, row, getField(e, StandardField.VOLUME)); @@ -160,7 +159,7 @@ public Document getDOMrepresentation() { addTableCell(result, row, getField(e, StandardField.CHAPTER)); addTableCell(result, row, getField(e, StandardField.EDITION)); addTableCell(result, row, getField(e, StandardField.SERIES)); - addTableCell(result, row, getField(e, StandardField.EDITOR));//new AuthorLastFirst().format(getField(e, StandardField.EDITOR_FIELD))); + addTableCell(result, row, getField(e, StandardField.EDITOR)); // new AuthorLastFirst().format(getField(e, StandardField.EDITOR_FIELD))); addTableCell(result, row, getField(e, StandardField.PUBLISHER)); addTableCell(result, row, getField(e, new UnknownField("reporttype"))); addTableCell(result, row, getField(e, StandardField.HOWPUBLISHED)); @@ -199,7 +198,7 @@ private static void addTableCell(Document doc, Element parent, String content) { Element text = doc.createElement("text:p"); Text textNode = doc.createTextNode(content); text.appendChild(textNode); - //text.setTextContent(content); + // text.setTextContent(content); cell.appendChild(text); parent.appendChild(cell); } diff --git a/src/main/java/org/jabref/logic/exporter/OpenDocumentRepresentation.java b/src/main/java/org/jabref/logic/exporter/OpenDocumentRepresentation.java index 3d402e9714f1..00c0f3d5cf1b 100644 --- a/src/main/java/org/jabref/logic/exporter/OpenDocumentRepresentation.java +++ b/src/main/java/org/jabref/logic/exporter/OpenDocumentRepresentation.java @@ -60,7 +60,7 @@ public Document getDOMrepresentation() { DocumentBuilder dbuild = DocumentBuilderFactory.newInstance().newDocumentBuilder(); result = dbuild.newDocument(); Element collection = result.createElement("office:document-content"); - //collection.setAttribute("xmlns", "http://openoffice.org/2000/office"); + // collection.setAttribute("xmlns", "http://openoffice.org/2000/office"); collection.setAttribute("xmlns:office", "urn:oasis:names:tc:opendocument:xmlns:office:1.0"); collection.setAttribute("xmlns:style", "urn:oasis:names:tc:opendocument:xmlns:style:1.0"); collection.setAttribute("xmlns:text", "urn:oasis:names:tc:opendocument:xmlns:text:1.0"); @@ -148,13 +148,13 @@ public Document getDOMrepresentation() { addTableCell(result, row, getField(e, StandardField.ADDRESS)); addTableCell(result, row, getField(e, StandardField.ASSIGNEE)); addTableCell(result, row, getField(e, StandardField.ANNOTE)); - addTableCell(result, row, getField(e, StandardField.AUTHOR));//new AuthorLastFirst().format(getField(e, StandardField.AUTHOR_FIELD))); + addTableCell(result, row, getField(e, StandardField.AUTHOR));// new AuthorLastFirst().format(getField(e, StandardField.AUTHOR_FIELD))); addTableCell(result, row, getField(e, StandardField.BOOKTITLE)); addTableCell(result, row, getField(e, StandardField.CHAPTER)); addTableCell(result, row, getField(e, StandardField.DAY)); addTableCell(result, row, getField(e, StandardField.DAYFILED)); addTableCell(result, row, getField(e, StandardField.EDITION)); - addTableCell(result, row, getField(e, StandardField.EDITOR));//new AuthorLastFirst().format(getField(e, StandardField.EDITOR_FIELD))); + addTableCell(result, row, getField(e, StandardField.EDITOR));// new AuthorLastFirst().format(getField(e, StandardField.EDITOR_FIELD))); addTableCell(result, row, getField(e, StandardField.HOWPUBLISHED)); addTableCell(result, row, getField(e, StandardField.INSTITUTION)); addTableCell(result, row, getField(e, StandardField.JOURNAL)); @@ -205,7 +205,7 @@ private void addTableCell(Document doc, Element parent, String content) { Element text = doc.createElement("text:p"); Text textNode = doc.createTextNode(content); text.appendChild(textNode); - //text.setTextContent(content); + // text.setTextContent(content); cell.appendChild(text); parent.appendChild(cell); } diff --git a/src/main/java/org/jabref/logic/exporter/OpenDocumentSpreadsheetCreator.java b/src/main/java/org/jabref/logic/exporter/OpenDocumentSpreadsheetCreator.java index 4281473f5e22..5ca85932028e 100644 --- a/src/main/java/org/jabref/logic/exporter/OpenDocumentSpreadsheetCreator.java +++ b/src/main/java/org/jabref/logic/exporter/OpenDocumentSpreadsheetCreator.java @@ -52,7 +52,7 @@ private static void storeOpenDocumentSpreadsheetFile(Path file, InputStream sour try (ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(Files.newOutputStream(file)))) { - //addResourceFile("mimetype", "/resource/ods/mimetype", out); + // addResourceFile("mimetype", "/resource/ods/mimetype", out); ZipEntry ze = new ZipEntry("mimetype"); String mime = "application/vnd.oasis.opendocument.spreadsheet"; ze.setMethod(ZipEntry.STORED); @@ -67,7 +67,7 @@ private static void storeOpenDocumentSpreadsheetFile(Path file, InputStream sour out.closeEntry(); ZipEntry zipEntry = new ZipEntry("content.xml"); - //zipEntry.setMethod(ZipEntry.DEFLATED); + // zipEntry.setMethod(ZipEntry.DEFLATED); out.putNextEntry(zipEntry); int c; while ((c = source.read()) >= 0) { diff --git a/src/main/java/org/jabref/logic/exporter/XmpExporter.java b/src/main/java/org/jabref/logic/exporter/XmpExporter.java index f622871bb2b8..9a045f8ebc8f 100644 --- a/src/main/java/org/jabref/logic/exporter/XmpExporter.java +++ b/src/main/java/org/jabref/logic/exporter/XmpExporter.java @@ -15,6 +15,7 @@ import org.jabref.logic.xmp.XmpUtilWriter; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; +import org.jabref.model.entry.field.InternalField; /** * A custom exporter to write bib entries to a .xmp file for further processing @@ -49,7 +50,7 @@ public void export(BibDatabaseContext databaseContext, Path file, Charset encodi for (BibEntry entry : entries) { // Avoid situations, where two cite keys are null Path entryFile; - String suffix = entry.getId() + "_" + entry.getCiteKey() + ".xmp"; + String suffix = entry.getId() + "_" + entry.getField(InternalField.KEY_FIELD).orElse("") + ".xmp"; if (file.getParent() == null) { entryFile = Paths.get(suffix); } else { diff --git a/src/main/java/org/jabref/logic/externalfiles/LinkedFileHandler.java b/src/main/java/org/jabref/logic/externalfiles/LinkedFileHandler.java index ec7c4153adcc..c1046b782085 100644 --- a/src/main/java/org/jabref/logic/externalfiles/LinkedFileHandler.java +++ b/src/main/java/org/jabref/logic/externalfiles/LinkedFileHandler.java @@ -142,8 +142,8 @@ public Optional findExistingFile(LinkedFile flEntry, BibEntry entry, Strin Path targetFilePath = flEntry.findIn(databaseContext, filePreferences) .get().getParent().resolve(targetFileName); Path oldFilePath = flEntry.findIn(databaseContext, filePreferences).get(); - //Check if file already exists in directory with different case. - //This is necessary because other entries may have such a file. + // Check if file already exists in directory with different case. + // This is necessary because other entries may have such a file. Optional matchedByDiffCase = Optional.empty(); try (Stream stream = Files.list(oldFilePath.getParent())) { matchedByDiffCase = stream.filter(name -> name.toString().equalsIgnoreCase(targetFilePath.toString())) diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatter.java index 09d8a9b97995..c5d7dafa01f2 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatter.java @@ -33,6 +33,6 @@ public String getExampleInput() { @Override public String format(String fieldText) { // StringEscapeUtils converts characters and regex kills tags - return StringEscapeUtils.unescapeHtml4(fieldText).replaceAll("<[^>]*>",""); + return StringEscapeUtils.unescapeHtml4(fieldText).replaceAll("<[^>]*>", ""); } } diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/LatexCleanupFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/LatexCleanupFormatter.java index c9bf179d2013..20dc360ba0f6 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/LatexCleanupFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/LatexCleanupFormatter.java @@ -41,7 +41,7 @@ public String format(String oldString) { newValue = REPLACE_WITH_AT.matcher(newValue).replaceAll("$1@@"); // Replace $, but not \$ with @@ newValue = REPLACE_EVERY_OTHER_AT.matcher(newValue).replaceAll("$1\\$$2@@"); // Replace every other @@ with $ - //newValue = newValue.replaceAll("([0-9\\(\\.]+) \\$","\\$$1\\\\ "); // Move numbers followed by a space left of $ inside the equation, e.g., 0.35 $\mu$m + // newValue = newValue.replaceAll("([0-9\\(\\.]+) \\$","\\$$1\\\\ "); // Move numbers followed by a space left of $ inside the equation, e.g., 0.35 $\mu$m newValue = MOVE_NUMBERS_WITH_OPERATORS.matcher(newValue).replaceAll("\\$$1"); // Move numbers, possibly with operators +, -, or /, left of $ into the equation newValue = MOVE_NUMBERS_RIGHT_INTO_EQUATION.matcher(newValue).replaceAll(" $1@@"); // Move numbers right of @@ into the equation diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/UnitsToLatexFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/UnitsToLatexFormatter.java index b32f14a1e116..140d8966b838 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/UnitsToLatexFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/UnitsToLatexFormatter.java @@ -41,7 +41,7 @@ public class UnitsToLatexFormatter extends Formatter { "cd", // candela "dB", // decibel "dBm", // decibel - "dBc", //decibel + "dBc", // decibel "eV", // electron volts "inch", // inch "kat", // katal diff --git a/src/main/java/org/jabref/logic/help/HelpFile.java b/src/main/java/org/jabref/logic/help/HelpFile.java index b08b088c510e..c010dcd6981d 100644 --- a/src/main/java/org/jabref/logic/help/HelpFile.java +++ b/src/main/java/org/jabref/logic/help/HelpFile.java @@ -21,7 +21,7 @@ public enum HelpFile { REGEX_SEARCH("fields/filelinks#RegularExpressionSearch"), PREVIEW("setup/preview"), AUTOSAVE("general/autosave"), - //The help page covers both OO and LO. + // The help page covers both OO and LO. OPENOFFICE_LIBREOFFICE("import-export/openofficeintegration"), FETCHER_ACM("import-using-online-bibliographic-database/acmportal"), FETCHER_ADS("import-using-online-bibliographic-database/ads"), diff --git a/src/main/java/org/jabref/logic/importer/FetcherException.java b/src/main/java/org/jabref/logic/importer/FetcherException.java index 23bd9fc6826d..d97a43a6ec16 100644 --- a/src/main/java/org/jabref/logic/importer/FetcherException.java +++ b/src/main/java/org/jabref/logic/importer/FetcherException.java @@ -4,7 +4,6 @@ public class FetcherException extends JabRefException { - public FetcherException(String errorMessage, Throwable cause) { super(errorMessage, cause); } diff --git a/src/main/java/org/jabref/logic/importer/FulltextFetchers.java b/src/main/java/org/jabref/logic/importer/FulltextFetchers.java index 52f2dcbd8d66..6318e6d12c28 100644 --- a/src/main/java/org/jabref/logic/importer/FulltextFetchers.java +++ b/src/main/java/org/jabref/logic/importer/FulltextFetchers.java @@ -89,7 +89,7 @@ private static Optional getResults(Future try { return future.get(); } catch (InterruptedException ignore) { - + // ignore thread interruptions } catch (ExecutionException | CancellationException e) { LOGGER.debug("Fetcher execution failed or was cancelled"); } diff --git a/src/main/java/org/jabref/logic/importer/ImportException.java b/src/main/java/org/jabref/logic/importer/ImportException.java index 061d74442a0e..2c92c6f5d1ec 100644 --- a/src/main/java/org/jabref/logic/importer/ImportException.java +++ b/src/main/java/org/jabref/logic/importer/ImportException.java @@ -4,7 +4,6 @@ public class ImportException extends JabRefException { - public ImportException(String errorMessage, Exception cause) { super(errorMessage, cause); } diff --git a/src/main/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystem.java b/src/main/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystem.java index 9dff54b8b744..4b76ff44886d 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystem.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystem.java @@ -156,7 +156,7 @@ public void doPostCleanup(BibEntry entry) { entry.getField(StandardField.ABSTRACT) .map(abstractText -> abstractText.replace("

", "").trim()) - .ifPresent(abstractText-> entry.setField(StandardField.ABSTRACT,abstractText)); + .ifPresent(abstractText -> entry.setField(StandardField.ABSTRACT, abstractText)); // The fetcher adds some garbage (number of found entries etc before) entry.setCommentsBeforeEntry(""); } diff --git a/src/main/java/org/jabref/logic/importer/fetcher/CiteSeer.java b/src/main/java/org/jabref/logic/importer/fetcher/CiteSeer.java index d1fcd79b406c..9586fb6c519b 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/CiteSeer.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/CiteSeer.java @@ -49,7 +49,7 @@ public URL getURLForQuery(String query) throws URISyntaxException, MalformedURLE uriBuilder.addParameter("sort", "rlv"); // Sort by relevance uriBuilder.addParameter("q", query); // Query uriBuilder.addParameter("t", "doc"); // Type: documents - //uriBuilder.addParameter("start", "0"); // Start index (not supported at the moment) + // uriBuilder.addParameter("start", "0"); // Start index (not supported at the moment) return uriBuilder.build().toURL(); } diff --git a/src/main/java/org/jabref/logic/importer/fetcher/DOAJFetcher.java b/src/main/java/org/jabref/logic/importer/fetcher/DOAJFetcher.java index 96f9d4f4140f..39146f3f1209 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/DOAJFetcher.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/DOAJFetcher.java @@ -191,8 +191,10 @@ public Optional getHelpPage() { public URL getURLForQuery(String query) throws URISyntaxException, MalformedURLException, FetcherException { URIBuilder uriBuilder = new URIBuilder(SEARCH_URL); DOAJFetcher.addPath(uriBuilder, query); - uriBuilder.addParameter("pageSize", "30"); // Number of results - //uriBuilder.addParameter("page", "1"); // Page (not needed so far) + // Number of results + uriBuilder.addParameter("pageSize", "30"); + // Page (not needed so far) + // uriBuilder.addParameter("page", "1"); return uriBuilder.build().toURL(); } diff --git a/src/main/java/org/jabref/logic/importer/fetcher/GoogleScholar.java b/src/main/java/org/jabref/logic/importer/fetcher/GoogleScholar.java index a8850bd9822f..2154325aa3c4 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/GoogleScholar.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/GoogleScholar.java @@ -44,7 +44,7 @@ public class GoogleScholar implements FulltextFetcher, SearchBasedFetcher { private static final Pattern LINK_TO_BIB_PATTERN = Pattern.compile("(https:\\/\\/scholar.googleusercontent.com\\/scholar.bib[^\"]*)"); private static final String BASIC_SEARCH_URL = "https://scholar.google.com/scholar?"; - private static final String SEARCH_IN_TITLE_URL = "https://scholar.google.com//scholar?"; + private static final String SEARCH_IN_TITLE_URL = "https://scholar.google.com// scholar?"; private static final int NUM_RESULTS = 10; diff --git a/src/main/java/org/jabref/logic/importer/fetcher/IEEE.java b/src/main/java/org/jabref/logic/importer/fetcher/IEEE.java index 0ffd58376aeb..1bd9e41bd81d 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/IEEE.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/IEEE.java @@ -80,7 +80,7 @@ private static BibEntry parseJsonRespone(JSONObject jsonEntry, Character keyword } entry.setField(StandardField.ABSTRACT, jsonEntry.optString("abstract")); - //entry.setField(StandardField.IEEE_ID, jsonEntry.optString("article_number")); + // entry.setField(StandardField.IEEE_ID, jsonEntry.optString("article_number")); final List authors = new ArrayList<>(); JSONObject authorsContainer = jsonEntry.optJSONObject("authors"); @@ -91,7 +91,7 @@ private static BibEntry parseJsonRespone(JSONObject jsonEntry, Character keyword entry.setField(StandardField.AUTHOR, authors.stream().collect(Collectors.joining(" and "))); entry.setField(StandardField.LOCATION, jsonEntry.optString("conference_location")); entry.setField(StandardField.DOI, jsonEntry.optString("doi")); - entry.setField(StandardField.YEAR,jsonEntry.optString("publication_year")); + entry.setField(StandardField.YEAR, jsonEntry.optString("publication_year")); entry.setField(StandardField.PAGES, jsonEntry.optString("start_page") + "--" + jsonEntry.optString("end_page")); JSONObject keywordsContainer = jsonEntry.optJSONObject("index_terms"); @@ -141,7 +141,7 @@ public Optional findFullText(BibEntry entry) throws IOException { stampString = STAMP_BASE_STRING_DOCUMENT + docId; } - //You get this url if you export bibtex from IEEE + // You get this url if you export bibtex from IEEE Matcher stampMatcher = STAMP_PATTERN.matcher(urlString.get()); if (stampMatcher.find()) { // Found it @@ -156,7 +156,7 @@ public Optional findFullText(BibEntry entry) throws IOException { if (doi.isPresent() && doi.get().getDOI().startsWith(IEEE_DOI) && doi.get().getExternalURI().isPresent()) { // Download the HTML page from IEEE URLDownload urlDownload = new URLDownload(doi.get().getExternalURI().get().toURL()); - //We don't need to modify the cookies, but we need support for them + // We don't need to modify the cookies, but we need support for them urlDownload.getCookieFromUrl(); String resolvedDOIPage = urlDownload.asString(); @@ -176,7 +176,7 @@ public Optional findFullText(BibEntry entry) throws IOException { // Download the HTML page containing a frame with the PDF URLDownload urlDownload = new URLDownload(BASE_URL + stampString); - //We don't need to modify the cookies, but we need support for them + // We don't need to modify the cookies, but we need support for them urlDownload.getCookieFromUrl(); String framePage = urlDownload.asString(); diff --git a/src/main/java/org/jabref/logic/importer/fetcher/INSPIREFetcher.java b/src/main/java/org/jabref/logic/importer/fetcher/INSPIREFetcher.java index 7a676021eff4..5497e49c120a 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/INSPIREFetcher.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/INSPIREFetcher.java @@ -60,7 +60,7 @@ public Optional getHelpPage() { public URL getURLForQuery(String query) throws URISyntaxException, MalformedURLException, FetcherException { URIBuilder uriBuilder = new URIBuilder(INSPIRE_HOST); uriBuilder.addParameter("p", query); // Query - //uriBuilder.addParameter("jrec", "1"); // Start index (not needed at the moment) + // uriBuilder.addParameter("jrec", "1"); // Start index (not needed at the moment) uriBuilder.addParameter("rg", "100"); // Should return up to 100 items (instead of default 25) uriBuilder.addParameter("of", "hx"); // BibTeX format return uriBuilder.build().toURL(); @@ -79,7 +79,7 @@ public Parser getParser() { Elements preElements = doc.getElementsByTag("pre"); for (Element elem : preElements) { - //We have to use a new instance here, because otherwise only the first entry gets parsed + // We have to use a new instance here, because otherwise only the first entry gets parsed BibtexParser bibtexParser = new BibtexParser(preferences, new DummyFileUpdateMonitor()); List entry = bibtexParser.parseEntries(elem.text()); entries.addAll(entry); diff --git a/src/main/java/org/jabref/logic/importer/fetcher/MedlineFetcher.java b/src/main/java/org/jabref/logic/importer/fetcher/MedlineFetcher.java index 9168c7f7282e..c03fb80265cc 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/MedlineFetcher.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/MedlineFetcher.java @@ -64,7 +64,7 @@ private static String replaceCommaWithAND(String query) { } /** - * When using 'esearch.fcgi?db=&term=' we will get a list of IDs matching the query. + * When using 'esearch.fcgi?db=<database>&term=<query>' we will get a list of IDs matching the query. * Input: Any text query (&term) * Output: List of UIDs matching the query * @@ -106,7 +106,7 @@ private List getPubMedIdsFromQuery(String query) throws FetcherException break; case XMLStreamConstants.END_ELEMENT: - //Everything relevant is listed before the IdList. So we break the loop right after the IdList tag closes. + // Everything relevant is listed before the IdList. So we break the loop right after the IdList tag closes. if (streamReader.getName().toString().equals("IdList")) { break fetchLoop; } @@ -166,7 +166,7 @@ public List performSearch(String query) throws FetcherException { } else { String searchTerm = replaceCommaWithAND(query); - //searching for pubmed ids matching the query + // searching for pubmed ids matching the query List idList = getPubMedIdsFromQuery(searchTerm); if (idList.isEmpty()) { @@ -178,7 +178,7 @@ public List performSearch(String query) throws FetcherException { numberOfResultsFound + " results found. Only 50 relevant results will be fetched by default."); } - //pass the list of ids to fetchMedline to download them. like a id fetcher for mutliple ids + // pass the list of ids to fetchMedline to download them. like a id fetcher for mutliple ids entryList = fetchMedline(idList); return entryList; @@ -204,7 +204,7 @@ private URL createSearchUrl(String term) throws URISyntaxException, MalformedURL */ private List fetchMedline(List ids) throws FetcherException { try { - //Separate the IDs with a comma to search multiple entries + // Separate the IDs with a comma to search multiple entries URL fetchURL = getURLForID(String.join(",", ids)); URLConnection data = fetchURL.openConnection(); ParserResult result = new MedlineImporter().importDatabase( diff --git a/src/main/java/org/jabref/logic/importer/fetcher/MrDLibFetcher.java b/src/main/java/org/jabref/logic/importer/fetcher/MrDLibFetcher.java index 2b42b3e44aed..600a659e0a3e 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/MrDLibFetcher.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/MrDLibFetcher.java @@ -39,7 +39,6 @@ public class MrDLibFetcher implements EntryBasedFetcher { private String description; private String recommendationSetId; - public MrDLibFetcher(String language, Version version) { LANGUAGE = language; VERSION = version; @@ -100,7 +99,7 @@ private String makeServerRequest(String queryByTitle) throws FetcherException { URLDownload.bypassSSLVerification(); String response = urlDownload.asString(); - //Conversion of < and > + // Conversion of < and > response = response.replaceAll(">", ">"); response = response.replaceAll("<", "<"); return response; diff --git a/src/main/java/org/jabref/logic/importer/fetcher/SpringerFetcher.java b/src/main/java/org/jabref/logic/importer/fetcher/SpringerFetcher.java index 817f07f76aa0..d27ec8998e7a 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/SpringerFetcher.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/SpringerFetcher.java @@ -160,7 +160,7 @@ public URL getURLForQuery(String query) throws URISyntaxException, MalformedURLE uriBuilder.addParameter("q", query); // Search query uriBuilder.addParameter("api_key", API_KEY); // API key uriBuilder.addParameter("p", "20"); // Number of results to return - //uriBuilder.addParameter("s", "1"); // Start item (not needed at the moment) + // uriBuilder.addParameter("s", "1"); // Start item (not needed at the moment) return uriBuilder.build().toURL(); } diff --git a/src/main/java/org/jabref/logic/importer/fileformat/BiblioscapeImporter.java b/src/main/java/org/jabref/logic/importer/fileformat/BiblioscapeImporter.java index 9fc35b6bb43f..23bcec078271 100644 --- a/src/main/java/org/jabref/logic/importer/fileformat/BiblioscapeImporter.java +++ b/src/main/java/org/jabref/logic/importer/fileformat/BiblioscapeImporter.java @@ -177,14 +177,13 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException { } else if ("TH".equals(entry.getKey())) { comments.add("Short Title: " + entry.getValue()); - } else if ("SE".equals(entry.getKey())) - { + } else if ("SE".equals(entry.getKey())) { hm.put(StandardField.CHAPTER, entry .getValue().toString()); - //else if (entry.getKey().equals("AC")) - // hm.put("",entry.getValue().toString()); - //else if (entry.getKey().equals("LP")) - // hm.put("",entry.getValue().toString()); + // else if (entry.getKey().equals("AC")) + // hm.put("",entry.getValue().toString()); + // else if (entry.getKey().equals("LP")) + // hm.put("",entry.getValue().toString()); } } diff --git a/src/main/java/org/jabref/logic/importer/fileformat/BibtexImporter.java b/src/main/java/org/jabref/logic/importer/fileformat/BibtexImporter.java index 7284171237a5..b8e5ce78712c 100644 --- a/src/main/java/org/jabref/logic/importer/fileformat/BibtexImporter.java +++ b/src/main/java/org/jabref/logic/importer/fileformat/BibtexImporter.java @@ -32,6 +32,7 @@ public BibtexImporter(ImportFormatPreferences importFormatPreferences, FileUpdat this.importFormatPreferences = importFormatPreferences; this.fileMonitor = fileMonitor; } + /** * @return true as we have no effective way to decide whether a file is in bibtex format or not. See * https://github.com/JabRef/jabref/pull/379#issuecomment-158685726 for more details. diff --git a/src/main/java/org/jabref/logic/importer/fileformat/BibtexParser.java b/src/main/java/org/jabref/logic/importer/fileformat/BibtexParser.java index 0934f8413988..d3b1c2ba8658 100644 --- a/src/main/java/org/jabref/logic/importer/fileformat/BibtexParser.java +++ b/src/main/java/org/jabref/logic/importer/fileformat/BibtexParser.java @@ -38,6 +38,7 @@ import org.jabref.model.entry.field.Field; import org.jabref.model.entry.field.FieldFactory; import org.jabref.model.entry.field.FieldProperty; +import org.jabref.model.entry.field.InternalField; import org.jabref.model.entry.field.StandardField; import org.jabref.model.entry.types.EntryTypeFactory; import org.jabref.model.metadata.MetaData; @@ -89,7 +90,7 @@ public BibtexParser(ImportFormatPreferences importFormatPreferences, FileUpdateM * * @param bibtexString * @param fileMonitor - * @return An Optional. Optional.empty() if non was found or an error occurred. + * @return An Optional<BibEntry>. Optional.empty() if non was found or an error occurred. * @throws ParseException */ public static Optional singleFromString(String bibtexString, ImportFormatPreferences importFormatPreferences, FileUpdateMonitor fileMonitor) throws ParseException { @@ -247,7 +248,9 @@ private void parseAndAddEntry(String type) { boolean duplicateKey = database.insertEntry(entry); if (duplicateKey) { - parserResult.addDuplicateKey(entry.getCiteKey()); + entry.getField(InternalField.KEY_FIELD).ifPresent( + key -> parserResult.addDuplicateKey(key) + ); } } catch (IOException ex) { // Trying to make the parser more robust. @@ -574,7 +577,7 @@ private void parseField(BibEntry entry) throws IOException { if (field.getProperties().contains(FieldProperty.PERSON_NAMES)) { entry.setField(field, entry.getField(field).get() + " and " + content); } else if (StandardField.KEYWORDS.equals(field)) { - //multiple keywords fields should be combined to one + // multiple keywords fields should be combined to one entry.addKeyword(content, importFormatPreferences.getKeywordSeparator()); } } else { diff --git a/src/main/java/org/jabref/logic/importer/fileformat/EndnoteImporter.java b/src/main/java/org/jabref/logic/importer/fileformat/EndnoteImporter.java index f306a5e307a8..794030a04237 100644 --- a/src/main/java/org/jabref/logic/importer/fileformat/EndnoteImporter.java +++ b/src/main/java/org/jabref/logic/importer/fileformat/EndnoteImporter.java @@ -197,9 +197,8 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException { } else { hm.put(StandardField.PUBLISHER, val); } - } - // replace single dash page ranges (23-45) with double dashes (23--45): - else if ("P".equals(prefix)) { + } else if ("P".equals(prefix)) { + // replace single dash page ranges (23-45) with double dashes (23--45): hm.put(StandardField.PAGES, val.replaceAll("([0-9]) *- *([0-9])", "$1--$2")); } else if ("V".equals(prefix)) { hm.put(StandardField.VOLUME, val); @@ -245,14 +244,14 @@ else if ("P".equals(prefix)) { author = ""; } - //fixauthorscomma + // fixauthorscomma if (!"".equals(author)) { hm.put(StandardField.AUTHOR, fixAuthor(author)); } if (!"".equals(editor)) { hm.put(StandardField.EDITOR, fixAuthor(editor)); } - //if pages missing and article number given, use the article number + // if pages missing and article number given, use the article number if (((hm.get(StandardField.PAGES) == null) || "-".equals(hm.get(StandardField.PAGES))) && !"".equals(artnum)) { hm.put(StandardField.PAGES, artnum); } diff --git a/src/main/java/org/jabref/logic/importer/fileformat/GvkParser.java b/src/main/java/org/jabref/logic/importer/fileformat/GvkParser.java index 29c24e20f4de..16aca51e16d7 100644 --- a/src/main/java/org/jabref/logic/importer/fileformat/GvkParser.java +++ b/src/main/java/org/jabref/logic/importer/fileformat/GvkParser.java @@ -49,7 +49,7 @@ private List parseEntries(Document content) { // Namespace srwNamespace = Namespace.getNamespace("srw","http://www.loc.gov/zing/srw/"); // Schleife ueber allen Teilergebnissen - //Element root = content.getDocumentElement(); + // Element root = content.getDocumentElement(); Element root = (Element) content.getElementsByTagName("zs:searchRetrieveResponse").item(0); Element srwrecords = getChild("zs:records", root); if (srwrecords == null) { @@ -111,12 +111,12 @@ private BibEntry parseEntry(Element e) { } } - //ppn + // ppn if ("003@".equals(tag)) { ppn = getSubfield("0", datafield); } - //author + // author if ("028A".equals(tag)) { String vorname = getSubfield("d", datafield); String nachname = getSubfield("a", datafield); @@ -128,7 +128,7 @@ private BibEntry parseEntry(Element e) { } author = author.concat(vorname + " " + nachname); } - //author (weiterer) + // author (weiterer) if ("028B".equals(tag)) { String vorname = getSubfield("d", datafield); String nachname = getSubfield("a", datafield); @@ -141,7 +141,7 @@ private BibEntry parseEntry(Element e) { author = author.concat(vorname + " " + nachname); } - //editor + // editor if ("028C".equals(tag)) { String vorname = getSubfield("d", datafield); String nachname = getSubfield("a", datafield); @@ -154,24 +154,24 @@ private BibEntry parseEntry(Element e) { editor = editor.concat(vorname + " " + nachname); } - //title and subtitle + // title and subtitle if ("021A".equals(tag)) { title = getSubfield("a", datafield); subtitle = getSubfield("d", datafield); } - //publisher and address + // publisher and address if ("033A".equals(tag)) { publisher = getSubfield("n", datafield); address = getSubfield("p", datafield); } - //year + // year if ("011@".equals(tag)) { year = getSubfield("a", datafield); } - //year, volume, number, pages (year bei Zeitschriften (evtl. redundant mit 011@)) + // year, volume, number, pages (year bei Zeitschriften (evtl. redundant mit 011@)) if ("031A".equals(tag)) { year = getSubfield("j", datafield); @@ -194,13 +194,13 @@ private BibEntry parseEntry(Element e) { } number = title; } - //title and subtitle + // title and subtitle title = getSubfield("a", datafield); subtitle = getSubfield("d", datafield); volume = getSubfield("l", datafield); } - //series and number + // series and number if ("036E".equals(tag)) { series = getSubfield("a", datafield); number = getSubfield("l", datafield); @@ -211,17 +211,17 @@ private BibEntry parseEntry(Element e) { } } - //note + // note if ("037A".equals(tag)) { note = getSubfield("a", datafield); } - //edition + // edition if ("032@".equals(tag)) { edition = getSubfield("a", datafield); } - //isbn + // isbn if ("004A".equals(tag)) { final String isbn10 = getSubfield("0", datafield); final String isbn13 = getSubfield("A", datafield); @@ -252,7 +252,7 @@ private BibEntry parseEntry(Element e) { } } - //journal oder booktitle + // journal oder booktitle /* Problematiken hier: Sowohl für Artikel in * Zeitschriften als für Beiträge in Büchern @@ -271,7 +271,7 @@ private BibEntry parseEntry(Element e) { publisher = getSubfield("n", datafield); } - //pagetotal + // pagetotal if ("034D".equals(tag)) { pagetotal = getSubfield("a", datafield); @@ -297,13 +297,13 @@ private BibEntry parseEntry(Element e) { entryType = StandardEntryType.Book; } - //Hilfskategorien zur Entscheidung @article - //oder @incollection; hier könnte man auch die - //ISBN herausparsen als Erleichterung für das - //Auffinden der Quelle, die über die - //SRU-Schnittstelle gelieferten Daten zur - //Quelle unvollständig sind (z.B. nicht Serie - //und Nummer angegeben werden) + // Hilfskategorien zur Entscheidung @article + // oder @incollection; hier könnte man auch die + // ISBN herausparsen als Erleichterung für das + // Auffinden der Quelle, die über die + // SRU-Schnittstelle gelieferten Daten zur + // Quelle unvollständig sind (z.B. nicht Serie + // und Nummer angegeben werden) if ("039B".equals(tag)) { quelle = getSubfield("8", datafield); } @@ -353,7 +353,7 @@ private BibEntry parseEntry(Element e) { } else if (mak.startsWith("O")) { entryType = BibEntry.DEFAULT_TYPE; // FIXME: online only available in Biblatex - //entryType = "online"; + // entryType = "online"; } /* diff --git a/src/main/java/org/jabref/logic/importer/fileformat/IsiImporter.java b/src/main/java/org/jabref/logic/importer/fileformat/IsiImporter.java index 8e5b98730758..2fa6dcdf4628 100644 --- a/src/main/java/org/jabref/logic/importer/fileformat/IsiImporter.java +++ b/src/main/java/org/jabref/logic/importer/fileformat/IsiImporter.java @@ -348,7 +348,7 @@ static String parseMonth(String value) { for (String part : parts) { try { int number = Integer.parseInt(part); - Optional month = Month.getMonthByNumber(number); + Optional month = Month.getMonthByNumber(number); if (month.isPresent()) { return month.get().getJabRefFormat(); } diff --git a/src/main/java/org/jabref/logic/importer/fileformat/MedlineImporter.java b/src/main/java/org/jabref/logic/importer/fileformat/MedlineImporter.java index c37038bbb818..cd91bd6c3c8f 100644 --- a/src/main/java/org/jabref/logic/importer/fileformat/MedlineImporter.java +++ b/src/main/java/org/jabref/logic/importer/fileformat/MedlineImporter.java @@ -151,7 +151,7 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException { try { Object unmarshalledObject = unmarshallRoot(reader); - //check whether we have an article set, an article, a book article or a book article set + // check whether we have an article set, an article, a book article or a book article set if (unmarshalledObject instanceof PubmedArticleSet) { PubmedArticleSet articleSet = (PubmedArticleSet) unmarshalledObject; for (Object article : articleSet.getPubmedArticleOrPubmedBookArticle()) { @@ -189,7 +189,7 @@ private Object unmarshallRoot(BufferedReader reader) throws JAXBException, XMLSt XMLInputFactory xmlInputFactory = XMLInputFactory.newFactory(); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(reader); - //go to the root element + // go to the root element while (!xmlStreamReader.isStartElement()) { xmlStreamReader.next(); } @@ -290,7 +290,7 @@ private void addBookInformation(Map fields, Book book) { } if (book.getAuthorList() != null) { List authorLists = book.getAuthorList(); - //authorLists size should be one + // authorLists size should be one if (authorLists.size() == 1) { for (AuthorList authorList : authorLists) { handleAuthors(fields, authorList); @@ -458,7 +458,7 @@ private void addInvestigators(Map fields, InvestigatorList invest } investigatorNames.add(name); - //now add the affiliation info + // now add the affiliation info if (investigator.getAffiliationInfo() != null) { for (AffiliationInfo info : investigator.getAffiliationInfo()) { for (Serializable affiliation : info.getAffiliation().getContent()) { @@ -476,7 +476,7 @@ private void addInvestigators(Map fields, InvestigatorList invest private void addKeyWords(Map fields, List allKeywordLists) { List keywordStrings = new ArrayList<>(); - //add keywords to the list + // add keywords to the list for (KeywordList keywordList : allKeywordLists) { for (Keyword keyword : keywordList.getKeyword()) { for (Serializable content : keyword.getContent()) { @@ -486,12 +486,12 @@ private void addKeyWords(Map fields, List allKeyword } } } - //Check whether MeshHeadingList exist or not + // Check whether MeshHeadingList exist or not if (fields.get(StandardField.KEYWORDS) == null) { fields.put(StandardField.KEYWORDS, join(keywordStrings, KEYWORD_SEPARATOR)); } else { if (keywordStrings.size() > 0) { - //if it exists, combine the MeshHeading with the keywords + // if it exists, combine the MeshHeading with the keywords String result = join(keywordStrings, "; "); result = fields.get(StandardField.KEYWORDS) + KEYWORD_SEPARATOR + result; fields.put(StandardField.KEYWORDS, result); @@ -509,7 +509,7 @@ private void addOtherId(Map fields, List otherID) { private void addPersonalNames(Map fields, PersonalNameSubjectList personalNameSubjectList) { if (fields.get(StandardField.AUTHOR) == null) { - //if no authors appear, then add the personal names as authors + // if no authors appear, then add the personal names as authors List personalNames = new ArrayList<>(); if (personalNameSubjectList.getPersonalNameSubject() != null) { List personalNameSubject = personalNameSubjectList.getPersonalNameSubject(); @@ -600,7 +600,7 @@ private void addElocationID(Map fields, ELocationID eLocationID) private void addPubDate(Map fields, PubDate pubDate) { if (pubDate.getYear() == null) { - //if year of the pubdate is null, the medlineDate shouldn't be null + // if year of the pubdate is null, the medlineDate shouldn't be null fields.put(StandardField.YEAR, extractYear(pubDate.getMedlineDate())); } else { fields.put(StandardField.YEAR, pubDate.getYear()); @@ -635,19 +635,19 @@ private void addPagination(Map fields, Pagination pagination) { if ("MedlinePgn".equals(element.getName().getLocalPart())) { putIfValueNotNull(fields, StandardField.PAGES, fixPageRange(element.getValue())); } else if ("StartPage".equals(element.getName().getLocalPart())) { - //it could happen, that the article has only a start page + // it could happen, that the article has only a start page startPage = element.getValue() + endPage; putIfValueNotNull(fields, StandardField.PAGES, startPage); } else if ("EndPage".equals(element.getName().getLocalPart())) { endPage = element.getValue(); - //but it should not happen, that a endpage appears without startpage + // but it should not happen, that a endpage appears without startpage fields.put(StandardField.PAGES, fixPageRange(startPage + "-" + endPage)); } } } private String extractYear(String medlineDate) { - //The year of the medlineDate should be the first 4 digits + // The year of the medlineDate should be the first 4 digits return medlineDate.substring(0, 4); } diff --git a/src/main/java/org/jabref/logic/importer/fileformat/MedlinePlainImporter.java b/src/main/java/org/jabref/logic/importer/fileformat/MedlinePlainImporter.java index 4e911b1e8b2d..1d6d49349e09 100644 --- a/src/main/java/org/jabref/logic/importer/fileformat/MedlinePlainImporter.java +++ b/src/main/java/org/jabref/logic/importer/fileformat/MedlinePlainImporter.java @@ -75,7 +75,7 @@ public boolean isRecognizedFormat(BufferedReader reader) throws IOException { public ParserResult importDatabase(BufferedReader reader) throws IOException { List bibitems = new ArrayList<>(); - //use optional here, so that no exception will be thrown if the file is empty + // use optional here, so that no exception will be thrown if the file is empty String linesAsString = reader.lines().reduce((line, nextline) -> line + "\n" + nextline).orElse(""); String[] entries = linesAsString.replace("\u2013", "-").replace("\u2014", "--").replace("\u2015", "--") @@ -146,7 +146,7 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException { } } - //store the fields in a map + // store the fields in a map Map hashMap = new HashMap<>(); hashMap.put("PG", StandardField.PAGES); hashMap.put("PL", StandardField.ADDRESS); @@ -172,7 +172,7 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException { hashMap.put("OTO", new UnknownField("termowner")); hashMap.put("OWN", InternalField.OWNER); - //add the fields to hm + // add the fields to hm for (Map.Entry mapEntry : hashMap.entrySet()) { String medlineKey = mapEntry.getKey(); Field bibtexKey = mapEntry.getValue(); @@ -256,9 +256,9 @@ private EntryType addSourceType(String value, EntryType type) { private void addStandardNumber(Map hm, String lab, String value) { if ("IS".equals(lab)) { Field key = StandardField.ISSN; - //it is possible to have two issn, one for electronic and for print - //if there are two then it comes at the end in brackets (electronic) or (print) - //so search for the brackets + // it is possible to have two issn, one for electronic and for print + // if there are two then it comes at the end in brackets (electronic) or (print) + // so search for the brackets if (value.indexOf('(') > 0) { int keyStart = value.indexOf('('); int keyEnd = value.indexOf(')'); @@ -342,10 +342,10 @@ private void addTitles(Map hm, String lab, String val, EntryType private void addAbstract(Map hm, String lab, String value) { String abstractValue = ""; if ("AB".equals(lab)) { - //adds copyright information that comes at the end of an abstract + // adds copyright information that comes at the end of an abstract if (value.contains("Copyright")) { int copyrightIndex = value.lastIndexOf("Copyright"); - //remove the copyright from the field since the name of the field is copyright + // remove the copyright from the field since the name of the field is copyright String copyrightInfo = value.substring(copyrightIndex).replaceAll("Copyright ", ""); hm.put(new UnknownField("copyright"), copyrightInfo); abstractValue = value.substring(0, copyrightIndex); diff --git a/src/main/java/org/jabref/logic/importer/fileformat/ModsImporter.java b/src/main/java/org/jabref/logic/importer/fileformat/ModsImporter.java index b234fdf53a2c..1055d692fba6 100644 --- a/src/main/java/org/jabref/logic/importer/fileformat/ModsImporter.java +++ b/src/main/java/org/jabref/logic/importer/fileformat/ModsImporter.java @@ -101,7 +101,7 @@ public ParserResult importDatabase(BufferedReader input) throws IOException { } Unmarshaller unmarshaller = context.createUnmarshaller(); - //The unmarshalled object is a jaxbElement. + // The unmarshalled object is a jaxbElement. JAXBElement unmarshalledObject = (JAXBElement) unmarshaller.unmarshal(input); Optional collection = getElement(unmarshalledObject.getValue(), @@ -150,7 +150,7 @@ private void parseModsGroup(Map fields, List modsGroup, B for (Object groupElement : modsGroup) { - //Get the element. Only one of the elements should be not an empty optional. + // Get the element. Only one of the elements should be not an empty optional. Optional abstractDefinition = getElement(groupElement, AbstractDefinition.class); Optional genreDefinition = getElement(groupElement, GenreDefinition.class); Optional languageDefinition = getElement(groupElement, LanguageDefinition.class); @@ -165,7 +165,7 @@ private void parseModsGroup(Map fields, List modsGroup, B Optional identifierDefinition = getElement(groupElement, IdentifierDefinition.class); Optional titleInfoDefinition = getElement(groupElement, TitleInfoDefinition.class); - //Now parse the information if the element is present + // Now parse the information if the element is present abstractDefinition .ifPresent(abstractDef -> putIfValueNotNull(fields, StandardField.ABSTRACT, abstractDef.getValue())); @@ -198,9 +198,9 @@ private void parseModsGroup(Map fields, List modsGroup, B } - //The element subject can appear more than one time, that's why the keywords has to be put out of the for loop + // The element subject can appear more than one time, that's why the keywords has to be put out of the for loop putIfListIsNotEmpty(fields, keywords, StandardField.KEYWORDS, this.keywordSeparator); - //same goes for authors and notes + // same goes for authors and notes putIfListIsNotEmpty(fields, authors, StandardField.AUTHOR, " and "); putIfListIsNotEmpty(fields, notes, StandardField.NOTE, ", "); @@ -224,7 +224,7 @@ private void parseIdentifier(Map fields, IdentifierDefinition ide if ("citekey".equals(type) && !entry.getCiteKeyOptional().isPresent()) { entry.setCiteKey(identifier.getValue()); } else if (!"local".equals(type) && !"citekey".equals(type)) { - //put all identifiers (doi, issn, isbn,...) except of local and citekey + // put all identifiers (doi, issn, isbn,...) except of local and citekey putIfValueNotNull(fields, FieldFactory.parseField(identifier.getType()), identifier.getValue()); } } @@ -319,10 +319,10 @@ private void parseRelatedModsGroup(Map fields, List relat List> numberOrCaptionOrTitle = detail .getNumberOrCaptionOrTitle(); - //In the for loop should only be the value of the element that belongs to the detail not be null + // In the for loop should only be the value of the element that belongs to the detail not be null for (JAXBElement jaxbElement : numberOrCaptionOrTitle) { StringPlusLanguage value = jaxbElement.getValue(); - //put details like volume, issue,... + // put details like volume, issue,... putIfValueNotNull(fields, FieldFactory.parseField(detail.getType()), value.getValue()); } } else if (object instanceof ExtentDefinition) { @@ -354,8 +354,8 @@ private void putPageInformation(ExtentDefinition extentDefinition, Map fields, String elementName, DateDefiniti switch (elementName) { case "dateIssued": - //The first 4 digits of dateIssued should be the year + // The first 4 digits of dateIssued should be the year fields.put(StandardField.YEAR, date.getValue().substring(0, 4)); break; case "dateCreated": - //If there was no year in date issued, then take the year from date created + // If there was no year in date issued, then take the year from date created fields.computeIfAbsent(StandardField.YEAR, k -> date.getValue().substring(0, 4)); fields.put(new UnknownField("created"), date.getValue()); break; @@ -436,13 +436,13 @@ private void handleAuthorsInNamePart(NameDefinition name, List authors, if ((type == null) && (namePart.getValue() != null)) { authors.add(namePart.getValue()); } else if ("family".equals(type) && (namePart.getValue() != null)) { - //family should come first, so if family appears we can set the author then comes before - //we have to check if forename and family name are not empty in case it's the first author + // family should come first, so if family appears we can set the author then comes before + // we have to check if forename and family name are not empty in case it's the first author if (!foreName.isEmpty() && !familyName.isEmpty()) { - //now set and add the old author + // now set and add the old author author = familyName + ", " + Joiner.on(" ").join(foreName); authors.add(author); - //remove old forenames + // remove old forenames foreName.clear(); } else if (foreName.isEmpty() && !familyName.isEmpty()) { authors.add(familyName); @@ -457,7 +457,7 @@ private void handleAuthorsInNamePart(NameDefinition name, List authors, } } - //last author is not added, so do it here + // last author is not added, so do it here if (!foreName.isEmpty() && !familyName.isEmpty()) { author = familyName + ", " + Joiner.on(" ").join(foreName); authors.add(author.trim()); diff --git a/src/main/java/org/jabref/logic/importer/fileformat/OvidImporter.java b/src/main/java/org/jabref/logic/importer/fileformat/OvidImporter.java index 791f40439a64..cb1034354bb1 100644 --- a/src/main/java/org/jabref/logic/importer/fileformat/OvidImporter.java +++ b/src/main/java/org/jabref/logic/importer/fileformat/OvidImporter.java @@ -230,7 +230,7 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException { */ private static String fixNames(String content) { String names; - if (content.indexOf(';') > 0) { //LN FN; [LN FN;]* + if (content.indexOf(';') > 0) { // LN FN; [LN FN;]* names = content.replaceAll("[^\\.A-Za-z,;\\- ]", "").replace(";", " and"); } else if (content.indexOf(" ") > 0) { String[] sNames = content.split(" "); diff --git a/src/main/java/org/jabref/logic/importer/fileformat/PdfContentImporter.java b/src/main/java/org/jabref/logic/importer/fileformat/PdfContentImporter.java index 79060c67918b..da85d2946ca7 100644 --- a/src/main/java/org/jabref/logic/importer/fileformat/PdfContentImporter.java +++ b/src/main/java/org/jabref/logic/importer/fileformat/PdfContentImporter.java @@ -232,7 +232,7 @@ public ParserResult importDatabase(Path filePath, Charset defaultEncoding) { return new ParserResult(result); } - //make this method package visible so we can test it + // make this method package visible so we can test it Optional getEntryFromPDFContent(String firstpageContents, String lineSeparator) { // idea: split[] contains the different lines @@ -248,7 +248,7 @@ Optional getEntryFromPDFContent(String firstpageContents, String lineS lines = firstpageContentsUnifiedLineBreaks.split(lineSeparator); - lineIndex = 0; //to prevent array index out of bounds exception on second run we need to reset i to zero + lineIndex = 0; // to prevent array index out of bounds exception on second run we need to reset i to zero proceedToNextNonEmptyLine(); if (lineIndex >= lines.length) { @@ -300,7 +300,7 @@ Optional getEntryFromPDFContent(String firstpageContents, String lineS fillCurStringWithNonEmptyLines(); title = streamlineTitle(curString); curString = ""; - //i points to the next non-empty line + // i points to the next non-empty line // after title: authors author = null; @@ -393,7 +393,7 @@ Optional getEntryFromPDFContent(String firstpageContents, String lineS int edslength = "(Eds.)".length(); int posWithEditor = pos + edslength + 2;//+2 because of ":" after (Eds.) and the subsequent space if (posWithEditor > curString.length()) { - curString = curString.substring(posWithEditor - 2); //we don't have any spaces after Eds so we substract the 2 + curString = curString.substring(posWithEditor - 2); // we don't have any spaces after Eds so we substract the 2 } else { curString = curString.substring(posWithEditor); } diff --git a/src/main/java/org/jabref/logic/importer/fileformat/PdfXmpImporter.java b/src/main/java/org/jabref/logic/importer/fileformat/PdfXmpImporter.java index 218e52d9260b..9aa1d53ca9f8 100644 --- a/src/main/java/org/jabref/logic/importer/fileformat/PdfXmpImporter.java +++ b/src/main/java/org/jabref/logic/importer/fileformat/PdfXmpImporter.java @@ -21,7 +21,6 @@ public class PdfXmpImporter extends Importer { private final XmpPreferences xmpPreferences; - public PdfXmpImporter(XmpPreferences xmpPreferences) { this.xmpPreferences = xmpPreferences; } diff --git a/src/main/java/org/jabref/logic/importer/fileformat/RisImporter.java b/src/main/java/org/jabref/logic/importer/fileformat/RisImporter.java index 5c941f75fcb0..11fbca9b23c2 100644 --- a/src/main/java/org/jabref/logic/importer/fileformat/RisImporter.java +++ b/src/main/java/org/jabref/logic/importer/fileformat/RisImporter.java @@ -58,13 +58,13 @@ public boolean isRecognizedFormat(BufferedReader reader) throws IOException { public ParserResult importDatabase(BufferedReader reader) throws IOException { List bibitems = new ArrayList<>(); - //use optional here, so that no exception will be thrown if the file is empty + // use optional here, so that no exception will be thrown if the file is empty String linesAsString = reader.lines().reduce((line, nextline) -> line + "\n" + nextline).orElse(""); String[] entries = linesAsString.replace("\u2013", "-").replace("\u2014", "--").replace("\u2015", "--") .split("ER -.*\\n"); - //stores all the date tags from highest to lowest priority + // stores all the date tags from highest to lowest priority List dateTags = Arrays.asList("Y1", "PY", "DA", "Y2"); for (String entry1 : entries) { @@ -141,10 +141,10 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException { } else if ("BT".equals(tag)) { fields.put(StandardField.BOOKTITLE, value); } else if (("T2".equals(tag) || "J2".equals(tag) || "JA".equals(tag)) && ((fields.get(StandardField.JOURNAL) == null) || "".equals(fields.get(StandardField.JOURNAL)))) { - //if there is no journal title, then put second title as journal title + // if there is no journal title, then put second title as journal title fields.put(StandardField.JOURNAL, value); } else if ("JO".equals(tag) || "J1".equals(tag) || "JF".equals(tag)) { - //if this field appears then this should be the journal title + // if this field appears then this should be the journal title fields.put(StandardField.JOURNAL, value); } else if ("T3".equals(tag)) { fields.put(StandardField.SERIES, value); @@ -211,12 +211,12 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException { try { Year.parse(year, formatter); - //if the year is parsebale we have found a higher priority date + // if the year is parsebale we have found a higher priority date dateTag = tag; dateValue = value; datePriority = tagPriority; } catch (DateTimeParseException ex) { - //We can't parse the year, we ignore it + // We can't parse the year, we ignore it } } } else if ("KW".equals(tag)) { diff --git a/src/main/java/org/jabref/logic/importer/util/GrobidService.java b/src/main/java/org/jabref/logic/importer/util/GrobidService.java index e7dc450724eb..48e0316a7dbd 100644 --- a/src/main/java/org/jabref/logic/importer/util/GrobidService.java +++ b/src/main/java/org/jabref/logic/importer/util/GrobidService.java @@ -51,7 +51,7 @@ public String processCitation(String rawCitation, ConsolidateCitations consolida urlDownload.setPostData("citations=" + rawCitation + "&consolidateCitations=" + consolidateCitations); String httpResponse = urlDownload.asString(); - if (httpResponse == null || httpResponse.equals("@misc{-1,\n\n}\n")) { //This filters empty BibTeX entries + if (httpResponse == null || httpResponse.equals("@misc{-1,\n\n}\n")) { // This filters empty BibTeX entries throw new IOException("The GROBID server response does not contain anything."); } diff --git a/src/main/java/org/jabref/logic/importer/util/INSPIREBibtexFilterReader.java b/src/main/java/org/jabref/logic/importer/util/INSPIREBibtexFilterReader.java index 580eb8e82d31..83f49759bd0b 100644 --- a/src/main/java/org/jabref/logic/importer/util/INSPIREBibtexFilterReader.java +++ b/src/main/java/org/jabref/logic/importer/util/INSPIREBibtexFilterReader.java @@ -25,7 +25,6 @@ public class INSPIREBibtexFilterReader extends FilterReader { private boolean pre; - public INSPIREBibtexFilterReader(final Reader initialReader) { super(initialReader); inReader = new BufferedReader(initialReader); diff --git a/src/main/java/org/jabref/logic/integrity/BracesCorrector.java b/src/main/java/org/jabref/logic/integrity/BracesCorrector.java index 75d59fb5bee3..5535fdf3ebc3 100644 --- a/src/main/java/org/jabref/logic/integrity/BracesCorrector.java +++ b/src/main/java/org/jabref/logic/integrity/BracesCorrector.java @@ -6,7 +6,6 @@ public class BracesCorrector { private static final Pattern PATTERN_ESCAPED_CURLY_BRACES = Pattern.compile("(\\\\\\{)|(\\\\\\})"); - //private static final Pattern PATTERN_ESCAPED_CLOSING_CURLY_BRACE = Pattern.compile(""); public static String apply(String input) { if (input == null) { diff --git a/src/main/java/org/jabref/logic/integrity/EntryLinkChecker.java b/src/main/java/org/jabref/logic/integrity/EntryLinkChecker.java index 3a7cafd54222..a1197beb7cb8 100644 --- a/src/main/java/org/jabref/logic/integrity/EntryLinkChecker.java +++ b/src/main/java/org/jabref/logic/integrity/EntryLinkChecker.java @@ -18,7 +18,6 @@ public class EntryLinkChecker implements Checker { private final BibDatabase database; - public EntryLinkChecker(BibDatabase database) { this.database = Objects.requireNonNull(database); } diff --git a/src/main/java/org/jabref/logic/integrity/HowPublishedChecker.java b/src/main/java/org/jabref/logic/integrity/HowPublishedChecker.java index 1406e3641a51..75e358732fa1 100644 --- a/src/main/java/org/jabref/logic/integrity/HowPublishedChecker.java +++ b/src/main/java/org/jabref/logic/integrity/HowPublishedChecker.java @@ -15,7 +15,6 @@ public class HowPublishedChecker implements ValueChecker { private final BibDatabaseContext databaseContext; - public HowPublishedChecker(BibDatabaseContext databaseContext) { this.databaseContext = Objects.requireNonNull(databaseContext); } @@ -32,7 +31,7 @@ public Optional checkValue(String value) { return Optional.empty(); } - //BibTeX + // BibTeX if (!databaseContext.isBiblatexMode() && !FIRST_LETTER_CAPITALIZED.test(value.trim())) { return Optional.of(Localization.lang("should have the first letter capitalized")); } diff --git a/src/main/java/org/jabref/logic/integrity/MonthChecker.java b/src/main/java/org/jabref/logic/integrity/MonthChecker.java index 402fbf65f660..d0140ee38034 100644 --- a/src/main/java/org/jabref/logic/integrity/MonthChecker.java +++ b/src/main/java/org/jabref/logic/integrity/MonthChecker.java @@ -19,7 +19,6 @@ public class MonthChecker implements ValueChecker { private final BibDatabaseContext bibDatabaseContextMonth; - public MonthChecker(BibDatabaseContext bibDatabaseContext) { this.bibDatabaseContextMonth = Objects.requireNonNull(bibDatabaseContext); } @@ -38,13 +37,13 @@ public Optional checkValue(String value) { return Optional.empty(); } - //biblatex + // biblatex if (bibDatabaseContextMonth.isBiblatexMode() && !(ONLY_AN_INTEGER.test(value.trim()) || MONTH_NORMALIZED.test(value.trim()))) { return Optional.of(Localization.lang("should be an integer or normalized")); } - //BibTeX + // BibTeX if (!bibDatabaseContextMonth.isBiblatexMode() && !MONTH_NORMALIZED.test(value.trim())) { return Optional.of(Localization.lang("should be normalized")); } diff --git a/src/main/java/org/jabref/logic/integrity/NoteChecker.java b/src/main/java/org/jabref/logic/integrity/NoteChecker.java index e6cdc6e6ba3c..db80442d1e96 100644 --- a/src/main/java/org/jabref/logic/integrity/NoteChecker.java +++ b/src/main/java/org/jabref/logic/integrity/NoteChecker.java @@ -15,7 +15,6 @@ public class NoteChecker implements ValueChecker { private final BibDatabaseContext bibDatabaseContextEdition; - public NoteChecker(BibDatabaseContext bibDatabaseContext) { this.bibDatabaseContextEdition = Objects.requireNonNull(bibDatabaseContext); } @@ -32,7 +31,7 @@ public Optional checkValue(String value) { return Optional.empty(); } - //BibTeX + // BibTeX if (!bibDatabaseContextEdition.isBiblatexMode() && !FIRST_LETTER_CAPITALIZED.test(value.trim())) { return Optional.of(Localization.lang("should have the first letter capitalized")); } diff --git a/src/main/java/org/jabref/logic/l10n/Language.java b/src/main/java/org/jabref/logic/l10n/Language.java index 45c565714a3f..b0b598a4b808 100644 --- a/src/main/java/org/jabref/logic/l10n/Language.java +++ b/src/main/java/org/jabref/logic/l10n/Language.java @@ -21,7 +21,7 @@ public enum Language { DUTCH("Nederlands", "nl"), NORWEGIAN("Norsk", "no"), PERSIAN("Persian (فارسی)", "fa"), - PORTUGUESE("Português","pt"), + PORTUGUESE("Português", "pt"), RUSSIAN("Russian", "ru"), SIMPLIFIED_CHINESE("Simplified Chinese", "zh"), SVENSKA("Svenska", "sv"), @@ -42,7 +42,7 @@ public enum Language { public static Optional convertToSupportedLocale(Language language) { Objects.requireNonNull(language); - //Very important to split languages like pt_BR into two parts, because otherwise the country would be treated lowercase and create problems in loading + // Very important to split languages like pt_BR into two parts, because otherwise the country would be treated lowercase and create problems in loading String[] languageParts = language.getId().split("_"); Locale locale; if (languageParts.length == 1) { diff --git a/src/main/java/org/jabref/logic/layout/AbstractParamLayoutFormatter.java b/src/main/java/org/jabref/logic/layout/AbstractParamLayoutFormatter.java index 1a40052b4f19..44e67a312f75 100644 --- a/src/main/java/org/jabref/logic/layout/AbstractParamLayoutFormatter.java +++ b/src/main/java/org/jabref/logic/layout/AbstractParamLayoutFormatter.java @@ -11,7 +11,6 @@ public abstract class AbstractParamLayoutFormatter implements ParamLayoutFormatt private static final char SEPARATOR = ','; - protected AbstractParamLayoutFormatter() { } diff --git a/src/main/java/org/jabref/logic/layout/LayoutHelper.java b/src/main/java/org/jabref/logic/layout/LayoutHelper.java index dde7ad47e247..ccdd63854358 100644 --- a/src/main/java/org/jabref/logic/layout/LayoutHelper.java +++ b/src/main/java/org/jabref/logic/layout/LayoutHelper.java @@ -37,7 +37,6 @@ public class LayoutHelper { private final LayoutFormatterPreferences prefs; private boolean endOfFile; - public LayoutHelper(Reader in, LayoutFormatterPreferences prefs) { this.in = new PushbackReader(Objects.requireNonNull(in)); this.prefs = Objects.requireNonNull(prefs); @@ -178,10 +177,9 @@ private void doBracketedOptionField() throws IOException { // changed section begin - arudert // keep the backslash so we know wether this is a fieldname or an ordinary parameter - //if (c != '\\') - //{ + // if (c != '\\') { buffer.append((char) c); - //} + // } // changed section end - arudert } diff --git a/src/main/java/org/jabref/logic/layout/format/AuthorAndsCommaReplacer.java b/src/main/java/org/jabref/logic/layout/format/AuthorAndsCommaReplacer.java index 110315b28954..f2ff504b7aa2 100644 --- a/src/main/java/org/jabref/logic/layout/format/AuthorAndsCommaReplacer.java +++ b/src/main/java/org/jabref/logic/layout/format/AuthorAndsCommaReplacer.java @@ -8,9 +8,6 @@ */ public class AuthorAndsCommaReplacer implements LayoutFormatter { - /* (non-Javadoc) - * @see org.jabref.export.layout.LayoutFormatter#format(java.lang.String) - */ @Override public String format(String fieldText) { @@ -19,7 +16,7 @@ public String format(String fieldText) { switch (authors.length) { case 1: - //Does nothing; + // Does nothing s = authors[0]; break; case 2: diff --git a/src/main/java/org/jabref/logic/layout/format/AuthorAndsReplacer.java b/src/main/java/org/jabref/logic/layout/format/AuthorAndsReplacer.java index 52531b47466a..a2826c7798ec 100644 --- a/src/main/java/org/jabref/logic/layout/format/AuthorAndsReplacer.java +++ b/src/main/java/org/jabref/logic/layout/format/AuthorAndsReplacer.java @@ -18,7 +18,7 @@ public String format(String fieldText) { return null; } String[] authors = fieldText.split(" and "); - //CHECKSTYLE:OFF + // CHECKSTYLE:OFF String s = switch (authors.length) { case 1 -> authors[0]; // just no action case 2 -> authors[0] + " & " + authors[1]; @@ -33,7 +33,7 @@ public String format(String fieldText) { yield sb.toString(); } }; - //CHECKSTYLE:ON + // CHECKSTYLE:ON return s; diff --git a/src/main/java/org/jabref/logic/layout/format/AuthorLastFirstOxfordCommas.java b/src/main/java/org/jabref/logic/layout/format/AuthorLastFirstOxfordCommas.java index 477dda339429..afd96ff63d48 100644 --- a/src/main/java/org/jabref/logic/layout/format/AuthorLastFirstOxfordCommas.java +++ b/src/main/java/org/jabref/logic/layout/format/AuthorLastFirstOxfordCommas.java @@ -8,8 +8,9 @@ *
  • Names are given in order: von last, jr, first.
  • *
  • First names will NOT be abbreviated.
  • *
  • Individual authors are separated by commas.
  • - *
  • The 'and' of a list of three or more authors is preceeded by a comma - * (Oxford comma)
  • + *
  • The 'and' of a list of three or more authors is preceded by a comma + * (Oxford comma) + * */ public class AuthorLastFirstOxfordCommas implements LayoutFormatter { diff --git a/src/main/java/org/jabref/logic/layout/format/Authors.java b/src/main/java/org/jabref/logic/layout/format/Authors.java index b1514623c87a..92ff6c6e8a29 100644 --- a/src/main/java/org/jabref/logic/layout/format/Authors.java +++ b/src/main/java/org/jabref/logic/layout/format/Authors.java @@ -155,11 +155,10 @@ private void handleArgument(String key, String value) { abbrDots = false; lastFirstSeparator = ", "; } - } + } else if (Authors.SEPARATORS.contains(key.trim().toLowerCase(Locale.ROOT)) || Authors.LAST_SEPARATORS.contains(key.trim().toLowerCase(Locale.ROOT))) { + // AuthorSep = [Comma | And | Colon | Semicolon | sep=] + // AuthorLastSep = [And | Comma | Colon | Semicolon | Amp | Oxford | lastsep=] - // AuthorSep = [Comma | And | Colon | Semicolon | sep=] - // AuthorLastSep = [And | Comma | Colon | Semicolon | Amp | Oxford | lastsep=] - else if (Authors.SEPARATORS.contains(key.trim().toLowerCase(Locale.ROOT)) || Authors.LAST_SEPARATORS.contains(key.trim().toLowerCase(Locale.ROOT))) { if (comp(key, "Comma")) { if (setSep) { lastSeparator = Authors.COMMA; @@ -275,8 +274,6 @@ private void addSingleName(StringBuilder sb, Author a, boolean firstFirst) { String abbr = firstNameResult; firstNameResult = a.getFirst().get(); int index = firstNameResult.indexOf(' '); - //System.out.println(firstNamePart); - //System.out.println(index); if (index >= 0) { firstNameResult = firstNameResult.substring(0, index + 1); if (abbr.length() > 3) { diff --git a/src/main/java/org/jabref/logic/layout/format/CompositeFormat.java b/src/main/java/org/jabref/logic/layout/format/CompositeFormat.java index 4f683dfa7408..5126872663bd 100644 --- a/src/main/java/org/jabref/logic/layout/format/CompositeFormat.java +++ b/src/main/java/org/jabref/logic/layout/format/CompositeFormat.java @@ -9,13 +9,11 @@ /** * A layout formatter that is the composite of the given Formatters executed in * order. - * */ public class CompositeFormat implements LayoutFormatter { private final List formatters; - /** * If called with this constructor, this formatter does nothing. */ diff --git a/src/main/java/org/jabref/logic/layout/format/CreateDocBook4Editors.java b/src/main/java/org/jabref/logic/layout/format/CreateDocBook4Editors.java index 86830860e580..26803d4904fc 100644 --- a/src/main/java/org/jabref/logic/layout/format/CreateDocBook4Editors.java +++ b/src/main/java/org/jabref/logic/layout/format/CreateDocBook4Editors.java @@ -11,7 +11,7 @@ public class CreateDocBook4Editors implements LayoutFormatter { @Override public String format(String fieldText) { - // L.Xue + // L.Xue StringBuilder sb = new StringBuilder(100); AuthorList al = AuthorList.parse(fieldText); DocBookAuthorFormatter formatter = new DocBookAuthorFormatter(); diff --git a/src/main/java/org/jabref/logic/layout/format/CreateDocBook5Editors.java b/src/main/java/org/jabref/logic/layout/format/CreateDocBook5Editors.java index 79df2cff342d..c98e256d733a 100644 --- a/src/main/java/org/jabref/logic/layout/format/CreateDocBook5Editors.java +++ b/src/main/java/org/jabref/logic/layout/format/CreateDocBook5Editors.java @@ -11,7 +11,7 @@ public class CreateDocBook5Editors implements LayoutFormatter { @Override public String format(String fieldText) { - // L.Xue + // L.Xue StringBuilder sb = new StringBuilder(100); AuthorList al = AuthorList.parse(fieldText); DocBookAuthorFormatter formatter = new DocBookAuthorFormatter(); diff --git a/src/main/java/org/jabref/logic/layout/format/HTMLChars.java b/src/main/java/org/jabref/logic/layout/format/HTMLChars.java index 5961d5c7f761..fb2eeb3cfbb6 100644 --- a/src/main/java/org/jabref/logic/layout/format/HTMLChars.java +++ b/src/main/java/org/jabref/logic/layout/format/HTMLChars.java @@ -81,7 +81,7 @@ public String format(String inField) { incommand = false; escaped = false; } else { - // Are we already at the end of the string? + // Are we already at the end of the string? if ((i + 1) == field.length()) { String command = currentCommand.toString(); String result = HTML_CHARS.get(command); diff --git a/src/main/java/org/jabref/logic/layout/format/Iso690FormatDate.java b/src/main/java/org/jabref/logic/layout/format/Iso690FormatDate.java index b00b69bdb728..cf1f05ddae2b 100644 --- a/src/main/java/org/jabref/logic/layout/format/Iso690FormatDate.java +++ b/src/main/java/org/jabref/logic/layout/format/Iso690FormatDate.java @@ -1,28 +1,28 @@ package org.jabref.logic.layout.format; import org.jabref.logic.layout.LayoutFormatter; +import org.jabref.model.strings.StringUtil; public class Iso690FormatDate implements LayoutFormatter { @Override public String format(String s) { - - if (s == null || s.trim().isEmpty()) { + if (StringUtil.isBlank(s)) { return ""; } StringBuilder sb = new StringBuilder(); String[] date = s.split("de"); - //parte el string en los distintos campos de la fecha - if (date.length == 1) { //sólo pone el año + // parte el string en los distintos campos de la fecha + if (date.length == 1) { // sólo pone el año sb.append(date[0].trim()); - } else if (date.length == 2) { //primer campo mes, segundo campo año - //cambiamos al formato año - mes + } else if (date.length == 2) { // primer campo mes, segundo campo año + // cambiamos al formato año - mes sb.append(date[1].trim()).append('-').append(date[0].trim()); } else if (date.length == 3) { - //primer campo día, segundo campo mes y tercer campo año + // primer campo día, segundo campo mes y tercer campo año // cambiamos al formato año-mes-día sb.append(date[2].trim()).append('-').append(date[1].trim()).append('-').append(date[0].trim()); } - return sb.toString();//retorna el string creado con la fecha. + return sb.toString(); // retorna el string creado con la fecha. } } diff --git a/src/main/java/org/jabref/logic/layout/format/Iso690NamesAuthors.java b/src/main/java/org/jabref/logic/layout/format/Iso690NamesAuthors.java index 248f46eeded9..99fb842f052a 100644 --- a/src/main/java/org/jabref/logic/layout/format/Iso690NamesAuthors.java +++ b/src/main/java/org/jabref/logic/layout/format/Iso690NamesAuthors.java @@ -3,29 +3,29 @@ import java.util.Locale; import org.jabref.logic.layout.LayoutFormatter; +import org.jabref.model.strings.StringUtil; public class Iso690NamesAuthors implements LayoutFormatter { @Override public String format(String s) { - - if (s == null || s.trim().isEmpty()) { + if (StringUtil.isBlank(s)) { return ""; } StringBuilder sb = new StringBuilder(); String[] authors = s.split("and"); - //parte el string en los distintos autores + // parte el string en los distintos autores for (int i = 0; i < authors.length; i++) { - //parte el string author en varios campos, según el separador "," + // parte el string author en varios campos, según el separador "," String[] author = authors[i].split(","); // No separa apellidos y nombre con coma (,) if (author.length < 2) { // Caso 1: Nombre Apellidos - //parte el string author en varios campos, según el separador " " + // parte el string author en varios campos, según el separador " " author = authors[i].split(" "); - //declaramos y damos un valor para evitar problemas + // declaramos y damos un valor para evitar problemas String name; String surname; @@ -33,34 +33,34 @@ public String format(String s) { sb.append(author[0].trim().toUpperCase(Locale.ROOT)); } else if (author.length == 2) { // Caso 1.1: Nombre Apellido - //primer campo Nombre + // primer campo Nombre name = author[0].trim(); - //Segundo campo Apellido + // Segundo campo Apellido surname = author[1].trim().toUpperCase(Locale.ROOT); - //añadimos los campos modificados al string final + // añadimos los campos modificados al string final sb.append(surname); sb.append(", "); sb.append(name); } else if (author.length == 3) { // Caso 1.2: Nombre Apellido1 Apellido2 - //primer campo Nombre + // primer campo Nombre name = author[0].trim(); - //Segundo y tercer campo Apellido1 Apellido2 + // Segundo y tercer campo Apellido1 Apellido2 surname = author[1].trim().toUpperCase(Locale.ROOT) + ' ' + author[2].trim().toUpperCase(Locale.ROOT); - //añadimos los campos modificados al string final + // añadimos los campos modificados al string final sb.append(surname); sb.append(", "); sb.append(name); } else if (author.length == 4) { // Caso 1.3: Nombre SegundoNombre Apellido1 Apellido2 - //primer y segundo campo Nombre SegundoNombre + // primer y segundo campo Nombre SegundoNombre name = author[0].trim() + ' ' + author[1].trim(); - //tercer y cuarto campo Apellido1 Apellido2 + // tercer y cuarto campo Apellido1 Apellido2 surname = author[2].trim().toUpperCase(Locale.ROOT) + ' ' + author[3].trim().toUpperCase(Locale.ROOT); - //añadimos los campos modificados al string final + // añadimos los campos modificados al string final sb.append(surname); sb.append(", "); sb.append(name); @@ -71,17 +71,17 @@ public String format(String s) { String surname = author[0].trim().toUpperCase(Locale.ROOT); // campo 2 nombre String name = author[1].trim(); - //añadimos los campos modificados al string final + // añadimos los campos modificados al string final sb.append(surname); sb.append(", "); sb.append(name); } - if (i < authors.length - 2) { //si hay mas de 2 autores, lo separamos por ", " + if (i < authors.length - 2) { // si hay mas de 2 autores, lo separamos por ", " sb.append(", "); } else if (i == authors.length - 2) { // si hay 2 autores, lo separamos por " y " sb.append(" y "); } } - return sb.toString();//retorna el string creado de autores. + return sb.toString(); // retorna el string creado de autores. } } diff --git a/src/main/java/org/jabref/logic/layout/format/NameFormatter.java b/src/main/java/org/jabref/logic/layout/format/NameFormatter.java index e8830ad1c5b6..f2a09d8ddceb 100644 --- a/src/main/java/org/jabref/logic/layout/format/NameFormatter.java +++ b/src/main/java/org/jabref/logic/layout/format/NameFormatter.java @@ -43,7 +43,7 @@ * * 2..-1 will affect Mary, Bruce and Arthur * - * The uses the Bibtex formatter format: + * The <format> uses the Bibtex formatter format: * * The four letter v, f, l, j indicate the name parts von, first, last, jr which * are used within curly braces. A single letter v, f, l, j indicates that the name should be abbreviated. diff --git a/src/main/java/org/jabref/logic/layout/format/NameFormatterPreferences.java b/src/main/java/org/jabref/logic/layout/format/NameFormatterPreferences.java index ef509030effb..922bc12b2e05 100644 --- a/src/main/java/org/jabref/logic/layout/format/NameFormatterPreferences.java +++ b/src/main/java/org/jabref/logic/layout/format/NameFormatterPreferences.java @@ -7,7 +7,6 @@ public class NameFormatterPreferences { private final List nameFormatterKey; private final List nameFormatterValue; - public NameFormatterPreferences(List nameFormatterKey, List nameFormatterValue) { this.nameFormatterKey = nameFormatterKey; this.nameFormatterValue = nameFormatterValue; diff --git a/src/main/java/org/jabref/logic/layout/format/Ordinal.java b/src/main/java/org/jabref/logic/layout/format/Ordinal.java index 85290643e794..645dcae42368 100644 --- a/src/main/java/org/jabref/logic/layout/format/Ordinal.java +++ b/src/main/java/org/jabref/logic/layout/format/Ordinal.java @@ -23,14 +23,14 @@ public String format(String fieldText) { while (m.find()) { String result = m.group(1); int value = Integer.parseInt(result); - //CHECKSTYLE:OFF + // CHECKSTYLE:OFF String ordinalString = switch (value) { case 1 -> "st"; case 2 -> "nd"; case 3 -> "rd"; default -> "th"; }; - //CHECKSTYLE:ON + // CHECKSTYLE:ON m.appendReplacement(sb, result + ordinalString); } m.appendTail(sb); diff --git a/src/main/java/org/jabref/logic/layout/format/WrapFileLinks.java b/src/main/java/org/jabref/logic/layout/format/WrapFileLinks.java index 1c9cba82a1ce..ee192cb871d7 100644 --- a/src/main/java/org/jabref/logic/layout/format/WrapFileLinks.java +++ b/src/main/java/org/jabref/logic/layout/format/WrapFileLinks.java @@ -219,7 +219,7 @@ public String format(String field) { * * https://sourceforge.net/tracker/index.php?func=detail&aid=1469903&group_id=92314&atid=600306 */ - sb.append(replaceStrings(flEntry.getLink()));//f.toURI().toString(); + sb.append(replaceStrings(flEntry.getLink()));// f.toURI().toString(); break; case FILE_EXTENSION: diff --git a/src/main/java/org/jabref/logic/msbib/MSBibConverter.java b/src/main/java/org/jabref/logic/msbib/MSBibConverter.java index de99ce6d9198..e883908ae685 100644 --- a/src/main/java/org/jabref/logic/msbib/MSBibConverter.java +++ b/src/main/java/org/jabref/logic/msbib/MSBibConverter.java @@ -69,7 +69,7 @@ public static MSBibEntry convert(BibEntry entry) { result.journalName = entry.getFieldOrAliasLatexFree(StandardField.JOURNAL).orElse(null); // Value must be converted - //Currently only english is supported + // Currently only english is supported entry.getLatexFreeField(StandardField.LANGUAGE) .ifPresent(lang -> result.fields.put("LCID", String.valueOf(MSBibMapping.getLCID(lang)))); StringBuilder sbNumber = new StringBuilder(); @@ -120,12 +120,12 @@ public static MSBibEntry convert(BibEntry entry) { private static List getAuthors(BibEntry entry, String authors, Field field) { List result = new ArrayList<>(); boolean corporate = false; - //Only one corporate author is supported - //We have the possible rare case that are multiple authors which start and end with latex , this is currently not considered + // Only one corporate author is supported + // We have the possible rare case that are multiple authors which start and end with latex , this is currently not considered if (authors.startsWith("{") && authors.endsWith("}")) { corporate = true; } - //FIXME: #4152 This is an ugly hack because the latex2unicode formatter kills of all curly braces, so no more corporate author parsing possible + // FIXME: #4152 This is an ugly hack because the latex2unicode formatter kills of all curly braces, so no more corporate author parsing possible String authorLatexFree = entry.getLatexFreeField(field).orElse(""); if (corporate) { authorLatexFree = "{" + authorLatexFree + "}"; diff --git a/src/main/java/org/jabref/logic/msbib/MSBibDatabase.java b/src/main/java/org/jabref/logic/msbib/MSBibDatabase.java index b62bd47c24f2..94defb646e3b 100644 --- a/src/main/java/org/jabref/logic/msbib/MSBibDatabase.java +++ b/src/main/java/org/jabref/logic/msbib/MSBibDatabase.java @@ -38,7 +38,6 @@ public class MSBibDatabase { private Set entries; - /** * Creates a {@link MSBibDatabase} for import */ diff --git a/src/main/java/org/jabref/logic/msbib/MSBibEntry.java b/src/main/java/org/jabref/logic/msbib/MSBibEntry.java index d1ed681af581..80a814c67617 100644 --- a/src/main/java/org/jabref/logic/msbib/MSBibEntry.java +++ b/src/main/java/org/jabref/logic/msbib/MSBibEntry.java @@ -78,7 +78,7 @@ class MSBibEntry { private final Pattern ADDRESS_PATTERN = Pattern.compile("\\b(\\w+)\\s?[,]?\\s?(\\w*)\\s?[,]?\\s?(\\w*)\\b"); public MSBibEntry() { - //empty + // empty } /** @@ -304,7 +304,7 @@ private void addField(Document document, Element parent, String name, String val parent.appendChild(elem); } - //Add authors for export + // Add authors for export private void addAuthor(Document document, Element allAuthors, String entryName, List authorsLst) { if (authorsLst == null) { return; diff --git a/src/main/java/org/jabref/logic/openoffice/OOBibStyle.java b/src/main/java/org/jabref/logic/openoffice/OOBibStyle.java index 0205c9113b3a..5c9e02cb1de0 100644 --- a/src/main/java/org/jabref/logic/openoffice/OOBibStyle.java +++ b/src/main/java/org/jabref/logic/openoffice/OOBibStyle.java @@ -134,6 +134,7 @@ public OOBibStyle(File styleFile, LayoutFormatterPreferences prefs, fromResource = false; path = styleFile.getPath(); } + public OOBibStyle(String resourcePath, LayoutFormatterPreferences prefs) throws IOException { this.prefs = Objects.requireNonNull(prefs); Objects.requireNonNull(resourcePath); diff --git a/src/main/java/org/jabref/logic/openoffice/OOPreFormatter.java b/src/main/java/org/jabref/logic/openoffice/OOPreFormatter.java index 61127acb12d7..92c88e7ca4dc 100644 --- a/src/main/java/org/jabref/logic/openoffice/OOPreFormatter.java +++ b/src/main/java/org/jabref/logic/openoffice/OOPreFormatter.java @@ -45,7 +45,7 @@ public String format(String field) { incommand = true; currentCommand = new StringBuilder(); } else if (!incommand && ((c == '{') || (c == '}'))) { - //Swallow braces, necessary for replacing encoded characters + // Swallow braces, necessary for replacing encoded characters } else if (Character.isLetter(c) || (c == '%') || StringUtil.SPECIAL_COMMAND_CHARS.contains(String.valueOf(c))) { @@ -83,7 +83,7 @@ public String format(String field) { incommand = false; escaped = false; } else { - // Are we already at the end of the string? + // Are we already at the end of the string? if ((i + 1) == finalResult.length()) { String command = currentCommand.toString(); String result = OOPreFormatter.CHARS.get(command); @@ -134,11 +134,10 @@ public String format(String field) { sb.append(Objects.requireNonNullElse(result, command)); sb.append(' '); } - } /* else if (c == '}') { - System.out.printf("com term by }: '%s'\n", currentCommand.toString()); - - argument = ""; - }*/ else { + } else if (c == '}') { + // System.out.printf("com term by }: '%s'\n", currentCommand.toString()); + // argument = ""; + } else { /* * TODO: this point is reached, apparently, if a command is * terminated in a strange way, such as with "$\omega$". diff --git a/src/main/java/org/jabref/logic/openoffice/OOUtil.java b/src/main/java/org/jabref/logic/openoffice/OOUtil.java index d3798b943a78..d45e0d3b3214 100644 --- a/src/main/java/org/jabref/logic/openoffice/OOUtil.java +++ b/src/main/java/org/jabref/logic/openoffice/OOUtil.java @@ -210,7 +210,7 @@ public static void insertTextAtCurrentLocation(XText text, XTextCursor cursor, S if (formatting.contains(Formatting.SMALLCAPS)) { xCursorProps.setPropertyValue(CHAR_CASE_MAP, com.sun.star.style.CaseMap.SMALLCAPS); - } else { + } else { xCursorProps.setPropertyValue(CHAR_CASE_MAP, com.sun.star.style.CaseMap.NONE); } diff --git a/src/main/java/org/jabref/logic/openoffice/StyleLoader.java b/src/main/java/org/jabref/logic/openoffice/StyleLoader.java index b6e367a38f61..687a83a6c9b4 100644 --- a/src/main/java/org/jabref/logic/openoffice/StyleLoader.java +++ b/src/main/java/org/jabref/logic/openoffice/StyleLoader.java @@ -83,7 +83,7 @@ private void loadExternalStyles() { for (String filename : lists) { try { OOBibStyle style = new OOBibStyle(new File(filename), layoutFormatterPreferences, encoding); - if (style.isValid()) { //Problem! + if (style.isValid()) { // Problem! externalStyles.add(style); } else { LOGGER.error(String.format("Style with filename %s is invalid", filename)); diff --git a/src/main/java/org/jabref/logic/openoffice/UndefinedBibtexEntry.java b/src/main/java/org/jabref/logic/openoffice/UndefinedBibtexEntry.java index 99ec460594ca..c112e274bbd2 100644 --- a/src/main/java/org/jabref/logic/openoffice/UndefinedBibtexEntry.java +++ b/src/main/java/org/jabref/logic/openoffice/UndefinedBibtexEntry.java @@ -11,7 +11,6 @@ public class UndefinedBibtexEntry extends BibEntry { private final String key; - public UndefinedBibtexEntry(String key) { this.key = key; setField(StandardField.AUTHOR, OOBibStyle.UNDEFINED_CITATION_MARKER); diff --git a/src/main/java/org/jabref/logic/openoffice/UndefinedParagraphFormatException.java b/src/main/java/org/jabref/logic/openoffice/UndefinedParagraphFormatException.java index 5f640d162719..99f0212d4a22 100644 --- a/src/main/java/org/jabref/logic/openoffice/UndefinedParagraphFormatException.java +++ b/src/main/java/org/jabref/logic/openoffice/UndefinedParagraphFormatException.java @@ -8,7 +8,6 @@ public class UndefinedParagraphFormatException extends Exception { private final String formatName; - public UndefinedParagraphFormatException(String formatName) { super(); this.formatName = formatName; diff --git a/src/main/java/org/jabref/logic/pdf/EntryAnnotationImporter.java b/src/main/java/org/jabref/logic/pdf/EntryAnnotationImporter.java index 0906d7ed2cfe..731e7063864c 100644 --- a/src/main/java/org/jabref/logic/pdf/EntryAnnotationImporter.java +++ b/src/main/java/org/jabref/logic/pdf/EntryAnnotationImporter.java @@ -47,7 +47,7 @@ public Map> importAnnotationsFromFiles(BibDatabaseCon Map> annotations = new HashMap<>(); AnnotationImporter importer = new PdfAnnotationImporter(); - //import annotationsOfFiles if the selected files are valid which is checked in getFilteredFileList() + // import annotationsOfFiles if the selected files are valid which is checked in getFilteredFileList() for (LinkedFile linkedFile : this.getFilteredFileList()) { linkedFile.findIn(databaseContext, filePreferences) .ifPresent(file -> annotations.put(file, importer.importAnnotations(file))); diff --git a/src/main/java/org/jabref/logic/pdf/FileAnnotationCache.java b/src/main/java/org/jabref/logic/pdf/FileAnnotationCache.java index 22a2e7cb872e..86a3c29b53f5 100644 --- a/src/main/java/org/jabref/logic/pdf/FileAnnotationCache.java +++ b/src/main/java/org/jabref/logic/pdf/FileAnnotationCache.java @@ -18,10 +18,10 @@ public class FileAnnotationCache { private static final Logger LOGGER = LoggerFactory.getLogger(FileAnnotation.class); - //cache size in entries + // cache size in entries private final static int CACHE_SIZE = 10; - //the inner list holds the annotations per file, the outer collection maps this to a BibEntry. + // the inner list holds the annotations per file, the outer collection maps this to a BibEntry. private LoadingCache>> annotationCache; /** diff --git a/src/main/java/org/jabref/logic/pdf/PdfAnnotationImporter.java b/src/main/java/org/jabref/logic/pdf/PdfAnnotationImporter.java index 207bc2d31dd7..eef7c2a55a21 100644 --- a/src/main/java/org/jabref/logic/pdf/PdfAnnotationImporter.java +++ b/src/main/java/org/jabref/logic/pdf/PdfAnnotationImporter.java @@ -99,7 +99,7 @@ private FileAnnotation createMarkedAnnotations(int pageIndex, PDPage page, PDAnn } } - //Marked text that has a sticky note on it should be linked to the sticky note + // Marked text that has a sticky note on it should be linked to the sticky note return new FileAnnotation(annotation, pageIndex + 1, annotationBelongingToMarking); } diff --git a/src/main/java/org/jabref/logic/protectedterms/ProtectedTermsList.java b/src/main/java/org/jabref/logic/protectedterms/ProtectedTermsList.java index dcec9014e5e9..5293cc40f69c 100644 --- a/src/main/java/org/jabref/logic/protectedterms/ProtectedTermsList.java +++ b/src/main/java/org/jabref/logic/protectedterms/ProtectedTermsList.java @@ -25,7 +25,6 @@ public class ProtectedTermsList implements Comparable { private final boolean internalList; private boolean enabled; - public ProtectedTermsList(String description, List termList, String location, boolean internalList) { this.description = Objects.requireNonNull(description); this.termsList = Objects.requireNonNull(termList); diff --git a/src/main/java/org/jabref/logic/shared/PostgreSQLProcessor.java b/src/main/java/org/jabref/logic/shared/PostgreSQLProcessor.java index ad53d54fd3b9..061c8f095690 100644 --- a/src/main/java/org/jabref/logic/shared/PostgreSQLProcessor.java +++ b/src/main/java/org/jabref/logic/shared/PostgreSQLProcessor.java @@ -92,7 +92,7 @@ String escape(String expression) { @Override public void startNotificationListener(DBMSSynchronizer dbmsSynchronizer) { // Disable cleanup output of ThreadedHousekeeper - //Logger.getLogger(ThreadedHousekeeper.class.getName()).setLevel(Level.SEVERE); + // Logger.getLogger(ThreadedHousekeeper.class.getName()).setLevel(Level.SEVERE); try { connection.createStatement().execute("LISTEN jabrefLiveUpdate"); // Do not use `new PostgresSQLNotificationListener(...)` as the object has to exist continuously! diff --git a/src/main/java/org/jabref/logic/shared/exception/OfflineLockException.java b/src/main/java/org/jabref/logic/shared/exception/OfflineLockException.java index 8661734e6e37..0b91566a9ab0 100644 --- a/src/main/java/org/jabref/logic/shared/exception/OfflineLockException.java +++ b/src/main/java/org/jabref/logic/shared/exception/OfflineLockException.java @@ -11,7 +11,6 @@ public class OfflineLockException extends Exception { private final BibEntry localBibEntry; private final BibEntry sharedBibEntry; - public OfflineLockException(BibEntry localBibEntry, BibEntry sharedBibEntry) { super("Local BibEntry data is not up-to-date."); this.localBibEntry = localBibEntry; diff --git a/src/main/java/org/jabref/logic/shared/listener/PostgresSQLNotificationListener.java b/src/main/java/org/jabref/logic/shared/listener/PostgresSQLNotificationListener.java index 77a3d6d91289..96b8b7ccaf6d 100644 --- a/src/main/java/org/jabref/logic/shared/listener/PostgresSQLNotificationListener.java +++ b/src/main/java/org/jabref/logic/shared/listener/PostgresSQLNotificationListener.java @@ -25,11 +25,12 @@ public PostgresSQLNotificationListener(DBMSSynchronizer dbmsSynchronizer, PGConn this.dbmsSynchronizer = dbmsSynchronizer; this.pgConnection = pgConnection; } + @Override public void run() { stop = false; try { - //noinspection InfiniteLoopStatement + // noinspection InfiniteLoopStatement while (!stop) { PGNotification notifications[] = pgConnection.getNotifications(); diff --git a/src/main/java/org/jabref/logic/undo/UndoChangeEvent.java b/src/main/java/org/jabref/logic/undo/UndoChangeEvent.java index 30040d513f34..c2a1896d50ee 100644 --- a/src/main/java/org/jabref/logic/undo/UndoChangeEvent.java +++ b/src/main/java/org/jabref/logic/undo/UndoChangeEvent.java @@ -11,7 +11,6 @@ public class UndoChangeEvent { private final boolean canRedo; private final String redoDescription; - public UndoChangeEvent(boolean canUndo, String undoDescription, boolean canRedo, String redoDescription) { this.canUndo = canUndo; this.undoDescription = undoDescription; diff --git a/src/main/java/org/jabref/logic/util/io/FileUtil.java b/src/main/java/org/jabref/logic/util/io/FileUtil.java index 1a489720431d..58d64fe984ec 100644 --- a/src/main/java/org/jabref/logic/util/io/FileUtil.java +++ b/src/main/java/org/jabref/logic/util/io/FileUtil.java @@ -266,7 +266,7 @@ public static String createFileNameFromPattern(BibDatabase database, BibEntry en targetName = entry.getCiteKeyOptional().orElse("default"); } - //Removes illegal characters from filename + // Removes illegal characters from filename targetName = FileNameCleaner.cleanFileName(targetName); return targetName; } @@ -286,7 +286,7 @@ public static String createDirNameFromPattern(BibDatabase database, BibEntry ent targetName = entry.getCiteKeyOptional().orElse("default"); } - //Removes illegal characters from filename + // Removes illegal characters from filename targetName = FileNameCleaner.cleanDirectoryName(targetName); return targetName; } diff --git a/src/main/java/org/jabref/logic/util/strings/HTMLUnicodeConversionMaps.java b/src/main/java/org/jabref/logic/util/strings/HTMLUnicodeConversionMaps.java index ac4b78c0857c..2f07045fdf49 100644 --- a/src/main/java/org/jabref/logic/util/strings/HTMLUnicodeConversionMaps.java +++ b/src/main/java/org/jabref/logic/util/strings/HTMLUnicodeConversionMaps.java @@ -571,8 +571,8 @@ public class HTMLUnicodeConversionMaps { {"316", "", "{\\c{l}}"}, // small l with cedilla {"317", "", "{{\\v{L}}}"}, // capital L with caron {"318", "", "{\\v{l}}"}, // small l with caron - //{"319", "Lmidot", "{\\Lmidot}"}, // upper case L with mid dot - //{"320", "lmidot", "{\\lmidot}"}, // lower case l with mid dot + // {"319", "Lmidot", "{\\Lmidot}"}, // upper case L with mid dot + // {"320", "lmidot", "{\\lmidot}"}, // lower case l with mid dot {"321", "Lstrok", "{{\\L}}"}, // upper case L with stroke {"322", "lstrok", "{{\\l}}"}, // lower case l with stroke {"323", "Nacute", "{{\\'{N}}}"}, // upper case N with acute @@ -669,8 +669,8 @@ public class HTMLUnicodeConversionMaps { {"733", "dblac", "{{\\H{}}}"}, // Double acute {"949", "epsi", "$\\epsilon$"}, // Epsilon - double check {"1013", "epsiv", "$\\varepsilonup$"}, // lunate epsilon, requires txfonts - //{"1055", "", "{{\\cyrchar\\CYRP}}"}, // Cyrillic capital Pe - //{"1082", "", "{\\cyrchar\\cyrk}"}, // Cyrillic small Ka + // {"1055", "", "{{\\cyrchar\\CYRP}}"}, // Cyrillic capital Pe + // {"1082", "", "{\\cyrchar\\cyrk}"}, // Cyrillic small Ka // {"2013", "", ""}, // NKO letter FA -- Maybe en dash = 0x2013? // {"2014", "", ""}, // NKO letter FA -- Maybe em dash = 0x2014? {"8192", "", "\\hspace{0.5em}"}, // en quad @@ -745,7 +745,7 @@ public class HTMLUnicodeConversionMaps { {"8897", "xvee", "$\\bigvee$"}, // Big vee {"8942", "vdots", "$\\vdots$"}, // vertical ellipsis U+22EE {"8943", "cdots", "$\\cdots$"}, // midline horizontal ellipsis U+22EF - /*{"8944", "", "$\\ddots$"}, // up right diagonal ellipsis U+22F0 */ + /* {"8944", "", "$\\ddots$"}, // up right diagonal ellipsis U+22F0 */ {"8945", "ddots", "$\\ddots$"}, // down right diagonal ellipsis U+22F1 {"9426", "circledc", "{\\copyright}"}, // circled small letter C diff --git a/src/main/java/org/jabref/logic/util/strings/RtfCharMap.java b/src/main/java/org/jabref/logic/util/strings/RtfCharMap.java index 87d8da6e3295..889add85841f 100644 --- a/src/main/java/org/jabref/logic/util/strings/RtfCharMap.java +++ b/src/main/java/org/jabref/logic/util/strings/RtfCharMap.java @@ -82,7 +82,7 @@ public RtfCharMap () { put("TH", "\\u222TH"); // "THORN" put("ss", "\\u223ss"); // "szlig" - //RTFCHARS.put("ss", "AFFEN"); // "szlig" + // RTFCHARS.put("ss", "AFFEN"); // "szlig" put("~a", "\\u227a"); // "atilde" put("aa", "\\u229a"); // "aring" diff --git a/src/main/java/org/jabref/logic/util/strings/UnicodeLigaturesMap.java b/src/main/java/org/jabref/logic/util/strings/UnicodeLigaturesMap.java index 77c54dec6b16..a5466c684d4d 100644 --- a/src/main/java/org/jabref/logic/util/strings/UnicodeLigaturesMap.java +++ b/src/main/java/org/jabref/logic/util/strings/UnicodeLigaturesMap.java @@ -21,7 +21,7 @@ public UnicodeLigaturesMap() { put("\uA737", "au"); put("\uA738", "AV"); put("\uA739", "av"); - //AV, av with bar + // AV, av with bar put("\uA73A", "AV"); put("\uA73B", "av"); put("\uA73C", "AY"); diff --git a/src/main/java/org/jabref/logic/util/strings/XmlCharsMap.java b/src/main/java/org/jabref/logic/util/strings/XmlCharsMap.java index 2da12c692a34..7f13068dca28 100644 --- a/src/main/java/org/jabref/logic/util/strings/XmlCharsMap.java +++ b/src/main/java/org/jabref/logic/util/strings/XmlCharsMap.java @@ -15,7 +15,7 @@ public XmlCharsMap() { put("\\{\\\\\\\"\\{u\\}\\}", "ü"); put("\\{\\\\\\\"\\{U\\}\\}", "Ü"); - //next 2 rows were missing... + // next 2 rows were missing... put("\\{\\\\\\`\\{a\\}\\}", "à"); put("\\{\\\\\\`\\{A\\}\\}", "À"); @@ -28,7 +28,7 @@ public XmlCharsMap() { put("\\{\\\\\\`\\{u\\}\\}", "ù"); put("\\{\\\\\\`\\{U\\}\\}", "Ù"); - //corrected these 10 lines below... + // corrected these 10 lines below... put("\\{\\\\\\'\\{a\\}\\}", "á"); put("\\{\\\\\\'\\{A\\}\\}", "Á"); put("\\{\\\\\\'\\{e\\}\\}", "é"); @@ -39,7 +39,7 @@ public XmlCharsMap() { put("\\{\\\\\\'\\{O\\}\\}", "Ó"); put("\\{\\\\\\'\\{u\\}\\}", "ú"); put("\\{\\\\\\'\\{U\\}\\}", "Ú"); - //added next four chars... + // added next four chars... put("\\{\\\\\\'\\{c\\}\\}", "ć"); put("\\{\\\\\\'\\{C\\}\\}", "Ć"); put("\\{\\\\c\\{c\\}\\}", "ç"); @@ -55,7 +55,7 @@ public XmlCharsMap() { put("\\{\\\\\\\uFFFD\\{a\\}\\}", "á"); put("\\{\\\\\\\uFFFD\\{A\\}\\}", "Á"); - //next 2 rows were missing... + // next 2 rows were missing... put("\\{\\\\\\^\\{a\\}\\}", "â"); put("\\{\\\\\\^\\{A\\}\\}", "Â"); @@ -86,7 +86,7 @@ public XmlCharsMap() { put("\\{\\\\\\\"u\\}", "ü"); put("\\{\\\\\\\"U\\}", "Ü"); - //next 2 rows were missing... + // next 2 rows were missing... put("\\{\\\\\\`a\\}", "à"); put("\\{\\\\\\`A\\}", "À"); @@ -108,11 +108,11 @@ public XmlCharsMap() { put("\\{\\\\\\'U\\}", "Ú"); put("\\{\\\\\\'a\\}", "á"); put("\\{\\\\\\'A\\}", "Á"); - //added next two chars... + // added next two chars... put("\\{\\\\\\'c\\}", "ć"); put("\\{\\\\\\'C\\}", "Ć"); - //next two lines were wrong... + // next two lines were wrong... put("\\{\\\\\\^a\\}", "â"); put("\\{\\\\\\^A\\}", "Â"); diff --git a/src/main/java/org/jabref/logic/xmp/XmpUtilReader.java b/src/main/java/org/jabref/logic/xmp/XmpUtilReader.java index 72eb89414367..1e37920ec3cb 100644 --- a/src/main/java/org/jabref/logic/xmp/XmpUtilReader.java +++ b/src/main/java/org/jabref/logic/xmp/XmpUtilReader.java @@ -26,8 +26,8 @@ public class XmpUtilReader { private static final String END_TAG = ""; private XmpUtilReader() { - //See: https://pdfbox.apache.org/2.0/getting-started.html - System.setProperty("sun.java2d.cmm", "sun.java2d.cmm.kcms.KcmsServiceProvider"); //To get higher rendering speed on java 8 oder 9 for images + // See: https://pdfbox.apache.org/2.0/getting-started.html + System.setProperty("sun.java2d.cmm", "sun.java2d.cmm.kcms.KcmsServiceProvider"); // To get higher rendering speed on java 8 oder 9 for images } /** @@ -142,8 +142,7 @@ private static List getXmpMetadata(PDDocument document) throws IOEx * Loads the specified file with the basic pdfbox functionality and uses an empty string as default password. * * @param path The path to load. - * @return - * @throws IOException from the underlying {@link PDDocument#load(File)} + * @throws IOException from the underlying @link PDDocument#load(File) */ public static PDDocument loadWithAutomaticDecryption(Path path) throws IOException { // try to load the document diff --git a/src/main/java/org/jabref/migrations/CustomEntryTypePreferenceMigration.java b/src/main/java/org/jabref/migrations/CustomEntryTypePreferenceMigration.java index 57d4b1de9e12..a938cb1859bd 100644 --- a/src/main/java/org/jabref/migrations/CustomEntryTypePreferenceMigration.java +++ b/src/main/java/org/jabref/migrations/CustomEntryTypePreferenceMigration.java @@ -15,7 +15,7 @@ class CustomEntryTypePreferenceMigration { - //non-default preferences + // non-default preferences private static final String CUSTOM_TYPE_NAME = "customTypeName_"; private static final String CUSTOM_TYPE_REQ = "customTypeReq_"; private static final String CUSTOM_TYPE_OPT = "customTypeOpt_"; diff --git a/src/main/java/org/jabref/migrations/PreferencesMigrations.java b/src/main/java/org/jabref/migrations/PreferencesMigrations.java index 27f6c67fed31..72ca396d807c 100644 --- a/src/main/java/org/jabref/migrations/PreferencesMigrations.java +++ b/src/main/java/org/jabref/migrations/PreferencesMigrations.java @@ -189,7 +189,7 @@ private static void upgradeLabelPatternToBibtexKeyPattern(JabRefPreferences pref LOGGER.info("Upgraded old default key generator pattern '" + oldDefault + "' to new version."); } } - //Pref node already exists do not migrate from previous version + // Pref node already exists do not migrate from previous version if (mainPrefsNode.nodeExists(JabRefPreferences.BIBTEX_KEY_PATTERNS_NODE)) { return; } @@ -276,7 +276,7 @@ private static void upgradeKeyBindingsToJavaFX(JabRefPreferences prefs) { } private static void addCrossRefRelatedFieldsForAutoComplete(JabRefPreferences prefs) { - //LinkedHashSet because we want to retain the order and add new fields to the end + // LinkedHashSet because we want to retain the order and add new fields to the end Set keys = new LinkedHashSet<>(prefs.getStringList(JabRefPreferences.AUTOCOMPLETER_COMPLETE_FIELDS)); keys.add("crossref"); keys.add("related"); diff --git a/src/main/java/org/jabref/model/ChainNode.java b/src/main/java/org/jabref/model/ChainNode.java index 1423ebefb96c..e5861937cb1c 100644 --- a/src/main/java/org/jabref/model/ChainNode.java +++ b/src/main/java/org/jabref/model/ChainNode.java @@ -9,11 +9,11 @@ *

    * In usual implementations, nodes function as wrappers around a data object. Thus normally they have a value property * which allows access to the value stored in the node. - * In contrast to this approach, the ChainNode class is designed to be used as a base class which provides the + * In contrast to this approach, the ChainNode<T> class is designed to be used as a base class which provides the * tree traversing functionality via inheritance. *

    * Example usage: - * private class BasicChainNode extends ChainNode { + * private class BasicChainNode extends ChainNode<BasicChainNode> { * public BasicChainNode() { * super(BasicChainNode.class); * } @@ -36,7 +36,7 @@ public abstract class ChainNode> { /** * Constructs a chain node without parent and no child. * - * @param derivingClass class deriving from TreeNode. It should always be "T.class". + * @param derivingClass class deriving from TreeNode<T>. It should always be "T.class". * We need this parameter since it is hard to get this information by other means. */ public ChainNode(Class derivingClass) { diff --git a/src/main/java/org/jabref/model/TreeNode.java b/src/main/java/org/jabref/model/TreeNode.java index 1e30747ff284..3c482a516d06 100644 --- a/src/main/java/org/jabref/model/TreeNode.java +++ b/src/main/java/org/jabref/model/TreeNode.java @@ -15,11 +15,11 @@ * Represents a node in a tree. *

    * Usually, tree nodes have a value property which allows access to the value stored in the node. - * In contrast to this approach, the TreeNode class is designed to be used as a base class which provides the + * In contrast to this approach, the TreeNode<T> class is designed to be used as a base class which provides the * tree traversing functionality via inheritance. *

    * Example usage: - * private class BasicTreeNode extends TreeNode { + * private class BasicTreeNode extends TreeNode<BasicTreeNode> { * public BasicTreeNode() { * super(BasicTreeNode.class); * } @@ -424,7 +424,7 @@ public void removeChild(T child) { children.remove(child); child.setParent(null); - notifyAboutDescendantChange((T)this); + notifyAboutDescendantChange((T) this); } /** @@ -441,7 +441,7 @@ public void removeChild(int childIndex) { child.get().setParent(null); } - notifyAboutDescendantChange((T)this); + notifyAboutDescendantChange((T) this); } /** @@ -473,7 +473,7 @@ public T addChild(T child, int index) { child.setParent((T) this); children.add(index, child); - notifyAboutDescendantChange((T)this); + notifyAboutDescendantChange((T) this); return child; } diff --git a/src/main/java/org/jabref/model/bibtexkeypattern/DatabaseBibtexKeyPattern.java b/src/main/java/org/jabref/model/bibtexkeypattern/DatabaseBibtexKeyPattern.java index 82570f1e0af7..32504f13a419 100644 --- a/src/main/java/org/jabref/model/bibtexkeypattern/DatabaseBibtexKeyPattern.java +++ b/src/main/java/org/jabref/model/bibtexkeypattern/DatabaseBibtexKeyPattern.java @@ -8,7 +8,6 @@ public class DatabaseBibtexKeyPattern extends AbstractBibtexKeyPattern { private final GlobalBibtexKeyPattern globalBibtexKeyPattern; - public DatabaseBibtexKeyPattern(GlobalBibtexKeyPattern globalBibtexKeyPattern) { this.globalBibtexKeyPattern = globalBibtexKeyPattern; } diff --git a/src/main/java/org/jabref/model/cleanup/FieldFormatterCleanups.java b/src/main/java/org/jabref/model/cleanup/FieldFormatterCleanups.java index b0e43f0e7564..3e9dd09e2934 100644 --- a/src/main/java/org/jabref/model/cleanup/FieldFormatterCleanups.java +++ b/src/main/java/org/jabref/model/cleanup/FieldFormatterCleanups.java @@ -91,7 +91,7 @@ public List getAsStringList(String newline) { } private static String getMetaDataString(List actionList, String newline) { - //first, group all formatters by the field for which they apply + // first, group all formatters by the field for which they apply Map> groupedByField = new TreeMap<>(Comparator.comparing(Field::getName)); for (FieldFormatterCleanup cleanup : actionList) { Field key = cleanup.getField(); @@ -101,7 +101,7 @@ private static String getMetaDataString(List actionList, groupedByField.put(key, new ArrayList<>()); } - //add the formatter to the map if it is not already there + // add the formatter to the map if it is not already there List formattersForKey = groupedByField.get(key); if (!formattersForKey.contains(cleanup.getFormatter().getKey())) { formattersForKey.add(cleanup.getFormatter().getKey()); diff --git a/src/main/java/org/jabref/model/database/BibDatabaseModeDetection.java b/src/main/java/org/jabref/model/database/BibDatabaseModeDetection.java index fb1a3688a012..3fa1f5745a56 100644 --- a/src/main/java/org/jabref/model/database/BibDatabaseModeDetection.java +++ b/src/main/java/org/jabref/model/database/BibDatabaseModeDetection.java @@ -10,6 +10,7 @@ public class BibDatabaseModeDetection { private BibDatabaseModeDetection() { } + /** * Tries to infer the database type by examining a BibDatabase database. * diff --git a/src/main/java/org/jabref/model/database/event/EntriesAddedEvent.java b/src/main/java/org/jabref/model/database/event/EntriesAddedEvent.java index 3229664ab16f..3e6de8cb5d81 100644 --- a/src/main/java/org/jabref/model/database/event/EntriesAddedEvent.java +++ b/src/main/java/org/jabref/model/database/event/EntriesAddedEvent.java @@ -27,7 +27,7 @@ public EntriesAddedEvent(List bibEntries, BibEntry firstEntry, Entries } /** - * @param bibEntries List of BibEntry objects which are being added. + * @param bibEntries List of BibEntry objects which are being added. * @param location Location affected by this event */ public EntriesAddedEvent(List bibEntries, EntriesEventSource location) { diff --git a/src/main/java/org/jabref/model/database/event/EntriesRemovedEvent.java b/src/main/java/org/jabref/model/database/event/EntriesRemovedEvent.java index 666ca89aca06..64e98089ba94 100644 --- a/src/main/java/org/jabref/model/database/event/EntriesRemovedEvent.java +++ b/src/main/java/org/jabref/model/database/event/EntriesRemovedEvent.java @@ -14,14 +14,14 @@ public class EntriesRemovedEvent extends EntriesEvent { /** - * @param bibEntries List of BibEntry objects which are being removed. + * @param bibEntries List of BibEntry objects which are being removed. */ public EntriesRemovedEvent(List bibEntries) { super(bibEntries); } /** - * @param bibEntries List of BibEntry objects which are being removed. + * @param bibEntries List of BibEntry objects which are being removed. * @param location Location affected by this event */ public EntriesRemovedEvent(List bibEntries, EntriesEventSource location) { diff --git a/src/main/java/org/jabref/model/entry/AuthorList.java b/src/main/java/org/jabref/model/entry/AuthorList.java index 629fca345011..8499a4665989 100644 --- a/src/main/java/org/jabref/model/entry/AuthorList.java +++ b/src/main/java/org/jabref/model/entry/AuthorList.java @@ -352,7 +352,7 @@ public Author getAuthor(int i) { /** * Returns the a list of Author objects. * - * @return the List object. + * @return the List<Author> object. */ public List getAuthors() { return authors; @@ -622,7 +622,7 @@ public int hashCode() { * Brown"

  • *
  • "John von Neumann and John Smith and Black Brown, Peter" ==> "John * von Neumann and John Smith and Peter Black Brown"
  • - * + * * * @return formatted list of authors. */ @@ -644,9 +644,9 @@ public String getAsFirstLastNamesWithAnd() { * is treated similarly if abbreviated in one case and not in another. This * form is not intended to be suitable for presentation, only for sorting. *

    - *

    *

      *
    • "John Smith" ==> "Smith, J.";
    • + *
    * * @return formatted list of authors */ diff --git a/src/main/java/org/jabref/model/entry/BibEntry.java b/src/main/java/org/jabref/model/entry/BibEntry.java index a7b87a31579d..2f9ffec51332 100644 --- a/src/main/java/org/jabref/model/entry/BibEntry.java +++ b/src/main/java/org/jabref/model/entry/BibEntry.java @@ -68,7 +68,7 @@ public class BibEntry implements Cloneable { private final Map latexFreeFields = new ConcurrentHashMap<>(); /** - * Cache that stores the field as keyword lists (format ) + * Cache that stores the field as keyword lists (format <Field, Separator, Keyword list>) */ private final MultiKeyMap fieldsAsKeywords = new MultiKeyMap<>(); @@ -151,29 +151,39 @@ private Optional getSourceField(Field targetField, EntryType targetEntry, //// 2. Handle special field mappings if (((sourceEntry == StandardEntryType.MvBook) && (targetEntry == StandardEntryType.InBook)) || - ((sourceEntry == StandardEntryType.MvBook) && (targetEntry == StandardEntryType.BookInBook)) || - ((sourceEntry == StandardEntryType.MvBook) && (targetEntry == StandardEntryType.SuppBook)) || - ((sourceEntry == StandardEntryType.Book) && (targetEntry == StandardEntryType.InBook)) || - ((sourceEntry == StandardEntryType.Book) && (targetEntry == StandardEntryType.BookInBook)) || - ((sourceEntry == StandardEntryType.Book) && (targetEntry == StandardEntryType.SuppBook))) { - if (targetField == StandardField.AUTHOR) { return Optional.of(StandardField.AUTHOR); } - if (targetField == StandardField.BOOKAUTHOR) { return Optional.of(StandardField.AUTHOR); } + ((sourceEntry == StandardEntryType.MvBook) && (targetEntry == StandardEntryType.BookInBook)) || + ((sourceEntry == StandardEntryType.MvBook) && (targetEntry == StandardEntryType.SuppBook)) || + ((sourceEntry == StandardEntryType.Book) && (targetEntry == StandardEntryType.InBook)) || + ((sourceEntry == StandardEntryType.Book) && (targetEntry == StandardEntryType.BookInBook)) || + ((sourceEntry == StandardEntryType.Book) && (targetEntry == StandardEntryType.SuppBook))) { + if (targetField == StandardField.AUTHOR) { + return Optional.of(StandardField.AUTHOR); + } + if (targetField == StandardField.BOOKAUTHOR) { + return Optional.of(StandardField.AUTHOR); + } } if (((sourceEntry == StandardEntryType.MvBook) && (targetEntry == StandardEntryType.Book)) || - ((sourceEntry == StandardEntryType.MvBook) && (targetEntry == StandardEntryType.InBook)) || - ((sourceEntry == StandardEntryType.MvBook) && (targetEntry == StandardEntryType.BookInBook)) || - ((sourceEntry == StandardEntryType.MvBook) && (targetEntry == StandardEntryType.SuppBook)) || - ((sourceEntry == StandardEntryType.MvCollection) && (targetEntry == StandardEntryType.Collection)) || - ((sourceEntry == StandardEntryType.MvCollection) && (targetEntry == StandardEntryType.InCollection)) || - ((sourceEntry == StandardEntryType.MvCollection) && (targetEntry == StandardEntryType.SuppCollection)) || - ((sourceEntry == StandardEntryType.MvProceedings) && (targetEntry == StandardEntryType.Proceedings)) || - ((sourceEntry == StandardEntryType.MvProceedings) && (targetEntry == StandardEntryType.InProceedings)) || - ((sourceEntry == StandardEntryType.MvReference) && (targetEntry == StandardEntryType.Reference)) || - ((sourceEntry == StandardEntryType.MvReference) && (targetEntry == StandardEntryType.InReference))) { - if (targetField == StandardField.MAINTITLE) { return Optional.of(StandardField.TITLE); } - if (targetField == StandardField.MAINSUBTITLE) { return Optional.of(StandardField.SUBTITLE); } - if (targetField == StandardField.MAINTITLEADDON) { return Optional.of(StandardField.TITLEADDON); } + ((sourceEntry == StandardEntryType.MvBook) && (targetEntry == StandardEntryType.InBook)) || + ((sourceEntry == StandardEntryType.MvBook) && (targetEntry == StandardEntryType.BookInBook)) || + ((sourceEntry == StandardEntryType.MvBook) && (targetEntry == StandardEntryType.SuppBook)) || + ((sourceEntry == StandardEntryType.MvCollection) && (targetEntry == StandardEntryType.Collection)) || + ((sourceEntry == StandardEntryType.MvCollection) && (targetEntry == StandardEntryType.InCollection)) || + ((sourceEntry == StandardEntryType.MvCollection) && (targetEntry == StandardEntryType.SuppCollection)) || + ((sourceEntry == StandardEntryType.MvProceedings) && (targetEntry == StandardEntryType.Proceedings)) || + ((sourceEntry == StandardEntryType.MvProceedings) && (targetEntry == StandardEntryType.InProceedings)) || + ((sourceEntry == StandardEntryType.MvReference) && (targetEntry == StandardEntryType.Reference)) || + ((sourceEntry == StandardEntryType.MvReference) && (targetEntry == StandardEntryType.InReference))) { + if (targetField == StandardField.MAINTITLE) { + return Optional.of(StandardField.TITLE); + } + if (targetField == StandardField.MAINSUBTITLE) { + return Optional.of(StandardField.SUBTITLE); + } + if (targetField == StandardField.MAINTITLEADDON) { + return Optional.of(StandardField.TITLEADDON); + } // those fields are no more available for the same-name inheritance strategy if ((targetField == StandardField.TITLE) || @@ -183,7 +193,7 @@ private Optional getSourceField(Field targetField, EntryType targetEntry, } // for these fields, inheritance is not allowed for the specified entry types - if ((targetField == StandardField.SHORTTITLE)) { + if (targetField == StandardField.SHORTTITLE) { return Optional.empty(); } } @@ -195,9 +205,15 @@ private Optional getSourceField(Field targetField, EntryType targetEntry, ((sourceEntry == StandardEntryType.Collection) && (targetEntry == StandardEntryType.SuppCollection)) || ((sourceEntry == StandardEntryType.Reference) && (targetEntry == StandardEntryType.InReference)) || ((sourceEntry == StandardEntryType.Proceedings) && (targetEntry == StandardEntryType.InProceedings))) { - if (targetField == StandardField.BOOKTITLE) { return Optional.of(StandardField.TITLE); } - if (targetField == StandardField.BOOKSUBTITLE) { return Optional.of(StandardField.SUBTITLE); } - if (targetField == StandardField.BOOKTITLEADDON) { return Optional.of(StandardField.TITLEADDON); } + if (targetField == StandardField.BOOKTITLE) { + return Optional.of(StandardField.TITLE); + } + if (targetField == StandardField.BOOKSUBTITLE) { + return Optional.of(StandardField.SUBTITLE); + } + if (targetField == StandardField.BOOKTITLEADDON) { + return Optional.of(StandardField.TITLEADDON); + } // those fields are no more available for the same-name inheritance strategy if ((targetField == StandardField.TITLE) || @@ -214,8 +230,12 @@ private Optional getSourceField(Field targetField, EntryType targetEntry, if (((sourceEntry == IEEETranEntryType.Periodical) && (targetEntry == StandardEntryType.Article)) || ((sourceEntry == IEEETranEntryType.Periodical) && (targetEntry == StandardEntryType.SuppPeriodical))) { - if (targetField == StandardField.JOURNALTITLE) { return Optional.of(StandardField.TITLE); } - if (targetField == StandardField.JOURNALSUBTITLE) { return Optional.of(StandardField.SUBTITLE); } + if (targetField == StandardField.JOURNALTITLE) { + return Optional.of(StandardField.TITLE); + } + if (targetField == StandardField.JOURNALSUBTITLE) { + return Optional.of(StandardField.SUBTITLE); + } // those fields are no more available for the same-name inheritance strategy if ((targetField == StandardField.TITLE) || @@ -306,15 +326,6 @@ public void setId(String id) { changed = true; } - /** - * Returns the cite key AKA citation key AKA BibTeX key, or null if it is not set. - * Note: this is not the internal Id of this entry. The internal Id is always present, whereas the BibTeX key might not be present. - */ - @Deprecated - public String getCiteKey() { - return fields.get(InternalField.KEY_FIELD); - } - /** * Sets the cite key AKA citation key AKA BibTeX key. Note: This is not the internal Id of this entry. * The internal Id is always present, whereas the BibTeX key might not be present. @@ -336,7 +347,7 @@ public Optional getCiteKeyOptional() { } public boolean hasCiteKey() { - return !Strings.isNullOrEmpty(getCiteKey()); + return this.getField(InternalField.KEY_FIELD).map(key -> !Strings.isNullOrEmpty(key)).orElse(false); } /** @@ -485,7 +496,7 @@ public Optional getFieldOrAliasLatexFree(Field name) { * archiveprefix <-> eprinttype
    * journal <-> journaltitle
    * key <-> sortkey
    - * pdf <-> file
    file
    * primaryclass <-> eprintclass
    * school <-> institution
    * These work bidirectional.
    @@ -905,10 +916,10 @@ public Optional setFiles(List files) { * Changes to the underlying list will have no effect on the entry itself. Use {@link #addFile(LinkedFile)} */ public List getFiles() { - //Extract the path + // Extract the path Optional oldValue = getField(StandardField.FILE); if (!oldValue.isPresent()) { - return new ArrayList<>(); //Return new ArrayList because emptyList is immutable + return new ArrayList<>(); // Return new ArrayList because emptyList is immutable } return FileFieldParser.parse(oldValue.get()); diff --git a/src/main/java/org/jabref/model/entry/BibtexString.java b/src/main/java/org/jabref/model/entry/BibtexString.java index 551dc749ad43..3080dd40fb6a 100644 --- a/src/main/java/org/jabref/model/entry/BibtexString.java +++ b/src/main/java/org/jabref/model/entry/BibtexString.java @@ -185,10 +185,10 @@ public boolean equals(Object o) { return false; } BibtexString that = (BibtexString) o; - return (Objects.equals(hasChanged,that.hasChanged) && + return (Objects.equals(hasChanged, that.hasChanged) && Objects.equals(name, that.name) && Objects.equals(content, that.content) && - Objects.equals(id, that.id) && + Objects.equals(id, that.id) && Objects.equals(type, that.type) && Objects.equals(parsedSerialization, that.parsedSerialization)); } diff --git a/src/main/java/org/jabref/model/entry/FileFieldParser.java b/src/main/java/org/jabref/model/entry/FileFieldParser.java index 442a18b2361e..86ac1b2c4436 100644 --- a/src/main/java/org/jabref/model/entry/FileFieldParser.java +++ b/src/main/java/org/jabref/model/entry/FileFieldParser.java @@ -22,10 +22,9 @@ public static List parse(String value) { if (!escaped && (c == '\\')) { escaped = true; continue; - } - // Check if we are entering an XML special character construct such - // as ",", because we need to know in order to ignore the semicolon. - else if (!escaped && (c == '&') && !inXmlChar) { + } else if (!escaped && (c == '&') && !inXmlChar) { + // Check if we are entering an XML special character construct such + // as ",", because we need to know in order to ignore the semicolon. sb.append(c); if ((value.length() > (i + 1)) && (value.charAt(i + 1) == '#')) { inXmlChar = true; diff --git a/src/main/java/org/jabref/model/entry/LinkedFile.java b/src/main/java/org/jabref/model/entry/LinkedFile.java index 3c79ffd68129..dac550e9ded7 100644 --- a/src/main/java/org/jabref/model/entry/LinkedFile.java +++ b/src/main/java/org/jabref/model/entry/LinkedFile.java @@ -28,7 +28,7 @@ public class LinkedFile implements Serializable { private static final LinkedFile NULL_OBJECT = new LinkedFile("", "", ""); - //We have to mark these properties as transient because they can't be serialized directly + // We have to mark these properties as transient because they can't be serialized directly private transient StringProperty description = new SimpleStringProperty(); private transient StringProperty link = new SimpleStringProperty(); private transient StringProperty fileType = new SimpleStringProperty(); diff --git a/src/main/java/org/jabref/model/entry/event/FieldChangedEvent.java b/src/main/java/org/jabref/model/entry/event/FieldChangedEvent.java index 90151a111bab..cdf55f380f39 100644 --- a/src/main/java/org/jabref/model/entry/event/FieldChangedEvent.java +++ b/src/main/java/org/jabref/model/entry/event/FieldChangedEvent.java @@ -14,7 +14,6 @@ public class FieldChangedEvent extends EntryChangedEvent { private final String oldValue; private int delta = 0; - /** * @param bibEntry Affected BibEntry object * @param field Name of field which has been changed diff --git a/src/main/java/org/jabref/model/entry/identifier/DOI.java b/src/main/java/org/jabref/model/entry/identifier/DOI.java index 68e1ff2968da..c11a614cc186 100644 --- a/src/main/java/org/jabref/model/entry/identifier/DOI.java +++ b/src/main/java/org/jabref/model/entry/identifier/DOI.java @@ -14,10 +14,7 @@ import org.slf4j.LoggerFactory; /** - * Class for working with Digital object identifiers (DOIs) and Short DOIs - * - * @see https://en.wikipedia.org/wiki/Digital_object_identifier - * @see http://shortdoi.org + * Class for working with Digital object identifiers (DOIs) and Short DOIs */ public class DOI implements Identifier { private static final Logger LOGGER = LoggerFactory.getLogger(DOI.class); @@ -119,7 +116,7 @@ public DOI(String doi) { } /** - * Creates an Optional from various schemes including URL, URN, and plain DOIs. + * Creates an Optional<DOI> from various schemes including URL, URN, and plain DOIs. * * Useful for suppressing the IllegalArgumentException of the Constructor and checking for * Optional.isPresent() instead. diff --git a/src/main/java/org/jabref/model/entry/identifier/Eprint.java b/src/main/java/org/jabref/model/entry/identifier/Eprint.java index 99343c24410e..93b85a722a16 100644 --- a/src/main/java/org/jabref/model/entry/identifier/Eprint.java +++ b/src/main/java/org/jabref/model/entry/identifier/Eprint.java @@ -16,8 +16,7 @@ /** * Class for working with Eprint identifiers * - * @see https://arxiv.org/help/arxiv_identifier - * @see https://arxiv.org/hypertex/bibstyles/ + * See also https://arxiv.org/help/arxiv_identifier and https://arxiv.org/hypertex/bibstyles/ */ public class Eprint implements Identifier { public static final URI RESOLVER = URI.create("https://arxiv.org"); @@ -80,7 +79,7 @@ public Eprint(String eprint) { } /** - * Creates an Optional from various schemes including URL. + * Creates an Optional<Eprint> from various schemes including URL. * * Useful for suppressing the IllegalArgumentException of the Constructor * and checking for Optional.isPresent() instead. diff --git a/src/main/java/org/jabref/model/entry/identifier/ISBN.java b/src/main/java/org/jabref/model/entry/identifier/ISBN.java index 59697fcf9ca7..aa8005ce860a 100644 --- a/src/main/java/org/jabref/model/entry/identifier/ISBN.java +++ b/src/main/java/org/jabref/model/entry/identifier/ISBN.java @@ -16,7 +16,6 @@ public class ISBN implements Identifier { private final String isbnString; - public ISBN(String isbnString) { this.isbnString = Objects.requireNonNull(isbnString).trim().replace("-", ""); } diff --git a/src/main/java/org/jabref/model/entry/identifier/ISSN.java b/src/main/java/org/jabref/model/entry/identifier/ISSN.java index 07795373aeeb..e60e582cde5d 100644 --- a/src/main/java/org/jabref/model/entry/identifier/ISSN.java +++ b/src/main/java/org/jabref/model/entry/identifier/ISSN.java @@ -11,7 +11,6 @@ public class ISSN { private final String issnString; - public ISSN(String issnString) { this.issnString = Objects.requireNonNull(issnString).trim(); } diff --git a/src/main/java/org/jabref/model/entry/types/BiblatexEntryTypeDefinitions.java b/src/main/java/org/jabref/model/entry/types/BiblatexEntryTypeDefinitions.java index 9344c2faff44..874db26a41a4 100644 --- a/src/main/java/org/jabref/model/entry/types/BiblatexEntryTypeDefinitions.java +++ b/src/main/java/org/jabref/model/entry/types/BiblatexEntryTypeDefinitions.java @@ -352,7 +352,7 @@ public class BiblatexEntryTypeDefinitions { .withRequiredFields(StandardField.AUTHOR, StandardField.TITLE, StandardField.DATE) .withDetailFields(StandardField.SUBTITLE, StandardField.TITLEADDON, StandardField.LANGUAGE, StandardField.HOWPUBLISHED, StandardField.NOTE, StandardField.LOCATION, StandardField.ADDENDUM, StandardField.PUBSTATE, StandardField.EVENTTITLE, - StandardField.EVENTDATE,StandardField.VENUE, StandardField.URL, StandardField.URLDATE) + StandardField.EVENTDATE, StandardField.VENUE, StandardField.URL, StandardField.URLDATE) .build(); private static final BibEntryType CONFERENCE = new BibEntryTypeBuilder() diff --git a/src/main/java/org/jabref/model/entry/types/EntryTypeFactory.java b/src/main/java/org/jabref/model/entry/types/EntryTypeFactory.java index 6c9745bde109..86756afde423 100644 --- a/src/main/java/org/jabref/model/entry/types/EntryTypeFactory.java +++ b/src/main/java/org/jabref/model/entry/types/EntryTypeFactory.java @@ -48,8 +48,8 @@ private static boolean isBiblatex(EntryType type) { public static EntryType parse(String typeName) { - List types = new ArrayList<>(Arrays. asList(StandardEntryType.values())); - types.addAll(Arrays. asList(IEEETranEntryType.values())); + List types = new ArrayList<>(Arrays.asList(StandardEntryType.values())); + types.addAll(Arrays.asList(IEEETranEntryType.values())); return types.stream().filter(type -> type.getName().equals(typeName.toLowerCase(Locale.ENGLISH))).findFirst().orElse(new UnknownEntryType(typeName)); } diff --git a/src/main/java/org/jabref/model/entry/types/IEEETranEntryTypeDefinitions.java b/src/main/java/org/jabref/model/entry/types/IEEETranEntryTypeDefinitions.java index 9c04458b92cb..694c055042b2 100644 --- a/src/main/java/org/jabref/model/entry/types/IEEETranEntryTypeDefinitions.java +++ b/src/main/java/org/jabref/model/entry/types/IEEETranEntryTypeDefinitions.java @@ -12,7 +12,7 @@ /** * This class represents all supported IEEETran entry types. * - * @see http://ctan.sharelatex.com/tex-archive/macros/latex/contrib/IEEEtran/bibtex/IEEEtran_bst_HOWTO.pdf + * See http://ctan.sharelatex.com/tex-archive/macros/latex/contrib/IEEEtran/bibtex/IEEEtran_bst_HOWTO.pdf *

    * Electronic, IEEETranBSTCTL, Periodical, Patent, Standard */ diff --git a/src/main/java/org/jabref/model/groups/AllEntriesGroup.java b/src/main/java/org/jabref/model/groups/AllEntriesGroup.java index fdb5b0d5fbf4..d0b92fe4760b 100644 --- a/src/main/java/org/jabref/model/groups/AllEntriesGroup.java +++ b/src/main/java/org/jabref/model/groups/AllEntriesGroup.java @@ -9,7 +9,6 @@ */ public class AllEntriesGroup extends AbstractGroup { - public AllEntriesGroup(String name) { super(name, GroupHierarchyType.INDEPENDENT); } diff --git a/src/main/java/org/jabref/model/groups/GroupTreeNode.java b/src/main/java/org/jabref/model/groups/GroupTreeNode.java index 85795e361949..5bba190df12a 100644 --- a/src/main/java/org/jabref/model/groups/GroupTreeNode.java +++ b/src/main/java/org/jabref/model/groups/GroupTreeNode.java @@ -116,7 +116,7 @@ private SearchMatcher getSearchMatcher(GroupHierarchyType originalContext) { } } else if ((context == GroupHierarchyType.REFINING) && !isRoot() && (originalContext != GroupHierarchyType.INCLUDING)) { - //noinspection OptionalGetWithoutIsPresent + // noinspection OptionalGetWithoutIsPresent searchRule.addRule(getParent().get().getSearchMatcher(originalContext)); } return searchRule; diff --git a/src/main/java/org/jabref/model/util/FileHelper.java b/src/main/java/org/jabref/model/util/FileHelper.java index da0ff3ee8539..dba58b1fd21d 100644 --- a/src/main/java/org/jabref/model/util/FileHelper.java +++ b/src/main/java/org/jabref/model/util/FileHelper.java @@ -152,7 +152,7 @@ private static Optional expandFilename(String filename, Path directory) { Objects.requireNonNull(directory); Path file = Paths.get(filename); - //Explicitly check for an empty String, as File.exists returns true on that empty path, because it maps to the default jar location + // Explicitly check for an empty String, as File.exists returns true on that empty path, because it maps to the default jar location // if we then call toAbsoluteDir, it would always return the jar-location folder. This is not what we want here if (filename.isEmpty()) { return Optional.of(directory); diff --git a/src/main/java/org/jabref/preferences/CustomImportList.java b/src/main/java/org/jabref/preferences/CustomImportList.java index 7aca6a3d720c..5b05e0525129 100644 --- a/src/main/java/org/jabref/preferences/CustomImportList.java +++ b/src/main/java/org/jabref/preferences/CustomImportList.java @@ -22,7 +22,6 @@ public class CustomImportList extends TreeSet { private final JabRefPreferences prefs; - public CustomImportList(JabRefPreferences prefs) { super(); this.prefs = prefs; diff --git a/src/main/java/org/jabref/preferences/JabRefPreferences.java b/src/main/java/org/jabref/preferences/JabRefPreferences.java index a98c4ae72891..9af9a2a81c11 100644 --- a/src/main/java/org/jabref/preferences/JabRefPreferences.java +++ b/src/main/java/org/jabref/preferences/JabRefPreferences.java @@ -293,10 +293,10 @@ public class JabRefPreferences implements PreferencesService { public static final String CUSTOMIZED_BIBLATEX_TYPES = "customizedBiblatexTypes"; // Version public static final String VERSION_IGNORED_UPDATE = "versionIgnoreUpdate"; - //KeyBindings - keys - public because needed for pref migration + // KeyBindings - keys - public because needed for pref migration public static final String BINDINGS = "bindings"; - //AutcompleteFields - public because needed for pref migration + // AutcompleteFields - public because needed for pref migration public static final String AUTOCOMPLETER_COMPLETE_FIELDS = "autoCompleteFields"; // Id Entry Generator Preferences @@ -350,7 +350,7 @@ public class JabRefPreferences implements PreferencesService { private static final String PROTECTED_TERMS_ENABLED_INTERNAL = "protectedTermsEnabledInternal"; private static final String PROTECTED_TERMS_DISABLED_INTERNAL = "protectedTermsDisabledInternal"; - //GroupViewMode + // GroupViewMode private static final String GROUP_INTERSECT_UNION_VIEW_MODE = "groupIntersectUnionViewModes"; // Dialog states @@ -626,7 +626,7 @@ private JabRefPreferences() { // use BibTeX key appended with filename as default pattern defaults.put(IMPORT_FILENAMEPATTERN, ImportTabViewModel.DEFAULT_FILENAME_PATTERNS[1]); - //Default empty String to be backwards compatible + // Default empty String to be backwards compatible defaults.put(IMPORT_FILEDIRPATTERN, ""); customImports = new CustomImportList(this); @@ -648,7 +648,7 @@ private JabRefPreferences() { defaults.put(FILE_BROWSER_COMMAND, ""); } - //versioncheck defaults + // versioncheck defaults defaults.put(VERSION_IGNORED_UPDATE, ""); // preview @@ -829,7 +829,7 @@ public Map getCustomTabsNamesAndFields() { int defNumber = 0; while (true) { - //Saved as CUSTOMTABNAME_def{number} and ; separated + // Saved as CUSTOMTABNAME_def{number} and ; separated String name = (String) defaults.get(CUSTOM_TAB_NAME + "_def" + defNumber); String fields = (String) defaults.get(CUSTOM_TAB_FIELDS + "_def" + defNumber); diff --git a/src/test/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtilTest.java b/src/test/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtilTest.java index 04050a9bd209..1bcd38953380 100644 --- a/src/test/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtilTest.java +++ b/src/test/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtilTest.java @@ -42,7 +42,7 @@ public void setUp(@TempDir Path folder) throws Exception { @Test public void test() throws Exception { - //Due to mocking the externalFileType class, the file extension will not be found + // Due to mocking the externalFileType class, the file extension will not be found List expected = Collections.singletonList(new LinkedFile("", "CiteKey.pdf", "")); diff --git a/src/test/java/org/jabref/gui/fieldeditors/LinkedFileViewModelTest.java b/src/test/java/org/jabref/gui/fieldeditors/LinkedFileViewModelTest.java index 86ab685cc8cb..bac8b1122738 100644 --- a/src/test/java/org/jabref/gui/fieldeditors/LinkedFileViewModelTest.java +++ b/src/test/java/org/jabref/gui/fieldeditors/LinkedFileViewModelTest.java @@ -157,7 +157,7 @@ void downloadDoesNotOverwriteFileTypeExtension() throws MalformedURLException { linkedFile = new LinkedFile(new URL("http://arxiv.org/pdf/1207.0408v1"), ""); databaseContext = mock(BibDatabaseContext.class); - when(filePreferences.getFileNamePattern()).thenReturn("[bibtexkey]"); //use this variant, as we cannot mock the linkedFileHandler cause it's initialized inside the viewModel + when(filePreferences.getFileNamePattern()).thenReturn("[bibtexkey]"); // use this variant, as we cannot mock the linkedFileHandler cause it's initialized inside the viewModel LinkedFileViewModel viewModel = new LinkedFileViewModel(linkedFile, entry, databaseContext, new CurrentThreadTaskExecutor(), dialogService, xmpPreferences, filePreferences, externalFileType); diff --git a/src/test/java/org/jabref/logic/bibtex/BibEntryWriterTest.java b/src/test/java/org/jabref/logic/bibtex/BibEntryWriterTest.java index 19411d8254c1..5ebca3902d5d 100644 --- a/src/test/java/org/jabref/logic/bibtex/BibEntryWriterTest.java +++ b/src/test/java/org/jabref/logic/bibtex/BibEntryWriterTest.java @@ -48,10 +48,10 @@ void testSerialization() throws IOException { StringWriter stringWriter = new StringWriter(); BibEntry entry = new BibEntry(StandardEntryType.Article); - //set a required field + // set a required field entry.setField(StandardField.AUTHOR, "Foo Bar"); entry.setField(StandardField.JOURNAL, "International Journal of Something"); - //set an optional field + // set an optional field entry.setField(StandardField.NUMBER, "1"); entry.setField(StandardField.NOTE, "some note"); @@ -81,7 +81,7 @@ void writeOtherTypeTest() throws Exception { entry.setField(StandardField.COMMENT, "testentry"); entry.setCiteKey("test"); - //write out bibtex string + // write out bibtex string StringWriter stringWriter = new StringWriter(); writer.write(entry, stringWriter, BibDatabaseMode.BIBTEX); String actual = stringWriter.toString(); @@ -111,10 +111,10 @@ void writeEntryWithOrField() throws Exception { StringWriter stringWriter = new StringWriter(); BibEntry entry = new BibEntry(StandardEntryType.InBook); - //set an required OR field (author/editor) + // set an required OR field (author/editor) entry.setField(StandardField.EDITOR, "Foo Bar"); entry.setField(StandardField.JOURNAL, "International Journal of Something"); - //set an optional field + // set an optional field entry.setField(StandardField.NUMBER, "1"); entry.setField(StandardField.NOTE, "some note"); @@ -139,11 +139,11 @@ void writeEntryWithOrFieldBothFieldsPresent() throws Exception { StringWriter stringWriter = new StringWriter(); BibEntry entry = new BibEntry(StandardEntryType.InBook); - //set an required OR field with both fields(author/editor) + // set an required OR field with both fields(author/editor) entry.setField(StandardField.AUTHOR, "Foo Thor"); entry.setField(StandardField.EDITOR, "Edi Bar"); entry.setField(StandardField.JOURNAL, "International Journal of Something"); - //set an optional field + // set an optional field entry.setField(StandardField.NUMBER, "1"); entry.setField(StandardField.NOTE, "some note"); @@ -199,7 +199,7 @@ void roundTripTest() throws IOException { Collection entries = result.getDatabase().getEntries(); BibEntry entry = entries.iterator().next(); - //write out bibtex string + // write out bibtex string StringWriter stringWriter = new StringWriter(); writer.write(entry, stringWriter, BibDatabaseMode.BIBTEX); String actual = stringWriter.toString(); @@ -223,7 +223,7 @@ void roundTripWithPrependingNewlines() throws IOException { Collection entries = result.getDatabase().getEntries(); BibEntry entry = entries.iterator().next(); - //write out bibtex string + // write out bibtex string StringWriter stringWriter = new StringWriter(); writer.write(entry, stringWriter, BibDatabaseMode.BIBTEX); String actual = stringWriter.toString(); @@ -286,7 +286,7 @@ void roundTripWithCamelCasingInTheOriginalEntryAndResultInLowerCase() throws IOE // modify entry entry.setField(StandardField.AUTHOR, "BlaBla"); - //write out bibtex string + // write out bibtex string StringWriter stringWriter = new StringWriter(); writer.write(entry, stringWriter, BibDatabaseMode.BIBTEX); String actual = stringWriter.toString(); @@ -323,7 +323,7 @@ void testEntryTypeChange() throws IOException { // modify entry entry.setType(StandardEntryType.InProceedings); - //write out bibtex string + // write out bibtex string StringWriter stringWriter = new StringWriter(); writer.write(entry, stringWriter, BibDatabaseMode.BIBTEX); String actual = stringWriter.toString(); @@ -356,7 +356,7 @@ void roundTripWithAppendedNewlines() throws IOException { Collection entries = result.getDatabase().getEntries(); BibEntry entry = entries.iterator().next(); - //write out bibtex string + // write out bibtex string StringWriter stringWriter = new StringWriter(); writer.write(entry, stringWriter, BibDatabaseMode.BIBTEX); String actual = stringWriter.toString(); @@ -389,7 +389,7 @@ private String testSingleWrite(String bibtexEntry) throws IOException { Collection entries = result.getDatabase().getEntries(); BibEntry entry = entries.iterator().next(); - //write out bibtex string + // write out bibtex string StringWriter stringWriter = new StringWriter(); writer.write(entry, stringWriter, BibDatabaseMode.BIBTEX); String actual = stringWriter.toString(); @@ -418,7 +418,7 @@ void monthFieldSpecialSyntax() throws IOException { assertTrue(fields.contains(StandardField.MONTH)); assertEquals("#mar#", entry.getField(StandardField.MONTH).get()); - //write out bibtex string + // write out bibtex string StringWriter stringWriter = new StringWriter(); writer.write(entry, stringWriter, BibDatabaseMode.BIBTEX); String actual = stringWriter.toString(); @@ -479,7 +479,7 @@ void addFieldWithLongerLength() throws IOException { // modify entry entry.setField(StandardField.HOWPUBLISHED, "asdf"); - //write out bibtex string + // write out bibtex string StringWriter stringWriter = new StringWriter(); writer.write(entry, stringWriter, BibDatabaseMode.BIBTEX); String actual = stringWriter.toString(); @@ -542,7 +542,7 @@ void roundTripWithPrecedingCommentTest() throws IOException { Collection entries = result.getDatabase().getEntries(); BibEntry entry = entries.iterator().next(); - //write out bibtex string + // write out bibtex string StringWriter stringWriter = new StringWriter(); writer.write(entry, stringWriter, BibDatabaseMode.BIBTEX); String actual = stringWriter.toString(); @@ -570,7 +570,7 @@ void roundTripWithPrecedingCommentAndModificationTest() throws IOException { // change the entry entry.setField(StandardField.AUTHOR, "John Doe"); - //write out bibtex string + // write out bibtex string StringWriter stringWriter = new StringWriter(); writer.write(entry, stringWriter, BibDatabaseMode.BIBTEX); String actual = stringWriter.toString(); @@ -592,15 +592,15 @@ void alphabeticSerialization() throws IOException { StringWriter stringWriter = new StringWriter(); BibEntry entry = new BibEntry(StandardEntryType.Article); - //required fields + // required fields entry.setField(StandardField.AUTHOR, "Foo Bar"); entry.setField(StandardField.JOURNALTITLE, "International Journal of Something"); entry.setField(StandardField.TITLE, "Title"); entry.setField(StandardField.DATE, "2019-10-16"); - //optional fields + // optional fields entry.setField(StandardField.NUMBER, "1"); entry.setField(StandardField.NOTE, "some note"); - //unknown fields + // unknown fields entry.setField(StandardField.YEAR, "2019"); entry.setField(StandardField.CHAPTER, "chapter"); diff --git a/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java b/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java index 7cdf6d2dc563..75cb1c30d2aa 100644 --- a/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java +++ b/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java @@ -63,7 +63,7 @@ void setUp(@TempDir Path bibFolder) throws IOException { context.setDatabasePath(bibFolder.resolve("test.bib")); FilePreferences fileDirPrefs = mock(FilePreferences.class, Answers.RETURNS_SMART_NULLS); - //Biblocation as Primary overwrites all other dirs + // Biblocation as Primary overwrites all other dirs when(fileDirPrefs.isBibLocationAsPrimary()).thenReturn(true); worker = new CleanupWorker(context, diff --git a/src/test/java/org/jabref/logic/cleanup/MoveFilesCleanupTest.java b/src/test/java/org/jabref/logic/cleanup/MoveFilesCleanupTest.java index 523dfb5a049c..22ef8bd86e70 100644 --- a/src/test/java/org/jabref/logic/cleanup/MoveFilesCleanupTest.java +++ b/src/test/java/org/jabref/logic/cleanup/MoveFilesCleanupTest.java @@ -59,7 +59,7 @@ void setUp(@TempDir Path bibFolder) throws IOException { entry.setField(StandardField.FILE, FileFieldWriter.getStringRepresentation(fileField)); filePreferences = mock(FilePreferences.class); - when(filePreferences.isBibLocationAsPrimary()).thenReturn(false); //Biblocation as Primary overwrites all other dirs, therefore we set it to false here + when(filePreferences.isBibLocationAsPrimary()).thenReturn(false); // Biblocation as Primary overwrites all other dirs, therefore we set it to false here cleanup = new MoveFilesCleanup(databaseContext, filePreferences); } diff --git a/src/test/java/org/jabref/logic/cleanup/RenamePdfCleanupTest.java b/src/test/java/org/jabref/logic/cleanup/RenamePdfCleanupTest.java index d60b82a72c3e..89393473737b 100644 --- a/src/test/java/org/jabref/logic/cleanup/RenamePdfCleanupTest.java +++ b/src/test/java/org/jabref/logic/cleanup/RenamePdfCleanupTest.java @@ -41,7 +41,7 @@ void setUp(@TempDir Path testFolder) { entry.setCiteKey("Toot"); filePreferences = mock(FilePreferences.class); - when(filePreferences.isBibLocationAsPrimary()).thenReturn(true); //Set Biblocation as Primary Directory, otherwise the tmp folders won't be cleaned up correctly + when(filePreferences.isBibLocationAsPrimary()).thenReturn(true); // Set Biblocation as Primary Directory, otherwise the tmp folders won't be cleaned up correctly cleanup = new RenamePdfCleanup(false, context, filePreferences); } diff --git a/src/test/java/org/jabref/logic/exporter/XmpExporterTest.java b/src/test/java/org/jabref/logic/exporter/XmpExporterTest.java index 3f14e69d66ba..d102c01aa390 100644 --- a/src/test/java/org/jabref/logic/exporter/XmpExporterTest.java +++ b/src/test/java/org/jabref/logic/exporter/XmpExporterTest.java @@ -46,7 +46,7 @@ public void exportSingleEntry(@TempDir Path testFolder) throws Exception { entry.setField(StandardField.AUTHOR, "Alan Turing"); exporter.export(databaseContext, file, encoding, Collections.singletonList(entry)); - String actual = String.join("\n", Files.readAllLines(file)); //we are using \n to join, so we need it in the expected string as well, \r\n would fail + String actual = String.join("\n", Files.readAllLines(file)); // we are using \n to join, so we need it in the expected string as well, \r\n would fail String expected = " \n" + " \n" + " \n" + @@ -79,7 +79,7 @@ public void writeMultipleEntriesInASingleFile(@TempDir Path testFolder) throws E exporter.export(databaseContext, file, encoding, Arrays.asList(entryTuring, entryArmbrust)); - String actual = String.join("\n", Files.readAllLines(file)); //we are using \n to join, so we need it in the expected string as well, \r\n would fail + String actual = String.join("\n", Files.readAllLines(file)); // we are using \n to join, so we need it in the expected string as well, \r\n would fail String expected = " \n" + " \n" + @@ -135,7 +135,7 @@ public void writeMultipleEntriesInDifferentFiles(@TempDir Path testFolder) throw assertEquals(Collections.emptyList(), lines); Path fileTuring = Paths.get(file.getParent().toString() + "/" + entryTuring.getId() + "_null.xmp"); - String actualTuring = String.join("\n", Files.readAllLines(fileTuring)); //we are using \n to join, so we need it in the expected string as well, \r\n would fail + String actualTuring = String.join("\n", Files.readAllLines(fileTuring)); // we are using \n to join, so we need it in the expected string as well, \r\n would fail String expectedTuring = " \n" + " \n" + @@ -156,7 +156,7 @@ public void writeMultipleEntriesInDifferentFiles(@TempDir Path testFolder) throw assertEquals(expectedTuring, actualTuring); Path fileArmbrust = Paths.get(file.getParent().toString() + "/" + entryArmbrust.getId() + "_Armbrust2010.xmp"); - String actualArmbrust = String.join("\n", Files.readAllLines(fileArmbrust)); //we are using \n to join, so we need it in the expected string as well, \r\n would fail + String actualArmbrust = String.join("\n", Files.readAllLines(fileArmbrust)); // we are using \n to join, so we need it in the expected string as well, \r\n would fail String expectedArmbrust = " \n" + " \n" + diff --git a/src/test/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystemTest.java b/src/test/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystemTest.java index 4925966752c1..22ad681f0ef0 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystemTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystemTest.java @@ -159,7 +159,7 @@ public void searchByEntryFindsEntry() throws Exception { @Test public void testPerformSearchByFamaeyMcGaughEntry() throws Exception { Optional fetchedEntry = fetcher.performSearchById("10.12942/lrr-2012-10"); - fetchedEntry.ifPresent(entry -> entry.clearField(StandardField.ABSTRACT));//Remove abstract due to copyright + fetchedEntry.ifPresent(entry -> entry.clearField(StandardField.ABSTRACT));// Remove abstract due to copyright assertEquals(Optional.of(famaeyMcGaughEntry), fetchedEntry); } @@ -177,7 +177,7 @@ public void testPerformSearchByIdInvalidDoi() throws Exception { @Test public void testPerformSearchBySunWelchEntry() throws Exception { Optional fetchedEntry = fetcher.performSearchById("10.1038/nmat3160"); - fetchedEntry.ifPresent(entry -> entry.clearField(StandardField.ABSTRACT)); //Remove abstract due to copyright + fetchedEntry.ifPresent(entry -> entry.clearField(StandardField.ABSTRACT)); // Remove abstract due to copyright assertEquals(Optional.of(sunWelchEntry), fetchedEntry); } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/IEEETest.java b/src/test/java/org/jabref/logic/importer/fetcher/IEEETest.java index b2a45b5fa42b..c5ac3f885d0d 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/IEEETest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/IEEETest.java @@ -108,8 +108,8 @@ void searchResultHasNoKeywordTerms() throws FetcherException { expected.setField(StandardField.TITLE, "Optimal operation of PV-DG-battery based microgrid with power quality conditioner"); expected.setField(StandardField.VOLUME, "13"); - List fetchedEntries = fetcher.performSearch("8636659"); //article number - fetchedEntries.forEach(entry -> entry.clearField(StandardField.ABSTRACT)); //Remove abstract due to copyright); + List fetchedEntries = fetcher.performSearch("8636659"); // article number + fetchedEntries.forEach(entry -> entry.clearField(StandardField.ABSTRACT)); // Remove abstract due to copyright); assertEquals(Collections.singletonList(expected), fetchedEntries); } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/MedlineFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/MedlineFetcherTest.java index 7ad94a2bfeae..ada1b137b351 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/MedlineFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/MedlineFetcherTest.java @@ -139,35 +139,35 @@ public void testGetHelpPage() { @Test public void testSearchByIDWijedasa() throws Exception { Optional fetchedEntry = fetcher.performSearchById("27670948"); - fetchedEntry.get().clearField(StandardField.ABSTRACT); //Remove abstract due to copyright + fetchedEntry.get().clearField(StandardField.ABSTRACT); // Remove abstract due to copyright assertEquals(Optional.of(entryWijedasa), fetchedEntry); } @Test public void testSearchByIDEndharti() throws Exception { Optional fetchedEntry = fetcher.performSearchById("27670445"); - fetchedEntry.get().clearField(StandardField.ABSTRACT); //Remove abstract due to copyright + fetchedEntry.get().clearField(StandardField.ABSTRACT); // Remove abstract due to copyright assertEquals(Optional.of(entryEndharti), fetchedEntry); } @Test public void testSearchByIDIchikawa() throws Exception { Optional fetchedEntry = fetcher.performSearchById("26197440"); - fetchedEntry.get().clearField(StandardField.ABSTRACT); //Remove abstract due to copyright + fetchedEntry.get().clearField(StandardField.ABSTRACT); // Remove abstract due to copyright assertEquals(Optional.of(bibEntryIchikawa), fetchedEntry); } @Test public void testSearchByIDSari() throws Exception { Optional fetchedEntry = fetcher.performSearchById("26867355"); - fetchedEntry.get().clearField(StandardField.ABSTRACT); //Remove abstract due to copyright + fetchedEntry.get().clearField(StandardField.ABSTRACT); // Remove abstract due to copyright assertEquals(Optional.of(bibEntrySari), fetchedEntry); } @Test public void testMultipleEntries() throws Exception { List entryList = fetcher.performSearch("java"); - entryList.forEach(entry -> entry.clearField(StandardField.ABSTRACT)); //Remove abstract due to copyright); + entryList.forEach(entry -> entry.clearField(StandardField.ABSTRACT)); // Remove abstract due to copyright); assertEquals(50, entryList.size()); assertTrue(entryList.contains(bibEntryIchikawa)); } diff --git a/src/test/java/org/jabref/logic/importer/fileformat/CustomImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/CustomImporterTest.java index 23cc0b39912a..529d770234eb 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/CustomImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/CustomImporterTest.java @@ -54,7 +54,7 @@ public void equalsWithSameReference() { @Test public void equalsIsBasedOnName() { - //noinspection AssertEqualsBetweenInconvertibleTypes + // noinspection AssertEqualsBetweenInconvertibleTypes assertEquals(new CopacImporter(), importer); } diff --git a/src/test/java/org/jabref/logic/importer/util/GroupsParserTest.java b/src/test/java/org/jabref/logic/importer/util/GroupsParserTest.java index 9b18f96b970c..07ca10e22348 100644 --- a/src/test/java/org/jabref/logic/importer/util/GroupsParserTest.java +++ b/src/test/java/org/jabref/logic/importer/util/GroupsParserTest.java @@ -71,7 +71,7 @@ void testImportSubGroups() throws Exception { List orderedData = Arrays.asList("0 AllEntriesGroup:", "1 ExplicitGroup:1;0;", "2 ExplicitGroup:2;0;", "0 ExplicitGroup:3;0;"); - //Create group hierarchy: + // Create group hierarchy: // Level 0 Name: All entries // Level 1 Name: 1 // Level 2 Name: 2 diff --git a/src/test/java/org/jabref/logic/l10n/LanguageTest.java b/src/test/java/org/jabref/logic/l10n/LanguageTest.java index 8b583357db92..d821d8925482 100644 --- a/src/test/java/org/jabref/logic/l10n/LanguageTest.java +++ b/src/test/java/org/jabref/logic/l10n/LanguageTest.java @@ -17,7 +17,7 @@ void convertKnownLanguageOnly() { @Test void convertKnownLanguageAndCountryCorrect() { - //Language and country code have to be separated see: https://stackoverflow.com/a/3318598 + // Language and country code have to be separated see: https://stackoverflow.com/a/3318598 assertEquals(Optional.of(new Locale("pt", "BR")), Language.convertToSupportedLocale(Language.BRAZILIAN_PORTUGUESE)); } diff --git a/src/test/java/org/jabref/logic/openoffice/StyleLoaderTest.java b/src/test/java/org/jabref/logic/openoffice/StyleLoaderTest.java index 5ac0ec152a92..e83ace4d707d 100644 --- a/src/test/java/org/jabref/logic/openoffice/StyleLoaderTest.java +++ b/src/test/java/org/jabref/logic/openoffice/StyleLoaderTest.java @@ -135,7 +135,7 @@ public void testInitalizeWithOneExternalFileRemoveStyleUpdatesPreferences() thro for (OOBibStyle style : toremove) { assertTrue(loader.removeStyle(style)); } - //As the prefs are mocked away, the getExternalStyles still returns the initial one + // As the prefs are mocked away, the getExternalStyles still returns the initial one assertFalse(preferences.getExternalStyles().isEmpty()); } diff --git a/src/test/java/org/jabref/logic/pdf/EntryAnnotationImporterTest.java b/src/test/java/org/jabref/logic/pdf/EntryAnnotationImporterTest.java index 9230dcc16a7f..4f2754d9359f 100644 --- a/src/test/java/org/jabref/logic/pdf/EntryAnnotationImporterTest.java +++ b/src/test/java/org/jabref/logic/pdf/EntryAnnotationImporterTest.java @@ -33,14 +33,14 @@ public void setUp() { @Test public void readEntryExampleThesis() { - //given + // given entry.setField(StandardField.FILE, ":thesis-example.pdf:PDF"); EntryAnnotationImporter entryAnnotationImporter = new EntryAnnotationImporter(entry); - //when + // when Map> annotations = entryAnnotationImporter.importAnnotationsFromFiles(databaseContext, mock(FilePreferences.class)); - //then + // then int fileCounter = 0; int annotationCounter = 0; for (List annotationsOfFile : annotations.values()) { diff --git a/src/test/java/org/jabref/logic/search/SearchQueryTest.java b/src/test/java/org/jabref/logic/search/SearchQueryTest.java index e8630135ed7c..2be23fd98f47 100644 --- a/src/test/java/org/jabref/logic/search/SearchQueryTest.java +++ b/src/test/java/org/jabref/logic/search/SearchQueryTest.java @@ -200,7 +200,7 @@ public void testGetPattern() { String query = "progress"; SearchQuery result = new SearchQuery(query, false, false); Pattern pattern = Pattern.compile("(\\Qprogress\\E)"); - //We can't directly compare the pattern objects + // We can't directly compare the pattern objects assertEquals(Optional.of(pattern.toString()), result.getPatternForWords().map(Pattern::toString)); } @@ -222,7 +222,7 @@ public void testGetRegexpJavascriptPattern() { @Test public void testEscapingInPattern() { - //first word contain all java special regex characters + // first word contain all java special regex characters String queryText = "<([{\\\\^-=$!|]})?*+.> word1 word2."; SearchQuery textQueryWithSpecialChars = new SearchQuery(queryText, false, false); String pattern = "(\\Q<([{\\^-=$!|]})?*+.>\\E)|(\\Qword1\\E)|(\\Qword2.\\E)"; @@ -231,7 +231,7 @@ public void testEscapingInPattern() { @Test public void testEscapingInJavascriptPattern() { - //first word contain all javascript special regex characters that should be escaped individually in text based search + // first word contain all javascript special regex characters that should be escaped individually in text based search String queryText = "([{\\\\^$|]})?*+./ word1 word2."; SearchQuery textQueryWithSpecialChars = new SearchQuery(queryText, false, false); String pattern = "(\\(\\[\\{\\\\\\^\\$\\|\\]\\}\\)\\?\\*\\+\\.\\/)|(word1)|(word2\\.)"; diff --git a/src/test/java/org/jabref/logic/shared/DBMSProcessorTest.java b/src/test/java/org/jabref/logic/shared/DBMSProcessorTest.java index fe7c59b4263b..653f0a11f3e6 100644 --- a/src/test/java/org/jabref/logic/shared/DBMSProcessorTest.java +++ b/src/test/java/org/jabref/logic/shared/DBMSProcessorTest.java @@ -190,7 +190,7 @@ void testUpdateNewerEntry() { dbmsProcessor.insertEntry(bibEntry); - //simulate older version + // simulate older version bibEntry.getSharedBibEntryData().setVersion(0); bibEntry.setField(StandardField.YEAR, "1993"); @@ -202,7 +202,7 @@ void testUpdateEqualEntry() throws OfflineLockException, SQLException { BibEntry expectedBibEntry = getBibEntryExample(); dbmsProcessor.insertEntry(expectedBibEntry); - //simulate older version + // simulate older version expectedBibEntry.getSharedBibEntryData().setVersion(0); dbmsProcessor.updateEntry(expectedBibEntry); diff --git a/src/test/java/org/jabref/logic/shared/SynchronizationTestSimulator.java b/src/test/java/org/jabref/logic/shared/SynchronizationTestSimulator.java index 934b8762ed8e..dac5e0f92d58 100644 --- a/src/test/java/org/jabref/logic/shared/SynchronizationTestSimulator.java +++ b/src/test/java/org/jabref/logic/shared/SynchronizationTestSimulator.java @@ -69,11 +69,11 @@ public void clear() throws SQLException { @Test public void simulateEntryInsertionAndManualPull() throws Exception { - //client A inserts an entry + // client A inserts an entry clientContextA.getDatabase().insertEntry(getBibEntryExample(1)); - //client A inserts another entry + // client A inserts another entry clientContextA.getDatabase().insertEntry(getBibEntryExample(2)); - //client B pulls the changes + // client B pulls the changes clientContextB.getDBMSSynchronizer().pullChanges(); assertEquals(clientContextA.getDatabase().getEntries(), clientContextB.getDatabase().getEntries()); @@ -97,18 +97,18 @@ public void simulateEntryUpdateAndManualPull() throws Exception { @Test public void simulateEntryDelitionAndManualPull() throws Exception { BibEntry bibEntry = getBibEntryExample(1); - //client A inserts an entry + // client A inserts an entry clientContextA.getDatabase().insertEntry(bibEntry); - //client B pulls the entry + // client B pulls the entry clientContextB.getDBMSSynchronizer().pullChanges(); assertFalse(clientContextA.getDatabase().getEntries().isEmpty()); assertFalse(clientContextB.getDatabase().getEntries().isEmpty()); assertEquals(clientContextA.getDatabase().getEntries(), clientContextB.getDatabase().getEntries()); - //client A removes the entry + // client A removes the entry clientContextA.getDatabase().removeEntry(bibEntry); - //client B pulls the change + // client B pulls the change clientContextB.getDBMSSynchronizer().pullChanges(); assertTrue(clientContextA.getDatabase().getEntries().isEmpty()); @@ -118,21 +118,21 @@ public void simulateEntryDelitionAndManualPull() throws Exception { @Test public void simulateUpdateOnNoLongerExistingEntry() throws Exception { BibEntry bibEntryOfClientA = getBibEntryExample(1); - //client A inserts an entry + // client A inserts an entry clientContextA.getDatabase().insertEntry(bibEntryOfClientA); - //client B pulls the entry + // client B pulls the entry clientContextB.getDBMSSynchronizer().pullChanges(); assertFalse(clientContextA.getDatabase().getEntries().isEmpty()); assertFalse(clientContextB.getDatabase().getEntries().isEmpty()); assertEquals(clientContextA.getDatabase().getEntries(), clientContextB.getDatabase().getEntries()); - //client A removes the entry + // client A removes the entry clientContextA.getDatabase().removeEntry(bibEntryOfClientA); assertFalse(clientContextB.getDatabase().getEntries().isEmpty()); assertNull(eventListenerB.getSharedEntriesNotPresentEvent()); - //client B tries to update the entry + // client B tries to update the entry BibEntry bibEntryOfClientB = clientContextB.getDatabase().getEntries().get(0); bibEntryOfClientB.setField(StandardField.YEAR, "2009"); diff --git a/src/test/java/org/jabref/logic/util/JavaVersionTest.java b/src/test/java/org/jabref/logic/util/JavaVersionTest.java index 443b404f803d..662549e43646 100644 --- a/src/test/java/org/jabref/logic/util/JavaVersionTest.java +++ b/src/test/java/org/jabref/logic/util/JavaVersionTest.java @@ -20,12 +20,12 @@ public class JavaVersionTest { java.add("1.6.0_10"); // Oracle java.add("1.6.0_45"); // Oracle java.add("1.7.0_13"); // Oracle - java.add("1.8.0_76-release"); //openjdk - java.add("1.8.0_92"); //Oracle - java.add("1.8.0_111"); //Oracle - java.add("1.8.0_112-release"); //openjdk - java.add("1.8.0_152-release"); //openjdk - java.add("1.8.0_144"); //Oracle + java.add("1.8.0_76-release"); // openjdk + java.add("1.8.0_92"); // Oracle + java.add("1.8.0_111"); // Oracle + java.add("1.8.0_112-release"); // openjdk + java.add("1.8.0_152-release"); // openjdk + java.add("1.8.0_144"); // Oracle // Examples http://openjdk.java.net/jeps/223 // Note that it might be possible that java 9 versions are either 9.1.4+8 or new style 1.9.0_31-b08 diff --git a/src/test/java/org/jabref/logic/util/io/RegExpBasedFileFinderTests.java b/src/test/java/org/jabref/logic/util/io/RegExpBasedFileFinderTests.java index 8110322183c6..b1a2ff97ae70 100644 --- a/src/test/java/org/jabref/logic/util/io/RegExpBasedFileFinderTests.java +++ b/src/test/java/org/jabref/logic/util/io/RegExpBasedFileFinderTests.java @@ -46,7 +46,7 @@ public void setUp() { @Test public void testFindFiles() throws Exception { - //given + // given BibEntry localEntry = new BibEntry(StandardEntryType.Article); localEntry.setCiteKey("pdfInDatabase"); localEntry.setField(StandardField.YEAR, "2001"); @@ -56,33 +56,33 @@ public void testFindFiles() throws Exception { List dirs = Collections.singletonList(Paths.get(FILES_DIRECTORY)); RegExpBasedFileFinder fileFinder = new RegExpBasedFileFinder("**/[bibtexkey].*\\\\.[extension]", ','); - //when + // when List result = fileFinder.findAssociatedFiles(localEntry, dirs, extensions); - //then + // then assertEquals(Collections.singletonList(Paths.get("src/test/resources/org/jabref/logic/importer/unlinkedFilesTestFolder/pdfInDatabase.pdf")), result); } @Test public void testYearAuthFirspageFindFiles() throws Exception { - //given + // given List extensions = Collections.singletonList("pdf"); List dirs = Collections.singletonList(Paths.get(FILES_DIRECTORY)); RegExpBasedFileFinder fileFinder = new RegExpBasedFileFinder("**/[year]_[auth]_[firstpage].*\\\\.[extension]", ','); - //when + // when List result = fileFinder.findAssociatedFiles(entry, dirs, extensions); - //then + // then assertEquals(Collections.singletonList(Paths.get("src/test/resources/org/jabref/logic/importer/unlinkedFilesTestFolder/directory/subdirectory/2003_Hippel_209.pdf")), result); } @Test public void testAuthorWithDiacritics() throws Exception { - //given + // given BibEntry localEntry = new BibEntry(StandardEntryType.Article); localEntry.setCiteKey("Grazulis2017"); localEntry.setField(StandardField.YEAR, "2017"); @@ -94,17 +94,17 @@ public void testAuthorWithDiacritics() throws Exception { List dirs = Collections.singletonList(Paths.get(FILES_DIRECTORY)); RegExpBasedFileFinder fileFinder = new RegExpBasedFileFinder("**/[year]_[auth]_[firstpage]\\\\.[extension]", ','); - //when + // when List result = fileFinder.findAssociatedFiles(localEntry, dirs, extensions); - //then + // then assertEquals(Collections.singletonList(Paths.get("src/test/resources/org/jabref/logic/importer/unlinkedFilesTestFolder/directory/subdirectory/2017_Gražulis_726.pdf")), result); } @Test public void testFindFileInSubdirectory() throws Exception { - //given + // given BibEntry localEntry = new BibEntry(StandardEntryType.Article); localEntry.setCiteKey("pdfInSubdirectory"); localEntry.setField(StandardField.YEAR, "2017"); @@ -114,17 +114,17 @@ public void testFindFileInSubdirectory() throws Exception { List dirs = Collections.singletonList(Paths.get(FILES_DIRECTORY)); RegExpBasedFileFinder fileFinder = new RegExpBasedFileFinder("**/[bibtexkey].*\\\\.[extension]", ','); - //when + // when List result = fileFinder.findAssociatedFiles(localEntry, dirs, extensions); - //then + // then assertEquals(Collections.singletonList(Paths.get("src/test/resources/org/jabref/logic/importer/unlinkedFilesTestFolder/directory/subdirectory/pdfInSubdirectory.pdf")), result); } @Test public void testFindFileNonRecursive() throws Exception { - //given + // given BibEntry localEntry = new BibEntry(StandardEntryType.Article); localEntry.setCiteKey("pdfInSubdirectory"); localEntry.setField(StandardField.YEAR, "2017"); @@ -134,10 +134,10 @@ public void testFindFileNonRecursive() throws Exception { List dirs = Collections.singletonList(Paths.get(FILES_DIRECTORY)); RegExpBasedFileFinder fileFinder = new RegExpBasedFileFinder("*/[bibtexkey].*\\\\.[extension]", ','); - //when + // when List result = fileFinder.findAssociatedFiles(localEntry, dirs, extensions); - //then + // then assertTrue(result.isEmpty()); } diff --git a/src/test/java/org/jabref/model/entry/AuthorListParameterTest.java b/src/test/java/org/jabref/model/entry/AuthorListParameterTest.java index 47adb50271d0..4947265355bc 100644 --- a/src/test/java/org/jabref/model/entry/AuthorListParameterTest.java +++ b/src/test/java/org/jabref/model/entry/AuthorListParameterTest.java @@ -15,8 +15,8 @@ private static Stream data() { Arguments.of("王, 军", new Author("军", "军.", null, "王", null)), Arguments.of("Doe, John", new Author("John", "J.", null, "Doe", null)), Arguments.of("von Berlichingen zu Hornberg, Johann Gottfried", new Author("Johann Gottfried", "J. G.", "von", "Berlichingen zu Hornberg", null)), - //Arguments.of("Robert and Sons, Inc.", new Author(null, null, null, "Robert and Sons, Inc.", null))), - //Arguments.of("al-Ṣāliḥ, Abdallāh", new Author("Abdallāh", "A.", null, "al-Ṣāliḥ", null))), + // Arguments.of("Robert and Sons, Inc.", new Author(null, null, null, "Robert and Sons, Inc.", null))), + // Arguments.of("al-Ṣāliḥ, Abdallāh", new Author("Abdallāh", "A.", null, "al-Ṣāliḥ", null))), Arguments.of("de la Vallée Poussin, Jean Charles Gabriel", new Author("Jean Charles Gabriel", "J. C. G.", "de la", "Vallée Poussin", null)), Arguments.of("de la Vallée Poussin, J. C. G.", new Author("J. C. G.", "J. C. G.", "de la", "Vallée Poussin", null)), Arguments.of("{K}ent-{B}oswell, E. S.", new Author("E. S.", "E. S.", null, "{K}ent-{B}oswell", null)), diff --git a/src/test/java/org/jabref/model/entry/AuthorListTest.java b/src/test/java/org/jabref/model/entry/AuthorListTest.java index 0916af571f03..77bb79b5b7d8 100644 --- a/src/test/java/org/jabref/model/entry/AuthorListTest.java +++ b/src/test/java/org/jabref/model/entry/AuthorListTest.java @@ -606,7 +606,7 @@ public void createCorrectInitials() { @Test public void parseNameWithBracesAroundFirstName() throws Exception { - //TODO: Be more intelligent and abbreviate the first name correctly + // TODO: Be more intelligent and abbreviate the first name correctly Author expected = new Author("Tse-tung", "{Tse-tung}.", null, "Mao", null); assertEquals(new AuthorList(expected), AuthorList.parse("{Tse-tung} Mao")); } diff --git a/src/test/java/org/jabref/testutils/category/FetcherTest.java b/src/test/java/org/jabref/testutils/category/FetcherTest.java index 5e833e1ca48e..3bcbbcc84e90 100644 --- a/src/test/java/org/jabref/testutils/category/FetcherTest.java +++ b/src/test/java/org/jabref/testutils/category/FetcherTest.java @@ -13,5 +13,5 @@ @Inherited @Tag("FetcherTest") public @interface FetcherTest { - //empty + // empty } diff --git a/src/test/java/org/jabref/testutils/category/GUITest.java b/src/test/java/org/jabref/testutils/category/GUITest.java index c166c80a3284..8add1b3eda8d 100644 --- a/src/test/java/org/jabref/testutils/category/GUITest.java +++ b/src/test/java/org/jabref/testutils/category/GUITest.java @@ -13,5 +13,5 @@ @Inherited @Tag("GUITest") public @interface GUITest { - //empty + // empty }