From: Eric Hartmann Date: Tue, 24 Jul 2012 08:39:33 +0000 (+0200) Subject: Manual merge of branch 3.2 X-Git-Tag: 3.3~366 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d8fff0e184666bb4b95f4f479786447b6b4840cf;p=sonarqube.git Manual merge of branch 3.2 --- d8fff0e184666bb4b95f4f479786447b6b4840cf diff --cc sonar-core/src/main/java/org/sonar/core/plugins/PluginClassloaders.java index a53effc5c34,f4c6c7e87f9..90d42808000 --- 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,11 -130,10 +130,14 @@@ public class PluginClassloaders realm.addURL(url); } return realm; + } catch (UnsupportedClassVersionError e) { + throw new SonarException("The plugin " + plugin.getKey() + " is not supported with Java " + SystemUtils.JAVA_VERSION_TRIMMED, e); + } catch (Throwable e) { + // SONAR-3688 + // Throwable is explicitely caught instead of Exception in order to log the plugins + // that are compiled for Java > 5. In such case java.lang.UnsupportedClassVersionError + // is raised. throw new SonarException("Fail to build the classloader of " + plugin.getKey(), e); } } @@@ -147,12 -154,11 +158,15 @@@ base.addURL(file.toURI().toURL()); } return true; + } catch (UnsupportedClassVersionError e) { + throw new SonarException("The plugin " + plugin.getKey() + " is not supported with Java " + SystemUtils.JAVA_VERSION_TRIMMED, e); + } catch (Throwable e) { - throw new SonarException("Fail to extend the plugin " + plugin.getBasePlugin() + " with " + plugin.getKey(), e); + // SONAR-3688 + // Throwable is explicitely caught instead of Exception in order to log the plugins + // that are compiled for Java > 5. In such case java.lang.UnsupportedClassVersionError + // is raised. + throw new SonarException("Fail to extend the plugin " + plugin.getBasePlugin() + " for " + plugin.getKey(), e); } } @@@ -210,17 -216,16 +224,20 @@@ } } - public Plugin instantiatePlugin(PluginMetadata metadata) { + public Plugin instantiatePlugin(PluginMetadata plugin) { try { - Class claz = get(metadata.getKey()).loadClass(metadata.getMainClass()); - return (Plugin) claz.newInstance(); + Class clazz = get(plugin.getKey()).loadClass(plugin.getMainClass()); + return (Plugin) clazz.newInstance(); + + } catch (UnsupportedClassVersionError e) { + throw new SonarException("The plugin " + plugin.getKey() + " is not supported with Java " + SystemUtils.JAVA_VERSION_TRIMMED, e); } catch (Throwable e) { - throw new SonarException("Fail to load the plugin " + plugin.getKey(), e); + // SONAR-3688 + // Throwable is explicitely caught instead of Exception in order to log the plugins + // that are compiled for Java > 5. In such case java.lang.UnsupportedClassVersionError + // is raised. + throw new SonarException("Fail to load plugin " + metadata.getKey(), e); } }