]> source.dussan.org Git - jgit.git/commit
Open auto-closeable resources in try-with-resource 86/119286/4
authorDavid Pursehouse <david.pursehouse@gmail.com>
Tue, 13 Mar 2018 02:44:23 +0000 (11:44 +0900)
committerMatthias Sohn <matthias.sohn@sap.com>
Tue, 13 Mar 2018 21:16:06 +0000 (22:16 +0100)
commit5c70be00856d5375485e6f062b6e1e09a606601f
tree55726d1e2a1c52d75460a0a4336d487238037ba6
parente23b09ad6efc35f6574cfefd4467ad20e5212ff2
Open auto-closeable resources in try-with-resource

When an auto-closeable resources is not opened in try-with-resource,
the warning "should be managed by try-with-resource" is emitted by
Eclipse.

Fix the ones that can be silenced simply by moving the declaration of
the variable into a try-with-resource.

In cases where we explicitly call the close() method, for example in
tests where we are testing specific behavior caused by the close(),
suppress the warning.

Leave the ones that will require more significant refcactoring to fix.
They can be done in separate commits that can be reviewed and tested
in isolation.

Change-Id: I9682cd20fb15167d3c7f9027cecdc82bc50b83c4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
47 files changed:
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ServletUtils.java
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartOutputStream.java
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/ProtocolErrorTest.java
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SetAdditionalHeadersTest.java
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Version.java
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ResetCommandTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackFileTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/UnpackedObjectTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/WindowCacheGetTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryCacheTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/SquashCommitMsgTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/ResolveMergerTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchCcErrorTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchCcTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchErrorTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleAddTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleSyncTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleUpdateTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/NetRCTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PackParserTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/NotTreeFilterTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/util/TemporaryBufferTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/AutoCRLFOutputStreamTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/UnionInputStreamTest.java
org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityIndex.java
org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoProject.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryPackParser.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectLoader.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java
org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
org.eclipse.jgit/src/org/eclipse/jgit/util/TemporaryBuffer.java