Remove redundant final in try-with-resources
This commit is contained in:
parent
b4e6cee636
commit
b10da3eac6
2 changed files with 3 additions and 3 deletions
|
@ -56,7 +56,7 @@ class InitGitDBRepo {
|
||||||
final InitGitDBRepo initRepo = new InitGitDBRepo();
|
final InitGitDBRepo initRepo = new InitGitDBRepo();
|
||||||
final File validDbDir = initRepo.validDbDir(dbDir.toFile());
|
final File validDbDir = initRepo.validDbDir(dbDir.toFile());
|
||||||
validDbDir.mkdirs();
|
validDbDir.mkdirs();
|
||||||
try (final Repository repository = RepositoryCache.FileKey.exact(validDbDir, FS.DETECTED).open(false)) {
|
try (Repository repository = RepositoryCache.FileKey.exact(validDbDir, FS.DETECTED).open(false)) {
|
||||||
repository.create(true);
|
repository.create(true);
|
||||||
initRepo.createInitialBranchOnMaster(repository);
|
initRepo.createInitialBranchOnMaster(repository);
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ class InitGitDBRepo {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifyIsEmpty(final File dbDir) throws IOException {
|
private void verifyIsEmpty(final File dbDir) throws IOException {
|
||||||
try (final DirectoryStream<Path> directoryStream = Files.newDirectoryStream(dbDir.toPath())) {
|
try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(dbDir.toPath())) {
|
||||||
if (directoryStream.iterator().hasNext()) {
|
if (directoryStream.iterator().hasNext()) {
|
||||||
throw new DirectoryNotEmptyException(dbDir.toString());
|
throw new DirectoryNotEmptyException(dbDir.toString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ class KeyRemover {
|
||||||
* @throws IOException the object could not be stored.
|
* @throws IOException the object could not be stored.
|
||||||
*/
|
*/
|
||||||
private ObjectId insertTree(final TreeFormatter treeFormatter) throws IOException {
|
private ObjectId insertTree(final TreeFormatter treeFormatter) throws IOException {
|
||||||
try (final ObjectInserter inserter = repository.getObjectDatabase().newInserter()) {
|
try (ObjectInserter inserter = repository.getObjectDatabase().newInserter()) {
|
||||||
return inserter.insert(treeFormatter);
|
return inserter.insert(treeFormatter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue