From 53e8ade4d320ce4d3fd0089147c06c13a25c4662 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 3 Aug 2017 12:07:22 +0100 Subject: [PATCH] Improve diagnostics for delete failures in DevTools integration tests --- .../devtools/tests/JarFileRemoteApplicationLauncher.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/JarFileRemoteApplicationLauncher.java b/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/JarFileRemoteApplicationLauncher.java index ade49743807..0d16152e6fe 100644 --- a/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/JarFileRemoteApplicationLauncher.java +++ b/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/JarFileRemoteApplicationLauncher.java @@ -42,7 +42,13 @@ public class JarFileRemoteApplicationLauncher extends RemoteApplicationLauncher @Override protected String createApplicationClassPath() throws Exception { File appDirectory = new File("target/app"); - FileSystemUtils.deleteRecursively(appDirectory); + if (appDirectory.isDirectory()) { + FileSystemUtils.deleteRecursively(appDirectory.toPath()); + if (appDirectory.isDirectory()) { + throw new IllegalStateException( + "Failed to delete '" + appDirectory.getAbsolutePath() + "'"); + } + } appDirectory.mkdirs(); Manifest manifest = new Manifest(); manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");