Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ plugins {

id 'idea'

id 'org.openrewrite.rewrite' version '6.29.0'
id 'org.openrewrite.rewrite' version '6.29.3'

id "org.itsallcode.openfasttrace" version "3.0.1"
}
Expand Down Expand Up @@ -401,7 +401,7 @@ dependencies {
xjc group: 'org.glassfish.jaxb', name: 'jaxb-xjc', version: '3.0.2'
xjc group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '3.0.2'

rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:2.22.0"))
rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:2.23.2"))
rewrite("org.openrewrite.recipe:rewrite-static-analysis")
rewrite("org.openrewrite.recipe:rewrite-logging-frameworks")
rewrite("org.openrewrite.recipe:rewrite-testing-frameworks")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public void updateItem(CitationKeyPatternsPanelItemModel item, boolean empty) {
setStyle("");
} else if (isSelected()) {
setStyle("-fx-background-color: -fx-selection-bar");
} else if (item.getEntryType().getName().equals(CitationKeyPatternsPanelViewModel.ENTRY_TYPE_DEFAULT_NAME)) {
} else if (CitationKeyPatternsPanelViewModel.ENTRY_TYPE_DEFAULT_NAME.equals(item.getEntryType().getName())) {
setStyle("-fx-background-color: -fx-default-button");
} else {
setStyle("");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ public class CitationKeyPatternsPanelViewModel {

if (itemOneName.equals(itemTwoName)) {
return 0;
} else if (itemOneName.equals(ENTRY_TYPE_DEFAULT_NAME)) {
} else if (ENTRY_TYPE_DEFAULT_NAME.equals(itemOneName)) {
return -1;
} else if (itemTwoName.equals(ENTRY_TYPE_DEFAULT_NAME)) {
} else if (ENTRY_TYPE_DEFAULT_NAME.equals(itemTwoName)) {
return 1;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public static Set<ExternalFileType> fromString(String storedFileTypes) {
// Read the prefs information for file types:
String[][] vals = StringUtil.decodeStringDoubleArray(storedFileTypes);
for (String[] val : vals) {
if ((val.length == 2) && val[1].equals(FILE_TYPE_REMOVED_FLAG)) {
if ((val.length == 2) && FILE_TYPE_REMOVED_FLAG.equals(val[1])) {
// This entry indicates that a default entry type should be removed:
ExternalFileType toRemove = null;
for (ExternalFileType type : types) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ public void setValues() {
if (parentNode != null) {
parentNode.getGroup()
.getIconName()
.filter(iconName -> !iconName.equals(DefaultGroupsFactory.ALL_ENTRIES_GROUP_DEFAULT_ICON))
.filter(iconName -> !DefaultGroupsFactory.ALL_ENTRIES_GROUP_DEFAULT_ICON.equals(iconName))
.ifPresent(iconProperty::setValue);
parentNode.getGroup().getColor().ifPresent(color -> colorUseProperty.setValue(true));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public void setValues() {
catalogs.addAll(WebFetchers.getSearchBasedFetchers(importFormatPreferences, importerPreferences)
.stream()
.map(SearchBasedFetcher::getName)
.filter(name -> !name.equals(CompositeSearchBasedFetcher.FETCHER_NAME))
.filter(name -> !CompositeSearchBasedFetcher.FETCHER_NAME.equals(name))
.map(name -> {
boolean enabled = importerPreferences.getCatalogs().contains(name);
return new StudyCatalogItem(name, enabled);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public ManageStudyDefinitionViewModel(ImportFormatPreferences importFormatPrefer
.map(SearchBasedFetcher::getName)
// The user wants to select specific fetchers
// The fetcher summarizing ALL fetchers can be emulated by selecting ALL fetchers (which happens rarely when doing an SLR)
.filter(name -> !name.equals(CompositeSearchBasedFetcher.FETCHER_NAME))
.filter(name -> !CompositeSearchBasedFetcher.FETCHER_NAME.equals(name))
.map(name -> {
boolean enabled = DEFAULT_SELECTION.contains(name);
return new StudyCatalogItem(name, enabled);
Expand Down Expand Up @@ -108,7 +108,7 @@ public ManageStudyDefinitionViewModel(Study study,
.map(SearchBasedFetcher::getName)
// The user wants to select specific fetchers
// The fetcher summarizing ALL fetchers can be emulated by selecting ALL fetchers (which happens rarely when doing an SLR)
.filter(name -> !name.equals(CompositeSearchBasedFetcher.FETCHER_NAME))
.filter(name -> !CompositeSearchBasedFetcher.FETCHER_NAME.equals(name))
.map(name -> {
boolean enabled = studyDatabases.contains(new StudyDatabase(name, true));
return new StudyCatalogItem(name, enabled);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private static Map<String, String> serializeMetaData(Map<String, List<String>> s
continue;
}

boolean isSaveActions = metaItem.getKey().equals(MetaData.SAVE_ACTIONS);
boolean isSaveActions = MetaData.SAVE_ACTIONS.equals(metaItem.getKey());
// The last "MetaData.SEPARATOR_STRING" adds compatibility to JabRef v5.9 and earlier
StringJoiner joiner = new StringJoiner(MetaData.SEPARATOR_STRING, "", MetaData.SEPARATOR_STRING);
boolean lastWasSaveActionsEnablement = false;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/logic/exporter/XmpExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void export(BibDatabaseContext databaseContext, Path file, List<BibEntry>

// This is a distinction between writing all entries from the supplied list to a single .xmp file,
// or write every entry to a separate file.
if (file.getFileName().toString().trim().equals(XMP_SPLIT_DIRECTORY_INDICATOR)) {
if (XMP_SPLIT_DIRECTORY_INDICATOR.equals(file.getFileName().toString().trim())) {
for (BibEntry entry : entries) {
// Avoid situations, where two citation keys are null
Path entryFile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,6 @@ private boolean isAPSJournal(BibEntry entry, String doiAsString) {
}
String suffix = doiAsString.substring(doiAsString.lastIndexOf('/') + 1);
String organizationId = doiAsString.substring(doiAsString.indexOf('.') + 1, doiAsString.indexOf('/'));
return organizationId.equals(APS_JOURNAL_ORG_DOI_ID) && APS_SUFFIX_PATTERN.matcher(suffix).matches();
return APS_JOURNAL_ORG_DOI_ID.equals(organizationId) && APS_SUFFIX_PATTERN.matcher(suffix).matches();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ private void parseDatabaseID() throws IOException {
skipWhitespace();
String label = parseTextToken().trim();

if (label.equals(BibtexDatabaseWriter.DATABASE_ID_PREFIX)) {
if (BibtexDatabaseWriter.DATABASE_ID_PREFIX.equals(label)) {
skipWhitespace();
database.setSharedDatabaseID(parseTextToken().trim());
}
Expand Down Expand Up @@ -354,7 +354,7 @@ private void parseJabRefComment(Map<String, String> meta) {
// We remove all line breaks in the metadata
// These have been inserted to prevent too long lines when the file was saved, and are not part of the data.
String comment = buffer.toString().replaceAll("[\\x0d\\x0a]", "");
if (comment.substring(0, Math.min(comment.length(), MetaData.META_FLAG.length())).equals(MetaData.META_FLAG)) {
if (MetaData.META_FLAG.equals(comment.substring(0, Math.min(comment.length(), MetaData.META_FLAG.length())))) {
if (comment.startsWith(MetaData.META_FLAG)) {
String rest = comment.substring(MetaData.META_FLAG.length());

Expand All @@ -367,8 +367,8 @@ private void parseJabRefComment(Map<String, String> meta) {
dumpTextReadSoFarToString();
}
}
} else if (comment.substring(0, Math.min(comment.length(), MetaData.ENTRYTYPE_FLAG.length()))
.equals(MetaData.ENTRYTYPE_FLAG)) {
} else if (MetaData.ENTRYTYPE_FLAG
.equals(comment.substring(0, Math.min(comment.length(), MetaData.ENTRYTYPE_FLAG.length())))) {
// A custom entry type can also be stored in a
// "@comment"
Optional<BibEntryType> typ = MetaDataParser.parseCustomEntryType(comment);
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/org/jabref/logic/importer/util/MetaDataParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public MetaData parse(MetaData metaData, Map<String, String> data, Character key
} else if (entry.getKey().startsWith(MetaData.SELECTOR_META_PREFIX)) {
// edge case, it might be one special field e.g. article from biblatex-apa, but we can't distinguish this from any other field and rather prefer to handle it as UnknownField
metaData.addContentSelector(ContentSelectors.parse(FieldFactory.parseField(entry.getKey().substring(MetaData.SELECTOR_META_PREFIX.length())), StringUtil.unquote(entry.getValue(), MetaData.ESCAPE_CHARACTER)));
} else if (entry.getKey().equals(MetaData.FILE_DIRECTORY)) {
} else if (MetaData.FILE_DIRECTORY.equals(entry.getKey())) {
metaData.setLibrarySpecificFileDirectory(parseDirectory(entry.getValue()));
} else if (entry.getKey().startsWith(MetaData.FILE_DIRECTORY + '-')) {
// The user name starts directly after FILE_DIRECTORY + '-'
Expand All @@ -130,26 +130,26 @@ public MetaData parse(MetaData metaData, Map<String, String> data, Character key
String user = entry.getKey().substring(MetaData.FILE_DIRECTORY_LATEX.length() + 1);
Path path = Path.of(parseDirectory(entry.getValue())).normalize();
metaData.setLatexFileDirectory(user, path);
} else if (entry.getKey().equals(MetaData.SAVE_ACTIONS)) {
} else if (MetaData.SAVE_ACTIONS.equals(entry.getKey())) {
metaData.setSaveActions(fieldFormatterCleanupsParse(values));
} else if (entry.getKey().equals(MetaData.DATABASE_TYPE)) {
} else if (MetaData.DATABASE_TYPE.equals(entry.getKey())) {
metaData.setMode(BibDatabaseMode.parse(getSingleItem(values)));
} else if (entry.getKey().equals(MetaData.KEYPATTERNDEFAULT)) {
} else if (MetaData.KEYPATTERNDEFAULT.equals(entry.getKey())) {
defaultCiteKeyPattern = new CitationKeyPattern(getSingleItem(values));
} else if (entry.getKey().equals(MetaData.PROTECTED_FLAG_META)) {
} else if (MetaData.PROTECTED_FLAG_META.equals(entry.getKey())) {
if (Boolean.parseBoolean(getSingleItem(values))) {
metaData.markAsProtected();
} else {
metaData.markAsNotProtected();
}
} else if (entry.getKey().equals(MetaData.SAVE_ORDER_CONFIG)) {
} else if (MetaData.SAVE_ORDER_CONFIG.equals(entry.getKey())) {
metaData.setSaveOrder(SaveOrder.parse(values));
} else if (entry.getKey().equals(MetaData.GROUPSTREE) || entry.getKey().equals(MetaData.GROUPSTREE_LEGACY)) {
} else if (MetaData.GROUPSTREE.equals(entry.getKey()) || MetaData.GROUPSTREE_LEGACY.equals(entry.getKey())) {
metaData.setGroups(GroupsParser.importGroups(values, keywordSeparator, fileMonitor, metaData));
} else if (entry.getKey().equals(MetaData.GROUPS_SEARCH_SYNTAX_VERSION)) {
} else if (MetaData.GROUPS_SEARCH_SYNTAX_VERSION.equals(entry.getKey())) {
Version version = Version.parse(getSingleItem(values));
metaData.setGroupSearchSyntaxVersion(version);
} else if (entry.getKey().equals(MetaData.VERSION_DB_STRUCT)) {
} else if (MetaData.VERSION_DB_STRUCT.equals(entry.getKey())) {
metaData.setVersionDBStructure(getSingleItem(values));
} else {
// Keep meta data items that we do not know in the file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public Optional<String> checkValue(String value) {
return Optional.empty();
}

if (value.equals(FIRST_EDITION)) {
if (FIRST_EDITION.equals(value)) {
return Optional.of(Localization.lang("edition of book reported as just 1"));
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/logic/layout/Layout.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public Layout(List<StringInt> parsedEntries,
tmpEntries.add(le);
blockEntries = null;
} else {
LOGGER.debug(blockStart + '\n' + parsedEntry.s);
LOGGER.debug("{}\n{}", blockStart, parsedEntry.s);
LOGGER.warn("Nested field/group entries are not implemented!");
Thread.dumpStack();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void run() {

if (notifications != null) {
for (PGNotification notification : notifications) {
if (!notification.getName().equals(DBMSProcessor.PROCESSOR_ID)) {
if (!DBMSProcessor.PROCESSOR_ID.equals(notification.getName())) {
dbmsSynchronizer.pullChanges();
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/jabref/logic/util/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private static Logger getLogger() {
* @return the parsed version or {@link Version#UNKNOWN_VERSION} if an error occurred
*/
public static Version parse(String version) {
if ((version == null) || version.isEmpty() || version.equals(BuildInfo.UNKNOWN_VERSION)
if ((version == null) || version.isEmpty() || BuildInfo.UNKNOWN_VERSION.equals(version)
|| "${version}".equals(version)) {
return UNKNOWN_VERSION;
}
Expand Down Expand Up @@ -127,9 +127,9 @@ public boolean isNewerThan(Version otherVersion) {
Objects.requireNonNull(otherVersion);
if (Objects.equals(this, otherVersion)) {
return false;
} else if (this.getFullVersion().equals(BuildInfo.UNKNOWN_VERSION)) {
} else if (BuildInfo.UNKNOWN_VERSION.equals(this.getFullVersion())) {
return false;
} else if (otherVersion.getFullVersion().equals(BuildInfo.UNKNOWN_VERSION)) {
} else if (BuildInfo.UNKNOWN_VERSION.equals(otherVersion.getFullVersion())) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -516,9 +516,9 @@ private static void upgradeCleanups(JabRefCliPreferences prefs) {
List<String> formatterCleanups = List.of(StringUtil.unifyLineBreaks(prefs.get(V5_8_CLEANUP_FIELD_FORMATTERS), "\n")
.split("\n"));
if (formatterCleanups.size() >= 2
&& (formatterCleanups.getFirst().equals(FieldFormatterCleanups.ENABLED)
|| formatterCleanups.getFirst().equals(FieldFormatterCleanups.DISABLED))) {
prefs.putBoolean(V6_0_CLEANUP_FIELD_FORMATTERS_ENABLED, formatterCleanups.getFirst().equals(FieldFormatterCleanups.ENABLED)
&& (FieldFormatterCleanups.ENABLED.equals(formatterCleanups.getFirst())
|| FieldFormatterCleanups.DISABLED.equals(formatterCleanups.getFirst()))) {
prefs.putBoolean(V6_0_CLEANUP_FIELD_FORMATTERS_ENABLED, FieldFormatterCleanups.ENABLED.equals(formatterCleanups.getFirst())
? Boolean.TRUE
: Boolean.FALSE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public boolean isBiblatexMode() {
*/
public boolean isStudy() {
return this.getDatabasePath()
.map(path -> path.getFileName().toString().equals(Crawler.FILENAME_STUDY_RESULT_BIB) &&
.map(path -> Crawler.FILENAME_STUDY_RESULT_BIB.equals(path.getFileName().toString()) &&
Files.exists(path.resolveSibling(StudyRepository.STUDY_DEFINITION_FILE_NAME)))
.orElse(false);
}
Expand Down