PatchListCacheImpl: Catch LargeObjectException This is an uncaught exception that may be thrown by JGit DFS internals during the ResolveMerger step if it attempts to content merge very large files. This method is ultimately called during push of a new merge change in order to index it, preventing such changes from being used at all in Gerrit. Users might think that pushing a merge with "-s ours" is enough to avoid this problem, but the exception actually happens when producing the automerged base. Simply failing to produce the patch list in this case is not going to make the review experience especially pleasant, but it will at least allow changes to be pushed. Change-Id: I54cb0e696ea2d285e9297e0ba17adbf3a2a3af72
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListCacheImpl.java b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListCacheImpl.java index 6c769f7..52856c6 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListCacheImpl.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListCacheImpl.java
@@ -27,6 +27,7 @@ import com.google.inject.Singleton; import com.google.inject.name.Named; +import org.eclipse.jgit.errors.LargeObjectException; import org.eclipse.jgit.lib.Config; import org.eclipse.jgit.lib.ObjectId; @@ -79,7 +80,7 @@ public PatchList get(PatchListKey key) throws PatchListNotAvailableException { try { return fileCache.get(key); - } catch (ExecutionException e) { + } catch (ExecutionException | LargeObjectException e) { PatchListLoader.log.warn("Error computing " + key, e); throw new PatchListNotAvailableException(e.getCause()); } @@ -104,7 +105,7 @@ if (computeIntraline) { try { return intraCache.get(key); - } catch (ExecutionException e) { + } catch (ExecutionException | LargeObjectException e) { IntraLineLoader.log.warn("Error computing " + key, e); return new IntraLineDiff(IntraLineDiff.Status.ERROR); }