Skip to content

Commit fe878f2

Browse files
namedgraphclaude
andcommitted
Fix NPE in CacheInvalidationFilter when request scope is unavailable
When a request is rejected before the Jersey injection scope is populated (e.g. by ContentLengthLimitFilter), app.get() returns null instead of an Optional, causing a NullPointerException in the response filter stage. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 39777bc commit fe878f2

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/main/java/com/atomgraph/linkeddatahub/server/filter/response/CacheInvalidationFilter.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ public class CacheInvalidationFilter implements ContainerResponseFilter
6060
@Override
6161
public void filter(ContainerRequestContext req, ContainerResponseContext resp) throws IOException
6262
{
63-
// If no application was matched (e.g., non-existent dataspace), skip cache invalidation
64-
if (!getApplication().isPresent()) return;
63+
// If no application was matched (e.g., non-existent dataspace or request scope unavailable), skip cache invalidation
64+
Optional<com.atomgraph.linkeddatahub.apps.model.Application> application = getApplication();
65+
if (application == null || !application.isPresent()) return;
6566

6667
if (req.getMethod().equals(HttpMethod.POST) && resp.getHeaderString(HttpHeaders.LOCATION) != null)
6768
{

0 commit comments

Comments
 (0)