Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
enwi committed Feb 21, 2017
1 parent 8a28ba4 commit 39511d9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
21 changes: 11 additions & 10 deletions src/main/java/org/korosoft/jenkins/plugin/rtp/RichTextPortlet.java
Expand Up @@ -71,26 +71,27 @@ public String getRichText() {
if (j == null) {
throw new IllegalStateException("Jenkins.getInstance() is null!");
}
TopLevelItem item = j.getItem(jobName);
if (item == null) {
throw new IllegalStateException("Jenkins.getInstance().getItem(jobName) is null!");
}


Item item = j.getItem(jobName);
if (!(item instanceof AbstractProject)) {
return String.format(Messages.jobNotFound(), jobName);
item = j.getItemByFullName(jobName);
}
if (item == null) {
return String.format(Messages.jobNotFound(), jobName);
}
AbstractProject<?, ?> project = (AbstractProject<?, ?>) item;

Job<?, ?> project = (Job<?, ?>) item;
if (!useLastStable) {
return getRichTextFromActions(project.getActions(AbstractRichTextAction.class));
} else {
for (AbstractBuild<?, ?> abstractBuild : project.getBuilds()) {
for (Run<?, ?> build : project.getBuilds()) {

Result res = abstractBuild.getResult();
Result res = build.getResult();
if(res == null) {
throw new IllegalStateException("abstractBuild.getResult() is null!");
}
if (res.isBetterOrEqualTo(Result.SUCCESS)) {
return getRichTextFromActions(abstractBuild.getActions(AbstractRichTextAction.class));
return getRichTextFromActions(build.getActions(AbstractRichTextAction.class));
}
}
return Messages.noStableBuildsYet();
Expand Down
Expand Up @@ -27,7 +27,6 @@
import org.jenkinsci.plugins.workflow.steps.AbstractStepImpl;
import org.kohsuke.stapler.AncestorInPath;
import org.kohsuke.stapler.DataBoundConstructor;
//import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.QueryParameter;
Expand Down

0 comments on commit 39511d9

Please sign in to comment.