mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-06 00:25:58 +00:00
Plugin is now optional
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@15898 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
03b398024a
commit
29697efdfa
3 files changed
+26
-18
No files matched your search
@@ -169,11 +169,6 @@ public class ClassicPluginStrategy implements PluginStrategy {
|
||||
}
|
||||
|
||||
public void load(PluginWrapper wrapper) throws IOException {
|
||||
String className = wrapper.getPluginClass();
|
||||
if(className ==null) {
|
||||
throw new IOException("Plugin installation failed. No 'Plugin-Class' entry in the manifest of "+wrapper.getShortName());
|
||||
}
|
||||
|
||||
loadPluginDependencies(wrapper.getDependencies(),
|
||||
wrapper.getOptionalDependencies());
|
||||
|
||||
@@ -185,19 +180,25 @@ public class ClassicPluginStrategy implements PluginStrategy {
|
||||
ClassLoader old = Thread.currentThread().getContextClassLoader();
|
||||
Thread.currentThread().setContextClassLoader(wrapper.classLoader);
|
||||
try {
|
||||
try {
|
||||
Class clazz = wrapper.classLoader.loadClass(className);
|
||||
Object o = clazz.newInstance();
|
||||
if(!(o instanceof Plugin)) {
|
||||
throw new IOException(className+" doesn't extend from hudson.Plugin");
|
||||
String className = wrapper.getPluginClass();
|
||||
if(className==null) {
|
||||
// use the default dummy instance
|
||||
wrapper.setPlugin(Plugin.NONE);
|
||||
} else {
|
||||
try {
|
||||
Class clazz = wrapper.classLoader.loadClass(className);
|
||||
Object o = clazz.newInstance();
|
||||
if(!(o instanceof Plugin)) {
|
||||
throw new IOException(className+" doesn't extend from hudson.Plugin");
|
||||
}
|
||||
wrapper.setPlugin((Plugin) o);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new IOException2("Unable to load " + className + " from " + wrapper.getShortName(),e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new IOException2("Unable to create instance of " + className + " from " + wrapper.getShortName(),e);
|
||||
} catch (InstantiationException e) {
|
||||
throw new IOException2("Unable to create instance of " + className + " from " + wrapper.getShortName(),e);
|
||||
}
|
||||
wrapper.setPlugin((Plugin) o);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new IOException2("Unable to load " + className + " from " + wrapper.getShortName(),e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new IOException2("Unable to create instance of " + className + " from " + wrapper.getShortName(),e);
|
||||
} catch (InstantiationException e) {
|
||||
throw new IOException2("Unable to create instance of " + className + " from " + wrapper.getShortName(),e);
|
||||
}
|
||||
|
||||
// initialize plugin
|
||||
|
||||
Reference in new issue
Block a user