diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ecb5ffcdc45..20073534ba2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ on: jobs: build: - name: ${{ matrix.os }} with Java 17 + name: ${{ matrix.os }} with Java 21 runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -22,11 +22,11 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Set up JDK 17 + - name: Set up JDK uses: actions/setup-java@v4 with: distribution: 'oracle' - java-version: '17' + java-version: '21' - name: Cache Maven packages uses: actions/cache@v4 with: diff --git a/.github/workflows/javadoc.yml b/.github/workflows/javadoc.yml index 43374bbe752..98fda6162c8 100644 --- a/.github/workflows/javadoc.yml +++ b/.github/workflows/javadoc.yml @@ -18,11 +18,11 @@ jobs: steps: - name: Checkout master branch uses: actions/checkout@v4 - - name: Set up JDK 17 + - name: Set up JDK uses: actions/setup-java@v4 with: distribution: 'oracle' - java-version: '17' + java-version: '21' - name: Cache Maven packages uses: actions/cache@v4 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f3ec07b299e..7c16a03c020 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,11 +25,11 @@ jobs: steps: - name: Checkout master branch uses: actions/checkout@v4 - - name: Set up JDK 17 + - name: Set up JDK uses: actions/setup-java@v4 with: distribution: 'oracle' - java-version: '17' + java-version: '21' - name: Cache Maven packages uses: actions/cache@v4 with: diff --git a/Dockerfile b/Dockerfile index a9dd3bfcddc..a1f15c80f63 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,10 @@ -# Copyright (c) 2018, 2024 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2018, 2025 Oracle and/or its affiliates. All rights reserved. # Portions Copyright (c) 2020, Chris Fraire . FROM ubuntu:jammy AS build # hadolint ignore=DL3008 -RUN apt-get update && apt-get install --no-install-recommends -y openjdk-17-jdk python3 python3-venv && \ +RUN apt-get update && apt-get install --no-install-recommends -y openjdk-21-jdk python3 python3-venv && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* @@ -41,7 +41,7 @@ RUN cp `ls -t distribution/target/*.tar.gz | head -1` /opengrok.tar.gz # Store the version in a file so that the tools can report it. RUN /mvn/mvnw help:evaluate -Dexpression=project.version -q -DforceStdout > /mvn/VERSION -FROM tomcat:10.1.40-jdk17 +FROM tomcat:10.1.40-jdk21 LABEL maintainer="https://github.com/oracle/opengrok" LABEL org.opencontainers.image.source="https://github.com/oracle/opengrok" LABEL org.opencontainers.image.description="OpenGrok code search" diff --git a/docker/README.md b/docker/README.md index 02981104d57..d3f939dbeb0 100644 --- a/docker/README.md +++ b/docker/README.md @@ -26,7 +26,7 @@ image based on the official one. ## Additional info about the image * Tomcat 10 -* JRE 17 +* JRE 21 * Configurable mirroring/reindexing (default every 10 min) The mirroring step works by going through all projects and attempting to diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/Definitions.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/Definitions.java index 6c26ecb04a0..17681f8ddab 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/Definitions.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/Definitions.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2018, Chris Fraire . */ package org.opengrok.indexer.analysis; @@ -66,7 +66,7 @@ public static class LineTagMap implements Serializable { private static final long serialVersionUID = 1191703801007779481L; @SuppressWarnings("java:S116") - private final Map> sym_tags; //NOPMD + private final HashMap> sym_tags; //NOPMD protected LineTagMap() { this.sym_tags = new HashMap<>(); @@ -74,16 +74,16 @@ protected LineTagMap() { } // line number -> tag map @SuppressWarnings("java:S116") - private final Map line_maps; + private final HashMap line_maps; /** * Map from symbol to the line numbers on which the symbol is defined. */ - private final Map> symbols; + private final HashMap> symbols; /** * List of all the tags. */ - private final List tags; + private final ArrayList tags; public Definitions() { symbols = new HashMap<>(); diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/JFlexTokenizer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/JFlexTokenizer.java index 0824870747f..9509a1652fd 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/JFlexTokenizer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/JFlexTokenizer.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2017, 2020, Chris Fraire . */ package org.opengrok.indexer.analysis; @@ -49,6 +49,7 @@ public class JFlexTokenizer extends Tokenizer * will be owned by the {@link JFlexTokenizer}. * @param matcher a defined instance */ + @SuppressWarnings("this-escape") public JFlexTokenizer(ScanningSymbolMatcher matcher) { if (matcher == null) { throw new IllegalArgumentException("`matcher' is null"); @@ -83,12 +84,9 @@ public final void close() throws IOException { matcher.yyclose(); } - private final CharTermAttribute termAtt = addAttribute( - CharTermAttribute.class); - private final OffsetAttribute offsetAtt = addAttribute( - OffsetAttribute.class); - private final PositionIncrementAttribute posIncrAtt = addAttribute( - PositionIncrementAttribute.class); + private final CharTermAttribute termAtt = addAttribute(CharTermAttribute.class); + private final OffsetAttribute offsetAtt = addAttribute(OffsetAttribute.class); + private final PositionIncrementAttribute posIncrAtt = addAttribute(PositionIncrementAttribute.class); /** * Attempts to advance the stream to the next acceptable token, and updates diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/JFlexXref.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/JFlexXref.java index a11ff4748e9..ee3434f935c 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/JFlexXref.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/JFlexXref.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2009, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2011, Jens Elkner. * Portions Copyright (c) 2017, 2020, Chris Fraire . */ @@ -37,8 +37,7 @@ /** * @author Lubos Kosco */ -public class JFlexXref implements Xrefer, SymbolMatchedListener, - NonSymbolMatchedListener { +public class JFlexXref implements Xrefer, SymbolMatchedListener, NonSymbolMatchedListener { /** * Used to indicate pre-formatted output with @@ -99,6 +98,7 @@ public class JFlexXref implements Xrefer, SymbolMatchedListener, * will be owned by the {@link JFlexXref}. * @param matcher a defined instance */ + @SuppressWarnings("this-escape") public JFlexXref(ScanningSymbolMatcher matcher) { if (matcher == null) { throw new IllegalArgumentException("`matcher' is null"); @@ -109,11 +109,11 @@ public JFlexXref(ScanningSymbolMatcher matcher) { // The xrefer will own the matcher, so we won't have to unsubscribe. userPageLink = RuntimeEnvironment.getInstance().getUserPage(); - if (userPageLink != null && userPageLink.length() == 0) { + if (userPageLink != null && userPageLink.isEmpty()) { userPageLink = null; } userPageSuffix = RuntimeEnvironment.getInstance().getUserPageSuffix(); - if (userPageSuffix != null && userPageSuffix.length() == 0) { + if (userPageSuffix != null && userPageSuffix.isEmpty()) { userPageSuffix = null; } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/PathTokenizer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/PathTokenizer.java index d1cd58ea06d..fea6129912a 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/PathTokenizer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/PathTokenizer.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2018, Chris Fraire . */ package org.opengrok.indexer.analysis; @@ -52,7 +52,9 @@ public class PathTokenizer extends Tokenizer { // below should be '/' since we try to convert even windows file separators // to unix ones public static final char DEFAULT_DELIMITER = '/'; + @SuppressWarnings("this-escape") private final CharTermAttribute termAtt = addAttribute(CharTermAttribute.class); + @SuppressWarnings("this-escape") private final OffsetAttribute offsetAtt = addAttribute(OffsetAttribute.class); private int startPosition = 0; private final char delimiter; diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/plain/DefinitionsTokenStream.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/plain/DefinitionsTokenStream.java index 0b9023d511a..61b72413a73 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/plain/DefinitionsTokenStream.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/plain/DefinitionsTokenStream.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2020, Chris Fraire . */ package org.opengrok.indexer.analysis.plain; @@ -48,12 +48,12 @@ public class DefinitionsTokenStream extends TokenStream { */ private final List events = new ArrayList<>(); - private final CharTermAttribute termAtt = addAttribute( - CharTermAttribute.class); - private final OffsetAttribute offsetAtt = addAttribute( - OffsetAttribute.class); - private final PositionIncrementAttribute posIncrAtt = addAttribute( - PositionIncrementAttribute.class); + @SuppressWarnings("this-escape") + private final CharTermAttribute termAtt = addAttribute(CharTermAttribute.class); + @SuppressWarnings("this-escape") + private final OffsetAttribute offsetAtt = addAttribute(OffsetAttribute.class); + @SuppressWarnings("this-escape") + private final PositionIncrementAttribute posIncrAtt = addAttribute(PositionIncrementAttribute.class); private int offset; @@ -65,8 +65,7 @@ public class DefinitionsTokenStream extends TokenStream { * @param wrapper an optional instance * @throws IOException if I/O error occurs */ - public void initialize(Definitions defs, StreamSource src, - ReaderWrapper wrapper) throws IOException { + public void initialize(Definitions defs, StreamSource src, ReaderWrapper wrapper) throws IOException { if (defs == null) { throw new IllegalArgumentException("`defs' is null"); } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/authorization/AuthorizationEntity.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/authorization/AuthorizationEntity.java index 086bb540301..bea0683b0d3 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/authorization/AuthorizationEntity.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/authorization/AuthorizationEntity.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2018, Chris Fraire . */ package org.opengrok.indexer.authorization; @@ -119,14 +119,14 @@ public boolean test(AuthorizationEntity t) { */ protected AuthControlFlag flag; protected String name; - protected Map setup = new TreeMap<>(); + protected transient Map setup = new TreeMap<>(); /** * Hold current setup - merged with all ancestor's stacks. */ protected transient Map currentSetup = new TreeMap<>(); - private Set forProjects = new TreeSet<>(); - private Set forGroups = new TreeSet<>(); + private transient Set forProjects = new TreeSet<>(); + private transient Set forGroups = new TreeSet<>(); protected transient boolean working = true; diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/authorization/AuthorizationStack.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/authorization/AuthorizationStack.java index 3d6cc130b7c..2fb2e1ee770 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/authorization/AuthorizationStack.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/authorization/AuthorizationStack.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2018, Chris Fraire . */ package org.opengrok.indexer.authorization; @@ -51,7 +51,7 @@ public class AuthorizationStack extends AuthorizationEntity { private static final Logger LOGGER = LoggerFactory.getLogger(AuthorizationStack.class); - private List stack = new ArrayList<>(); + private transient List stack = new ArrayList<>(); public AuthorizationStack() { } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/Filter.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/Filter.java index 235a6452c10..d70ae4b2b30 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/Filter.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/Filter.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2020, Chris Fraire . */ package org.opengrok.indexer.configuration; @@ -37,11 +37,11 @@ public class Filter implements Serializable { private static final long serialVersionUID = 3L; /** The list of exact filenames. */ - private final Set filenames; + private final transient Set filenames; /** The list of filenames with wildcards. */ - private final List patterns; + private final transient List patterns; /** The list of paths. */ - private final List paths; + private final transient List paths; /** * The full list of all patterns. This list will be saved in the * configuration file (if used). diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/SuggesterConfig.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/SuggesterConfig.java index 359305b3bc1..e9c606b33f1 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/SuggesterConfig.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/SuggesterConfig.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2019, Chris Fraire . */ package org.opengrok.indexer.configuration; @@ -170,7 +170,7 @@ public boolean isEnabled() { return enabled; } - public void setEnabled(final boolean enabled) { + public final void setEnabled(final boolean enabled) { this.enabled = enabled; } @@ -178,7 +178,7 @@ public int getMaxResults() { return maxResults; } - public void setMaxResults(final int maxResults) { + public final void setMaxResults(final int maxResults) { if (maxResults <= 0) { throw new IllegalArgumentException("Max results cannot be negative or zero"); } @@ -189,7 +189,7 @@ public int getMinChars() { return minChars; } - public void setMinChars(final int minChars) { + public final void setMinChars(final int minChars) { if (minChars < 0) { throw new IllegalArgumentException( "Minimum number of characters needed for suggester to provide suggestions cannot be negative"); @@ -201,7 +201,7 @@ public Set getAllowedProjects() { return allowedProjects; } - public void setAllowedProjects(final Set allowedProjects) { + public final void setAllowedProjects(final Set allowedProjects) { this.allowedProjects = allowedProjects; } @@ -209,7 +209,7 @@ public int getMaxProjects() { return maxProjects; } - public void setMaxProjects(final int maxProjects) { + public final void setMaxProjects(final int maxProjects) { if (maxProjects < 1) { throw new IllegalArgumentException("Maximum projects for suggestions cannot be less than 1"); } @@ -220,7 +220,7 @@ public Set getAllowedFields() { return allowedFields; } - public void setAllowedFields(final Set allowedFields) { + public final void setAllowedFields(final Set allowedFields) { this.allowedFields = new HashSet<>(allowedFields); } @@ -228,7 +228,7 @@ public boolean isAllowComplexQueries() { return allowComplexQueries; } - public void setAllowComplexQueries(final boolean allowComplexQueries) { + public final void setAllowComplexQueries(final boolean allowComplexQueries) { this.allowComplexQueries = allowComplexQueries; } @@ -236,7 +236,7 @@ public boolean isAllowMostPopular() { return allowMostPopular; } - public void setAllowMostPopular(final boolean allowMostPopular) { + public final void setAllowMostPopular(final boolean allowMostPopular) { this.allowMostPopular = allowMostPopular; } @@ -244,7 +244,7 @@ public boolean isShowScores() { return showScores; } - public void setShowScores(final boolean showScores) { + public final void setShowScores(final boolean showScores) { this.showScores = showScores; } @@ -252,7 +252,7 @@ public boolean isShowProjects() { return showProjects; } - public void setShowProjects(final boolean showProjects) { + public final void setShowProjects(final boolean showProjects) { this.showProjects = showProjects; } @@ -260,7 +260,7 @@ public boolean isShowTime() { return showTime; } - public void setShowTime(final boolean showTime) { + public final void setShowTime(final boolean showTime) { this.showTime = showTime; } @@ -268,7 +268,7 @@ public String getRebuildCronConfig() { return rebuildCronConfig; } - public void setRebuildCronConfig(final String rebuildCronConfig) { + public final void setRebuildCronConfig(final String rebuildCronConfig) { if (rebuildCronConfig != null) { // check cron format CronParser parser = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.UNIX)); parser.parse(rebuildCronConfig); // throws IllegalArgumentException if invalid @@ -280,7 +280,7 @@ public int getBuildTerminationTime() { return buildTerminationTime; } - public void setBuildTerminationTime(final int buildTerminationTime) { + public final void setBuildTerminationTime(final int buildTerminationTime) { if (buildTerminationTime < 0) { throw new IllegalArgumentException("Suggester build termination time cannot be negative"); } @@ -291,14 +291,14 @@ public int getTimeThreshold() { return timeThreshold; } - public void setTimeThreshold(final int timeThreshold) { + public final void setTimeThreshold(final int timeThreshold) { if (timeThreshold < 0) { throw new IllegalArgumentException("Time threshold for suggestions cannot be negative"); } this.timeThreshold = timeThreshold; } - public void setRebuildThreadPoolSizeInNcpuPercent(final int percent) { + public final void setRebuildThreadPoolSizeInNcpuPercent(final int percent) { if (percent < 0 || percent > 100) { throw new IllegalArgumentException("Need percentage value"); } @@ -309,7 +309,7 @@ public int getRebuildThreadPoolSizeInNcpuPercent() { return rebuildThreadPoolSizeInNcpuPercent; } - public void setSearchThreadPoolSizeInNcpuPercent(final int percent) { + public final void setSearchThreadPoolSizeInNcpuPercent(final int percent) { if (percent < 0 || percent > 100) { throw new IllegalArgumentException("Need percentage value"); } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/framework/PluginFramework.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/framework/PluginFramework.java index 988db5acbf8..8b96a682117 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/framework/PluginFramework.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/framework/PluginFramework.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. */ package org.opengrok.indexer.framework; @@ -97,7 +97,7 @@ public synchronized File getPluginDirectory() { * * @param pluginDirectory the directory */ - public synchronized void setPluginDirectory(File pluginDirectory) { + public final synchronized void setPluginDirectory(File pluginDirectory) { this.pluginDirectory = pluginDirectory; } @@ -106,7 +106,7 @@ public synchronized void setPluginDirectory(File pluginDirectory) { * * @param directory the directory path */ - public synchronized void setPluginDirectory(String directory) { + public final synchronized void setPluginDirectory(String directory) { setPluginDirectory(directory != null ? new File(directory) : null); } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/AccuRevRepository.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/AccuRevRepository.java index 7f024d00e2f..2f321203791 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/AccuRevRepository.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/AccuRevRepository.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2018, Chris Fraire . */ package org.opengrok.indexer.history; @@ -96,6 +96,7 @@ public class AccuRevRepository extends Repository { */ private static final String DEPOT_ROOT = String.format("%s.%s", File.separator, File.separator); + @SuppressWarnings("this-escape") public AccuRevRepository() { type = "AccuRev"; datePatterns = new String[]{ diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/Annotation.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/Annotation.java index afa7e27cfe3..32fe05daf3b 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/Annotation.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/Annotation.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2019, Krystof Tulinger . * Portions Copyright (c) 2020, Chris Fraire . * Portions Copyright (c) 2023, Ric Harris . @@ -123,9 +123,9 @@ public String getRevisionForDisplay(int line) { /** * Gets all revisions that are in use, first is the lowest one (sorted using natural order). * - * @return list of all revisions the file has + * @return set of all revisions the file has */ - public Set getRevisions() { + public final Set getRevisions() { return annotationData.getRevisions(); } @@ -180,7 +180,7 @@ void addFileVersion(String revision, int fileVersion) { * @param revision revision number * @return file version number. 0 if unknown. 1 first version of file, etc. */ - public int getFileVersion(String revision) { + public final int getFileVersion(String revision) { return fileVersions.getOrDefault(revision, 0); } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/AnnotationData.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/AnnotationData.java index e8b4c90ddb5..8c5dbf71c68 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/AnnotationData.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/AnnotationData.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2023, Ric Harris . */ package org.opengrok.indexer.history; @@ -52,7 +52,7 @@ public AnnotationData(String filename) { this.filename = filename; } - private List annotationLines = new ArrayList<>(); + private transient List annotationLines = new ArrayList<>(); private int widestRevision; private int widestAuthor; private String filename; diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/BitKeeperRepository.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/BitKeeperRepository.java index e3145f9e94b..a1b09ca004a 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/BitKeeperRepository.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/BitKeeperRepository.java @@ -19,7 +19,7 @@ /* * Copyright (c) 2017, James Service - * Portions Copyright (c) 2017, 2021, Oracle and/or its affiliates. + * Portions Copyright (c) 2017, 2025, Oracle and/or its affiliates. * Portions Copyright (c) 2018, Chris Fraire . */ package org.opengrok.indexer.history; @@ -88,7 +88,7 @@ public class BitKeeperRepository extends Repository { /** * The version of the BitKeeper executable. This affects the correct dspec to use for tags. */ - private Version version = null; + private transient Version version = null; /** * Constructor to construct the thing to be constructed. diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/CVSRepository.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/CVSRepository.java index f68f68d47a7..5da32d5b86e 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/CVSRepository.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/CVSRepository.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2017, 2020, Chris Fraire . */ package org.opengrok.indexer.history; @@ -58,6 +58,7 @@ public class CVSRepository extends RCSRepository { */ public static final String CMD_FALLBACK = "cvs"; + @SuppressWarnings("this-escape") public CVSRepository() { /* * This variable is set in the ancestor to TRUE which has a side effect diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/History.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/History.java index dca8d97aa81..edd1b6fa9f6 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/History.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/History.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2019, Chris Fraire . */ package org.opengrok.indexer.history; @@ -46,12 +46,12 @@ public class History implements Serializable { static final String TAGS_SEPARATOR = ", "; /** Entries in the log. The first entry is the most recent one. */ - private List entries; + private transient List entries; /** * Track renamed files, so they can be treated in special way (for some SCMs) during cache creation. * These are relative to repository root. */ - private final Set renamedFiles; + private final transient Set renamedFiles; /** * Revision of the newest change. Used in history cache. @@ -59,7 +59,7 @@ public class History implements Serializable { private String latestRev; // revision to tag list. Individual tags are joined via TAGS_SEPARATOR. - private Map tags = new HashMap<>(); + private transient Map tags = new HashMap<>(); public History() { this(new ArrayList<>()); diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/HistoryEntry.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/HistoryEntry.java index f91def5e692..b1da1d394ea 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/HistoryEntry.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/HistoryEntry.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2019, Chris Fraire . */ package org.opengrok.indexer.history; @@ -57,7 +57,7 @@ public class HistoryEntry implements Serializable { private boolean active; @JsonIgnore - private SortedSet files; + private transient SortedSet files; /** Creates a new instance of HistoryEntry. */ public HistoryEntry() { diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/RepoRepository.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/RepoRepository.java index 90a23f66905..8b230f4d0ce 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/RepoRepository.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/RepoRepository.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2010, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2010, Trond Norbye . All rights reserved. * Portions Copyright (c) 2018, Chris Fraire . */ @@ -48,6 +48,7 @@ public class RepoRepository extends Repository { */ public static final String CMD_FALLBACK = "repo"; + @SuppressWarnings("this-escape") public RepoRepository() { type = "repo"; setWorking(Boolean.TRUE); diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/Repository.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/Repository.java index d2ddf2831f2..33eac3aa22f 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/Repository.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/Repository.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2017, 2020, Chris Fraire . */ package org.opengrok.indexer.history; @@ -78,15 +78,15 @@ public abstract class Repository extends RepositoryInfo { */ protected String RepoCommand; - protected final List ignoredFiles; + protected final transient List ignoredFiles; - protected final List ignoredDirs; + protected final transient List ignoredDirs; /** * List of <revision, tags> pairs for repositories which display tags * only for files changed by the tagged commit. */ - protected NavigableSet tagList = null; + protected transient NavigableSet tagList = null; abstract boolean fileHasHistory(File file); diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/SSCMRepository.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/SSCMRepository.java index 7ef1692b5d8..cb29497bba0 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/SSCMRepository.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/SSCMRepository.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2018, Chris Fraire . */ package org.opengrok.indexer.history; @@ -70,6 +70,7 @@ public class SSCMRepository extends Repository { private static final String BRANCH_PROPERTY = "SCMBranch"; private static final String REPOSITORY_PROPERTY = "SCMRepository"; + @SuppressWarnings("this-escape") public SSCMRepository() { setType("SSCM"); setRemote(true); diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexAnalysisSettings.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexAnalysisSettings.java index e180f4bae7a..3da03a3ac8e 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexAnalysisSettings.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexAnalysisSettings.java @@ -18,6 +18,7 @@ */ /* + * Portions Copyright (c) 2025, Oracle and/or its affiliates. * Copyright (c) 2018, Chris Fraire . */ package org.opengrok.indexer.index; @@ -69,7 +70,7 @@ public final class IndexAnalysisSettings implements Serializable { * de-serialization circumvents normal construction. * @serial */ - private Map analyzersVersions = new HashMap<>(); + private transient Map analyzersVersions = new HashMap<>(); /** * Gets the project name to be used to distinguish different instances of diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexAnalysisSettings3.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexAnalysisSettings3.java index be88b724362..4843959d10f 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexAnalysisSettings3.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexAnalysisSettings3.java @@ -18,6 +18,7 @@ */ /* + * Portions Copyright (c) 2025, Oracle and/or its affiliates. * Copyright (c) 2018, 2019, Chris Fraire . */ package org.opengrok.indexer.index; @@ -69,7 +70,7 @@ public final class IndexAnalysisSettings3 implements Serializable { * de-serialization circumvents normal construction. * @serial */ - private Map analyzersVersions = new HashMap<>(); + private transient Map analyzersVersions = new HashMap<>(); /** * Nullable because otherwise custom de-serialization does not work, as a @@ -78,7 +79,7 @@ public final class IndexAnalysisSettings3 implements Serializable { * anything but a simple {@link HashMap} here. * @serial */ - private Map indexedSymlinks = new HashMap<>(); + private transient Map indexedSymlinks = new HashMap<>(); /** * Gets the project name to be used to distinguish different instances of diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexCheckException.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexCheckException.java index 8955ddf4f4c..c6ae86c1c1e 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexCheckException.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexCheckException.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. */ package org.opengrok.indexer.index; @@ -33,7 +33,7 @@ public class IndexCheckException extends Exception { private static final long serialVersionUID = 5693446916108385595L; - private final Set failedPaths = new HashSet<>(); + private final transient Set failedPaths = new HashSet<>(); public IndexCheckException(String message, Path path) { super(message); diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexDocumentException.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexDocumentException.java index a36a9dca1a6..d42d1959015 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexDocumentException.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexDocumentException.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. */ package org.opengrok.indexer.index; @@ -32,8 +32,8 @@ public class IndexDocumentException extends IndexCheckException { private static final long serialVersionUID = -277429315137557112L; - private final Map duplicatePathMap; - private final Set missingPaths; + private final transient Map duplicatePathMap; + private final transient Set missingPaths; public IndexDocumentException(String s, Path path) { super(s, path); diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/search/CustomQueryParser.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/search/CustomQueryParser.java index 37765543b7f..8c83669e7a6 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/search/CustomQueryParser.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/search/CustomQueryParser.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2018, Chris Fraire . */ package org.opengrok.indexer.search; @@ -40,6 +40,7 @@ public class CustomQueryParser extends QueryParser { * * @param field default field for unqualified query terms */ + @SuppressWarnings("this-escape") public CustomQueryParser(String field) { super(field, new CompatibleAnalyser()); setDefaultOperator(AND_OPERATOR); diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/PrefixMatcher.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/PrefixMatcher.java index 7d321994390..bc82fff2d5a 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/PrefixMatcher.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/PrefixMatcher.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. */ package org.opengrok.indexer.search.context; @@ -28,6 +28,7 @@ public class PrefixMatcher extends LineMatcher { private final String prefix; + @SuppressWarnings("this-escape") public PrefixMatcher(String prefix, boolean caseInsensitive) { super(caseInsensitive); this.prefix = normalizeString(prefix); diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/TokenSetMatcher.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/TokenSetMatcher.java index 01c261dedad..e172d213e56 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/TokenSetMatcher.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/TokenSetMatcher.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. */ package org.opengrok.indexer.search.context; @@ -28,6 +28,7 @@ public class TokenSetMatcher extends LineMatcher { private final Set tokenSet; + @SuppressWarnings("this-escape") public TokenSetMatcher(Set tokenSet, boolean caseInsensitive) { super(caseInsensitive); diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/WildCardMatcher.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/WildCardMatcher.java index 8ce5f2d4e98..342a6aad6df 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/WildCardMatcher.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/WildCardMatcher.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * * Portions Apache software license, see below * @@ -29,6 +29,7 @@ public class WildCardMatcher extends LineMatcher { final String pattern; + @SuppressWarnings("this-escape") public WildCardMatcher(String pattern, boolean caseInsensitive) { super(caseInsensitive); this.pattern = normalizeString(pattern); diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/util/Progress.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/util/Progress.java index 63fe5713d40..4ee70831690 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/util/Progress.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/util/Progress.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2017, 2020, Chris Fraire . */ package org.opengrok.indexer.util; @@ -189,7 +189,7 @@ private void logLoop() { } @VisibleForTesting - Level getLevel(Map lastLoggedChunk, long currentCount, Level currentLevel) { + final Level getLevel(Map lastLoggedChunk, long currentCount, Level currentLevel) { // The intention is to log the initial and final count at the base log level. if (currentCount <= 1 || (totalCount != null && currentCount == totalCount)) { currentLevel = baseLogLevel; diff --git a/opengrok-indexer/src/main/jflex/search/context/PlainLineTokenizer.lex b/opengrok-indexer/src/main/jflex/search/context/PlainLineTokenizer.lex index 2e2dc020a6c..6c1cf91b606 100644 --- a/opengrok-indexer/src/main/jflex/search/context/PlainLineTokenizer.lex +++ b/opengrok-indexer/src/main/jflex/search/context/PlainLineTokenizer.lex @@ -18,12 +18,9 @@ */ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. */ -/** - * for plain text tokenizers - */ package org.opengrok.indexer.search.context; import java.io.CharArrayReader; @@ -37,6 +34,9 @@ import org.opengrok.indexer.web.Util; import org.opengrok.indexer.analysis.Scopes; import org.opengrok.indexer.analysis.Scopes.Scope; +/** + * for plain text tokenizers + */ %% %public diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/DefinitionsTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/DefinitionsTest.java index 2365c5768cd..94470ac67ab 100644 --- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/DefinitionsTest.java +++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/DefinitionsTest.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2010, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2018, Chris Fraire . */ package org.opengrok.indexer.analysis; @@ -140,9 +140,9 @@ void serialize() throws Exception { Definitions instance = new Definitions(); instance.addTag(1, "one", "", "", 0, 0); byte[] serial = instance.serialize(); - Definitions instance2 = Definitions.deserialize(serial); - assertEquals(instance.getTags().size(), instance2.getTags().size()); - assertEquals(instance.getSymbols().size(), instance2.getSymbols().size()); + Definitions deserializedInstance = Definitions.deserialize(serial); + assertEquals(instance.getTags().size(), deserializedInstance.getTags().size()); + assertEquals(instance.getSymbols().size(), deserializedInstance.getSymbols().size()); } } diff --git a/opengrok-web/src/main/java/org/opengrok/web/api/v1/RestApp.java b/opengrok-web/src/main/java/org/opengrok/web/api/v1/RestApp.java index ba2a1a5aace..1ff4a1d12c7 100644 --- a/opengrok-web/src/main/java/org/opengrok/web/api/v1/RestApp.java +++ b/opengrok-web/src/main/java/org/opengrok/web/api/v1/RestApp.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. */ package org.opengrok.web.api.v1; @@ -31,10 +31,10 @@ public class RestApp extends ResourceConfig { public static final String API_PATH = "api/v1"; + @SuppressWarnings("this-escape") public RestApp() { register(new SuggesterAppBinder()); packages("org.opengrok.web.api.constraints", "org.opengrok.web.api.error"); packages(true, "org.opengrok.web.api.v1"); } - } diff --git a/plugins/src/main/java/opengrok/auth/entity/LdapUser.java b/plugins/src/main/java/opengrok/auth/entity/LdapUser.java index f67dbcf738b..5a342cf116f 100644 --- a/plugins/src/main/java/opengrok/auth/entity/LdapUser.java +++ b/plugins/src/main/java/opengrok/auth/entity/LdapUser.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. */ package opengrok.auth.entity; @@ -36,7 +36,7 @@ public class LdapUser implements Serializable { private String dn; // Distinguished Name - private final Map> attributes; + private final transient Map> attributes; private static final long serialVersionUID = 1L; diff --git a/plugins/src/main/java/opengrok/auth/plugin/configuration/Configuration.java b/plugins/src/main/java/opengrok/auth/plugin/configuration/Configuration.java index fc211f8a168..e62459c6c85 100644 --- a/plugins/src/main/java/opengrok/auth/plugin/configuration/Configuration.java +++ b/plugins/src/main/java/opengrok/auth/plugin/configuration/Configuration.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. */ package opengrok.auth.plugin.configuration; @@ -30,6 +30,7 @@ import java.io.OutputStream; import java.io.Serializable; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import com.fasterxml.jackson.annotation.JsonAutoDetect; @@ -55,7 +56,7 @@ public class Configuration implements Serializable { private static final long serialVersionUID = -1; @JsonProperty - private List servers = new ArrayList<>(); + private ArrayList servers = new ArrayList<>(); @JsonProperty private int interval; @JsonProperty @@ -71,8 +72,8 @@ public class Configuration implements Serializable { @JsonProperty private int countLimit; - public void setServers(List servers) { - this.servers = servers; + public void setServers(Collection servers) { + this.servers = new ArrayList<>(servers); } public List getServers() { diff --git a/plugins/src/main/java/opengrok/auth/plugin/ldap/LdapFacade.java b/plugins/src/main/java/opengrok/auth/plugin/ldap/LdapFacade.java index ba6d619be8f..0fbaaddd385 100644 --- a/plugins/src/main/java/opengrok/auth/plugin/ldap/LdapFacade.java +++ b/plugins/src/main/java/opengrok/auth/plugin/ldap/LdapFacade.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. */ package opengrok.auth.plugin.ldap; @@ -182,7 +182,7 @@ public LdapFacade(Configuration cfg) { setSearchBase(cfg.getSearchBase()); setWebHooks(cfg.getWebHooks()); - // Anti-pattern: do some non trivial stuff in the constructor. + // Anti-pattern: do some non-trivial stuff in the constructor. prepareSearchControls(cfg.getSearchTimeout(), cfg.getCountLimit()); prepareServers(); } @@ -194,8 +194,8 @@ private void setWebHooks(WebHooks webHooks) { /** * Go through all servers in the pool and record the first working. */ - void prepareServers() { - LOGGER.log(Level.FINER, "checking servers for {0}", this); + final void prepareServers() { + LOGGER.log(Level.FINER, "checking servers {0}", servers); for (int i = 0; i < servers.size(); i++) { LdapServer server = servers.get(i); if (server.isWorking() && actualServer == -1) { @@ -231,7 +231,7 @@ public List getServers() { return servers; } - public LdapFacade setServers(List servers, int connectTimeout, int readTimeout) { + public final LdapFacade setServers(List servers, int connectTimeout, int readTimeout) { this.servers = servers; // Inherit timeout values from server pool configuration. for (LdapServer server : servers) { @@ -249,7 +249,7 @@ public int getInterval() { return interval; } - public void setInterval(int interval) { + public final void setInterval(int interval) { this.interval = interval; for (LdapServer server : servers) { server.setInterval(interval); @@ -260,7 +260,7 @@ public String getSearchBase() { return searchBase; } - public void setSearchBase(String base) { + public final void setSearchBase(String base) { this.searchBase = base; } diff --git a/plugins/src/main/java/opengrok/auth/plugin/ldap/LdapServer.java b/plugins/src/main/java/opengrok/auth/plugin/ldap/LdapServer.java index 5d6ffb94526..63948040895 100644 --- a/plugins/src/main/java/opengrok/auth/plugin/ldap/LdapServer.java +++ b/plugins/src/main/java/opengrok/auth/plugin/ldap/LdapServer.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. */ package opengrok.auth.plugin.ldap; @@ -83,7 +83,7 @@ public class LdapServer implements Serializable { private int readTimeout; private int interval = 10 * 1000; - private final Map env; + private final transient Map env; private transient LdapContext ctx; private long errorTimestamp = 0; @@ -111,7 +111,7 @@ public String getUrl() { return url; } - public LdapServer setName(String name) { + public final LdapServer setName(String name) { this.url = name; return this; } diff --git a/pom.xml b/pom.xml index 081aa83469e..7f5c33342b7 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ information: Portions Copyright [yyyy] [name of copyright owner] CDDL HEADER END -Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. Portions Copyright (c) 2018, 2020, Chris Fraire . --> @@ -74,7 +74,7 @@ Portions Copyright (c) 2018, 2020, Chris Fraire . 3.0.0-M5 3.13.0 1.14.1 - 5.2.0 + 5.17.0 2.14.0 diff --git a/suggester/pom.xml b/suggester/pom.xml index 81de2854a31..a32e03eb2ab 100644 --- a/suggester/pom.xml +++ b/suggester/pom.xml @@ -18,7 +18,7 @@ information: Portions Copyright [yyyy] [name of copyright owner] CDDL HEADER END -Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. Portions Copyright (c) 2020, Chris Fraire . --> @@ -101,7 +101,7 @@ Portions Copyright (c) 2020, Chris Fraire . net.openhft chronicle-map - 3.22.9 + 3.27ea0 com.sun.java diff --git a/suggester/src/main/java/org/opengrok/suggest/popular/impl/chronicle/ChronicleMapAdapter.java b/suggester/src/main/java/org/opengrok/suggest/popular/impl/chronicle/ChronicleMapAdapter.java index c39e618d0d1..3ccb928524b 100644 --- a/suggester/src/main/java/org/opengrok/suggest/popular/impl/chronicle/ChronicleMapAdapter.java +++ b/suggester/src/main/java/org/opengrok/suggest/popular/impl/chronicle/ChronicleMapAdapter.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. */ package org.opengrok.suggest.popular.impl.chronicle; @@ -52,7 +52,7 @@ public ChronicleMapAdapter(final String name, final double averageKeySize, final .averageKeySize(averageKeySize) .keyReaderAndDataAccess(BytesRefSizedReader.INSTANCE, new BytesRefDataAccess()) .entries(entries) - .createOrRecoverPersistedTo(file); + .createPersistedTo(file); this.chronicleMapFile = file; } @@ -135,7 +135,7 @@ public void resize(final int newMapSize, final double newMapAvgKey) throws IOExc .averageKeySize(newMapAvgKey) .entries(newMapSize) .keyReaderAndDataAccess(BytesRefSizedReader.INSTANCE, new BytesRefDataAccess()) - .createOrRecoverPersistedTo(chronicleMapFile); + .createPersistedTo(chronicleMapFile); m.putAll(tempFile.toFile()); map = m; } finally { diff --git a/suggester/src/main/java/org/opengrok/suggest/util/Progress.java b/suggester/src/main/java/org/opengrok/suggest/util/Progress.java index e50b7ed2bc6..f5f85575f69 100644 --- a/suggester/src/main/java/org/opengrok/suggest/util/Progress.java +++ b/suggester/src/main/java/org/opengrok/suggest/util/Progress.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2017, 2020, Chris Fraire . */ package org.opengrok.suggest.util; @@ -152,7 +152,7 @@ private void logLoop() { } @VisibleForTesting - Level getLevel(Map lastLoggedChunk, long currentCount, Level currentLevel) { + final Level getLevel(Map lastLoggedChunk, long currentCount, Level currentLevel) { // The intention is to log the initial and final count at the base log level. if (currentCount <= 1 || (totalCount != null && currentCount == totalCount)) { currentLevel = baseLogLevel;