FlushCaches/ShowCaches: Adjust to changed return type of REST endpoint
In change I1dd37821a the return type of REST endpoints was changed
to always return Response<?>. The FlushCaches and ShowCaches commands
were not adjusted to this, resulting in ClassCastException.
Bug: Issue 11476
Change-Id: Icc0f11ccf6f79e0e5af2e48aedb776d88ea8cf37
diff --git a/java/com/google/gerrit/sshd/commands/FlushCaches.java b/java/com/google/gerrit/sshd/commands/FlushCaches.java
index df56cf4..98562b0 100644
--- a/java/com/google/gerrit/sshd/commands/FlushCaches.java
+++ b/java/com/google/gerrit/sshd/commands/FlushCaches.java
@@ -89,7 +89,8 @@
@SuppressWarnings("unchecked")
private void doList() {
for (String name :
- (List<String>) listCaches.setFormat(OutputFormat.LIST).apply(new ConfigResource())) {
+ (List<String>)
+ listCaches.setFormat(OutputFormat.LIST).apply(new ConfigResource()).value()) {
stderr.print(name);
stderr.print('\n');
}
diff --git a/java/com/google/gerrit/sshd/commands/ShowCaches.java b/java/com/google/gerrit/sshd/commands/ShowCaches.java
index c19e790..3c617b0 100644
--- a/java/com/google/gerrit/sshd/commands/ShowCaches.java
+++ b/java/com/google/gerrit/sshd/commands/ShowCaches.java
@@ -194,7 +194,8 @@
private Collection<CacheInfo> getCaches() {
@SuppressWarnings("unchecked")
- Map<String, CacheInfo> caches = (Map<String, CacheInfo>) listCaches.apply(new ConfigResource());
+ Map<String, CacheInfo> caches =
+ (Map<String, CacheInfo>) listCaches.apply(new ConfigResource()).value();
for (Map.Entry<String, CacheInfo> entry : caches.entrySet()) {
CacheInfo cache = entry.getValue();
cache.name = entry.getKey();