{"record":{"id":"d5cfaa94d61bb621","repo":"flowable/flowable-engine","slug":"commentid-is-null","errorCode":null,"errorMessage":"commentId is null","messagePattern":"commentId is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetCommentCmd.java","lineNumber":36,"sourceCode":"import org.flowable.common.engine.api.FlowableIllegalArgumentException;\nimport org.flowable.common.engine.impl.interceptor.Command;\nimport org.flowable.common.engine.impl.interceptor.CommandContext;\nimport org.flowable.engine.impl.util.CommandContextUtil;\nimport org.flowable.engine.task.Comment;\n\n/**\n * @author Frederik Heremans\n */\npublic class GetCommentCmd implements Command<Comment>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n    protected String commentId;\n\n    public GetCommentCmd(String commentId) {\n        this.commentId = commentId;\n\n        if (commentId == null) {\n            throw new FlowableIllegalArgumentException(\"commentId is null\");\n        }\n    }\n\n    @Override\n    public Comment execute(CommandContext commandContext) {\n        return CommandContextUtil.getCommentEntityManager(commandContext).findComment(commentId);\n    }\n}\n","sourceCodeStart":18,"sourceCodeEnd":45,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetCommentCmd.java#L18-L45","documentation":"GetCommentCmd's constructor validates its argument eagerly: a null commentId immediately throws FlowableIllegalArgumentException when the command object is instantiated, before any command context runs. The comment id is required to look up a single Comment entity.","triggerScenarios":"Calling taskService.getComment(null) or new GetCommentCmd(null) directly; a comment id field that was never set from a preceding API response; refactored code dropping the id parameter.","commonSituations":"UI passing an unset comment identifier; deserialization of a payload missing the comment id; confusing comment id with task id.","solutions":["Pass a valid, non-null comment id obtained from taskService.getProcessInstanceComments() / getTaskComments()","Add a null/blank check before calling getComment","If the comment may not exist, still pass the id and handle a null return from the lookup instead of skipping the call"],"exampleFix":"// before\nComment c = taskService.getComment(commentId); // commentId possibly null\n// after\nif (commentId != null) {\n    Comment c = taskService.getComment(commentId);\n}","handlingStrategy":"validation","validationCode":"if (commentId == null || commentId.isEmpty()) throw new IllegalArgumentException(\"commentId required\");\nComment c = taskService.getComment(commentId);","typeGuard":"boolean hasCommentId(String id) { return id != null && !id.trim().isEmpty(); }","tryCatchPattern":null,"preventionTips":["Obtain comment ids from comment query results only","Validate ids at API boundaries handling external payloads","Keep comment id and task id in clearly named fields"],"tags":["flowable","null-argument","comment"],"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"}