{"record":{"id":"872529f0a98916be","repo":"quarkusio/quarkus","slug":"name-must-not-be-null","errorCode":null,"errorMessage":"`\" + name + \"` must not be `null`","messagePattern":"`\" \\+ name \\+ \"` must not be `null`","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/redis-client/runtime/src/main/java/io/quarkus/redis/runtime/datasource/Validation.java","lineNumber":15,"sourceCode":"package io.quarkus.redis.runtime.datasource;\n\nimport java.time.Duration;\nimport java.util.Collection;\nimport java.util.Map;\n\npublic class Validation {\n\n    private Validation() {\n        // avoid direct instantiation\n    }\n\n    public static <X> X[] notNullOrEmpty(X[] array, String name) {\n        if (array == null) {\n            throw new IllegalArgumentException(\"`\" + name + \"` must not be `null`\");\n        }\n        if (array.length == 0) {\n            throw new IllegalArgumentException(\"`\" + name + \"` must not be empty\");\n        }\n        return array;\n    }\n\n    public static float[] notNullOrEmpty(float[] array, String name) {\n        if (array == null) {\n            throw new IllegalArgumentException(\"`\" + name + \"` must not be `null`\");\n        }\n        if (array.length == 0) {\n            throw new IllegalArgumentException(\"`\" + name + \"` must not be empty\");\n        }\n        return array;\n    }\n\n    public static double[] notNullOrEmpty(double[] array, String name) {","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/runtime/datasource/Validation.java#L1-L33","documentation":"Validation.notNullOrEmpty(X[] array, String name) throws IllegalArgumentException when the generic array parameter is null. Quarkus Redis extensions use this centralized validator to fail fast with a message naming the offending parameter.","triggerScenarios":"Passing a null String[]/Object[] to any Redis API that validates its array arguments through Validation.notNullOrEmpty (e.g. key sets, members, field arrays).","commonSituations":"Null result of an upstream lookup used as an argument; optional config value left null and passed directly; refactor leaving a null default.","solutions":["Ensure the array is non-null before calling the API","Use an empty check / Optional.orElse to substitute a valid value","Reorder logic so the API is not called when there is nothing to pass"],"exampleFix":"// before\nString[] keys = cache.get(\"keys\"); // may be null\nredis.bfmexists(key, keys);\n// after\nString[] keys = cache.get(\"keys\");\nif (keys != null && keys.length > 0) redis.bfmexists(key, keys);","handlingStrategy":"type-guard","validationCode":"if (array == null) {\n    throw new IllegalArgumentException(name + \" must be provided\");\n}","typeGuard":"static <X> boolean hasArray(X[] array) {\n    return array != null && array.length > 0;\n}","tryCatchPattern":"try {\n    api.call(key, array);\n} catch (IllegalArgumentException e) {\n    log.error(\"Missing argument: \" + e.getMessage());\n}","preventionTips":["Use @NonNull/Objects.requireNonNull at API boundaries","Avoid passing nullable fields directly into Redis calls","Initialize array fields with defaults"],"tags":["validation","null-check","redis","illegal-argument"],"backgroundTag":"null-required-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"}