{"record":{"id":"55c1fcb5f501b57d","repo":"quarkusio/quarkus","slug":"values-is-null","errorCode":null,"errorMessage":"Values is null","messagePattern":"Values is 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":1059,"sourceCode":"\n    public String getFragment() {\n        return fragment;\n    }\n\n    public UriBuilder segment(String... segments) throws IllegalArgumentException {\n        if (segments == null)\n            throw new IllegalArgumentException(\"Segment parameter is null\");\n        for (String segment : segments) {\n            if (segment == null)\n                throw new IllegalArgumentException(\"Segment is null\");\n            path(Encode.encodePathSegment(segment));\n        }\n        return this;\n    }\n\n    public URI buildFromEncoded(Object... values) throws IllegalArgumentException, UriBuilderException {\n        if (values == null)\n            throw new IllegalArgumentException(\"Values is null\");\n        return buildFromValues(false, true, values);\n    }\n\n    public UriBuilder replacePath(String path) {\n        if (path == null) {\n            this.path = null;\n            return this;\n        }\n        this.path = Encode.encodePath(path);\n        return this;\n    }\n\n    public URI build(Object[] values, boolean encodeSlashInPath) throws IllegalArgumentException, UriBuilderException {\n        if (values == null)\n            throw new IllegalArgumentException(\"Values is null\");\n        return buildFromValues(encodeSlashInPath, false, values);\n    }\n","sourceCodeStart":1041,"sourceCodeEnd":1077,"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#L1041-L1077","documentation":"UriBuilder.buildFromEncoded(Object...) throws IllegalArgumentException when the values array itself is null. This method substitutes template variables with pre-encoded values, and a null varargs array cannot be meaningfully processed, so the implementation rejects it up front.","triggerScenarios":"Calling uriBuilder.buildFromEncoded(null) directly, or forwarding a null values array obtained from another call site (e.g. a helper that collects template arguments and returns null when there are none).","commonSituations":"Generic URI-building helper methods that pass through a values array which is null on some code path; refactoring where a previously empty array became null.","solutions":["Pass an empty array instead of null: buildFromEncoded(new Object[0])","Ensure the calling helper returns Object[]... / an empty array rather than null","Guard the call site: if (values != null) builder.buildFromEncoded(values) else builder.build()"],"exampleFix":"// before\nURI uri = builder.buildFromEncoded(args); // args == null -> IllegalArgumentException\n// after\nURI uri = builder.buildFromEncoded(args == null ? new Object[0] : args);","handlingStrategy":"validation","validationCode":"Object[] safeValues = values == null ? new Object[0] : values;\nURI uri = uriBuilder.buildFromEncoded(safeValues);","typeGuard":"boolean isUsableValues(Object[] values) {\n    return values != null;\n}","tryCatchPattern":"try {\n    return uriBuilder.buildFromEncoded(values);\n} catch (IllegalArgumentException e) {\n    log.warn(\"buildFromEncoded rejected: \" + e.getMessage());\n    return uriBuilder.build();\n}","preventionTips":["Never pass a literal null to varargs-style build methods; use new Object[0]","Ensure helper methods returning value arrays return empty arrays, not null","Keep a single URI-building helper so null checks live in one place"],"tags":["jax-rs","uri","null-check","resteasy-reactive"],"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-12T22:17:10.623Z"}