{"record":{"id":"6d4662ab1a70441d","repo":"didi/DoKit","slug":"transformation-must-not-be-null","errorCode":null,"errorMessage":"Transformation must not be null.","messagePattern":"Transformation must not be null\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Android/dokit/src/main/java/com/didichuxing/doraemonkit/picasso/Request.java","lineNumber":427,"sourceCode":"    public Builder priority(Priority priority) {\n      if (priority == null) {\n        throw new IllegalArgumentException(\"Priority invalid.\");\n      }\n      if (this.priority != null) {\n        throw new IllegalStateException(\"Priority already set.\");\n      }\n      this.priority = priority;\n      return this;\n    }\n\n    /**\n     * Add a custom transformation to be applied to the image.\n     * <p>\n     * Custom transformations will always be run after the built-in transformations.\n     */\n    public Builder transform(com.didichuxing.doraemonkit.picasso.Transformation transformation) {\n      if (transformation == null) {\n        throw new IllegalArgumentException(\"Transformation must not be null.\");\n      }\n      if (transformation.key() == null) {\n        throw new IllegalArgumentException(\"Transformation key must not be null.\");\n      }\n      if (transformations == null) {\n        transformations = new ArrayList<com.didichuxing.doraemonkit.picasso.Transformation>(2);\n      }\n      transformations.add(transformation);\n      return this;\n    }\n\n    /**\n     * Add a list of custom transformations to be applied to the image.\n     * <p>\n     * Custom transformations will always be run after the built-in transformations.\n     */\n    public Builder transform(List<? extends Transformation> transformations) {\n      if (transformations == null) {","sourceCodeStart":409,"sourceCodeEnd":445,"githubUrl":"https://github.com/didi/DoKit/blob/626827cddb2feb2f3aee87a52a064b4e5ca2bed4/Android/dokit/src/main/java/com/didichuxing/doraemonkit/picasso/Request.java#L409-L445","documentation":"Thrown by Request.Builder.transform(Transformation) when the argument is null. Transformations are applied to the decoded bitmap and must be concrete objects, so Picasso rejects null immediately rather than failing later during bitmap processing.","triggerScenarios":"Calling transform(null), or transform(transformations.get(i)) where the list contains a null element.","commonSituations":"Conditionally building a transformation list with null placeholders; a factory method that returns null for unsupported image types and is passed straight through; iterating a sparse list with unset slots.","solutions":["Null-check before calling transform; skip null entries.","Make transformation factory methods return a no-op Transformation instead of null.","Filter nulls from lists: list.stream().filter(Objects::nonNull) before use."],"exampleFix":"// before\nTransformation t = imageType.isCircle() ? new CircleTransform() : null;\nbuilder.transform(t);\n\n// after\nif (imageType.isCircle()) {\n  builder.transform(new CircleTransform());\n}","handlingStrategy":"type-guard","validationCode":"if (transformation != null) { builder.transform(transformation); }","typeGuard":"static boolean isUsableTransformation(Transformation t) {\n  return t != null && t.key() != null;\n}","tryCatchPattern":null,"preventionTips":["Filter nulls out of transformation lists before transform(List).","Prefer no-op transformations over null returns from factories."],"tags":["android","picasso","null-safety","image-transform","validation"],"backgroundTag":null,"analyzedSha":"626827cddb2feb2f3aee87a52a064b4e5ca2bed4","analyzedAt":"2026-08-14T12:45:58.758Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}