{"record":{"id":"b9669109bdb3e79a","repo":"alibaba/Sentinel","slug":"name-is-null-or-empty","errorCode":null,"errorMessage":"${name} is null or empty","messagePattern":"(.+?) is null or empty","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sentinel-core/src/main/java/com/alibaba/csp/sentinel/eagleeye/EagleEyeCoreUtils.java","lineNumber":48,"sourceCode":"\n    public static final String[] EMPTY_STRING_ARRAY = new String[0];\n\n    public static boolean isBlank(String str) {\n        int strLen;\n        if (str == null || (strLen = str.length()) == 0) {\n            return true;\n        }\n        for (int i = 0; i < strLen; i++) {\n            if ((!Character.isWhitespace(str.charAt(i)))) {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    public static String checkNotNullEmpty(String value, String name) throws IllegalArgumentException {\n        if (isBlank(value)) {\n            throw new IllegalArgumentException(name + \" is null or empty\");\n        }\n        return value;\n    }\n\n    public static <T> T checkNotNull(T value, String name) throws IllegalArgumentException {\n        if (value == null) {\n            throw new IllegalArgumentException(name + \" is null\");\n        }\n        return value;\n    }\n\n    public static <T> T defaultIfNull(T value, T defaultValue) {\n        return (value == null) ? defaultValue : value;\n    }\n\n    public static boolean isNotBlank(String str) {\n        return !isBlank(str);\n    }","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/alibaba/Sentinel/blob/a3f40ba8e900c8489bd520274739f17235a7721c/sentinel-core/src/main/java/com/alibaba/csp/sentinel/eagleeye/EagleEyeCoreUtils.java#L30-L66","documentation":"EagleEyeCoreUtils.checkNotNullEmpty(value, name) is the eagleeye core precondition helper: it throws IllegalArgumentException('<name> is null or empty') when the value is null, empty, or whitespace-only. All eagleeye logger builders (file paths, logger names, etc.) funnel through it, so this error marks a required string argument missing or blank.","triggerScenarios":"Calling checkNotNullEmpty(\"\", \"filePath\") or checkNotNullEmpty(null, \"loggerName\"); indirectly via BaseLoggerBuilder.configLogFilePath(\"\") or other builder methods that validate their arguments with this helper.","commonSituations":"Building an eagleeye/Sentinel log path from a variable that is null because a config key was misspelled or not yet loaded at static-init time; tests passing empty strings; path properties with only whitespace.","solutions":["Supply a non-blank value, e.g. a concrete path under a known log dir","Default the variable first: String p = (path == null || path.trim().isEmpty()) ? \"/var/log/app\" : path;","Check for misspelled/unloaded config keys feeding the argument at initialization time"],"exampleFix":"// before\nbuilder.configLogFilePath(System.getProperty(\"eagleeye.log.dir\")); // null if unset\n\n// after\nString dir = System.getProperty(\"eagleeye.log.dir\", \"/tmp\");\nbuilder.configLogFilePath(dir + \"/eagleeye.log\");","handlingStrategy":"validation","validationCode":"String value = Objects.requireNonNullElse(source, \"\").trim();\nif (value.isEmpty()) {\n    value = \"/default/path\"; // or reject explicitly\n}\nEagleEyeCoreUtils.checkNotNullEmpty(value, \"filePath\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default config-derived strings before passing them to eagleeye builders","Fail fast at startup with a clear message when required log config is missing, instead of letting the utility throw deep in initialization"],"tags":["eagleeye","validation","illegal-argument","null-check","core"],"backgroundTag":null,"analyzedSha":"a3f40ba8e900c8489bd520274739f17235a7721c","analyzedAt":"2026-08-14T11:10:30.678Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}