{"record":{"id":"6693ef0be24c2d6e","repo":"flowable/flowable-engine","slug":"keylike-is-null","errorCode":null,"errorMessage":"keyLike is null","messagePattern":"keyLike is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/repository/AppDefinitionQueryImpl.java","lineNumber":160,"sourceCode":"            throw new FlowableIllegalArgumentException(\"ids is an empty collection\");\n        }\n        this.deploymentIds = deploymentIds;\n        return this;\n    }\n\n    @Override\n    public AppDefinitionQueryImpl appDefinitionKey(String key) {\n        if (key == null) {\n            throw new FlowableIllegalArgumentException(\"key is null\");\n        }\n        this.key = key;\n        return this;\n    }\n\n    @Override\n    public AppDefinitionQueryImpl appDefinitionKeyLike(String keyLike) {\n        if (keyLike == null) {\n            throw new FlowableIllegalArgumentException(\"keyLike is null\");\n        }\n        this.keyLike = keyLike;\n        return this;\n    }\n\n    @Override\n    public AppDefinitionQueryImpl appDefinitionResourceName(String resourceName) {\n        if (resourceName == null) {\n            throw new FlowableIllegalArgumentException(\"resourceName is null\");\n        }\n        this.resourceName = resourceName;\n        return this;\n    }\n\n    @Override\n    public AppDefinitionQueryImpl appDefinitionResourceNameLike(String resourceNameLike) {\n        if (resourceNameLike == null) {\n            throw new FlowableIllegalArgumentException(\"resourceNameLike is null\");","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/repository/AppDefinitionQueryImpl.java#L142-L178","documentation":"Fluent-query guard in AppDefinitionQueryImpl.appDefinitionKeyLike: the like-pattern for the app definition key is null, which would otherwise produce a SQL fragment comparing against NULL and silently wrong results.","triggerScenarios":"Calling appDefinitionKeyLike(keyLike) with null — usually an optional search term from a request that was not supplied, or a computed pattern (key + \"%\") where the base key is null.","commonSituations":"Search UI with an empty key field bound as null; dynamic query builders that always invoke every filter method; pattern built from a nullable configuration value.","solutions":["Null-check the pattern; append wildcards only after confirming the base value is non-null","Treat null/empty input as 'no key filter' and skip the call","Catch FlowableIllegalArgumentException at the API layer and return 400"],"exampleFix":"// before\nquery.appDefinitionKeyLike(keyLike + \"%\");\n// after\nif (keyLike != null) {\n    query.appDefinitionKeyLike(keyLike + \"%\");\n}","handlingStrategy":"validation","validationCode":"if (keyLike != null && !keyLike.isEmpty()) {\n    query.appDefinitionKeyLike(keyLike);\n}","typeGuard":"boolean isApplicable(String v) { return v != null && !v.isEmpty(); }","tryCatchPattern":"try {\n    query.appDefinitionKeyLike(keyLike);\n} catch (FlowableIllegalArgumentException e) {\n    throw new ResponseStatusException(HttpStatus.BAD_REQUEST, e.getMessage(), e);\n}","preventionTips":["Skip like-criteria when the search term is null or blank","Build patterns (term + \"%\") only after null-checking the term","Keep optional-filter guards in one reusable query-builder helper"],"tags":["flowable","null-check","query-builder","validation"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}