{"record":{"id":"7eefd2a37a51d971","repo":"quarkusio/quarkus","slug":"last-modified-was-null","errorCode":null,"errorMessage":"Last modified was null","messagePattern":"Last modified was null","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/RequestImpl.java","lineNumber":177,"sourceCode":"        if (ifModifiedSince != null && (!isRfc7232preconditions() || (!headers.containsKey(HttpHeaders.IF_NONE_MATCH)))) {\n            builder = ifModifiedSince(ifModifiedSince, lastModified);\n        }\n        if (builder == null) {\n            String ifUnmodifiedSince = headers.getFirst(HttpHeaders.IF_UNMODIFIED_SINCE);\n            if (ifUnmodifiedSince != null && (!isRfc7232preconditions() || (!headers.containsKey(HttpHeaders.IF_MATCH)))) {\n                builder = ifUnmodifiedSince(ifUnmodifiedSince, lastModified);\n            }\n        }\n        if (builder != null && varyHeader != null)\n            builder.header(HttpHeaders.VARY, varyHeader);\n\n        return builder;\n    }\n\n    @Override\n    public Response.ResponseBuilder evaluatePreconditions(Date lastModified, EntityTag eTag) {\n        if (lastModified == null)\n            throw new IllegalArgumentException(\"Last modified was null\");\n        if (eTag == null)\n            throw new IllegalArgumentException(\"etag was null\");\n        Response.ResponseBuilder rtn = null;\n        Response.ResponseBuilder lastModifiedBuilder = evaluatePreconditions(lastModified);\n        Response.ResponseBuilder etagBuilder = evaluatePreconditions(eTag);\n        if (lastModifiedBuilder == null && etagBuilder == null)\n            rtn = null;\n        else if (lastModifiedBuilder != null && etagBuilder == null)\n            rtn = lastModifiedBuilder;\n        else if (lastModifiedBuilder == null && etagBuilder != null)\n            rtn = etagBuilder;\n        else {\n            rtn = lastModifiedBuilder;\n            rtn.tag(eTag);\n        }\n        if (rtn != null && varyHeader != null)\n            rtn.header(HttpHeaders.VARY, varyHeader);\n        return rtn;","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/RequestImpl.java#L159-L195","documentation":"RequestImpl.evaluatePreconditions(Date, EntityTag) throws IllegalArgumentException when lastModified is null. The two-argument overload requires both a timestamp and an ETag to evaluate all conditional headers.","triggerScenarios":"Calling the (Date, EntityTag) overload with a null lastModified, e.g. when the entity's modification date could not be loaded.","commonSituations":"Resource without stored modification metadata; date initialized lazily and never set; passing a computed date that failed to parse from a header or database value.","solutions":["Compute a valid lastModified value (entity update time, file mtime) before the call.","If only the ETag is known, use the single-arg evaluatePreconditions(EntityTag) overload.","Null-check and delegate to the no-arg overload when metadata is unavailable."],"exampleFix":"// before\nreturn request.evaluatePreconditions(lastModified, etag);\n// after\nif (lastModified == null) {\n    return request.evaluatePreconditions(etag);\n}\nreturn request.evaluatePreconditions(lastModified, etag);","handlingStrategy":"type-guard","validationCode":"if (lastModified == null || etag == null) {\n    return lastModified == null && etag == null\n        ? request.evaluatePreconditions()\n        : (lastModified == null ? request.evaluatePreconditions(etag)\n                                : request.evaluatePreconditions(lastModified));\n}","typeGuard":"boolean preconditionable(Date lm, EntityTag t) {\n    return lm != null && t != null;\n}","tryCatchPattern":"try {\n    return request.evaluatePreconditions(lastModified, etag);\n} catch (IllegalArgumentException e) {\n    return request.evaluatePreconditions();\n}","preventionTips":["Null-check both arguments before the two-arg overload","Fall back to single-arg overloads for partial metadata","Centralize conditional-response building in one helper"],"tags":["jaxrs","resteasy-reactive","conditional-request","last-modified"],"backgroundTag":"null-last-modified-precondition","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}