Merge branch 'stable-3.7' into stable-3.8

* stable-3.7:
  Set version to 3.7.4-SNAPSHOT
  Set version to 3.7.3
  Set version to 3.5.7-SNAPSHOT
  Set version to 3.5.6
  Move creation of PerThreadCache to SshCommand
  Update bouncycastle to 1.72
  Align commons-compress and tukaani-xz versions with jgit
  Bump JGit to 74fa245b3
  Bump JGit to 45de4fa
  Log external ID differential cache loader failure
  ProjectState: simplify the 'getPluginConfig' method

Release-Notes: skip
Change-Id: I5e2c6918eb41febe921e96f3612a3f3530f1aae4
diff --git a/java/com/google/gerrit/server/account/externalids/ExternalIdCacheLoader.java b/java/com/google/gerrit/server/account/externalids/ExternalIdCacheLoader.java
index 1edb284..8b53d70 100644
--- a/java/com/google/gerrit/server/account/externalids/ExternalIdCacheLoader.java
+++ b/java/com/google/gerrit/server/account/externalids/ExternalIdCacheLoader.java
@@ -43,7 +43,9 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
 import org.eclipse.jgit.errors.ConfigInvalidException;
+import org.eclipse.jgit.lib.AnyObjectId;
 import org.eclipse.jgit.lib.Config;
 import org.eclipse.jgit.lib.ObjectId;
 import org.eclipse.jgit.lib.ObjectReader;
@@ -184,8 +186,17 @@
         }
       }
 
-      AllExternalIds allExternalIds =
-          buildAllExternalIds(repo, oldExternalIds, additions, removals);
+      AllExternalIds allExternalIds;
+      try {
+        allExternalIds = buildAllExternalIds(repo, oldExternalIds, additions, removals);
+      } catch (IllegalArgumentException e) {
+        Set<String> additionKeys =
+            additions.keySet().stream().map(AnyObjectId::getName).collect(Collectors.toSet());
+        logger.atSevere().withCause(e).log(
+            "Failed to load external ID cache. Repository ref is %s, cache ref is %s, additions are %s",
+            extIdRef.getObjectId().getName(), parentWithCacheValue.getId().getName(), additionKeys);
+        throw e;
+      }
       reloadCounter.increment(true);
       reloadDifferential.record(System.nanoTime() - start, TimeUnit.NANOSECONDS);
       return allExternalIds;
diff --git a/java/com/google/gerrit/server/project/ProjectState.java b/java/com/google/gerrit/server/project/ProjectState.java
index 9899a6d..a3f8009 100644
--- a/java/com/google/gerrit/server/project/ProjectState.java
+++ b/java/com/google/gerrit/server/project/ProjectState.java
@@ -476,19 +476,19 @@
    * {@code PluginConfig#withInheritance(ProjectState.Factory)}
    */
   public PluginConfig getPluginConfig(String pluginName) {
-    if (getConfig().getPluginConfigs().containsKey(pluginName)) {
-      Config config = new Config();
+    Config config = new Config();
+    String cachedPluginConfig = getConfig().getPluginConfigs().get(pluginName);
+    if (cachedPluginConfig != null) {
       try {
-        config.fromText(getConfig().getPluginConfigs().get(pluginName));
+        config.fromText(cachedPluginConfig);
       } catch (ConfigInvalidException e) {
         // This is OK to propagate as IllegalStateException because it's a programmer error.
         // The config was converted to a String using Config#toText. So #fromText must not
         // throw a ConfigInvalidException
         throw new IllegalStateException("invalid plugin config for " + pluginName, e);
       }
-      return PluginConfig.create(pluginName, config, getConfig());
     }
-    return PluginConfig.create(pluginName, new Config(), getConfig());
+    return PluginConfig.create(pluginName, config, getConfig());
   }
 
   public Optional<BranchOrderSection> getBranchOrderSection() {
diff --git a/java/com/google/gerrit/server/query/change/OutputStreamQuery.java b/java/com/google/gerrit/server/query/change/OutputStreamQuery.java
index 716cf10..961404a 100644
--- a/java/com/google/gerrit/server/query/change/OutputStreamQuery.java
+++ b/java/com/google/gerrit/server/query/change/OutputStreamQuery.java
@@ -30,7 +30,6 @@
 import com.google.gerrit.index.query.QueryResult;
 import com.google.gerrit.server.DynamicOptions;
 import com.google.gerrit.server.account.AccountAttributeLoader;
-import com.google.gerrit.server.cache.PerThreadCache;
 import com.google.gerrit.server.config.TrackingFooters;
 import com.google.gerrit.server.data.ChangeAttribute;
 import com.google.gerrit.server.data.PatchSetAttribute;
@@ -211,7 +210,7 @@
         return;
       }
 
-      try (PerThreadCache ignored = PerThreadCache.create()) {
+      try {
         final QueryStatsAttribute stats = new QueryStatsAttribute();
         stats.runTimeMilliseconds = TimeUtil.nowMs();
 
diff --git a/java/com/google/gerrit/sshd/SshCommand.java b/java/com/google/gerrit/sshd/SshCommand.java
index 9df263b..a4e427d 100644
--- a/java/com/google/gerrit/sshd/SshCommand.java
+++ b/java/com/google/gerrit/sshd/SshCommand.java
@@ -23,6 +23,7 @@
 import com.google.gerrit.server.InvalidDeadlineException;
 import com.google.gerrit.server.RequestInfo;
 import com.google.gerrit.server.RequestListener;
+import com.google.gerrit.server.cache.PerThreadCache;
 import com.google.gerrit.server.cancellation.RequestCancelledException;
 import com.google.gerrit.server.cancellation.RequestStateContext;
 import com.google.gerrit.server.config.GerritServerConfig;
@@ -62,7 +63,8 @@
   public void start(ChannelSession channel, Environment env) throws IOException {
     startThread(
         () -> {
-          try (DynamicOptions pluginOptions = new DynamicOptions(injector, dynamicBeans)) {
+          try (PerThreadCache ignored = PerThreadCache.create();
+              DynamicOptions pluginOptions = new DynamicOptions(injector, dynamicBeans)) {
             parseCommandLine(pluginOptions);
             stdout = toPrintWriter(out);
             stderr = toPrintWriter(err);
diff --git a/polygerrit-ui/app/BUILD b/polygerrit-ui/app/BUILD
index 6df4456..925820c 100644
--- a/polygerrit-ui/app/BUILD
+++ b/polygerrit-ui/app/BUILD
@@ -180,9 +180,9 @@
             "**/*_test.ts",
         ],
     ) + [
+        "@npm//typescript",
         "@ui_dev_npm//:node_modules",
         "@ui_npm//:node_modules",
-        "@npm//typescript",
     ],
 )
 
diff --git a/tools/deps.bzl b/tools/deps.bzl
index 83044c9..7d4499a 100644
--- a/tools/deps.bzl
+++ b/tools/deps.bzl
@@ -121,8 +121,8 @@
     # When upgrading commons-compress, also upgrade tukaani-xz
     maven_jar(
         name = "commons-compress",
-        artifact = "org.apache.commons:commons-compress:1.20",
-        sha1 = "b8df472b31e1f17c232d2ad78ceb1c84e00c641b",
+        artifact = "org.apache.commons:commons-compress:1.22",
+        sha1 = "691a8b4e6cf4248c3bc72c8b719337d5cb7359fa",
     )
 
     maven_jar(