File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
test/jdk/java/net/httpclient Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2020, 2023 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2020, 2025 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
@@ -273,8 +273,12 @@ HttpClient newHttpClient(boolean share) {
273273 // rewrap in "Request Cancelled" when the multi exchange was aborted...
274274 private static boolean isCancelled (Throwable t ) {
275275 while (t instanceof ExecutionException ) t = t .getCause ();
276- if (t instanceof CancellationException ) return true ;
277- if (t instanceof IOException ) return String .valueOf (t ).contains ("Request cancelled" );
276+ Throwable cause = t ;
277+ while (cause != null ) {
278+ if (cause instanceof CancellationException ) return true ;
279+ if (cause instanceof IOException && String .valueOf (cause ).contains ("Request cancelled" )) return true ;
280+ cause = cause .getCause ();
281+ }
278282 out .println ("Not a cancellation exception: " + t );
279283 t .printStackTrace (out );
280284 return false ;
You can’t perform that action at this time.
0 commit comments