summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CheckoutCommandTest.java3
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileRepositoryBuilderTest.java3
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java2
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java41
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/util/TemporaryBufferTest.java2
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/EolCanonicalizingInputStreamTest.java2
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/UnionInputStreamTest.java7
7 files changed, 43 insertions, 17 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CheckoutCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CheckoutCommandTest.java
index b75d0bdc4c..3f0bc043ac 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CheckoutCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CheckoutCommandTest.java
@@ -162,8 +162,9 @@ public class CheckoutCommandTest extends RepositoryTestCase {
} catch (IOException e) {
// the test makes only sense if deletion of
// a file with open stream fails
+ } finally {
+ fis.close();
}
- fis.close();
FileUtils.delete(testFile);
CheckoutCommand co = git.checkout();
// delete Test.txt in branch test
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileRepositoryBuilderTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileRepositoryBuilderTest.java
index b6377482dc..8f3f488296 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileRepositoryBuilderTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileRepositoryBuilderTest.java
@@ -112,6 +112,7 @@ public class FileRepositoryBuilderTest extends LocalDiskRepositoryTestCase {
}
}
+ @SuppressWarnings("resource" /* java 7 */)
@Test
public void absoluteGitDirRef() throws Exception {
FileRepository repo1 = createWorkRepository();
@@ -129,6 +130,7 @@ public class FileRepositoryBuilderTest extends LocalDiskRepositoryTestCase {
assertEquals(dir, repo2.getWorkTree());
}
+ @SuppressWarnings("resource" /* java 7 */)
@Test
public void relativeGitDirRef() throws Exception {
FileRepository repo1 = createWorkRepository();
@@ -147,6 +149,7 @@ public class FileRepositoryBuilderTest extends LocalDiskRepositoryTestCase {
assertEquals(dir, repo2.getWorkTree());
}
+ @SuppressWarnings("resource" /* java 7 */)
@Test
public void scanWithGitDirRef() throws Exception {
FileRepository repo1 = createWorkRepository();
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java
index cb3c7d88f0..baa0d094d5 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java
@@ -128,6 +128,7 @@ public class SubmoduleWalkTest extends RepositoryTestCase {
assertFalse(gen.next());
}
+ @SuppressWarnings("resource" /* java 7 */)
@Test
public void repositoryWithRootLevelSubmoduleAbsoluteRef()
throws IOException, ConfigInvalidException {
@@ -176,6 +177,7 @@ public class SubmoduleWalkTest extends RepositoryTestCase {
assertFalse(gen.next());
}
+ @SuppressWarnings("resource" /* java 7 */)
@Test
public void repositoryWithRootLevelSubmoduleRelativeRef()
throws IOException, ConfigInvalidException {
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java
index 2924297de7..717a58bcbb 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java
@@ -78,8 +78,9 @@ public class SideBandOutputStreamTest {
@Test
public void testWrite_CH_DATA() throws IOException {
- final SideBandOutputStream out;
- out = new SideBandOutputStream(CH_DATA, SMALL_BUF, rawOut);
+ @SuppressWarnings("resource" /* java 7 */)
+ final SideBandOutputStream out = new SideBandOutputStream(CH_DATA,
+ SMALL_BUF, rawOut);
out.write(new byte[] { 'a', 'b', 'c' });
out.flush();
assertBuffer("0008\001abc");
@@ -87,8 +88,9 @@ public class SideBandOutputStreamTest {
@Test
public void testWrite_CH_PROGRESS() throws IOException {
- final SideBandOutputStream out;
- out = new SideBandOutputStream(CH_PROGRESS, SMALL_BUF, rawOut);
+ @SuppressWarnings("resource" /* java 7 */)
+ final SideBandOutputStream out = new SideBandOutputStream(CH_PROGRESS,
+ SMALL_BUF, rawOut);
out.write(new byte[] { 'a', 'b', 'c' });
out.flush();
assertBuffer("0008\002abc");
@@ -96,8 +98,9 @@ public class SideBandOutputStreamTest {
@Test
public void testWrite_CH_ERROR() throws IOException {
- final SideBandOutputStream out;
- out = new SideBandOutputStream(CH_ERROR, SMALL_BUF, rawOut);
+ @SuppressWarnings("resource" /* java 7 */)
+ final SideBandOutputStream out = new SideBandOutputStream(CH_ERROR,
+ SMALL_BUF, rawOut);
out.write(new byte[] { 'a', 'b', 'c' });
out.flush();
assertBuffer("0008\003abc");
@@ -105,8 +108,9 @@ public class SideBandOutputStreamTest {
@Test
public void testWrite_Small() throws IOException {
- final SideBandOutputStream out;
- out = new SideBandOutputStream(CH_DATA, SMALL_BUF, rawOut);
+ @SuppressWarnings("resource" /* java 7 */)
+ final SideBandOutputStream out = new SideBandOutputStream(CH_DATA,
+ SMALL_BUF, rawOut);
out.write('a');
out.write('b');
out.write('c');
@@ -116,8 +120,9 @@ public class SideBandOutputStreamTest {
@Test
public void testWrite_SmallBlocks1() throws IOException {
- final SideBandOutputStream out;
- out = new SideBandOutputStream(CH_DATA, 6, rawOut);
+ @SuppressWarnings("resource" /* java 7 */)
+ final SideBandOutputStream out = new SideBandOutputStream(CH_DATA, 6,
+ rawOut);
out.write('a');
out.write('b');
out.write('c');
@@ -127,8 +132,9 @@ public class SideBandOutputStreamTest {
@Test
public void testWrite_SmallBlocks2() throws IOException {
- final SideBandOutputStream out;
- out = new SideBandOutputStream(CH_DATA, 6, rawOut);
+ @SuppressWarnings("resource" /* java 7 */)
+ final SideBandOutputStream out = new SideBandOutputStream(CH_DATA, 6,
+ rawOut);
out.write(new byte[] { 'a', 'b', 'c' });
out.flush();
assertBuffer("0006\001a0006\001b0006\001c");
@@ -136,8 +142,9 @@ public class SideBandOutputStreamTest {
@Test
public void testWrite_SmallBlocks3() throws IOException {
- final SideBandOutputStream out;
- out = new SideBandOutputStream(CH_DATA, 7, rawOut);
+ @SuppressWarnings("resource" /* java 7 */)
+ final SideBandOutputStream out = new SideBandOutputStream(CH_DATA, 7,
+ rawOut);
out.write('a');
out.write(new byte[] { 'b', 'c' });
out.flush();
@@ -152,8 +159,9 @@ public class SideBandOutputStreamTest {
buf[i] = (byte) i;
}
- final SideBandOutputStream out;
- out = new SideBandOutputStream(CH_DATA, MAX_BUF, rawOut);
+ @SuppressWarnings("resource" /* java 7 */)
+ final SideBandOutputStream out = new SideBandOutputStream(CH_DATA,
+ MAX_BUF, rawOut);
out.write(buf);
out.flush();
@@ -167,6 +175,7 @@ public class SideBandOutputStreamTest {
}
}
+ @SuppressWarnings("resource" /* java 7 */)
@Test
public void testFlush() throws IOException {
final int[] flushCnt = new int[1];
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/TemporaryBufferTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/TemporaryBufferTest.java
index 8b67532a97..5f5968dbcf 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/TemporaryBufferTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/TemporaryBufferTest.java
@@ -353,6 +353,7 @@ public class TemporaryBufferTest {
@Test
public void testDestroyWhileOpen() throws IOException {
+ @SuppressWarnings("resource" /* java 7 */)
final TemporaryBuffer b = new TemporaryBuffer.LocalFile();
try {
b.write(new TestRng(getName())
@@ -411,6 +412,7 @@ public class TemporaryBufferTest {
@Test
public void testHeap() throws IOException {
+ @SuppressWarnings("resource" /* java 7 */)
final TemporaryBuffer b = new TemporaryBuffer.Heap(2 * 8 * 1024);
final byte[] r = new byte[8 * 1024];
b.write(r);
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/EolCanonicalizingInputStreamTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/EolCanonicalizingInputStreamTest.java
index 52ad0139c6..bd1524563b 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/EolCanonicalizingInputStreamTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/EolCanonicalizingInputStreamTest.java
@@ -121,7 +121,9 @@ public class EolCanonicalizingInputStreamTest {
}
assertEquals(expected.length, read);
+ cis2.close();
}
+ cis1.close();
}
private static byte[] asBytes(String in) {
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/UnionInputStreamTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/UnionInputStreamTest.java
index daebffbc1b..c213157b35 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/UnionInputStreamTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/UnionInputStreamTest.java
@@ -69,6 +69,7 @@ public class UnionInputStreamTest {
@Test
public void testReadSingleBytes() throws IOException {
+ @SuppressWarnings("resource" /* java 7 */)
final UnionInputStream u = new UnionInputStream();
assertTrue(u.isEmpty());
@@ -101,6 +102,7 @@ public class UnionInputStreamTest {
@Test
public void testReadByteBlocks() throws IOException {
+ @SuppressWarnings("resource" /* java 7 */)
final UnionInputStream u = new UnionInputStream();
u.add(new ByteArrayInputStream(new byte[] { 1, 0, 2 }));
u.add(new ByteArrayInputStream(new byte[] { 3 }));
@@ -124,6 +126,7 @@ public class UnionInputStreamTest {
@Test
public void testArrayConstructor() throws IOException {
+ @SuppressWarnings("resource" /* java 7 */)
final UnionInputStream u = new UnionInputStream(
new ByteArrayInputStream(new byte[] { 1, 0, 2 }),
new ByteArrayInputStream(new byte[] { 3 }),
@@ -141,6 +144,7 @@ public class UnionInputStreamTest {
@Test
public void testMarkSupported() {
+ @SuppressWarnings("resource" /* java 7 */)
final UnionInputStream u = new UnionInputStream();
assertFalse(u.markSupported());
u.add(new ByteArrayInputStream(new byte[] { 1, 0, 2 }));
@@ -149,6 +153,7 @@ public class UnionInputStreamTest {
@Test
public void testSkip() throws IOException {
+ @SuppressWarnings("resource" /* java 7 */)
final UnionInputStream u = new UnionInputStream();
u.add(new ByteArrayInputStream(new byte[] { 1, 0, 2 }));
u.add(new ByteArrayInputStream(new byte[] { 3 }));
@@ -171,6 +176,7 @@ public class UnionInputStreamTest {
@Test
public void testAutoCloseDuringRead() throws IOException {
+ @SuppressWarnings("resource" /* java 7 */)
final UnionInputStream u = new UnionInputStream();
final boolean closed[] = new boolean[2];
u.add(new ByteArrayInputStream(new byte[] { 1 }) {
@@ -248,6 +254,7 @@ public class UnionInputStreamTest {
throw new IOException("Expected");
}
};
+ @SuppressWarnings("resource" /* java 7 */)
final UnionInputStream u = new UnionInputStream(
new ByteArrayInputStream(new byte[]{1,2,3}),
errorReadStream);