Skip to content

Commit e6e3cdd

Browse files
committed
fix bug in isEmpty method
1 parent ca0dc6b commit e6e3cdd

File tree

1 file changed

+7
-7
lines changed
  • tomcat-base/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat

1 file changed

+7
-7
lines changed

tomcat-base/src/shared/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ public Tomcat getTomcat() throws IOException {
6767
}
6868

6969
protected boolean isEmptyDir(Path path) {
70-
if (Files.isDirectory(path)) {
71-
try (Stream<Path> entries = Files.list(path)) {
72-
return entries.findFirst().isPresent();
73-
} catch (IOException e) {
74-
throw new RuntimeException(e);
75-
}
70+
if (!Files.isDirectory(path)) {
71+
return false;
7672
}
7773

78-
return false;
74+
try (Stream<Path> entries = Files.list(path)) {
75+
return !entries.findAny().isPresent();
76+
} catch (IOException e) {
77+
throw new RuntimeException(e);
78+
}
7979
}
8080

8181
private void addWebapp(Tomcat tomcat, Path path) {

0 commit comments

Comments
 (0)