Skip to content
Permalink
Browse files
[FIXED JENKINS-16993] Since 1.503 LogRotator is extension point and D…
…ESCRIPTOR was removed from this class
  • Loading branch information
vjuranek committed Feb 28, 2013
1 parent e44913c commit a29e32f0733280bb52903e69367d96b60e71772f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
@@ -3,7 +3,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.424</version>
<version>1.503</version>
<relativePath>../pom.xml</relativePath>
</parent>

@@ -16,13 +16,18 @@
import hudson.tasks.LogRotator;
import hudson.tasks.Notifier;
import hudson.tasks.Publisher;
import hudson.tasks.LogRotator.LRDescriptor;

import org.kohsuke.stapler.StaplerRequest;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Vector;

import jenkins.model.BuildDiscarder;
import jenkins.model.Jenkins;
import net.sf.json.JSONObject;

/**
@@ -42,7 +47,7 @@ public class BuildPublisher extends Notifier implements MatrixAggregatable {
private LogRotator logRotator;

private transient HudsonInstance publicHudsonInstance;

@Override
public boolean perform(AbstractBuild build, Launcher launcher,
BuildListener listener) throws InterruptedException, IOException {
@@ -145,7 +150,8 @@ public Publisher newInstance(StaplerRequest req, JSONObject formData) throws For
req.bindParameters(bp, "bp.");

if (req.getParameter("publicLogrotate") != null) {
bp.logRotator = LogRotator.DESCRIPTOR.newInstance(req,formData.getJSONObject("publicLogrotate"));
LRDescriptor desc = (LRDescriptor)Jenkins.getInstance().getDescriptor(LogRotator.class);
bp.logRotator = (LogRotator)desc.newInstance(req,formData.getJSONObject("publicLogrotate"));
} else {
bp.logRotator = null;
}
@@ -22,7 +22,8 @@
<f:optionalBlock name="publicLogrotate"
help="/help/project-config/log-rotation.html"
title="${%Discard Old Builds}" checked="${instance.logRotator!=null}">
<st:include page="/hudson/tasks/LogRotator/config.jelly" it="${instance}" />
<j:set var="instance" value="${instance.logRotator}" />
<st:include page="config.jelly" class="hudson.tasks.LogRotator" />
</f:optionalBlock>
</f:advanced>
<!--TODO: post actions -->

0 comments on commit a29e32f

Please sign in to comment.