{"record":{"id":"1f325b3cd392d8b0","repo":"flowable/flowable-engine","slug":"name-is-null-1f325b","errorCode":null,"errorMessage":"name is null","messagePattern":"name is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/cmd/GetGroupsWithPrivilegeCmd.java","lineNumber":36,"sourceCode":"\nimport 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.idm.api.Group;\nimport org.flowable.idm.engine.impl.util.CommandContextUtil;\n\n/**\n * @author Joram Barrez\n */\npublic class GetGroupsWithPrivilegeCmd implements Command<List<Group>>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n\n    protected String name;\n\n    public GetGroupsWithPrivilegeCmd(String name) {\n        if (name == null) {\n            throw new FlowableIllegalArgumentException(\"name is null\");\n        }\n        this.name = name;\n    }\n\n    @Override\n    public List<Group> execute(CommandContext commandContext) {\n        return CommandContextUtil.getGroupEntityManager(commandContext).findGroupsByPrivilegeId(name);\n    }\n\n}\n","sourceCodeStart":18,"sourceCodeEnd":47,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/cmd/GetGroupsWithPrivilegeCmd.java#L18-L47","documentation":"GetGroupsWithPrivilegeCmd's constructor requires the privilege name to be non-null, since groups are queried by their association to a named privilege. A null name triggers FlowableIllegalArgumentException before execution.","triggerScenarios":"Calling IdentityService.getGroupsWithPrivilege(null) or constructing new GetGroupsWithPrivilegeCmd(null) while listing groups that hold a given privilege.","commonSituations":"Admin consoles rendering privilege-to-group mappings where the selected privilege is null (nothing selected); privilege names refactored/renamed so the constant is no longer set; property-driven privilege config that is empty.","solutions":["Pass a valid non-null privilege name to IdentityService.getGroupsWithPrivilege().","Ensure the privilege name matches an existing privilege (createPrivilegeQuery().privilegeName(name)).","Validate the selection in the UI/API layer before querying.","Catch FlowableIllegalArgumentException and show a 'privilege name required' message."],"exampleFix":"// before\nList<Group> groups = identityService.getGroupsWithPrivilege(privilegeName); // may be null\n\n// after\nif (privilegeName == null || privilegeName.isEmpty()) {\n    throw new IllegalArgumentException(\"privilege name is required\");\n}\nList<Group> groups = identityService.getGroupsWithPrivilege(privilegeName);","handlingStrategy":"validation","validationCode":"if (privilegeName == null || privilegeName.isEmpty()) {\n    throw new IllegalArgumentException(\"privilege name must be provided before querying groups\");\n}","typeGuard":"boolean hasValidPrivilegeName(String name) {\n    return name != null && !name.isEmpty();\n}","tryCatchPattern":"try {\n    List<Group> groups = identityService.getGroupsWithPrivilege(privilegeName);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().contains(\"name is null\")) {\n        throw new InvalidRequestException(\"Privilege name must not be null\");\n    }\n    throw e;\n}","preventionTips":["Require an explicit privilege selection in admin UIs; disable the query until one is made.","Keep privilege name constants in one place and verify they are initialized.","Validate query parameters at the controller before calling IdentityService.","Test privilege-listing flows with missing selections."],"tags":["flowable","idm","null-check","privilege"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}