]> source.dussan.org Git - jgit.git/commitdiff
UploadPack: suppress resource warning for DepthWalk.RevWalk 98/1201698/2
authorMatthias Sohn <matthias.sohn@sap.com>
Tue, 8 Oct 2024 23:41:30 +0000 (01:41 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Fri, 11 Oct 2024 08:44:41 +0000 (08:44 +0000)
which borrows the ObjectReader from `walk` which is closed by
UploadPack#close.

Change-Id: Idb91f025c2872421702034381bb55d292d0e74ed

org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java

index 3772c0081977db08ac91e0e3eec2d55fb04c695b..8945f6e67f04394d33630e70a41dcdafdf81facc 100644 (file)
@@ -2369,7 +2369,8 @@ public class UploadPack implements Closeable {
                                                : req.getDepth() - 1;
                                pw.setShallowPack(req.getDepth(), unshallowCommits);
 
-                               // Ownership is transferred below
+                               // dw borrows the reader from walk which is closed by #close
+                               @SuppressWarnings("resource")
                                DepthWalk.RevWalk dw = new DepthWalk.RevWalk(
                                                walk.getObjectReader(), walkDepth);
                                dw.setDeepenSince(req.getDeepenSince());