From: Matthias Sohn Date: Tue, 19 Nov 2024 12:12:53 +0000 (+0100) Subject: Suppress non-externalized string warnings X-Git-Tag: v7.1.0.202411191359-rc1~1^2~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fchanges%2F14%2F1203914%2F1;p=jgit.git Suppress non-externalized string warnings Change-Id: Ib0737f7ec6b9872f6d4514d140e7d32a4a40809d --- diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCacheConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCacheConfig.java index d63c208bbb..17bf51876d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCacheConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCacheConfig.java @@ -51,7 +51,7 @@ public class DfsBlockCacheConfig { /** Default number of max cache hits. */ public static final int DEFAULT_CACHE_HOT_MAX = 1; - static final String DEFAULT_NAME = ""; + static final String DEFAULT_NAME = ""; //$NON-NLS-1$ private String name; @@ -91,7 +91,7 @@ public class DfsBlockCacheConfig { * {@link PrintWriter} to write the cache's configuration to. */ public void print(PrintWriter writer) { - print(/* linePrefix= */ "", /* pad= */ " ", writer); + print(/* linePrefix= */ "", /* pad= */ " ", writer); //$NON-NLS-1$//$NON-NLS-2$ } /** @@ -105,14 +105,12 @@ public class DfsBlockCacheConfig { * @param writer * {@link PrintWriter} to write the cache's configuration to. */ + @SuppressWarnings("nls") private void print(String linePrefix, String pad, PrintWriter writer) { String currentPrefixLevel = linePrefix; if (!name.isEmpty() || !packExtCacheConfigurations.isEmpty()) { - String name = this.name; - if (name.isEmpty()) { - name = ""; - } - writer.println(linePrefix + "Name: " + name); + writer.println(linePrefix + "Name: " + + (name.isEmpty() ? DEFAULT_NAME : this.name)); currentPrefixLevel += pad; } writer.println(currentPrefixLevel + "BlockLimit: " + blockLimit); @@ -602,7 +600,7 @@ public class DfsBlockCacheConfig { void print(String linePrefix, String pad, PrintWriter writer) { packExtCacheConfiguration.print(linePrefix, pad, writer); - writer.println(linePrefix + pad + "PackExts: " + writer.println(linePrefix + pad + "PackExts: " //$NON-NLS-1$ + packExts.stream().sorted().collect(Collectors.toList())); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCacheStats.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCacheStats.java index 518db8c82d..436f57437e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCacheStats.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCacheStats.java @@ -46,7 +46,7 @@ class DfsBlockCacheStats implements BlockCacheStats { private final AtomicReference liveBytes; DfsBlockCacheStats() { - this(""); + this(""); //$NON-NLS-1$ } DfsBlockCacheStats(String name) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/PackExtBlockCacheTable.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/PackExtBlockCacheTable.java index 28b021c68f..bb44f9397a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/PackExtBlockCacheTable.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/PackExtBlockCacheTable.java @@ -125,10 +125,10 @@ class PackExtBlockCacheTable implements DfsBlockCacheTable { Set blockCacheTables = new HashSet<>(); blockCacheTables.add(defaultBlockCacheTable); blockCacheTables.addAll(packExtBlockCacheTables.values()); - String name = defaultBlockCacheTable.getName() + "," + String name = defaultBlockCacheTable.getName() + "," //$NON-NLS-1$ + packExtBlockCacheTables.values().stream() .map(DfsBlockCacheTable::getName).sorted() - .collect(Collectors.joining(",")); + .collect(Collectors.joining(",")); //$NON-NLS-1$ return new PackExtBlockCacheTable(name, defaultBlockCacheTable, List.copyOf(blockCacheTables), packExtBlockCacheTables); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/RecursiveMerger.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/RecursiveMerger.java index 24614f7d18..ec1b599b77 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/RecursiveMerger.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/RecursiveMerger.java @@ -244,11 +244,11 @@ public class RecursiveMerger extends ResolveMerger { private String failingPathsMessage() { int max = 25; String failedPaths = failingPaths.entrySet().stream().limit(max) - .map(entry -> entry.getKey() + ":" + entry.getValue()) - .collect(Collectors.joining("\n")); + .map(entry -> entry.getKey() + ":" + entry.getValue()) //$NON-NLS-1$ + .collect(Collectors.joining("\n")); //$NON-NLS-1$ if (failingPaths.size() > max) { - failedPaths = String.format("%s\n... (%s failing paths omitted)", + failedPaths = String.format("%s\n... (%s failing paths omitted)", //$NON-NLS-1$ failedPaths, failingPaths.size() - max); } return failedPaths;