{"record":{"id":"ea7f0868a4814ba2","repo":"flowable/flowable-engine","slug":"name-is-null-ea7f08","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/GetUsersWithPrivilegeCmd.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.User;\nimport org.flowable.idm.engine.impl.util.CommandContextUtil;\n\n/**\n * @author Joram Barrez\n */\npublic class GetUsersWithPrivilegeCmd implements Command<List<User>>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n\n    protected String name;\n\n    public GetUsersWithPrivilegeCmd(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<User> execute(CommandContext commandContext) {\n        return CommandContextUtil.getUserEntityManager(commandContext).findUsersByPrivilegeId(name);\n    }\n}\n","sourceCodeStart":18,"sourceCodeEnd":46,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/cmd/GetUsersWithPrivilegeCmd.java#L18-L46","documentation":"GetUsersWithPrivilegeCmd lists all users that hold a named privilege (e.g. 'access-rest-api'). The privilege name is the lookup key, so the constructor validates it immediately and throws FlowableIllegalArgumentException when null.","triggerScenarios":"Calling identityService.createUserQuery().privilegeName(null) (which constructs this command) or new GetUsersWithPrivilegeCmd(null) directly.","commonSituations":"Privilege name sourced from a config property or process variable that is unset; passing a variable holding a null privilege name in identity-management admin tooling.","solutions":["Pass a concrete privilege name string, e.g. new GetUsersWithPrivilegeCmd(\"access-idm\")","Validate the privilege-name source (config/variable) before invoking the query","Catch FlowableIllegalArgumentException if a null name should degrade to an empty result"],"exampleFix":"// before\nList<User> users = identityService.createUserQuery().privilegeName(privilegeName).list();\n// after\nList<User> users = privilegeName != null\n        ? identityService.createUserQuery().privilegeName(privilegeName).list()\n        : Collections.emptyList();","handlingStrategy":"validation","validationCode":"if (privilegeName == null || privilegeName.isEmpty()) throw new IllegalArgumentException(\"privilege name is required\");","typeGuard":"boolean hasPrivilegeName(String name) { return name != null && !name.trim().isEmpty(); }","tryCatchPattern":"try { users = identityService.createUserQuery().privilegeName(name).list(); } catch (FlowableIllegalArgumentException e) { users = Collections.emptyList(); }","preventionTips":["Define privilege names as constants instead of ad-hoc strings","Validate config properties for privilege names at startup","Never forward raw request parameters as privilege names without checks"],"tags":["flowable","idm","null-argument","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"}