{"record":{"id":"37c784c7721a76d4","repo":"alibaba/Sentinel","slug":"name-is-null","errorCode":null,"errorMessage":"${name} is null","messagePattern":"(.+?) is null","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sentinel-core/src/main/java/com/alibaba/csp/sentinel/eagleeye/EagleEyeCoreUtils.java","lineNumber":55,"sourceCode":"        }\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    }\n\n    public static boolean isNotEmpty(String str) {\n        return str != null && str.length() > 0;\n    }\n\n    public static String trim(String str) {\n        return str == null ? null : str.trim();","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/alibaba/Sentinel/blob/a3f40ba8e900c8489bd520274739f17235a7721c/sentinel-core/src/main/java/com/alibaba/csp/sentinel/eagleeye/EagleEyeCoreUtils.java#L37-L73","documentation":"Thrown by EagleEyeCoreUtils.checkNotNull(T value, String name), a fail-fast precondition helper inside Sentinel's vendored EagleEye metrics/logging core. It raises IllegalArgumentException the moment a caller passes a null reference where the EagleEye infrastructure requires a non-null object (logger names, appenders, entry values, etc.). The message embeds the caller-supplied 'name' so the offending argument is identifiable in the stack trace.","triggerScenarios":"Calling EagleEyeCoreUtils.checkNotNull(null, someName) directly, or invoking an EagleEye API that internally delegates to this guard with a null argument (e.g. building an EagleEye logger/appender with a null name or null charset). Any code path that resolves a dependency (logger name from config/system property) to null and forwards it here will throw.","commonSituations":"A logger name or appender name is loaded from a system property or configuration file that is missing in the deployment environment, so the variable resolves to null before being passed in. Refactoring code that previously tolerated null names now fails fast. Unit tests that pass null literals to EagleEye builder APIs.","solutions":["Find the argument whose name appears in the message and ensure the caller supplies a real value (non-null logger/appender name).","If the value comes from configuration, provide a sensible default (e.g. defaultIfNull(name, \"defaultLogger\")) before calling the API.","If null is genuinely acceptable in your flow, branch on null explicitly instead of relying on the library guard."],"exampleFix":"// before\nString loggerName = System.getProperty(\"my.logger.name\"); // may be null\nEagleEyeCoreUtils.checkNotNull(loggerName, \"loggerName\");\n\n// after\nString loggerName = System.getProperty(\"my.logger.name\");\nif (loggerName == null) { loggerName = \"myDefaultLogger\"; }\nEagleEyeCoreUtils.checkNotNull(loggerName, \"loggerName\");","handlingStrategy":"validation","validationCode":"if (value == null) {\n    throw new IllegalArgumentException(\"value must not be null before calling EagleEye\");\n}\nEagleEyeCoreUtils.checkNotNull(value, \"value\");","typeGuard":null,"tryCatchPattern":"try {\n    EagleEyeCoreUtils.checkNotNull(v, \"v\");\n} catch (IllegalArgumentException e) {\n    // v was null: log context and apply default or rethrow with caller context\n    v = defaultValue;\n}","preventionTips":["Never pass configuration-derived strings to EagleEye without a null check or defaultIfNull.","Wrap EagleEye builders in small factory methods that centralize the null checks.","In tests, use non-null fixture names for all logger/appender names."],"tags":["eagleeye","null-check","precondition","illegal-argument","sentinel"],"backgroundTag":null,"analyzedSha":"a3f40ba8e900c8489bd520274739f17235a7721c","analyzedAt":"2026-08-14T11:10:30.678Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}