Skip to content

Commit 2f15177

Browse files
committed
UploadPack: suppress resource warning for DepthWalk.RevWalk
which borrows the ObjectReader from `walk` which is closed by UploadPack#close. Change-Id: Idb91f025c2872421702034381bb55d292d0e74ed
1 parent ac7cbfd commit 2f15177

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2369,7 +2369,8 @@ else if (ref.getName().startsWith(Constants.R_HEADS))
23692369
: req.getDepth() - 1;
23702370
pw.setShallowPack(req.getDepth(), unshallowCommits);
23712371

2372-
// Ownership is transferred below
2372+
// dw borrows the reader from walk which is closed by #close
2373+
@SuppressWarnings("resource")
23732374
DepthWalk.RevWalk dw = new DepthWalk.RevWalk(
23742375
walk.getObjectReader(), walkDepth);
23752376
dw.setDeepenSince(req.getDeepenSince());

0 commit comments

Comments
 (0)