Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
Issue jetty#9476 Fixed null Callback usages in HttpConnection.SendCal…
Browse files Browse the repository at this point in the history
…lback

1. Fixed the usages of `Callback` returned by `o.e.j.s.HttpConnection.SendCallback.release()` to check for `null` before invoking the `failedCallback(Callback, Throwable)` or `succeeded()` methods.

2. Also, added a try-finally block around the Callback invocations in order to ensure that shutdownOutput will get performed irrespective of whether they end up throwing any exception.
  • Loading branch information
sid-evolphin authored Jun 20, 2023
1 parent 452a418 commit 9aa8eef
Showing 1 changed file with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -897,17 +897,27 @@ private void releaseChunk()
@Override
protected void onCompleteSuccess()
{
release().succeeded();
if (_shutdownOut)
getEndPoint().shutdownOutput();
Callback callback = release();
try {
if (callback != null)
callback.succeeded();
} finally {
if (_shutdownOut)
getEndPoint().shutdownOutput();
}
}

@Override
public void onCompleteFailure(final Throwable x)
{
failedCallback(release(), x);
if (_shutdownOut)
getEndPoint().shutdownOutput();
Callback callback = release();
try {
if (callback != null)
failedCallback(callback, x);
} finally {
if (_shutdownOut)
getEndPoint().shutdownOutput();
}
}

@Override
Expand Down

0 comments on commit 9aa8eef

Please sign in to comment.