{"record":{"id":"5fa6a0dc8ebdcdc8","repo":"quarkusio/quarkus","slug":"value-is-null","errorCode":null,"errorMessage":"value is null","messagePattern":"value is null","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/MutableBaseJvmOption.java","lineNumber":36,"sourceCode":"    private Set<String> values = Set.of();\n\n    @Override\n    public String getName() {\n        return name;\n    }\n\n    @Override\n    public Collection<String> getValues() {\n        return values;\n    }\n\n    protected void setName(String name) {\n        this.name = name;\n    }\n\n    public T addValue(String value) {\n        if (value == null) {\n            throw new IllegalArgumentException(\"value is null\");\n        }\n        if (value.isBlank()) {\n            throw new IllegalArgumentException(\"value is blank\");\n        }\n        if (values.isEmpty()) {\n            values = new HashSet<>(1);\n        }\n        for (String v : value.split(\"\\\\|\")) {\n            values.add(v);\n        }\n        return (T) this;\n    }\n\n    protected abstract String getPropertyGroupPrefix();\n\n    protected abstract String getQuarkusExtensionPropertyPrefix();\n\n    @Override","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/MutableBaseJvmOption.java#L18-L54","documentation":"MutableBaseJvmOption.addValue(String) is a fluent builder for JVM option values and rejects null input with an IllegalArgumentException. The library treats a null value as a programming error in the caller rather than silently skipping it. Values are split on '|' and stored in a set, so a null would corrupt the stored value set.","triggerScenarios":"Calling addValue(null) directly, or passing a variable/expression that evaluates to null (e.g. a system property or config lookup that returned null) into addValue().","commonSituations":"Programmatically building JVM options from environment variables or config maps where a lookup returned null and was not defaulted; copying options from another source where a value slot is unset.","solutions":["Pass a non-null string; if the value may be missing, check for null before calling addValue()","Use an empty-string/default fallback or skip calling addValue when the source value is null","Inspect the stack trace to find which option name is being populated and fix the source of the null"],"exampleFix":"// before\nString val = System.getProperty(\"my.opt\");\noption.addValue(val);\n// after\nString val = System.getProperty(\"my.opt\");\nif (val != null && !val.isBlank()) {\n    option.addValue(val);\n}","handlingStrategy":"validation","validationCode":"if (value != null) {\n    option.addValue(value);\n}","typeGuard":"boolean isNonEmpty(String s) { return s != null && !s.isBlank(); }","tryCatchPattern":"try {\n    option.addValue(value);\n} catch (IllegalArgumentException e) {\n    log.warnf(\"Rejected JVM option value: %s\", e.getMessage());\n}","preventionTips":["Null-check values sourced from System.getProperty/env/config lookups before adding","Default missing values instead of passing null through builder chains","Unit-test option builders with null and empty inputs"],"tags":["jvm-options","argument-validation","null-check"],"backgroundTag":"null-argument","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"}