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);
}
}
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);
}
}
}
}
- 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);
}
}