From 809a82fba217dbca4a13dc734066f2ce9b5bda3e Mon Sep 17 00:00:00 2001 From: jansupol Date: Thu, 23 Jan 2025 11:22:07 +0100 Subject: [PATCH] Prevent NPE in ComponentBag Signed-off-by: jansupol --- .../org/glassfish/jersey/model/internal/ComponentBag.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core-common/src/main/java/org/glassfish/jersey/model/internal/ComponentBag.java b/core-common/src/main/java/org/glassfish/jersey/model/internal/ComponentBag.java index eeac2e8c84..ebe81a6a0a 100644 --- a/core-common/src/main/java/org/glassfish/jersey/model/internal/ComponentBag.java +++ b/core-common/src/main/java/org/glassfish/jersey/model/internal/ComponentBag.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -605,7 +605,7 @@ public Set getInstances(final Predicate filter) { return instancesView.stream() .filter(input -> { final ContractProvider model = getModel(input.getClass()); - return filter.test(model); + return model == null ? false : filter.test(model); }) .collect(Collectors.toCollection(LinkedHashSet::new)); }