{"record":{"id":"507dd4ca6b1cc6d3","repo":"Activiti/Activiti","slug":"priority-is-null","errorCode":null,"errorMessage":"Priority is null","messagePattern":"Priority is null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"activiti-core/activiti-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java","lineNumber":305,"sourceCode":"        }\n        return this;\n    }\n\n    public TaskQuery taskDescriptionLikeIgnoreCase(String descriptionLikeIgnoreCase) {\n        if (descriptionLikeIgnoreCase == null) {\n            throw new ActivitiIllegalArgumentException(\"Task descriptionLikeIgnoreCase is null\");\n        }\n        if (orActive) {\n            currentOrQueryObject.descriptionLikeIgnoreCase = descriptionLikeIgnoreCase.toLowerCase();\n        } else {\n            this.descriptionLikeIgnoreCase = descriptionLikeIgnoreCase.toLowerCase();\n        }\n        return this;\n    }\n\n    public TaskQuery taskPriority(Integer priority) {\n        if (priority == null) {\n            throw new ActivitiIllegalArgumentException(\"Priority is null\");\n        }\n        if (orActive) {\n            currentOrQueryObject.priority = priority;\n        } else {\n            this.priority = priority;\n        }\n        return this;\n    }\n\n    public TaskQuery taskMinPriority(Integer minPriority) {\n        if (minPriority == null) {\n            throw new ActivitiIllegalArgumentException(\"Min Priority is null\");\n        }\n        if (orActive) {\n            currentOrQueryObject.minPriority = minPriority;\n        } else {\n            this.minPriority = minPriority;\n        }","sourceCodeStart":287,"sourceCodeEnd":323,"githubUrl":"https://github.com/Activiti/Activiti/blob/56435b1a97deeafdc09dd40074b056c89fba5a8a/activiti-core/activiti-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java#L287-L323","documentation":"TaskQueryImpl.taskPriority(Integer) throws ActivitiIllegalArgumentException when the priority argument is null. The Activiti query API validates every query parameter eagerly so an incomplete query fails fast in Java instead of producing a broken SQL query at execution time. Pass an explicit integer priority (0-100 per Activiti convention).","triggerScenarios":"Calling taskQuery().taskPriority(null) directly, or passing a null Integer variable that was expected to hold the desired task priority, e.g. taskPriority(configuredPriority) where configuredPriority was never set.","commonSituations":"Priority read from a config/properties file or database column that is empty; a boxed Integer auto-unboxed from a null field; dynamic query builders forwarding user-supplied filter maps that omit the priority key.","solutions":["Ensure the value passed to taskPriority() is a non-null Integer before building the query","If priority filtering is optional, wrap the call: only invoke taskPriority(priority) when priority != null","Use a default value such as taskPriority(priority != null ? priority : 50) if a default is acceptable"],"exampleFix":"// before\nTaskQuery q = taskService.createTaskQuery().taskPriority(priority);\n// after\nTaskQuery q = taskService.createTaskQuery();\nif (priority != null) {\n    q.taskPriority(priority);\n}","handlingStrategy":"validation","validationCode":"if (priority == null) {\n    throw new IllegalArgumentException(\"priority must be set before calling taskPriority()\");\n}","typeGuard":"boolean hasPriority(Integer priority) {\n    return priority != null;\n}","tryCatchPattern":"try {\n    query.taskPriority(priority);\n} catch (ActivitiIllegalArgumentException e) {\n    if (!\"Priority is null\".equals(e.getMessage())) throw e;\n    // handle missing priority: apply default or skip filter\n}","preventionTips":["Make priority a primitive int or initialize the Integer field with a default","Wrap query building in a helper that only applies non-null filters","Assert filter inputs non-null at the boundary (controller/job entry) before query building"],"tags":["null-check","query-builder","activiti","task-query"],"backgroundTag":"null-argument","analyzedSha":"56435b1a97deeafdc09dd40074b056c89fba5a8a","analyzedAt":"2026-09-09T21:00:06.703Z","contentChangedAt":"2026-09-09T21:00:06.703Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}