{"record":{"id":"3f5ea9f3b8ec79d4","repo":"flowable/flowable-engine","slug":"provided-tokendatebefore-is-null","errorCode":null,"errorMessage":"Provided tokenDateBefore is null","messagePattern":"Provided tokenDateBefore 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":101,"sourceCode":"            throw new FlowableIllegalArgumentException(\"Provided token value is null\");\n        }\n        this.tokenValue = tokenValue;\n        return this;\n    }\n\n    @Override\n    public TokenQuery tokenDate(Date tokenDate) {\n        if (tokenDate == null) {\n            throw new FlowableIllegalArgumentException(\"Provided token date is null\");\n        }\n        this.tokenDate = tokenDate;\n        return this;\n    }\n\n    @Override\n    public TokenQuery tokenDateBefore(Date tokenDateBefore) {\n        if (tokenDateBefore == null) {\n            throw new FlowableIllegalArgumentException(\"Provided tokenDateBefore is null\");\n        }\n        this.tokenDateBefore = tokenDateBefore;\n        return this;\n    }\n\n    @Override\n    public TokenQuery tokenDateAfter(Date tokenDateAfter) {\n        if (tokenDateAfter == null) {\n            throw new FlowableIllegalArgumentException(\"Provided tokenDateAfter is null\");\n        }\n        this.tokenDateAfter = tokenDateAfter;\n        return this;\n    }\n\n    @Override\n    public TokenQuery ipAddress(String ipAddress) {\n        if (ipAddress == null) {\n            throw new FlowableIllegalArgumentException(\"Provided ip address is null\");","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/TokenQueryImpl.java#L83-L119","documentation":"Flowable's TokenQueryImpl.tokenDateBefore(Date tokenDateBefore) throws FlowableIllegalArgumentException when the argument is null. This upper-bound date criterion must be non-null to be translated into a SQL comparison. It is checked eagerly in the fluent API.","triggerScenarios":"Calling tokenDateBefore(null) on a TokenQuery, commonly when an 'until' date parameter was optional and null was passed unconditionally, or a date computation (e.g. Calendar operations) produced null.","commonSituations":"Cleanup jobs finding tokens older than a cutoff where the cutoff calculation failed; REST endpoints with optional until/from filters; scheduler code where a configured date was not resolved.","solutions":["Compute the cutoff date safely and skip the criterion if it cannot be computed","Apply the filter only when non-null: if (until != null) query.tokenDateBefore(until);","Default the cutoff to a sensible value like new Date() instead of null"],"exampleFix":"// before\nTokenQuery query = identityService.createTokenQuery().tokenDateBefore(cutoff);\n// after\nTokenQuery query = identityService.createTokenQuery();\nif (cutoff != null) {\n    query.tokenDateBefore(cutoff);\n}","handlingStrategy":"validation","validationCode":"if (cutoff == null) { throw new IllegalArgumentException(\"cutoff must not be null before tokenDateBefore()\"); }","typeGuard":"boolean hasCutoff(Date cutoff) { return cutoff != null; }","tryCatchPattern":"try { query.tokenDateBefore(cutoff); } catch (FlowableIllegalArgumentException e) { log.warn(\"Invalid token query: {}\", e.getMessage()); }","preventionTips":["Compute cutoff dates with safe defaults (e.g. new Date()) so they are never null","Apply optional range bounds only when present","Validate configuration values used as date cutoffs at startup"],"tags":["flowable","idm","query","token","date","null-check"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}