diff --git a/src/main/java/club/joylink/xiannccda/ats/message/FrameSchema.java b/src/main/java/club/joylink/xiannccda/ats/message/FrameSchema.java index ea08136..252680b 100644 --- a/src/main/java/club/joylink/xiannccda/ats/message/FrameSchema.java +++ b/src/main/java/club/joylink/xiannccda/ats/message/FrameSchema.java @@ -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); diff --git a/src/main/java/club/joylink/xiannccda/ats/message/MessageId.java b/src/main/java/club/joylink/xiannccda/ats/message/MessageId.java index 7eca067..926bfb6 100644 --- a/src/main/java/club/joylink/xiannccda/ats/message/MessageId.java +++ b/src/main/java/club/joylink/xiannccda/ats/message/MessageId.java @@ -34,6 +34,9 @@ public enum MessageId { DEPOT_PLAN(0x0007, null); int val; + /** + * 消息对象创建接口 + */ OccMessageCreate omc; interface OccMessageCreate {