{"record":{"id":"9edaa82465428e4e","repo":"quarkusio/quarkus","slug":"param-was-null-9edaa8","errorCode":null,"errorMessage":"Param was null","messagePattern":"Param was null","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/ObjectToStringDelegate.java","lineNumber":13,"sourceCode":"package org.jboss.resteasy.reactive.common.headers;\n\nimport java.util.Objects;\n\nimport jakarta.ws.rs.ext.RuntimeDelegate;\n\npublic class ObjectToStringDelegate implements RuntimeDelegate.HeaderDelegate<Object> {\n    public static final ObjectToStringDelegate INSTANCE = new ObjectToStringDelegate();\n\n    @Override\n    public Object fromString(String value) {\n        if (value == null)\n            throw new IllegalArgumentException(\"Param was null\");\n        throw new IllegalArgumentException(\"Does not support fromString\");\n    }\n\n    @Override\n    public String toString(Object value) {\n        if (value == null)\n            throw new IllegalArgumentException(\"Param was null\");\n        return Objects.toString(value);\n    }\n}\n","sourceCodeStart":1,"sourceCodeEnd":24,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/ObjectToStringDelegate.java#L1-L24","documentation":"ObjectToStringDelegate is a fallback HeaderDelegate for header types with no dedicated delegate; it serializes via Objects.toString. Its fromString always throws: first a null check ('Param was null'), then unconditionally, because generic object headers cannot be deserialized back from a string. This error means you passed null to a delegate that cannot parse anyway.","triggerScenarios":"Calling ObjectToStringDelegate.INSTANCE.fromString(null), or RuntimeDelegate header parsing routed to the fallback delegate with a null string for a header type lacking a registered fromString delegate.","commonSituations":"Using custom header value types not registered with RuntimeDelegate; server-side parsing of a request header whose type only supports toString; generic header-processing frameworks hitting the fallback path.","solutions":["Register a proper HeaderDelegate for the header's type via RuntimeDelegate.getInstance().createHeaderDelegate or a RuntimeDelegateDecorator so fromString is supported.","Parse the header manually with a known delegate (e.g. StringHeaderDelegate) if the type is truly String-like.","Null-check before invoking; note that even non-null input will throw 'Does not support fromString' here."],"exampleFix":"// before\nObject v = RuntimeDelegate.getInstance().createHeaderDelegate(MyHeader.class).fromString(raw);\n// after\nif (raw == null) { return null; }\nMyHeader v = MyHeader.parse(raw); // or register a real HeaderDelegate for MyHeader","handlingStrategy":"type-guard","validationCode":"if (rawHeader == null) {\n    return null; // nothing to parse\n}","typeGuard":"static <T> boolean hasRegisteredFromDelegate(Class<T> headerType) {\n    try {\n        RuntimeDelegate.getInstance().createHeaderDelegate(headerType);\n        return true;\n    } catch (IllegalArgumentException e) {\n        return false;\n    }\n}","tryCatchPattern":"try {\n    return delegate.fromString(raw);\n} catch (IllegalArgumentException e) {\n    throw new IllegalStateException(\"Header type has no parsing delegate: \" + e.getMessage(), e);\n}","preventionTips":["Register HeaderDelegates for all custom header value types.","Prefer built-in supported header types (String, MediaType, NewCookie, Date).","Never route Object-typed values into header parsing.","Fail fast in tests if a fallback delegate is reached for a typed header."],"tags":["http","header-parsing","null-check","jaxrs"],"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-12T22:17:10.623Z"}