]> source.dussan.org Git - jgit.git/commitdiff
Replace use of deprecated release() in BasePackPushConnection 91/45091/1
authorMatthias Sohn <matthias.sohn@sap.com>
Wed, 1 Apr 2015 23:06:08 +0000 (01:06 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Wed, 1 Apr 2015 23:06:08 +0000 (01:06 +0200)
Change-Id: I28a5c7e222daf35e3d1a1a6fda8ed6ef9b960f78
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java

index e367ab44c963437dc44e8c37bc42b5ba328ad60c..863934da16973b3a1e175fcf44f161e615503957 100644 (file)
@@ -279,9 +279,8 @@ public abstract class BasePackPushConnection extends BasePackConnection implemen
                Set<ObjectId> remoteObjects = new HashSet<ObjectId>();
                Set<ObjectId> newObjects = new HashSet<ObjectId>();
 
-               final PackWriter writer = new PackWriter(transport.getPackConfig(),
-                               local.newObjectReader());
-               try {
+               try (final PackWriter writer = new PackWriter(transport.getPackConfig(),
+                               local.newObjectReader())) {
 
                        for (final Ref r : getRefs()) {
                                // only add objects that we actually have
@@ -303,10 +302,9 @@ public abstract class BasePackPushConnection extends BasePackConnection implemen
                        writer.setDeltaBaseAsOffset(capableOfsDelta);
                        writer.preparePack(monitor, newObjects, remoteObjects);
                        writer.writePack(monitor, monitor, out);
-               } finally {
-                       writer.release();
+
+                       packTransferTime = writer.getStatistics().getTimeWriting();
                }
-               packTransferTime = writer.getStatistics().getTimeWriting();
        }
 
        private void readStatusReport(final Map<String, RemoteRefUpdate> refUpdates)