diff options
Diffstat (limited to 'java/com/google/gerrit/index/Schema.java')
-rw-r--r-- | java/com/google/gerrit/index/Schema.java | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/java/com/google/gerrit/index/Schema.java b/java/com/google/gerrit/index/Schema.java index 3aa9de0614..ec14a154f4 100644 --- a/java/com/google/gerrit/index/Schema.java +++ b/java/com/google/gerrit/index/Schema.java @@ -207,21 +207,19 @@ public class Schema<T> { /** * Build all fields in the schema from an input object. * - * <p>Null values are omitted, as are fields which cause errors, which are logged. + * <p>Null values are omitted, as are fields which cause errors, which are logged. If any of the + * fields cause a StorageException, the whole operation fails and the exception is propagated to + * the caller. * * @param obj input object. * @param skipFields set of field names to skip when indexing the document * @return all non-null field values from the object. */ public final Iterable<Values<T>> buildFields(T obj, ImmutableSet<String> skipFields) { - try { - return fields.values().stream() - .map(f -> fieldValues(obj, f, skipFields)) - .filter(Objects::nonNull) - .collect(toImmutableList()); - } catch (StorageException e) { - return ImmutableList.of(); - } + return fields.values().stream() + .map(f -> fieldValues(obj, f, skipFields)) + .filter(Objects::nonNull) + .collect(toImmutableList()); } @Override |