{"record":{"id":"f1f4c661dbcc2b31","repo":"quarkusio/quarkus","slug":"template-values-null","errorCode":null,"errorMessage":"Template values null","messagePattern":"Template values null","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/jaxrs/UriBuilderImpl.java","lineNumber":1094,"sourceCode":"    }\n\n    public String toTemplate() {\n        return buildString(new HashMap<String, Object>(), true, true, true);\n    }\n\n    public UriBuilder resolveTemplate(String name, Object value) throws IllegalArgumentException {\n        if (name == null)\n            throw new IllegalArgumentException(\"Name is null\");\n        if (value == null)\n            throw new IllegalArgumentException(\"Value is null\");\n        HashMap<String, Object> vals = new HashMap<String, Object>();\n        vals.put(name, value);\n        return resolveTemplates(vals);\n    }\n\n    public UriBuilder resolveTemplates(Map<String, Object> templateValues) throws IllegalArgumentException {\n        if (templateValues == null)\n            throw new IllegalArgumentException(\"Template values null\");\n        if (templateValues.containsKey(null))\n            throw new IllegalArgumentException(\"map key null\");\n        return uriTemplate(buildCharSequence(templateValues, false, true, true));\n    }\n\n    public UriBuilder resolveTemplate(String name, Object value, boolean encodeSlashInPath) throws IllegalArgumentException {\n        if (name == null)\n            throw new IllegalArgumentException(\"Name is null\");\n        if (value == null)\n            throw new IllegalArgumentException(\"Value is null\");\n        HashMap<String, Object> vals = new HashMap<String, Object>();\n        vals.put(name, value);\n        return uriTemplate(buildCharSequence(vals, false, true, encodeSlashInPath));\n    }\n\n    public UriBuilder resolveTemplateFromEncoded(String name, Object value) throws IllegalArgumentException {\n        if (name == null)\n            throw new IllegalArgumentException(\"Name is null\");","sourceCodeStart":1076,"sourceCodeEnd":1112,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/jaxrs/UriBuilderImpl.java#L1076-L1112","documentation":"UriBuilder.resolveTemplates(Map) throws IllegalArgumentException when the map of template values is null. The method needs a map (possibly empty) to resolve URI template placeholders; null is rejected as an invalid argument.","triggerScenarios":"Calling uriBuilder.resolveTemplates(null), or forwarding a Map field/return value that was never initialized.","commonSituations":"A helper that builds the template-value map lazily and returns null when no values apply; deserialization producing a null map.","solutions":["Pass an empty map when there are no values: resolveTemplates(Map.of()) or new HashMap<>()","Initialize the map at the source so callers never see null","Null-guard before the call"],"exampleFix":"// before\nbuilder.resolveTemplates(templateValues); // null\n// after\nbuilder.resolveTemplates(templateValues == null ? Map.of() : templateValues);","handlingStrategy":"validation","validationCode":"Map<String, Object> safe = templateValues == null ? Map.of() : templateValues;\nuriBuilder.resolveTemplates(safe);","typeGuard":"Map<String, Object> nonNull(Map<String, Object> m) {\n    return m == null ? Map.of() : m;\n}","tryCatchPattern":"try {\n    return uriBuilder.resolveTemplates(templateValues);\n} catch (IllegalArgumentException e) {\n    throw new IllegalArgumentException(\"resolveTemplates rejected: \" + e.getMessage(), e);\n}","preventionTips":["Initialize template-value maps eagerly (Map.of() / new HashMap<>())","Have lazy helpers return empty maps rather than null","Centralize URI building so map defaults are applied once"],"tags":["jax-rs","uri","template","null-check","map"],"backgroundTag":"null-argument-illegal-argument","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}