添加消息解析异常处理
This commit is contained in:
parent
51ecc2fed8
commit
0ec14986e2
@ -145,6 +145,10 @@ public class FrameSchema {
|
|||||||
if (messageId.equals(MessageId.UNKNOWN)) {
|
if (messageId.equals(MessageId.UNKNOWN)) {
|
||||||
throw new Exception("位置的消息id");
|
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();
|
MessageData message = messageId.omc.create();
|
||||||
message.decode(msgBuf);
|
message.decode(msgBuf);
|
||||||
messages.add(message);
|
messages.add(message);
|
||||||
|
@ -34,6 +34,9 @@ public enum MessageId {
|
|||||||
DEPOT_PLAN(0x0007, null);
|
DEPOT_PLAN(0x0007, null);
|
||||||
|
|
||||||
int val;
|
int val;
|
||||||
|
/**
|
||||||
|
* 消息对象创建接口
|
||||||
|
*/
|
||||||
OccMessageCreate omc;
|
OccMessageCreate omc;
|
||||||
|
|
||||||
interface OccMessageCreate {
|
interface OccMessageCreate {
|
||||||
|
Loading…
Reference in New Issue
Block a user