{"record":{"id":"59615e5c07e660eb","repo":"quarkusio/quarkus","slug":"param-was-null-59615e","errorCode":null,"errorMessage":"Param was null","messagePattern":"Param was null","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"warning","filePath":"independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/CacheControlDelegate.java","lineNumber":18,"sourceCode":"package org.jboss.resteasy.reactive.common.headers;\n\nimport java.util.List;\n\nimport jakarta.ws.rs.core.CacheControl;\nimport jakarta.ws.rs.ext.RuntimeDelegate;\n\nimport org.jboss.resteasy.reactive.common.util.ExtendedCacheControl;\n\n/**\n * @author <a href=\"mailto:bill@burkecentral.com\">Bill Burke</a>\n */\npublic class CacheControlDelegate implements RuntimeDelegate.HeaderDelegate<CacheControl> {\n    public static final CacheControlDelegate INSTANCE = new CacheControlDelegate();\n\n    public CacheControl fromString(String value) throws IllegalArgumentException {\n        if (value == null)\n            throw new IllegalArgumentException(\"Param was null\");\n        ExtendedCacheControl result = new ExtendedCacheControl();\n        result.setNoTransform(false);\n\n        String[] directives = value.split(\",\");\n        for (String directive : directives) {\n            directive = directive.trim();\n\n            String[] nv = directive.split(\"=\");\n            String name = nv[0].trim();\n            String val = null;\n            if (nv.length > 1) {\n                val = nv[1].trim();\n                if (val.startsWith(\"\\\"\"))\n                    val = val.substring(1);\n                if (val.endsWith(\"\\\"\"))\n                    val = val.substring(0, val.length() - 1);\n            }\n","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/CacheControlDelegate.java#L1-L36","documentation":"CacheControlDelegate is the JAX-RS RuntimeDelegate HeaderDelegate that parses a Cache-Control HTTP header from its string form. The JAX-RS contract requires an IllegalArgumentException for null input, so fromString(null) throws this error instead of returning null.","triggerScenarios":"Passing a null header string to CacheControlDelegate.INSTANCE.fromString(null), directly or via RuntimeDelegate/RESTEasy Reactive header parsing when a Cache-Control header value is unexpectedly absent.","commonSituations":"Manually parsing header maps where the header key exists but value is null; framework code invoking the delegate with a missing header value; interceptors reading Cache-Control of responses that never set it.","solutions":["Check for null before calling fromString and handle absence explicitly","Default the value to an empty/sensible string if the header is optional","Use Map.getOrDefault(headers, \"Cache-Control\", \"\") style lookups","Fix upstream code so it never passes null header values into the delegate"],"exampleFix":"// before\nCacheControl cc = CacheControlDelegate.INSTANCE.fromString(headers.getFirst(\"Cache-Control\"));\n// after\nString value = headers.getFirst(\"Cache-Control\");\nCacheControl cc = value == null ? null : CacheControlDelegate.INSTANCE.fromString(value);","handlingStrategy":"type-guard","validationCode":"if (value == null || value.isBlank()) { /* skip header parsing */ }","typeGuard":"boolean isParsableHeader(String v) { return v != null && !v.isEmpty(); }","tryCatchPattern":"try {\n    CacheControl cc = CacheControlDelegate.INSTANCE.fromString(value);\n} catch (IllegalArgumentException e) {\n    // null or malformed header; treat as absent\n}","preventionTips":["Null-check header map lookups before delegating","Use getOrDefault for optional headers","Never pass framework header values directly to delegates without checks"],"tags":["jaxrs","http-headers","cache-control","null-check"],"backgroundTag":"null-header-value","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}