{"record":{"id":"1d4cec11a39e0183","repo":"didi/DoKit","slug":"executor-service-must-not-be-null","errorCode":null,"errorMessage":"Executor service must not be null.","messagePattern":"Executor service must not be null\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Android/dokit/src/main/java/com/didichuxing/doraemonkit/picasso/DokitPicasso.java","lineNumber":738,"sourceCode":"    public Builder downloader(Downloader downloader) {\n      if (downloader == null) {\n        throw new IllegalArgumentException(\"Downloader must not be null.\");\n      }\n      if (this.downloader != null) {\n        throw new IllegalStateException(\"Downloader already set.\");\n      }\n      this.downloader = downloader;\n      return this;\n    }\n\n    /**\n     * Specify the executor service for loading images in the background.\n     * <p>\n     * Note: Calling {@link DokitPicasso#shutdown() shutdown()} will not shutdown supplied executors.\n     */\n    public Builder executor(ExecutorService executorService) {\n      if (executorService == null) {\n        throw new IllegalArgumentException(\"Executor service must not be null.\");\n      }\n      if (this.service != null) {\n        throw new IllegalStateException(\"Executor service already set.\");\n      }\n      this.service = executorService;\n      return this;\n    }\n\n    /** Specify the memory cache used for the most recent images. */\n    public Builder memoryCache(Cache memoryCache) {\n      if (memoryCache == null) {\n        throw new IllegalArgumentException(\"Memory cache must not be null.\");\n      }\n      if (this.cache != null) {\n        throw new IllegalStateException(\"Memory cache already set.\");\n      }\n      this.cache = memoryCache;\n      return this;","sourceCodeStart":720,"sourceCodeEnd":756,"githubUrl":"https://github.com/didi/DoKit/blob/626827cddb2feb2f3aee87a52a064b4e5ca2bed4/Android/dokit/src/main/java/com/didichuxing/doraemonkit/picasso/DokitPicasso.java#L720-L756","documentation":"DokitPicasso.Builder.executor() throws IllegalArgumentException when passed a null ExecutorService. Picasso requires a non-null executor to run background image loads. The null check is a fail-fast guard on builder configuration.","triggerScenarios":"Calling builder.executor(null), often from a field or factory method that returned null (e.g. a DI-provided executor that was not initialized).","commonSituations":"Passing an executor obtained from a dependency container that has not been set up; test code that stubs the executor as null; conditional code that builds the executor only in some branches.","solutions":["Pass a non-null ExecutorService, e.g. Executors.newFixedThreadPool(n)","If the executor variable may be null, guard: only call executor() when the value is non-null","Fix the upstream provider (DI module/factory) so it returns a valid executor"],"exampleFix":"// before\nbuilder.executor(null); // IllegalArgumentException\n\n// after\nbuilder.executor(Executors.newFixedThreadPool(4));","handlingStrategy":"validation","validationCode":"ExecutorService executor = provider.executor();\nif (executor != null) { builder.executor(executor); } // or fail loudly at provider level","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Assert non-null on DI-provided components at graph construction time","Avoid passing nullable executor variables; create the executor inline"],"tags":["android","picasso","builder","null-check"],"backgroundTag":null,"analyzedSha":"626827cddb2feb2f3aee87a52a064b4e5ca2bed4","analyzedAt":"2026-08-14T12:45:58.758Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}