Fix warm-cache groups runtime error
Running warm-cache groups would cause the following runtime exception:
```
[2023-03-09 17:53:54,398] [SSH warm-cache groups (admin)] ERROR
com.google.gerrit.sshd.BaseCommand : Internal server error (user admin
account 1000000) during warm-cache groups
groovy.lang.MissingMethodException: No signature of method:
com.google.gerrit.server.account.GroupIncludeCacheImpl.subgroupsOf() is
applicable for argument types:
(com.google.gerrit.reviewdb.client.AccountGroup$UUID) values:
```
The subgroupsOf method is no longer available, also the cache.get()
returns an optional rather than null.
Change-Id: I950c42a42d34adc632bf5cbe01683def0236bc9a
diff --git a/admin/warm-cache-1.0.groovy b/admin/warm-cache-1.0.groovy
index f5f9955..46c34f1 100644
--- a/admin/warm-cache-1.0.groovy
+++ b/admin/warm-cache-1.0.groovy
@@ -89,12 +89,12 @@
def groupsLoaded = 0
for (groupUuid in allGroupsUuids) {
- groupIncludeCache.subgroupsOf(groupUuid)
groupIncludeCache.parentGroupsOf(groupUuid)
def group = groupCache.get(groupUuid)
- if(group != null) {
- groupCache.get(group.getNameKey())
- groupCache.get(group.getId())
+
+ if(group.isPresent()) {
+ groupCache.get(group.get().getNameKey())
+ groupCache.get(group.get().getId())
}
groupsLoaded++