{"record":{"id":"86f8b95c91c345c4","repo":"redis/jedis","slug":"driver-version-must-not-be-null","errorCode":null,"errorMessage":"Driver version must not be null","messagePattern":"Driver version must not be null","errorType":"validation","errorClass":"JedisValidationException","httpStatus":null,"severity":"error","filePath":"src/main/java/redis/clients/jedis/DriverInfo.java","lineNumber":184,"sourceCode":"     * Both values must not contain spaces, newlines, non-printable characters, or brace characters\n     * as these would violate the format of the Redis CLIENT LIST reply.\n     * @param driverName the name of the upstream driver (e.g., \"spring-data-redis\"), must not be\n     *          {@code null}\n     * @param driverVersion the version of the upstream driver (e.g., \"3.2.0\"), must not be\n     *          {@code null}\n     * @return this builder\n     * @throws JedisValidationException if the driver name or version is {@code null} or has invalid\n     *           format\n     * @see <a href=\"https://maven.apache.org/guides/mini/guide-naming-conventions.html\">Maven\n     *      Naming Conventions</a>\n     * @see <a href=\"https://redis.io/docs/latest/commands/client-setinfo/\">CLIENT SETINFO</a>\n     */\n    public Builder addUpstreamDriver(String driverName, String driverVersion) {\n      if (driverName == null) {\n        throw new JedisValidationException(\"Driver name must not be null\");\n      }\n      if (driverVersion == null) {\n        throw new JedisValidationException(\"Driver version must not be null\");\n      }\n      validateDriverField(driverName, \"Driver name\");\n      validateDriverField(driverVersion, \"Driver version\");\n      String formattedDriverInfo = formatDriverInfo(driverName, driverVersion);\n      this.upstreamDrivers.add(0, formattedDriverInfo);\n      return this;\n    }\n\n    public Builder addUpstreamDriver(String driverName) {\n      if (driverName == null) {\n        throw new JedisValidationException(\"Driver name must not be null\");\n      }\n      validateDriverField(driverName, \"Driver name\");\n      this.upstreamDrivers.add(0, driverName);\n      return this;\n    }\n\n    /**","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/redis/jedis/blob/6dac31d4c224fb3257c216f3985340c6f500cdcb/src/main/java/redis/clients/jedis/DriverInfo.java#L166-L202","documentation":"DriverInfo.Builder.addUpstreamDriver(String, String) throws JedisValidationException when the driverVersion argument is null. Jedis builds a CLIENT SETINFO lib-name/lib-ver payload, so every upstream driver entry must have a non-null, non-empty version. The check runs before character validation, so null is rejected first.","triggerScenarios":"Calling builder.addUpstreamDriver(\"my-driver\", null) on DriverInfo.Builder; passing a version field that was never initialized (e.g. read from a manifest or system property that is absent) into addUpstreamDriver.","commonSituations":"Wrapping frameworks register themselves as upstream drivers and read version from package metadata or a properties resource that is missing; refactoring code where the version constant was removed or renamed; building DriverInfo in generated/templated code where the version placeholder resolves to null.","solutions":["Pass a concrete non-null version string to addUpstreamDriver(name, version).","If the version may be absent, skip the call or substitute a fallback like \"unknown\" instead of null.","Use JedisValidationException handling if driver registration is best-effort and should not abort startup."],"exampleFix":"// before\nDriverInfo.builder().addUpstreamDriver(\"spring-data-redis\", props.getProperty(\"sdr.version\")); // may be null\n// after\nString v = props.getProperty(\"sdr.version\", \"unknown\");\nDriverInfo.builder().addUpstreamDriver(\"spring-data-redis\", v);","handlingStrategy":"validation","validationCode":"if (driverVersion == null || driverVersion.trim().isEmpty()) {\n  throw new IllegalStateException(\"Upstream driver version must be provided\");\n}","typeGuard":"boolean hasVersion(String v) { return v != null && !v.trim().isEmpty(); }","tryCatchPattern":"try {\n  DriverInfo.builder().addUpstreamDriver(name, version);\n} catch (JedisValidationException e) {\n  log.warn(\"Driver registration skipped: {}\", e.getMessage());\n}","preventionTips":["Resolve driver versions from a single well-known source with a default fallback like \"unknown\".","Never pass properties-file or manifest values straight into addUpstreamDriver without a null check.","Add a unit test asserting the DriverInfo builder rejects/accepts expected inputs."],"tags":["validation","null-argument","driver-info"],"backgroundTag":"null-argument","analyzedSha":"6dac31d4c224fb3257c216f3985340c6f500cdcb","analyzedAt":"2026-09-08T04:55:01.204Z","contentChangedAt":"2026-09-08T04:55:01.204Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}