Skip to content

Commit

Permalink
Do not assume HttpResponse is a functional interface (jenkinsci#1590)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed Jun 4, 2024
1 parent 657322a commit 18933cd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/hudson/plugins/git/GitStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import hudson.security.ACL;
import hudson.security.ACLContext;
import hudson.triggers.SCMTrigger;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URISyntaxException;
import java.util.*;
Expand Down Expand Up @@ -177,7 +178,9 @@ public HttpResponse doNotifyCommit(HttpServletRequest request, @QueryParameter(r
contributors.addAll(listener.onNotifyCommit(origin, uri, sha1, buildParameters, branchesArray));
}

return (StaplerRequest req, StaplerResponse rsp, Object node) -> {
return new HttpResponse() {
@Override
public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node) throws IOException {
rsp.setStatus(SC_OK);
rsp.setContentType("text/plain");
for (int i = 0; i < contributors.size(); i++) {
Expand All @@ -192,6 +195,7 @@ public HttpResponse doNotifyCommit(HttpServletRequest request, @QueryParameter(r
for (ResponseContributor c : contributors) {
c.writeBody(req, rsp, w);
}
}
};
}

Expand Down

0 comments on commit 18933cd

Please sign in to comment.