Browse Source

PushCommand: Suppress resource warning for Transport in for loop

A list of Transport instances is provided by Transport.openAll, and
then iterated over in a for loop. Eclipse warns that the Transport
in the for-loop should be managed by try-with-resource.

The Transport is explicitly closed in the finally block, so just
suppress the warning.

Change-Id: I92b73cd90902637cf1ac1ab7b02b5ee5ed6bdb1e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-5.0
David Pursehouse 7 years ago
parent
commit
553da7540e
  1. 3
      org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java

3
org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java

@ -153,7 +153,8 @@ public class PushCommand extends
final List<Transport> transports;
transports = Transport.openAll(repo, remote, Transport.Operation.PUSH);
for (final Transport transport : transports) {
for (@SuppressWarnings("resource") // Explicitly closed in finally
final Transport transport : transports) {
transport.setPushThin(thin);
transport.setPushAtomic(atomic);
if (receivePack != null)

Loading…
Cancel
Save