AbstractElasticIndex: Add helper method to invoke base64 decode

Change-Id: I133b607b1af0ce7d8f770585870ffc3e2ae79b15
This commit is contained in:
David Pursehouse
2019-11-12 16:29:44 -08:00
parent 419bdcc59a
commit 6bd0701842
2 changed files with 4 additions and 2 deletions

View File

@@ -17,7 +17,6 @@ package com.google.gerrit.elasticsearch;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.gson.FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.apache.commons.codec.binary.Base64.decodeBase64;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.FluentIterable;
@@ -84,6 +83,10 @@ abstract class AbstractElasticIndex<K, V> implements Index<K, V> {
protected static final String SEARCH = "_search";
protected static final String SETTINGS = "settings";
protected static byte[] decodeBase64(String base64String) {
return Base64.decodeBase64(base64String);
}
protected static <T> List<T> decodeProtos(
JsonObject doc, String fieldName, ProtobufCodec<T> codec) {
JsonArray field = doc.getAsJsonArray(fieldName);

View File

@@ -21,7 +21,6 @@ import static com.google.gerrit.server.index.change.ChangeIndexRewriter.CLOSED_S
import static com.google.gerrit.server.index.change.ChangeIndexRewriter.OPEN_STATUSES;
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.Objects.requireNonNull;
import static org.apache.commons.codec.binary.Base64.decodeBase64;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableListMultimap;