Skip to content

Commit

Permalink
[FIXED JENKINS-20074] Do not report irrelevant exceptions thrown in t…
Browse files Browse the repository at this point in the history
…he process of reporting a (possibly relevant) exception.

Merge branch 'uncaught-socket-exceptions-JENKINS-20074'

Conflicts:
	core/pom.xml
  • Loading branch information
jglick committed Nov 4, 2013
2 parents b9e227e + 177b39a commit cd8791e
Showing 1 changed file with 13 additions and 2 deletions.
Expand Up @@ -11,6 +11,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import org.kohsuke.stapler.Stapler;

/**
* @author Kohsuke Kawaguchi
Expand All @@ -22,8 +23,18 @@ public static void init(final Jenkins j) throws IOException {
@Override
public void reportException(Throwable e, ServletContext context, HttpServletRequest req, HttpServletResponse rsp) throws ServletException, IOException {
req.setAttribute("javax.servlet.error.exception",e);
WebApp.get(j.servletContext).getSomeStapler()
.invoke(req,rsp, Jenkins.getInstance(), "/oops");
try {
WebApp.get(j.servletContext).getSomeStapler()
.invoke(req,rsp, Jenkins.getInstance(), "/oops");
} catch (ServletException x) {
if (!Stapler.isSocketException(x)) {
throw x;
}
} catch (IOException x) {
if (!Stapler.isSocketException(x)) {
throw x;
}
}
}
});
}
Expand Down

0 comments on commit cd8791e

Please sign in to comment.