Skip to content

Commit

Permalink
[FIXED JENKINS-20950] Do not try to persist the build which holds thi…
Browse files Browse the repository at this point in the history
…s action.
  • Loading branch information
jglick committed Dec 10, 2013
1 parent 2842fd9 commit 0dc90f1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
4 changes: 1 addition & 3 deletions pom.xml
Expand Up @@ -3,9 +3,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.424</version>
<!-- which version of Jenkins is this plugin built against? -->
<relativePath>pom.xml</relativePath>
<version>1.509.3</version>
</parent>

<groupId>com.sonyericsson.hudson.plugins.metadata</groupId>
Expand Down
Expand Up @@ -168,7 +168,7 @@ public static MetadataContainer<MetadataValue> getContainer(String node, String
if (action != null) {
container = action;
} else if (createContainer) {
action = new MetadataBuildAction(buildByNumber);
action = new MetadataBuildAction();
buildByNumber.addAction(action);
container = action;
} else {
Expand Down
Expand Up @@ -55,7 +55,7 @@ public void onCompleted(AbstractBuild build, TaskListener listener) {
logger.entering(BuildContributorsController.class.getName(), "onCompleted({0})", build);
MetadataBuildAction action = build.getAction(MetadataBuildAction.class);
if (action == null) {
action = new MetadataBuildAction(build);
action = new MetadataBuildAction();
build.addAction(action);
}
listener.getLogger().println(Messages.BuildContributorsController_LogMessage_Collecting());
Expand Down Expand Up @@ -91,7 +91,7 @@ public void onStarted(AbstractBuild build, TaskListener listener) {
}
MetadataBuildAction action = build.getAction(MetadataBuildAction.class);
if (action == null) {
action = new MetadataBuildAction(build);
action = new MetadataBuildAction();
build.addAction(action);
}

Expand Down
Expand Up @@ -28,7 +28,6 @@
import com.sonyericsson.hudson.plugins.metadata.Messages;
import com.sonyericsson.hudson.plugins.metadata.model.values.MetadataValue;
import com.sonyericsson.hudson.plugins.metadata.model.values.ParentUtil;
import hudson.model.Action;
import hudson.model.Hudson;
import hudson.model.Run;
import hudson.security.ACL;
Expand All @@ -38,6 +37,7 @@
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import jenkins.model.RunAction2;

/**
* Holds the meta data for a run.
Expand All @@ -47,17 +47,12 @@
@edu.umd.cs.findbugs.annotations.SuppressWarnings(
value = "UG_SYNC_SET_UNSYNC_GET",
justification = "It is synchronized")
public class MetadataBuildAction implements Action, MetadataContainer<MetadataValue> {
public class MetadataBuildAction implements RunAction2, MetadataContainer<MetadataValue> {

private Run run;
private transient Run run;
private List<MetadataValue> values;

/**
* Standard constructor.
*
* @param run The run that this action is added to.
* @param values the meta data for this run.
*/
@Deprecated
public MetadataBuildAction(Run run, List<MetadataValue> values) {
this.run = run;
if (values == null) {
Expand All @@ -66,11 +61,7 @@ public MetadataBuildAction(Run run, List<MetadataValue> values) {
this.values = values;
}

/**
* Standard constructor.
*
* @param run The run that this action is added to.
*/
@Deprecated
public MetadataBuildAction(Run run) {
this(run, null);
}
Expand All @@ -97,6 +88,16 @@ public String getUrlName() {
return Constants.COMMON_URL_NAME;
}

@Override
public void onAttached(Run<?,?> r) {
this.run = r;
}

@Override
public void onLoad(Run<?,?> r) {
this.run = r;
}

/**
* The run that this action is added to.
*
Expand Down

0 comments on commit 0dc90f1

Please sign in to comment.