@@ -365,11 +365,11 @@ public Responder(final RequestProcessingContext processingContext, final ServerR
365
365
366
366
public void process (ContainerResponse response ) {
367
367
processingContext .monitoringEventBuilder ().setContainerResponse (response );
368
- response = processResponse (response );
368
+ response = processResponse (response , null );
369
369
release (response );
370
370
}
371
371
372
- private ContainerResponse processResponse (ContainerResponse response ) {
372
+ private ContainerResponse processResponse (ContainerResponse response , Throwable unmappedThrowable ) {
373
373
final Stage <ContainerResponse > respondingRoot = processingContext .createRespondingRoot ();
374
374
375
375
if (respondingRoot != null ) {
@@ -379,7 +379,7 @@ private ContainerResponse processResponse(ContainerResponse response) {
379
379
380
380
// no-exception zone
381
381
// the methods below are guaranteed to not throw any exceptions
382
- completionCallbackRunner .onComplete (null );
382
+ completionCallbackRunner .onComplete (unmappedThrowable );
383
383
return response ;
384
384
}
385
385
@@ -427,7 +427,7 @@ public void process(final Throwable throwable) {
427
427
final Response exceptionResponse = mapException (throwable );
428
428
try {
429
429
response = preProcessResponse (exceptionResponse , request );
430
- processResponse (response );
430
+ processResponse (response , null );
431
431
} catch (final Throwable respError ) {
432
432
LOGGER .log (Level .SEVERE , LocalizationMessages .ERROR_PROCESSING_RESPONSE_FROM_ALREADY_MAPPED_EXCEPTION ());
433
433
processingContext .monitoringEventBuilder ()
@@ -448,9 +448,10 @@ public void process(final Throwable throwable) {
448
448
try {
449
449
request .getResponseWriter ().failure (responseError );
450
450
} finally {
451
- completionCallbackRunner .onComplete (responseError );
452
-
453
451
defaultMapperResponse = processResponseWithDefaultExceptionMapper (responseError , request );
452
+
453
+ // completionCallbackRunner.onComplete(responseError); is called from
454
+ // processResponseWithDefaultExceptionMapper
454
455
}
455
456
456
457
}
@@ -488,7 +489,7 @@ private boolean processResponseError(final Throwable responseError) {
488
489
489
490
if (processedError != null ) {
490
491
processedResponse =
491
- processResponse (new ContainerResponse (processingContext .request (), processedError ));
492
+ processResponse (new ContainerResponse (processingContext .request (), processedError ), null );
492
493
processed = true ;
493
494
}
494
495
} catch (final Throwable throwable ) {
@@ -545,10 +546,7 @@ private Response mapException(final Throwable originalThrowable) throws Throwabl
545
546
546
547
final long timestamp = tracingLogger .timestamp (ServerTraceEvent .EXCEPTION_MAPPING );
547
548
final ExceptionMapper mapper = runtime .exceptionMappers .findMapping (throwable );
548
- if (mapper != null
549
- && !DefaultExceptionMapper .class .getName ()
550
- .equals (mapper .getClass ().getName ())
551
- ) {
549
+ if (mapper != null && !DefaultExceptionMapper .class .isInstance (mapper )) {
552
550
return processExceptionWithMapper (mapper , throwable , timestamp );
553
551
}
554
552
if (waeResponse != null ) {
@@ -625,7 +623,7 @@ private ContainerResponse processResponseWithDefaultExceptionMapper(Throwable ex
625
623
ContainerRequest request ) {
626
624
long timestamp = tracingLogger .timestamp (ServerTraceEvent .EXCEPTION_MAPPING );
627
625
final Response response = processExceptionWithMapper (DEFAULT_EXCEPTION_MAPPER , exception , timestamp );
628
- return processResponse (preProcessResponse (response , request ));
626
+ return processResponse (preProcessResponse (response , request ), exception );
629
627
}
630
628
631
629
private ContainerResponse writeResponse (final ContainerResponse response ) {
0 commit comments