From 215eb9635581bd3469f36f140b63bdf0b9ab4eca Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 11 Oct 2022 19:14:04 +0100 Subject: [PATCH] Improve error handling in SpringBootPlugin Closes gh-32677 --- .../boot/gradle/plugin/SpringBootPlugin.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootPlugin.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootPlugin.java index 576fd08692..54d12d2173 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootPlugin.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootPlugin.java @@ -130,12 +130,15 @@ public class SpringBootPlugin implements Plugin { private void withPluginClassOfAction(PluginApplicationAction action, Consumer>> consumer) { + Class> pluginClass; try { - consumer.accept(action.getPluginClass()); + pluginClass = action.getPluginClass(); } catch (Throwable ex) { - // Plugin class unavailable. Continue. + // Plugin class unavailable. + return; } + consumer.accept(pluginClass); } }