{"record":{"id":"14a5566b320de4a3","repo":"flowable/flowable-engine","slug":"provided-tokendatalike-is-null","errorCode":null,"errorMessage":"Provided tokenDataLike is null","messagePattern":"Provided tokenDataLike is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/TokenQueryImpl.java","lineNumber":182,"sourceCode":"            throw new FlowableIllegalArgumentException(\"Provided userIdLike is null\");\n        }\n        this.userIdLike = userIdLike;\n        return this;\n    }\n\n    @Override\n    public TokenQuery tokenData(String tokenData) {\n        if (tokenData == null) {\n            throw new FlowableIllegalArgumentException(\"Provided token data is null\");\n        }\n        this.tokenData = tokenData;\n        return this;\n    }\n\n    @Override\n    public TokenQuery tokenDataLike(String tokenDataLike) {\n        if (tokenDataLike == null) {\n            throw new FlowableIllegalArgumentException(\"Provided tokenDataLike is null\");\n        }\n        this.tokenDataLike = tokenDataLike;\n        return this;\n    }\n\n    // sorting //////////////////////////////////////////////////////////\n\n    @Override\n    public TokenQuery orderByTokenId() {\n        return orderBy(TokenQueryProperty.TOKEN_ID);\n    }\n\n    @Override\n    public TokenQuery orderByTokenDate() {\n        return orderBy(TokenQueryProperty.TOKEN_DATE);\n    }\n\n    // results //////////////////////////////////////////////////////////","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/TokenQueryImpl.java#L164-L200","documentation":"TokenQueryImpl.tokenDataLike(String) adds a LIKE criterion on token data. Null arguments throw FlowableIllegalArgumentException at query-build time because a null pattern cannot form a valid SQL LIKE clause and would be ambiguous with no filtering.","triggerScenarios":"Calling TokenQuery.tokenDataLike(null) as part of a createTokenQuery() chain with a null optional filter value.","commonSituations":"Search endpoints where tokenDataLike is an optional parameter; DTO mapping leaving the field null; uniform application of all criteria without null-guards.","solutions":["Pass a non-null pattern, e.g. \"%abc%\".","Only invoke tokenDataLike when the filter value is non-null.","Omit the criterion to match all token data."],"exampleFix":"// before\nTokenQuery q = identityService.createTokenQuery().tokenDataLike(filter.tokenDataLike);\n\n// after\nTokenQuery q = identityService.createTokenQuery();\nif (filter.tokenDataLike != null) {\n    q = q.tokenDataLike(\"%\" + filter.tokenDataLike + \"%\");\n}","handlingStrategy":"validation","validationCode":"if (tokenDataLike == null) { tokenDataLike = \"%\"; } // or skip the call\nidentityService.createTokenQuery().tokenDataLike(tokenDataLike);","typeGuard":"boolean hasPattern(String v) { return v != null && !v.isEmpty(); }","tryCatchPattern":"try {\n    query.tokenDataLike(pattern);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().contains(\"tokenDataLike is null\")) { /* skip criterion */ } else { throw e; }\n}","preventionTips":["Apply optional search criteria only when present.","Normalize empty strings to null at your API boundary, then skip such criteria.","Cover optional-filter paths in tests."],"tags":["null-check","query-builder","idm-engine","java"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}