Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into JENKINS-34200
Browse files Browse the repository at this point in the history
  • Loading branch information
recena committed Apr 22, 2016
2 parents b895f08 + 275ea88 commit 730791c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
Expand Up @@ -26,6 +26,7 @@

import com.cloudbees.hudson.plugins.folder.AbstractFolder;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.ExtensionList;
import hudson.XmlFile;
import hudson.model.Action;
Expand Down Expand Up @@ -99,8 +100,9 @@ public abstract class ComputedFolder<I extends TopLevelItem> extends AbstractFol
private DescribableList<Trigger<?>,TriggerDescriptor> triggers;
// TODO p:config-triggers also expects there to be a BuildAuthorizationToken authToken option. Do we want one?

private transient @CheckForNull FolderComputation<I> computation;
private transient @Nonnull FolderComputation<I> computation;

@SuppressFBWarnings(value = "NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR")
protected ComputedFolder(ItemGroup parent, String name) {
super(parent, name);
init();
Expand Down Expand Up @@ -329,8 +331,7 @@ public String getWhyBlocked() {

@Override
public CauseOfBlockage getCauseOfBlockage() {
final FolderComputation<I> c = computation;
if (c != null && c.isBuilding()) {
if (computation.isBuilding()) {
return CauseOfBlockage.fromMessage(Messages._ComputedFolder_already_computing());
}
return null;
Expand Down Expand Up @@ -382,7 +383,7 @@ public Node getLastBuiltOn() {

@Override
public long getEstimatedDuration() {
return computation == null ? -1 : computation.getEstimatedDuration();
return computation.getEstimatedDuration();
}

@Override
Expand Down Expand Up @@ -415,15 +416,17 @@ protected File getComputationDir() {
return new File(getRootDir(), "computation");
}

/** URL binding and other purposes. */
public @CheckForNull FolderComputation<I> getComputation() {
/**
* URL binding and other purposes.
* It may be null temporarily inside the constructor, so beware if you extend this class.
*/
public @Nonnull FolderComputation<I> getComputation() {
return computation;
}

@Override
protected String renameBlocker() {
FolderComputation<I> comp = getComputation();
if (comp != null && comp.isBuilding()) {
if (computation.isBuilding()) {
return "Recomputation is currently in progress";
}
return super.renameBlocker();
Expand Down
@@ -1,7 +1,7 @@
<!--
The MIT License
Copyright 2013-2015 CloudBees.
Copyright 2013-2016 CloudBees, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -24,16 +24,13 @@ THE SOFTWARE.
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout"
xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt" xmlns:this="this">
<j:set var="url" value="${h.getNearestAncestorUrl(request,it)}"/>
<j:set var="title" value="${%Folder Computation}"/> <!-- fallback, usually invisible -->

<j:set var="computation" value="${it.computation}"/>
<j:if test="${computation != null}">
<j:set var="title" value="${computation.displayName}"/>
</j:if>
<l:task icon="images/24x24/notepad.png" href="${url}/computation/" title="${title}">
<j:if test="${h.hasPermission(it,it.BUILD) and it.buildable}">
<l:task icon="images/24x24/clock.png" href="${url}/build?delay=0" post="true" title="${%Run Now}"/>

<l:task icon="images/24x24/notepad.png" href="${rootURL}/${computation.url}" title="${computation.displayName}">
<j:if test="${h.hasPermission(it, it.BUILD) and it.buildable}">
<l:task icon="images/24x24/clock.png" href="${rootURL}/${it.url}build?delay=0" post="true" title="${%Run Now}"/>
</j:if>
<l:task icon="images/24x24/terminal.png" href="${url}/computation/console" title="${%Log}"/>
<l:task icon="images/24x24/terminal.png" href="${rootURL}/${computation.url}console" title="${%Log}"/>
</l:task>
</j:jelly>

0 comments on commit 730791c

Please sign in to comment.