Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix JENKINS-33690
Removed explicit look for an ExtendedEmailPublisher instance to get the Jenkins url.
  • Loading branch information
Alex Earl committed Mar 25, 2016
1 parent 4edc42b commit 6a17566
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Expand Up @@ -8,6 +8,7 @@
import hudson.plugins.emailext.plugins.EmailTrigger;
import hudson.plugins.emailext.plugins.RecipientProvider;
import jenkins.model.Jenkins;
import jenkins.model.JenkinsLocationConfiguration;
import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.codehaus.groovy.control.CompilerConfiguration;
Expand Down Expand Up @@ -72,12 +73,10 @@ private GroovyShell createEngine(AbstractBuild<?, ?> build, TaskListener listene
"hudson",
"hudson.model"));

ExtendedEmailPublisher publisher = build.getProject().getPublishersList().get(ExtendedEmailPublisher.class);

Binding binding = new Binding();
binding.setVariable("build", build);
binding.setVariable("project", build.getParent());
binding.setVariable("rooturl", publisher.getDescriptor().getHudsonUrl());
binding.setVariable("rooturl", JenkinsLocationConfiguration.get().getUrl());
binding.setVariable("out", listener.getLogger());

GroovyShell shell = new GroovyShell(cl, binding, cc);
Expand Down
15 changes: 8 additions & 7 deletions src/test/java/hudson/plugins/emailext/AttachmentUtilsTest.java
Expand Up @@ -43,12 +43,13 @@
public class AttachmentUtilsTest {

@Rule
public final JenkinsRule j = new JenkinsRule();

@Before
public void setUp() {
Mailbox.clearAll();
}
public final JenkinsRule j = new JenkinsRule() {
@Override
public void before() throws Throwable {
Mailbox.clearAll();
super.before();
}
};

@Test
public void testAttachmentFromWorkspace() throws Exception {
Expand Down Expand Up @@ -197,7 +198,7 @@ public void testNonEnglishCharacter() throws Exception {
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
build.getWorkspace().child("已使用红包.txt").write("test.property=success","UTF-8");
return true;
return build.getWorkspace().child("已使用红包.txt").exists();
}
});

Expand Down

0 comments on commit 6a17566

Please sign in to comment.