From 6b5828a820c78726b05bcfb74aa199be078e882e Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Thu, 27 Feb 2014 10:55:23 +0000 Subject: [PATCH] Be defensive if there is no main/classes --- .../springframework/boot/loader/tools/MainClassFinder.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java index 8e3c7a9909..cdb0849f76 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java @@ -95,8 +95,11 @@ public abstract class MainClassFinder { */ public static T doWithMainClasses(File rootFolder, ClassNameCallback callback) throws IOException { + if (!rootFolder.exists()) { + return null; // nothing to do + } if (!rootFolder.isDirectory()) { - throw new IllegalArgumentException("Inavlid root folder '" + rootFolder + "'"); + throw new IllegalArgumentException("Invalid root folder '" + rootFolder + "'"); } String prefix = rootFolder.getAbsolutePath() + "/"; Deque stack = new ArrayDeque();