{"record":{"id":"0f0979674ae6759c","repo":"redis/jedis","slug":"driverinfo-must-not-be-null-0f0979","errorCode":null,"errorMessage":"DriverInfo must not be null","messagePattern":"DriverInfo must not be null","errorType":"validation","errorClass":"JedisValidationException","httpStatus":null,"severity":"error","filePath":"src/main/java/redis/clients/jedis/DriverInfo.java","lineNumber":58,"sourceCode":"  /**\n   * Creates a new {@link Builder} with default values.\n   * <p>\n   * The default name is \"Jedis\" (from {@link JedisMetaInfo#getArtifactId()}).\n   * @return a new builder instance\n   */\n  public static Builder builder() {\n    return new Builder();\n  }\n\n  /**\n   * Creates a new {@link Builder} initialized with values from an existing {@link DriverInfo}.\n   * @param driverInfo the existing driver info to copy from, must not be {@code null}\n   * @return a new builder instance initialized with the existing values\n   * @throws JedisValidationException if driverInfo is {@code null}\n   */\n  public static Builder builder(DriverInfo driverInfo) {\n    if (driverInfo == null) {\n      throw new JedisValidationException(\"DriverInfo must not be null\");\n    }\n    return new Builder(driverInfo);\n  }\n\n  /**\n   * Returns the formatted name including upstream drivers or legacy suffix.\n   * <p>\n   * If a legacy suffix is set, returns the name followed by the suffix in parentheses. Otherwise,\n   * if upstream drivers are present, returns the name followed by upstream drivers in parentheses,\n   * separated by semicolons. If neither is set, returns just the name.\n   * <p>\n   * Examples:\n   * <ul>\n   * <li>{@code \"jedis\"} - no upstream drivers or suffix</li>\n   * <li>{@code \"jedis(my-suffix)\"} - legacy suffix mode</li>\n   * <li>{@code \"jedis(spring-data-redis_v3.2.0)\"} - one upstream driver</li>\n   * <li>{@code \"jedis(spring-session_v3.3.0;spring-data-redis_v3.2.0)\"} - multiple upstream\n   * drivers</li>","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/redis/jedis/blob/6dac31d4c224fb3257c216f3985340c6f500cdcb/src/main/java/redis/clients/jedis/DriverInfo.java#L40-L76","documentation":"DriverInfo.builder(DriverInfo) requires an existing DriverInfo instance to copy values from. Passing null cannot produce a meaningful builder, so Jedis throws JedisValidationException('DriverInfo must not be null') eagerly. This is a fail-fast guard on a programming error rather than a runtime condition.","triggerScenarios":"Calling DriverInfo.builder(existing) where the existing reference is null — typically a variable or getter result that was never initialized, a map/config lookup that returned null, or a method parameter forwarded without a null check.","commonSituations":"Library wrapper code composing driver info (e.g. Spring/Spring Data sessions tracking upstream drivers) passing an uninitialized DriverInfo; reflection or DI wiring producing null; copying driver info from an optional config that is absent.","solutions":["Ensure the DriverInfo passed to builder() is initialized before the call.","For a fresh instance, call the no-argument DriverInfo.builder() overload instead of builder(null).","If the value can legitimately be absent, branch: use the no-arg builder when null, the copying builder otherwise.","Guard the calling code with Objects.requireNonNull and a clear message to surface the miswired source earlier.","Check the code path that supplies the DriverInfo (config/session getter) for logic returning null."],"exampleFix":"// before\nDriverInfo.Builder b = DriverInfo.builder(session.getDriverInfo()); // may be null\n\n// after\nDriverInfo existing = session.getDriverInfo();\nDriverInfo.Builder b = (existing != null)\n    ? DriverInfo.builder(existing)\n    : DriverInfo.builder();","handlingStrategy":"type-guard","validationCode":"if (driverInfo == null) {\n  driverInfo = DriverInfo.builder().build(); // or use the no-arg builder\n}\nDriverInfo.Builder b = DriverInfo.builder(driverInfo);","typeGuard":"static boolean isValidDriverInfo(DriverInfo d) {\n  return d != null;\n}","tryCatchPattern":"try {\n  builder = DriverInfo.builder(existing);\n} catch (JedisValidationException e) {\n  builder = DriverInfo.builder(); // fall back to a fresh builder\n}","preventionTips":["Prefer the no-arg DriverInfo.builder() when creating new driver info; use the copying overload only for non-null instances.","Null-check optional sources (config/session getters) before forwarding to builder(DriverInfo).","Use Objects.requireNonNull at the wrapper's own boundary to fail with a clearer message.","In tests, cover the null-input path of any code composing DriverInfo."],"tags":["validation","null","driver-info","jedis"],"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"}