Skip to content
Permalink
Browse files

[JENKINS-42383] Removed Javadoc plugin dependency

  • Loading branch information...
v1v committed Mar 1, 2017
1 parent e83cb3d commit b29ceb66f297edb4ee6f53f5f3126ef0819faec9
Showing with 18 additions and 6 deletions.
  1. +1 −0 pom.xml
  2. +17 −6 src/main/java/org/jenkins/ci/plugins/jenkinslint/check/JavadocChecker.java
@@ -96,6 +96,7 @@
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>javadoc</artifactId>
<version>1.0</version>
<scope>test</scope>
</dependency>

<dependency>
@@ -3,11 +3,12 @@
import hudson.model.AbstractProject;
import hudson.model.Descriptor;
import hudson.model.Item;
import hudson.tasks.JavadocArchiver;
import hudson.tasks.Publisher;
import hudson.util.DescribableList;
import org.jenkins.ci.plugins.jenkinslint.model.AbstractCheck;

import java.util.logging.Level;

/**
* @author Victor Martinez
*/
@@ -20,16 +21,26 @@ public JavadocChecker() {
}

public boolean executeCheck(Item item) {
boolean found = false;
if (item instanceof AbstractProject) {
DescribableList<Publisher, Descriptor<Publisher>> publishersList = ((AbstractProject) item).getPublishersList();
for (Publisher publisher : publishersList) {
if (publisher instanceof hudson.tasks.JavadocArchiver) {
return ( ((JavadocArchiver) publisher).getJavadocDir() == null ||
( ((JavadocArchiver) publisher).getJavadocDir() != null &&
((JavadocArchiver) publisher).getJavadocDir().length() == 0 ));
if (publisher.getClass().getSimpleName().equals("JavadocArchiver")) {
try {
Object getJavadocDir = publisher.getClass().getMethod("getJavadocDir", null).invoke(publisher);
if (getJavadocDir instanceof String) {
if (getJavadocDir == null) {
found = true;
} else {
found = ((String) getJavadocDir).isEmpty();
}
}
} catch (Exception e) {
LOG.log(Level.WARNING, "Exception " + e.getMessage(), e.getCause());
}
}
}
}
return false;
return found;
}
}

0 comments on commit b29ceb6

Please sign in to comment.
You can’t perform that action at this time.