From d92ac8062b6d02846917a351dac8b3a6a061fae9 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Sun, 11 May 2014 11:21:11 +0200 Subject: [PATCH] Avoid IllegalStateException in case of abort concurrent to header generation. --- .../org/eclipse/jetty/client/http/HttpSenderOverHTTP.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpSenderOverHTTP.java b/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpSenderOverHTTP.java index a00be54cac2..d176826fc94 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpSenderOverHTTP.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpSenderOverHTTP.java @@ -23,6 +23,7 @@ import java.nio.ByteBuffer; import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.client.HttpContent; import org.eclipse.jetty.client.HttpExchange; +import org.eclipse.jetty.client.HttpRequestException; import org.eclipse.jetty.client.HttpSender; import org.eclipse.jetty.client.api.ContentProvider; import org.eclipse.jetty.client.api.Request; @@ -107,6 +108,12 @@ public class HttpSenderOverHTTP extends HttpSender endPoint.write(new ByteBufferRecyclerCallback(callback, bufferPool, toRecycle), toWrite); return; } + case DONE: + { + // The headers have already been generated, perhaps by a concurrent abort. + callback.failed(new HttpRequestException("Could not generate headers", request)); + return; + } default: { throw new IllegalStateException(result.toString());