Skip to content
Permalink
Browse files

[FIXED JENKINS-20950] Do not try to persist the build which holds thi…

…s action.
  • Loading branch information
jglick committed Dec 10, 2013
1 parent 2842fd9 commit 0dc90f1ab6b3942b971d76d3732c45dfb0c9fa0a
@@ -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>
@@ -168,7 +168,7 @@ public int httpStatus() {
if (action != null) {
container = action;
} else if (createContainer) {
action = new MetadataBuildAction(buildByNumber);
action = new MetadataBuildAction();
buildByNumber.addAction(action);
container = action;
} else {
@@ -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());
@@ -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);
}

@@ -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;
@@ -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.
@@ -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) {
@@ -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);
}
@@ -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.
*

0 comments on commit 0dc90f1

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