diff options
author | Shawn Pearce <spearce@spearce.org> | 2015-04-08 21:05:31 -0400 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org <gerrit@eclipse.org> | 2015-04-08 21:05:33 -0400 |
commit | a0bc9560aaf7ce08e845f17322149b18cf5e50f7 (patch) | |
tree | 6361f7245e73dc84e2fae981beedf00c5af7b21c | |
parent | 5ef9c1709e5a410c4bb777d05cb971dbf7a58688 (diff) | |
parent | 6691c20bc2cdc39fd339e37ff6cc80215beb48c3 (diff) | |
download | jgit-a0bc9560aaf7ce08e845f17322149b18cf5e50f7.tar.gz jgit-a0bc9560aaf7ce08e845f17322149b18cf5e50f7.zip |
Merge changes I28a5c7e2,If90a6cca
* changes:
Replace use of deprecated release() in BasePackPushConnection
Replace use of deprecated release() in BasePackFetchConnection
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java | 7 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java | 10 |
2 files changed, 6 insertions, 11 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 f907891bae..4036c00280 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(); } } 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 e367ab44c9..863934da16 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<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) |