File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
http-clients/netty-nio-client/src/main/java/software/amazon/awssdk/http/nio/netty/internal Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "category" : " Netty NIO HTTP Client" ,
3
+ "type" : " feature" ,
4
+ "description" : " Improved error messaging when a connection is closed. Fixes [#1260](https://github.com/aws/aws-sdk-java-v2/issues/1260)."
5
+ }
Original file line number Diff line number Diff line change 47
47
import java .io .IOException ;
48
48
import java .net .URI ;
49
49
import java .nio .ByteBuffer ;
50
+ import java .nio .channels .ClosedChannelException ;
50
51
import java .time .Duration ;
51
52
import java .util .Optional ;
52
53
import java .util .concurrent .CompletableFuture ;
@@ -262,6 +263,8 @@ private Throwable decorateException(Throwable originalCause) {
262
263
return new IOException ("Read timed out" , originalCause );
263
264
} else if (originalCause instanceof WriteTimeoutException ) {
264
265
return new IOException ("Write timed out" , originalCause );
266
+ } else if (originalCause instanceof ClosedChannelException ) {
267
+ return new IOException (getMessageForClosedChannel (), originalCause );
265
268
}
266
269
267
270
return originalCause ;
@@ -320,6 +323,12 @@ private String getMessageForTooManyAcquireOperationsError() {
320
323
+ "AWS, or by increasing the number of hosts sending requests." ;
321
324
}
322
325
326
+ private String getMessageForClosedChannel () {
327
+ return "The channel was closed. This may have been done by the client (e.g. because the request was aborted), " +
328
+ "by the service (e.g. because the request took too long or the client tried to write on a read-only socket), " +
329
+ "or by an intermediary party (e.g. because the channel was idle for too long)." ;
330
+ }
331
+
323
332
/**
324
333
* Close and release the channel back to the pool.
325
334
*
You can’t perform that action at this time.
0 commit comments