Bump kemitix maven tiles from 0.9.0 to 2.1.3 (#40)
* Bump kemitix-maven-tiles from 0.9.0 to 2.1.3 * Fix spotbugs error RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE [ERROR] Nullcheck of directoryStream at line 88 of value previously dereferenced in net.kemitix.gitdb.impl.InitGitDBRepo.lambda$ifExistsThenIsEmpty$2(File, File) [net.kemitix.gitdb.impl.InitGitDBRepo, net.kemitix.gitdb.impl.InitGitDBRepo] At InitGitDBRepo.java:[line 88]Redundant null check at InitGitDBRepo.java:[line 90] RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE
This commit is contained in:
parent
18f3761739
commit
02e940ac5f
2 changed files with 7 additions and 10 deletions
4
pom.xml
4
pom.xml
|
@ -11,7 +11,7 @@
|
|||
<properties>
|
||||
<java.version>8</java.version>
|
||||
<tiles-maven-plugin.version>2.12</tiles-maven-plugin.version>
|
||||
<kemitix-tiles.version>0.9.0</kemitix-tiles.version>
|
||||
<kemitix-maven-tiles.version>2.1.3</kemitix-maven-tiles.version>
|
||||
<kemitix-checkstyle.version>4.1.1</kemitix-checkstyle.version>
|
||||
<maven-surefire-plugin.version>2.22.1</maven-surefire-plugin.version>
|
||||
<junit-platform-surefire-provider.version>1.3.2</junit-platform-surefire-provider.version>
|
||||
|
@ -100,7 +100,7 @@
|
|||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<tiles>
|
||||
<tile>net.kemitix.tiles:all:${kemitix-tiles.version}</tile>
|
||||
<tile>net.kemitix.tiles:all:${kemitix-maven-tiles.version}</tile>
|
||||
<!--<tile>net.kemitix.tiles:pmd-strict:${kemitix-tiles.version}</tile>-->
|
||||
<tile>net.kemitix.checkstyle:tile:${kemitix-checkstyle.version}</tile>
|
||||
</tiles>
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.eclipse.jgit.util.FS;
|
|||
import java.io.File;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.*;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import static net.kemitix.conditional.Condition.where;
|
||||
|
@ -82,14 +83,10 @@ final class InitGitDBRepo {
|
|||
|
||||
private static Result<File> ifExistsThenIsEmpty(final File dbDir) {
|
||||
return Result.ok(dbDir)
|
||||
.thenWith(dir -> () -> {
|
||||
if (dir.exists()) {
|
||||
try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(dbDir.toPath())) {
|
||||
where(directoryStream.iterator().hasNext())
|
||||
.thenThrow(new DirectoryNotEmptyException(dbDir.toString()));
|
||||
}
|
||||
}
|
||||
});
|
||||
.thenWith(dir -> () ->
|
||||
where(dir.exists())
|
||||
.and(() -> Optional.ofNullable(dir.listFiles()).orElse(new File[0]).length != 0)
|
||||
.thenThrow(new DirectoryNotEmptyException(dir.toString())));
|
||||
}
|
||||
|
||||
private static RepositoryCache.FileKey exactDirectory(final File dir) {
|
||||
|
|
Loading…
Reference in a new issue