Skip to content
Permalink
Browse files

[JENKINS-20074] When displaying an uncaught exception, if we are unab…

…le to write the content, just do nothing.
  • Loading branch information...
jglick committed Oct 16, 2013
1 parent 587c6fe commit 177b39a5fb8eee20218a9066679727707864edf0
Showing with 14 additions and 3 deletions.
  1. +1 −1 core/pom.xml
  2. +13 −2 core/src/main/java/hudson/init/impl/InstallUncaughtExceptionHandler.java
@@ -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.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import org.kohsuke.stapler.Stapler;

/**
* @author Kohsuke Kawaguchi
@@ -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;
}
}
}
});
}

0 comments on commit 177b39a

Please sign in to comment.
You can’t perform that action at this time.