Skip to content

Commit

Permalink
[CXF-9059] Update impl to handle flush IOException
Browse files Browse the repository at this point in the history
  • Loading branch information
jgoodyear committed Sep 17, 2024
1 parent 15c3158 commit 3355144
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,14 @@ private boolean isSslTargetDifferent(URI lastURL, URI url) {

@Override
public void close(Message msg) throws IOException {
OutputStream os = msg.getContent(OutputStream.class);
// Java 21 may hang on close, we flush stream to help close them out.
if (os != null && AutoCloseable.class.isAssignableFrom(HttpClient.class)) {
os.flush();
try {
OutputStream os = msg.getContent(OutputStream.class);
// Java 21 may hang on close, we flush stream to help close them out.
if (os != null && AutoCloseable.class.isAssignableFrom(HttpClient.class)) {
os.flush();
}
} catch (IOException ioException) {
// ignore
}
super.close(msg);
msg.remove(HttpClient.class);
Expand Down

0 comments on commit 3355144

Please sign in to comment.