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

Commit

Permalink
Fix 9.4.51 NullPointerException jetty#9476
Browse files Browse the repository at this point in the history
Added a null check for the Callback parameter in o.e.j.iAbstractConnection.failedCallback(Callback, Throwable) so that the subsequent code-flow is not aborted; while the root cause may be ascertained in case debug logging is enabled.

Further, in the case of a RejectedExecutionException when submitting the failCallback, the Runnable is run instead of directly invoking the Callback, so that exceptions in the Callback do not abort the synchronous code-flow.
  • Loading branch information
sid-evolphin authored Jun 20, 2023
1 parent ec7e1fd commit 4debff7
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ protected Executor getExecutor()

protected void failedCallback(final Callback callback, final Throwable x)
{
if (callback == null) {
if (LOG.isDebugEnabled()) {
LOG.warn("Callback null", x);
}
return;
}
Runnable failCallback = () ->
{
try
Expand All @@ -93,7 +99,7 @@ protected void failedCallback(final Callback callback, final Throwable x)
}
catch (Exception e)
{
LOG.warn(e);
LOG.warn("Failed callback", e);
}
};

Expand All @@ -107,7 +113,7 @@ protected void failedCallback(final Callback callback, final Throwable x)
catch (RejectedExecutionException e)
{
LOG.debug(e);
callback.failed(x);
failCallback.run();
}
break;

Expand Down

0 comments on commit 4debff7

Please sign in to comment.