Skip to content

Commit

Permalink
Avoid potential NPE in Metrics filter
Browse files Browse the repository at this point in the history
The NPE could happen if an exception was thrown
in a ContainerRequestFilter

Fixes: quarkusio#16620
  • Loading branch information
geoand committed Apr 19, 2021
1 parent 809b135 commit 07c58b1
Showing 1 changed file with 3 additions and 0 deletions.
Expand Up @@ -17,6 +17,9 @@ public class QuarkusRestMetricsFilter {

@ServerResponseFilter
public void filter(ResourceInfo resourceInfo, Throwable throwable) {
if (resourceInfo == null) { // can happen if an exception was thrown before a target method has been identified
return;
}
final Class<?> resourceClass = resourceInfo.getResourceClass();
final Method resourceMethod = resourceInfo.getResourceMethod();
maybeCreateMetrics(resourceClass, resourceMethod);
Expand Down

0 comments on commit 07c58b1

Please sign in to comment.