|
@@ -10,8 +10,6 @@ import lombok.NoArgsConstructor;
|
|
|
import lombok.experimental.Accessors;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
-import wei.yigulu.iec104.container.Iec104Link;
|
|
|
-import wei.yigulu.iec104.container.LinkContainer;
|
|
|
import wei.yigulu.iec104.exception.Iec104Exception;
|
|
|
import wei.yigulu.iec104.nettyconfig.TechnicalTerm;
|
|
|
import wei.yigulu.iec104.util.SendAndReceiveNumUtil;
|
|
@@ -248,14 +246,12 @@ public class Apdu {
|
|
|
byte[][] bb = new byte[0][];
|
|
|
if (this.apciType == ApciType.I_FORMAT) {
|
|
|
try {
|
|
|
+ if(this.asdu.getDataFrame()==null){
|
|
|
+ throw new Iec104Exception("I帧数据体为空");
|
|
|
+ }
|
|
|
bb = this.asdu.getDataFrame().handleAndAnswer(this);
|
|
|
} catch (Exception e) {
|
|
|
- if (e instanceof NullPointerException) {
|
|
|
- log.error("数据帧解析后的逻辑处理出现异常", e);
|
|
|
- //throw new Iec104Exception("该I帧无数据体");
|
|
|
- }
|
|
|
- log.error("数据帧解析后的逻辑处理出现异常", e);
|
|
|
- //throw new Iec104Exception("I帧响应帧编译出错");
|
|
|
+ log.error("数据帧解析后的逻辑处理出现异常:{}", e.getMessage());
|
|
|
}
|
|
|
} else if (this.apciType == ApciType.S_FORMAT) {
|
|
|
bb = sHandleAndAnswer();
|
|
@@ -303,17 +299,6 @@ public class Apdu {
|
|
|
* @throws Iec104Exception iec exception
|
|
|
*/
|
|
|
public byte[][] sHandleAndAnswer() throws Iec104Exception {
|
|
|
- Iec104Link link = LinkContainer.getInstance().getLink(channel.id());
|
|
|
- int send = this.receiveSeqNum;
|
|
|
- int send1=link.getISend();
|
|
|
- if(send1>send){
|
|
|
- loseSend();
|
|
|
- link.setISend(send);
|
|
|
- }
|
|
|
- if(send1<send){
|
|
|
- log.warn("我方或对方计数出错");
|
|
|
- link.setISend(send);
|
|
|
- }
|
|
|
return null;
|
|
|
}
|
|
|
|