{"record":{"id":"c2d988bb2d51910c","repo":"apache/rocketmq","slug":"is-null","errorCode":null,"errorMessage":" is null.","messagePattern":" is null\\.","errorType":"exception","errorClass":"AuthorizationException","httpStatus":null,"severity":"error","filePath":"auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java","lineNumber":622,"sourceCode":"                    break;\n            }\n            if (CollectionUtils.isNotEmpty(result)) {\n                result.forEach(r -> {\n                    r.setChannelId(context.channel().id().asLongText());\n                    r.setRpcCode(String.valueOf(command.getCode()));\n                });\n            }\n        } catch (AuthorizationException ex) {\n            throw ex;\n        } catch (Throwable t) {\n            throw new AuthorizationException(\"parse authorization context error.\", t);\n        }\n        return result;\n    }\n\n    private static <T> T decodeRequiredBody(RemotingCommand command, Class<T> bodyClass, String bodyName) {\n        if (command.getBody() == null || command.getBody().length == 0) {\n            throw new AuthorizationException(bodyName + \" is null.\");\n        }\n        T body = RemotingSerializable.decode(command.getBody(), bodyClass);\n        if (body == null) {\n            throw new AuthorizationException(bodyName + \" is null.\");\n        }\n        return body;\n    }\n\n    private static String decodeRequiredText(RemotingCommand command, String bodyName) {\n        if (command.getBody() == null || command.getBody().length == 0) {\n            throw new AuthorizationException(bodyName + \" is null.\");\n        }\n        return new String(command.getBody(), StandardCharsets.UTF_8);\n    }\n\n    private static String requireResource(String resource, String resourceName) {\n        if (StringUtils.isBlank(resource)) {\n            throw new AuthorizationException(resourceName + \" is null.\");","sourceCodeStart":604,"sourceCodeEnd":640,"githubUrl":"https://github.com/apache/rocketmq/blob/293f5885719fc4aa3619446a1900f58ccfcfdd29/auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java#L604-L640","documentation":"Produced by decodeRequiredBody when the remoting command's body is null or zero-length: it throws AuthorizationException(bodyName + \" is null.\") so the caller sees e.g. 'topic list is null.', 'subscription group list is null.', or 'topic queue mapping is null.'. It guards every admin request code that needs a serialized body object (UPDATE_AND_CREATE_TOPIC_LIST, ..._SUBSCRIPTIONGROUP_LIST, UPDATE_AND_CREATE_STATIC_TOPIC, DELETE_TOPIC_IN_BROKER_LIST, DELETE_SUBSCRIPTION_GROUP_LIST, etc.) before attempting to decode.","triggerScenarios":"Sending any of the list/static-topic admin request codes without calling RemotingCommand#setBody, or with a zero-byte array. Common when a client constructs the request header correctly but forgets to serialize and attach the body object.","commonSituations":"Custom admin tooling or test harnesses that build RemotingCommand manually; refactors that drop the setBody call; clients assuming the broker fills in a default body.","solutions":["Serialize the request object (RemotingSerializable.encode) and call command.setBody(bytes) before sending.","Add a client-side assert that getBody() is non-null and length > 0 for body-carrying request codes.","Use the high-level admin APIs which always attach the body."],"exampleFix":"// before\nRemotingCommand cmd = RemotingCommand.createRequestCommand(code, header);\n// body never set -> 'topic list is null.'\n\n// after\nRemotingCommand cmd = RemotingCommand.createRequestCommand(code, header);\ncmd.setBody(RemotingSerializable.encode(requestBody));","handlingStrategy":"validation","validationCode":"if (requestBody != null) {\n    byte[] body = RemotingSerializable.encode(requestBody);\n    if (body != null && body.length > 0) cmd.setBody(body);\n}","typeGuard":null,"tryCatchPattern":"try { client.invokeSync(addr, cmd, timeout); }\ncatch (AuthorizationException e) {\n    if (e.getMessage().endsWith(\"is null.\") && cmd.getBody() == null) { attachBodyAndResend(); return; }\n    throw e;\n}","preventionTips":["Always call setBody for body-carrying request codes","Assert getBody() is non-empty before invoke","Use high-level admin APIs"],"tags":["rocketmq","authorization","remoting-body","null-safety"],"backgroundTag":null,"analyzedSha":"293f5885719fc4aa3619446a1900f58ccfcfdd29","analyzedAt":"2026-08-14T11:50:13.822Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}