Skip to content

Commit

Permalink
Fixed bug when ws-cleanup plugin is not installed. #3 [JENKINS-29418]
Browse files Browse the repository at this point in the history
  • Loading branch information
v1v committed Jul 14, 2015
1 parent 85fd0b1 commit 50b5ad9
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -3,6 +3,7 @@
import hudson.model.Descriptor;
import hudson.model.Item;
import hudson.model.Project;
import jenkins.model.Jenkins;
import org.jenkins.ci.plugins.jenkinslint.model.AbstractCheck;

/**
Expand All @@ -19,6 +20,11 @@ public CleanupWorkspaceChecker() {
}

public boolean executeCheck(Item item) {
return item instanceof Project && ((Project) item).getPublisher(Descriptor.find(hudson.plugins.ws_cleanup.WsCleanup.DescriptorImpl.class.getName())) == null;
if (Jenkins.getInstance().pluginManager.getPlugin("ws-cleanup")!=null) {
return item instanceof Project && ((Project) item).getPublisher(Descriptor.find(hudson.plugins.ws_cleanup.WsCleanup.DescriptorImpl.class.getName())) == null;
} else {
// If ws-cleanup hasn't been installed yet
return true;
}
}
}

0 comments on commit 50b5ad9

Please sign in to comment.