diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-07-23 18:17:14 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-07-23 18:17:14 +0200 |
commit | a0a52ddc782e95c38dfb1221064cbf72a41710f0 (patch) | |
tree | 41c564c3c1e880a1c2df7ea30737ba3e57e24ec9 | |
parent | 672f34433e52f15d851dff4978878887e69c2969 (diff) | |
download | sonarqube-a0a52ddc782e95c38dfb1221064cbf72a41710f0.tar.gz sonarqube-a0a52ddc782e95c38dfb1221064cbf72a41710f0.zip |
SONAR-3688 Improve log when loading a plugin that is not compiled for Java 5
-rw-r--r-- | sonar-core/src/main/java/org/sonar/core/plugins/PluginClassloaders.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/plugins/PluginClassloaders.java b/sonar-core/src/main/java/org/sonar/core/plugins/PluginClassloaders.java index 11a762d7333..2b2c27600be 100644 --- a/sonar-core/src/main/java/org/sonar/core/plugins/PluginClassloaders.java +++ b/sonar-core/src/main/java/org/sonar/core/plugins/PluginClassloaders.java @@ -122,8 +122,8 @@ public class PluginClassloaders { realm.addURL(url); } return realm; - } catch (Exception e) { - throw new SonarException(e); + } catch (Throwable e) { + throw new SonarException("Fail to build the classloader of " + plugin.getKey(), e); } } @@ -143,8 +143,8 @@ public class PluginClassloaders { base.addURL(file.toURI().toURL()); } return true; - } catch (Exception e) { - throw new SonarException(e); + } catch (Throwable e) { + throw new SonarException("Fail to extend the plugin " + plugin.getBasePlugin() + " for " + plugin.getKey(), e); } } @@ -207,7 +207,9 @@ public class PluginClassloaders { Class claz = get(metadata.getKey()).loadClass(metadata.getMainClass()); return (Plugin) claz.newInstance(); - } catch (Exception e) { + } catch (Throwable e) { + // Do not catch only Exception in order to detect the plugins compiled for Java > 5 + // (it raises a java.lang.UnsupportedClassVersionError) throw new SonarException("Fail to load plugin " + metadata.getKey(), e); } } |