{"record":{"id":"5f4bdc7d0608560b","repo":"redis/jedis","slug":"must-not-be-empty","errorCode":null,"errorMessage":" must not be empty","messagePattern":" must not be empty","errorType":"validation","errorClass":"JedisValidationException","httpStatus":null,"severity":"error","filePath":"src/main/java/redis/clients/jedis/DriverInfo.java","lineNumber":224,"sourceCode":"    public DriverInfo build() {\n      return new DriverInfo(name, upstreamDrivers);\n    }\n  }\n\n  /**\n   * Validates that the value does not contain characters that would violate the format of the Redis\n   * CLIENT LIST reply.\n   * <p>\n   * Only printable ASCII characters (0x21-0x7E, i.e., '!' to '~') are allowed, excluding braces.\n   * @param value the value to validate\n   * @param fieldName the name of the field for error messages (e.g., \"Driver name\", \"Driver\n   *          version\")\n   * @throws JedisValidationException if the value is empty or contains invalid characters\n   * @see <a href=\"https://redis.io/docs/latest/commands/client-setinfo/\">CLIENT SETINFO</a>\n   */\n  private static void validateDriverField(String value, String fieldName) {\n    if (value.trim().isEmpty()) {\n      throw new JedisValidationException(fieldName + \" must not be empty\");\n    }\n\n    validateNoInvalidCharacters(value, fieldName);\n  }\n\n  /**\n   * Validates that the value does not contain characters that would violate the format of the Redis\n   * CLIENT LIST reply: non-printable characters, spaces, or brace characters.\n   * <p>\n   * Only printable ASCII characters (0x21-0x7E, i.e., '!' to '~') are allowed, excluding braces.\n   * @param value the value to validate\n   * @param fieldName the name of the field for error messages\n   * @throws JedisValidationException if the value contains invalid characters\n   * @see <a href=\"https://redis.io/docs/latest/commands/client-setinfo/\">CLIENT SETINFO</a>\n   */\n  private static void validateNoInvalidCharacters(String value, String fieldName) {\n    for (int i = 0; i < value.length(); i++) {\n      char c = value.charAt(i);","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/redis/jedis/blob/6dac31d4c224fb3257c216f3985340c6f500cdcb/src/main/java/redis/clients/jedis/DriverInfo.java#L206-L242","documentation":"DriverInfo.validateDriverField throws JedisValidationException when a driver name or version is empty (or only whitespace): the message is \"<fieldName> must not be empty\" (e.g. \"Driver name must not be empty\"). CLIENT SETINFO values must be non-empty printable tokens, so blank strings are rejected after the null check.","triggerScenarios":"Calling addUpstreamDriver(\"\", \"1.0\"), addUpstreamDriver(\"x\", \"  \"), or the single-arg addUpstreamDriver(\"   \"); any DriverInfo.Builder entry whose field trims to empty.","commonSituations":"Version strings resolved from config files with blank values; driver names built by trimming user input down to nothing; defaults of \"\" used where null checks pass but emptiness fails.","solutions":["Supply a non-blank value (trim checks in the library mean \" \" is still rejected).","Validate caller-side with value != null && !value.trim().isEmpty() before registering.","Skip driver registration entirely when the real value is unavailable rather than passing a placeholder blank."],"exampleFix":"// before\nbuilder.addUpstreamDriver(driverName.trim(), version.trim()); // may become \"\"\n// after\nif (!driverName.trim().isEmpty() && !version.trim().isEmpty()) {\n  builder.addUpstreamDriver(driverName.trim(), version.trim());\n}","handlingStrategy":"validation","validationCode":"static boolean isBlank(String s) { return s == null || s.trim().isEmpty(); }\nif (isBlank(name) || isBlank(version)) { /* fix or skip registration */ }","typeGuard":"boolean nonBlank(String s) { return s != null && !s.trim().isEmpty(); }","tryCatchPattern":"try {\n  builder.addUpstreamDriver(name, version);\n} catch (JedisValidationException e) {\n  log.warn(\"Blank driver field rejected: {}\", e.getMessage());\n}","preventionTips":["Trim and check emptiness of all driver metadata before registration.","Avoid empty-string defaults; use null-checked optional values instead.","Centralize driver registration in one helper that validates once."],"tags":["validation","empty-value","driver-info"],"backgroundTag":"empty-required-field","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"}