添加消息解析异常处理

This commit is contained in:
walker 2023-06-07 09:09:44 +08:00
parent 51ecc2fed8
commit 0ec14986e2
2 changed files with 7 additions and 0 deletions

View File

@ -145,6 +145,10 @@ public class FrameSchema {
if (messageId.equals(MessageId.UNKNOWN)) {
throw new Exception("位置的消息id");
}
if (messageId.omc == null || messageId.omc.create() == null) {
throw new Exception(
String.format("id=%s的消息没有消息对象创建接口omc或接口返回null", messageId));
}
MessageData message = messageId.omc.create();
message.decode(msgBuf);
messages.add(message);

View File

@ -34,6 +34,9 @@ public enum MessageId {
DEPOT_PLAN(0x0007, null);
int val;
/**
* 消息对象创建接口
*/
OccMessageCreate omc;
interface OccMessageCreate {