Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn2015-05-20 22:02:52 +0000
committerMatthias Sohn2015-05-21 08:22:23 +0000
commit8b8c71f2cfbe2a44aa4e617d7b1ded714905aab3 (patch)
treea70bab1c79d1c86c6e0a11c86428a7dba3835a6b /org.eclipse.egit.core.test
parentaf9f7d03e94e2dc813226c4df4cae73b97053c72 (diff)
downloadegit-8b8c71f2cfbe2a44aa4e617d7b1ded714905aab3.tar.gz
egit-8b8c71f2cfbe2a44aa4e617d7b1ded714905aab3.tar.xz
egit-8b8c71f2cfbe2a44aa4e617d7b1ded714905aab3.zip
Replace calls to release() methods with try-with-resource
JGit deleted the deprecated release() methods in change I2c67384309c5c2e8511a7d0d4e088b4e95f819ff Change-Id: I1a166ba477543669824888296b3533dd9b0ef3be Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.egit.core.test')
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/internal/storage/IndexFileRevisionTest.java5
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java5
2 files changed, 2 insertions, 8 deletions
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/internal/storage/IndexFileRevisionTest.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/internal/storage/IndexFileRevisionTest.java
index 1ff0a9bec8..547a0caa03 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/internal/storage/IndexFileRevisionTest.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/internal/storage/IndexFileRevisionTest.java
@@ -116,14 +116,11 @@ public class IndexFileRevisionTest extends GitTestCase {
throws IOException {
DirCacheEntry entry = new DirCacheEntry(path, stage);
entry.setFileMode(FileMode.REGULAR_FILE);
- ObjectInserter inserter = repository.newObjectInserter();
- try {
+ try (ObjectInserter inserter = repository.newObjectInserter()) {
ObjectId blob = inserter.insert(Constants.OBJ_BLOB,
data.getBytes("UTF-8"));
entry.setObjectId(blob);
inserter.flush();
- } finally {
- inserter.release();
}
return entry;
}
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java
index d0d0af1511..a48bd2f55c 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java
@@ -82,13 +82,10 @@ public abstract class GitTestCase {
fileWriter.write(content);
fileWriter.close();
byte[] fileContents = IO.readFully(file);
- ObjectInserter inserter = repository.newObjectInserter();
- try {
+ try (ObjectInserter inserter = repository.newObjectInserter()) {
ObjectId objectId = inserter.insert(Constants.OBJ_BLOB, fileContents);
inserter.flush();
return objectId;
- } finally {
- inserter.release();
}
}

Back to the top