From b61be2cf3ebe865d6d6f7cb5fa406c1a61c4f68e Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Thu, 2 Apr 2015 01:02:21 +0200 Subject: [PATCH 1/2] Replace use of deprecated release() in BasePackFetchConnection Change-Id: If90a6cca9a2ae80474f5ad023cb2a0a8905010be Signed-off-by: Matthias Sohn --- .../eclipse/jgit/transport/BasePackFetchConnection.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java index f907891ba..4036c0028 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java @@ -377,7 +377,7 @@ public abstract class BasePackFetchConnection extends BasePackConnection @Override public void close() { if (walk != null) - walk.release(); + walk.close(); super.close(); } @@ -753,16 +753,13 @@ public abstract class BasePackFetchConnection extends BasePackConnection input = new SideBandInputStream(input, monitor, getMessageWriter(), outputStream); - ObjectInserter ins = local.newObjectInserter(); - try { + try (ObjectInserter ins = local.newObjectInserter()) { PackParser parser = ins.newPackParser(input); parser.setAllowThin(thinPack); parser.setObjectChecker(transport.getObjectChecker()); parser.setLockMessage(lockMessage); packLock = parser.parse(monitor); ins.flush(); - } finally { - ins.release(); } } From 6691c20bc2cdc39fd339e37ff6cc80215beb48c3 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Thu, 2 Apr 2015 01:06:08 +0200 Subject: [PATCH 2/2] Replace use of deprecated release() in BasePackPushConnection Change-Id: I28a5c7e222daf35e3d1a1a6fda8ed6ef9b960f78 Signed-off-by: Matthias Sohn --- .../eclipse/jgit/transport/BasePackPushConnection.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java index e367ab44c..863934da1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java @@ -279,9 +279,8 @@ public abstract class BasePackPushConnection extends BasePackConnection implemen Set remoteObjects = new HashSet(); Set newObjects = new HashSet(); - 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 refUpdates)