Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Auge2015-04-26 04:10:36 +0000
committerRaymond Auge2015-04-28 08:26:06 +0000
commitb234ac03f6d282648cb05586821847c5ed15b4e6 (patch)
treedce05651376267d88e2a7d1e6d01d86aac20bf86
parentf8d19cfc971f73ae38a2f4ab5ce593f2cb03b366 (diff)
downloadrt.equinox.bundles-b234ac03f6d282648cb05586821847c5ed15b4e6.tar.gz
rt.equinox.bundles-b234ac03f6d282648cb05586821847c5ed15b4e6.tar.xz
rt.equinox.bundles-b234ac03f6d282648cb05586821847c5ed15b4e6.zip
Bug 465445 - fix error handling
Signed-off-by: Raymond Auge <raymond.auge@liferay.com>
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/ResponseStateHandler.java44
1 files changed, 20 insertions, 24 deletions
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/ResponseStateHandler.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/ResponseStateHandler.java
index a5eca068..0bf19daf 100644
--- a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/ResponseStateHandler.java
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/ResponseStateHandler.java
@@ -83,15 +83,7 @@ public class ResponseStateHandler {
setException(e);
if (dispatcherType != DispatcherType.REQUEST) {
- if (e instanceof RuntimeException) {
- throw (RuntimeException)e;
- }
- else if (e instanceof IOException) {
- throw (IOException)e;
- }
- else if (e instanceof ServletException) {
- throw (ServletException)e;
- }
+ throwException(e);
}
}
finally {
@@ -131,7 +123,7 @@ public class ResponseStateHandler {
private void handleException() throws IOException, ServletException {
if (!(response instanceof HttpServletResponseWrapper)) {
- return;
+ throw new IllegalStateException("Response isn't a wrapper"); //$NON-NLS-1$
}
HttpServletResponseWrapper wrapper = (HttpServletResponseWrapper)response;
@@ -158,9 +150,7 @@ public class ResponseStateHandler {
HttpServletResponse wrappedResponse = (HttpServletResponse)wrapperImpl.getResponse();
if (wrappedResponse.isCommitted()) {
- // There's nothing we can do here.
-
- return;
+ throwException(exception);
}
ContextController contextController = dispatchTargets.getContextController();
@@ -171,15 +161,7 @@ public class ResponseStateHandler {
null, className, null, null, null, null, Match.EXACT, null);
if (errorDispatchTargets == null) {
- if (exception instanceof RuntimeException) {
- throw (RuntimeException)exception;
- }
- else if (exception instanceof IOException) {
- throw (IOException)exception;
- }
- else if (exception instanceof ServletException) {
- throw (ServletException)exception;
- }
+ throwException(exception);
}
request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, exception);
@@ -207,7 +189,7 @@ public class ResponseStateHandler {
private void handleResponseCode() throws IOException, ServletException {
if (!(response instanceof HttpServletResponseWrapper)) {
- return;
+ throw new IllegalStateException("Response isn't a wrapper"); //$NON-NLS-1$
}
HttpServletResponseWrapper wrapper = (HttpServletResponseWrapper)response;
@@ -271,9 +253,23 @@ public class ResponseStateHandler {
ResponseStateHandler responseStateHandler = new ResponseStateHandler(
request, wrapperResponse, errorDispatchTargets, DispatcherType.ERROR);
+ wrappedResponse.setStatus(status);
+
responseStateHandler.processRequest();
+ }
- wrappedResponse.setStatus(status);
+ private void throwException(Exception e)
+ throws IOException, ServletException {
+
+ if (e instanceof RuntimeException) {
+ throw (RuntimeException)e;
+ }
+ else if (e instanceof IOException) {
+ throw (IOException)e;
+ }
+ else if (e instanceof ServletException) {
+ throw (ServletException)e;
+ }
}
private DispatchTargets dispatchTargets;

Back to the top