closing streams properly under some circumstances
@@ -294,10 +294,10 @@ public class Maven2LayoutProvider
artifactIdLevelPath = artifactIdLevelPath.getParent();
// This is at the version level
- Path pomPath = Files.list(artifactBasePath)
- .filter(p -> p.getFileName().toString().endsWith(".pom"))
- .findFirst()
- .orElse(null);
+ try (Stream<Path> pathStream = Files.list(artifactBasePath))
+ {
+ Path pomPath = pathStream.filter(
+ p -> p.getFileName().toString().endsWith(".pom")).findFirst().orElse(null);
String version = ArtifactUtils.convertPathToArtifact(path).getVersion() != null ?
ArtifactUtils.convertPathToArtifact(path).getVersion() :
@@ -305,6 +305,8 @@ public class Maven2LayoutProvider
deleteMetadataAtVersionLevel(artifactBasePath, version);
}
+
+ }
}
else
{
