Fix race condition in some http conformance test
Make call to Exception.getMessage()/getReasonPhrase in synchronized
block to fix some flaky unit tests (e.g. testRequestContentCloseExceptionBeforeResponseWrite)
@@ -101,9 +101,9 @@ public class ServletResponseController {
public void trySendError(Throwable t) {
final boolean responseWasCommitted;
try {
+ synchronized (monitor) {
String reasonPhrase = getReasonPhrase(t, developerMode);
int statusCode = getStatusCode(t);
- synchronized (monitor) {
responseWasCommitted = responseCommitted;
if (!responseCommitted) {
responseCommitted = true;
