提交 177b39a5 编写于 作者: J Jesse Glick

[JENKINS-20074] When displaying an uncaught exception, if we are unable to...

[JENKINS-20074] When displaying an uncaught exception, if we are unable to write the content, just do nothing.
上级 587c6fe3
......@@ -42,7 +42,7 @@ THE SOFTWARE.
<properties>
<staplerFork>true</staplerFork>
<stapler.version>1.221</stapler.version>
<stapler.version>1.222-SNAPSHOT</stapler.version>
<spring.version>2.5.6.SEC03</spring.version>
<groovy.version>1.8.9</groovy.version>
</properties>
......
......@@ -11,6 +11,7 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import org.kohsuke.stapler.Stapler;
/**
* @author Kohsuke Kawaguchi
......@@ -22,8 +23,18 @@ public class InstallUncaughtExceptionHandler {
@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;
}
}
}
});
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册