{"record":{"id":"b57e0310fb888408","repo":"paascloud/paascloud-master","slug":"tpc10050001","errorCode":"TPC10050001","errorMessage":"TPC10050001","messagePattern":"TPC10050001","errorType":"error_code","errorClass":"TpcBizException","httpStatus":null,"severity":"error","filePath":"paascloud-provider/paascloud-provider-tpc/src/main/java/com/paascloud/provider/service/impl/TpcMqMessageServiceImpl.java","lineNumber":73,"sourceCode":"public class TpcMqMessageServiceImpl extends BaseService<TpcMqMessage> implements TpcMqMessageService {\n\t@Resource\n\tprivate TpcMqMessageMapper tpcMqMessageMapper;\n\t@Resource\n\tprivate TpcMqConfirmMapper tpcMqConfirmMapper;\n\t@Resource\n\tprivate TpcMqConsumerService tpcMqConsumerService;\n\t@Resource\n\tprivate UacRpcService uacRpcService;\n\t@Resource\n\tprivate MdcRpcService mdcRpcService;\n\t@Resource\n\tprivate OpcRpcService opcRpcService;\n\n\t@Override\n\tpublic void saveMessageWaitingConfirm(TpcMqMessageDto messageDto) {\n\n\t\tif (StringUtils.isEmpty(messageDto.getMessageTopic())) {\n\t\t\tthrow new TpcBizException(ErrorCodeEnum.TPC10050001);\n\t\t}\n\n\t\tDate now = new Date();\n\t\tTpcMqMessage message = new ModelMapper().map(messageDto, TpcMqMessage.class);\n\t\tmessage.setMessageStatus(MqSendStatusEnum.WAIT_SEND.sendStatus());\n\t\tmessage.setUpdateTime(now);\n\t\tmessage.setCreatedTime(now);\n\t\ttpcMqMessageMapper.insertSelective(message);\n\t}\n\n\t@Override\n\tpublic void confirmAndSendMessage(String messageKey) {\n\t\tfinal TpcMqMessage message = tpcMqMessageMapper.getByMessageKey(messageKey);\n\t\tif (message == null) {\n\t\t\tthrow new TpcBizException(ErrorCodeEnum.TPC10050002);\n\t\t}\n\n\t\tTpcMqMessage update = new TpcMqMessage();","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/paascloud/paascloud-master/blob/781281a9503332ed3cef44ea618349d14230a127/paascloud-provider/paascloud-provider-tpc/src/main/java/com/paascloud/provider/service/impl/TpcMqMessageServiceImpl.java#L55-L91","documentation":"TPC10050001 signals that a TPC MQ message cannot be persisted because its messageTopic is empty. saveMessageWaitingConfirm validates topic presence before mapping the DTO and creating a WAIT_SEND message record.","triggerScenarios":"Calling TpcMqMessageServiceImpl.saveMessageWaitingConfirm with a TpcMqMessageDto whose messageTopic is null or an empty string.","commonSituations":"Producer code forgets to set the topic before building the DTO; topic field lost when copying from a config object or map; refactored DTO construction dropped setmessageTopic.","solutions":["Set messageTopic on the TpcMqMessageDto before calling saveMessageWaitingConfirm.","Validate the topic at the producer's construction point to fail fast.","Check that the field name/copy mechanism (mapper, beanutils) actually populates messageTopic."],"exampleFix":"// before\nTpcMqMessageDto dto = new TpcMqMessageDto();\ndto.setMessageBody(body);\ntpcMqMessageService.saveMessageWaitingConfirm(dto);\n// after\nTpcMqMessageDto dto = new TpcMqMessageDto();\ndto.setMessageTopic(\"user-topic\");\ndto.setMessageBody(body);\ntpcMqMessageService.saveMessageWaitingConfirm(dto);","handlingStrategy":"validation","validationCode":"if (dto == null || StringUtils.isEmpty(dto.getMessageTopic())) {\n    throw new IllegalArgumentException(\"messageTopic is required\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    tpcMqMessageService.saveMessageWaitingConfirm(dto);\n} catch (TpcBizException e) {\n    if (\"TPC10050001\".equals(e.getMessage())) { /* surface 'topic required' to caller */ }\n    throw e;\n}","preventionTips":["Always set messageTopic when building TpcMqMessageDto","Add @NotBlank validation on messageTopic at the API boundary","Centralize DTO construction in a factory that requires topic"],"tags":["mq","validation","empty-topic"],"backgroundTag":"empty-required-field","analyzedSha":"781281a9503332ed3cef44ea618349d14230a127","analyzedAt":"2026-09-10T10:59:02.070Z","contentChangedAt":"2026-09-10T10:59:02.070Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}