{"record":{"id":"6a8a2ecc9adb249d","repo":"flowable/flowable-engine","slug":"exitafter-is-null","errorCode":null,"errorMessage":"exitAfter is null","messagePattern":"exitAfter is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/PlanItemInstanceQueryImpl.java","lineNumber":636,"sourceCode":"    }\n\n    @Override\n    public PlanItemInstanceQuery planItemInstanceExitBefore(Date exitBefore) {\n        if (exitBefore == null) {\n            throw new FlowableIllegalArgumentException(\"exitBefore is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.exitBefore = exitBefore;\n        } else {\n            this.exitBefore = exitBefore;\n        }\n        return this;\n    }\n\n    @Override\n    public PlanItemInstanceQuery planItemInstanceExitAfter(Date exitAfter) {\n        if (exitAfter == null) {\n            throw new FlowableIllegalArgumentException(\"exitAfter is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.exitAfter = exitAfter;\n        } else {\n            this.exitAfter = exitAfter;\n        }\n        return this;\n    }\n\n    @Override\n    public PlanItemInstanceQuery planItemInstanceEndedBefore(Date endedBefore) {\n        if (endedBefore == null) {\n            throw new FlowableIllegalArgumentException(\"endedBefore is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.endedBefore = endedBefore;\n        } else {\n            this.endedBefore = endedBefore;","sourceCodeStart":618,"sourceCodeEnd":654,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/PlanItemInstanceQueryImpl.java#L618-L654","documentation":"Flowable throws FlowableIllegalArgumentException when planItemInstanceExitAfter(Date) is given a null Date. The query API validates each criterion argument up front, so null timestamps are rejected at build time. Null means no filter; express that by not calling the method.","triggerScenarios":"Calling createPlanItemInstanceQuery().planItemInstanceExitAfter(null), e.g. when the exit-after date comes from an unset optional field in the caller's data model.","commonSituations":"Optional 'exitAfter' filter not provided by the client; deserialization leaving the field null; a date-conversion helper returning null.","solutions":["Ensure a valid Date is computed before the call.","Only invoke the method when the value exists.","Validate and convert date inputs with explicit failure paths.","Catch FlowableIllegalArgumentException during query building and surface a clear validation message."],"exampleFix":"// before\nquery.planItemInstanceExitAfter(request.getExitAfter()); // possibly null\n// after\nDate exitAfter = request.getExitAfter();\nif (exitAfter != null) {\n    query.planItemInstanceExitAfter(exitAfter);\n}","handlingStrategy":"validation","validationCode":"if (exitAfter == null) {\n    throw new IllegalArgumentException(\"exitAfter must be non-null; omit the filter instead\");\n}\nquery.planItemInstanceExitAfter(exitAfter);","typeGuard":"boolean hasExitAfter = (exitAfter != null);","tryCatchPattern":"try {\n    query.planItemInstanceExitAfter(exitAfter);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().contains(\"exitAfter\")) {\n        throw new BadRequestException(\"exitAfter date filter must not be null\");\n    }\n    throw e;\n}","preventionTips":["Guard date-filter calls with null checks","Convert date inputs explicitly and handle parse failures","Make optional filters explicit in service APIs with Optional<Date>","Verify query-building behavior when filters are missing"],"tags":["java","flowable","query","null-argument"],"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"}