Skip to content

Commit

Permalink
[FIXED JENKINS-16993] Since 1.503 LogRotator is extension point and D…
Browse files Browse the repository at this point in the history
…ESCRIPTOR was removed from this class
  • Loading branch information
vjuranek committed Feb 28, 2013
1 parent e44913c commit a29e32f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -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>

Expand Down
10 changes: 8 additions & 2 deletions src/main/java/hudson/plugins/build_publisher/BuildPublisher.java
Expand Up @@ -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;

/**
Expand All @@ -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 {
Expand Down Expand Up @@ -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;
}
Expand Down
Expand Up @@ -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 -->
Expand Down

0 comments on commit a29e32f

Please sign in to comment.