From b32d0e4f7414e4f144148e8e39cc308b2f9131a8 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Sun, 2 Feb 2014 14:24:16 +0100 Subject: [PATCH] Use dedicated exceptions to track incompatible/missing plugin to be used by other component to log/resolve configuration issue. --- core/src/main/java/hudson/PluginWrapper.java | 21 ++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/hudson/PluginWrapper.java b/core/src/main/java/hudson/PluginWrapper.java index 71370d4cdd..e35d03ba8d 100644 --- a/core/src/main/java/hudson/PluginWrapper.java +++ b/core/src/main/java/hudson/PluginWrapper.java @@ -501,10 +501,10 @@ public class PluginWrapper implements Comparable, ModelObject { } if (!missingDependencies.isEmpty()) - throw new IOException("Dependency "+Util.join(missingDependencies, ", ")+" doesn't exist"); + throw new MissingDepencyException("Dependency "+Util.join(missingDependencies, ", ")+" doesn't exist", missingDependencies); if (!incompatibleDependencies.isEmpty()) - throw new IOException("Dependency "+Util.join(incompatibleDependencies, ", ")+" doesn't match required version"); + throw new IncompatibleDependencyException("Dependency "+Util.join(incompatibleDependencies, ", ")+" doesn't match required version", incompatibleDependencies); } @@ -646,4 +646,21 @@ public class PluginWrapper implements Comparable, ModelObject { private static final Logger LOGGER = Logger.getLogger(PluginWrapper.class.getName()); + public class IncompatibleDependencyException extends IOException { + public final List plugins; + + public IncompatibleDependencyException(String message, List plugins) { + super(message); + this.plugins = plugins; + } + } + + public class MissingDepencyException extends IOException { + public final List plugins; + + public MissingDepencyException(String message, List plugins) { + super(message); + this.plugins = plugins; + } + } }