{"record":{"id":"14c65e7fa3507368","repo":"quarkusio/quarkus","slug":"path-is-null","errorCode":null,"errorMessage":"path is null","messagePattern":"path 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":394,"sourceCode":"            } else {\n                if (encode)\n                    segment = Encode.encodePath(segment);\n                if (\"\".equals(path)) {\n                    path = segment;\n                } else if (segment.startsWith(\"/\")) {\n                    path += segment;\n                } else {\n                    path += \"/\" + segment;\n                }\n            }\n\n        }\n        return path;\n    }\n\n    public UriBuilder path(String segment) throws IllegalArgumentException {\n        if (segment == null)\n            throw new IllegalArgumentException(\"path is null\");\n        path = paths(encode, path, segment);\n        return this;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    public UriBuilder path(Class resource) throws IllegalArgumentException {\n        if (resource == null)\n            throw new IllegalArgumentException(\"path is null\");\n        Path ann = (Path) resource.getAnnotation(Path.class);\n        if (ann != null) {\n            String[] segments = new String[] { ann.value() };\n            path = paths(true, path, segments);\n        } else {\n            throw new IllegalArgumentException(\"class must be annotated with @Path\");\n        }\n        return this;\n    }\n","sourceCodeStart":376,"sourceCodeEnd":412,"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#L376-L412","documentation":"UriBuilderImpl.path(String) throws 'path is null' when the segment argument is null. The JAX-RS UriBuilder contract requires IllegalArgumentException for null path arguments. The segment is appended to the internal path list via paths(), which cannot accept null. Passing an empty string is allowed.","triggerScenarios":"Calling builder.path(null) or path(variable) where the variable is null - e.g. an optional path config value absent, a map.get() miss, or a lookup that returned null.","commonSituations":"Reading a path fragment from absent configuration; an earlier null propagating through path concatenation; test code passing null to probe error handling.","solutions":["Check for null before calling: if (segment != null) builder.path(segment);","Default optional path config to an empty string instead of null","Fail fast with Objects.requireNonNull(segment, 'segment') at your call site","Trace where the null originated (config/lookup) and fix the source"],"exampleFix":"// before: builder.path(config.basePath()); // throws if null // after: String p = config.basePath(); builder.path(p != null ? p : \"\");","handlingStrategy":"type-guard","validationCode":"if (segment == null) {\n    throw new IllegalArgumentException('path segment must not be null');\n}","typeGuard":"static boolean hasPath(String segment) {\n    return segment != null;\n}","tryCatchPattern":"try {\n    builder.path(segment);\n} catch (IllegalArgumentException e) {\n    throw new IllegalArgumentException('path segment was null; check config/annotation lookup', e);\n}","preventionTips":["Default optional path config to an empty string instead of null","Skip the path() call when the segment is null","Fail fast with Objects.requireNonNull where the segment is produced"],"tags":["resteasy-reactive","jaxrs","uri","path","null-check","illegal-argument"],"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"}