fixed error handle

This commit is contained in:
free will committed 2021-03-24 11:22:23 +08:00
1 parent 7bf0906291
commit adf834a4e9
10 files changed
+31 -67

No files matched your search

+5 -13
View File
@@ -61,7 +61,7 @@ public class CPacket implements InteractWithField, IEncodingAble {
Block block= null;
try {
block = new SelfEncodingBase().selfWireEncode(this.ttl);
} catch (EncoderException | BlockException e) {
} catch (EncoderException | BlockException | ComponentException e) {
throw new PacketException("CPacket.fillDataToFields: "+e.getMessage());
}
if(block==null){
@@ -74,7 +74,7 @@ public class CPacket implements InteractWithField, IEncodingAble {
this.minPacket.readOnlyField.clearBlocks();
try {
block=new SelfEncodingBase().selfWireEncode(this.payload);
} catch (EncoderException | BlockException e) {
} catch (EncoderException | BlockException | ComponentException e) {
throw new PacketException("CPacket.fillDataToFields: "+e.getMessage());
}
if(block==null){
@@ -151,11 +151,7 @@ public class CPacket implements InteractWithField, IEncodingAble {
// 指定包类型
this.minPacket.packetType=new VlInt(TLV.TlvPacketMINCommon);
try {
return this.minPacket.wireEncode(encoder);
} catch (EncoderException e) {
throw new PacketException("CPacket.wireEncode: "+e.getMessage());
}
return this.minPacket.wireEncode(encoder);
}
/**
@@ -165,12 +161,8 @@ public class CPacket implements InteractWithField, IEncodingAble {
*/
@Override
public boolean wireDecode(Block block) throws PacketException {
try {
if(!this.minPacket.wireDecode(block)){
return false;
}
} catch (VlIntException e) {
throw new PacketException("CPacket.wireDecode: "+e.getMessage());
if(!this.minPacket.wireDecode(block)){
return false;
}
return this.extraDataFromFields();
}
+4 -4
View File
@@ -87,7 +87,7 @@ public class Data implements IEncodingAble,InteractWithField {
Block block= null;
try {
block = new SelfEncodingBase().selfWireEncode(this.congestionMark);
} catch (EncoderException | BlockException e) {
} catch (EncoderException | BlockException | ComponentException e) {
throw new PacketException("Data.fillDataToFields: "+e.getMessage());
}
if(block==null){
@@ -111,7 +111,7 @@ public class Data implements IEncodingAble,InteractWithField {
if(this.freshnessPeriod.isInitial()){
try {
block=new SelfEncodingBase().selfWireEncode(this.freshnessPeriod);
} catch (EncoderException | BlockException e) {
} catch (EncoderException | BlockException | ComponentException e) {
throw new PacketException("Data.fillDataToFields: "+e.getMessage());
}
if(block==null){
@@ -124,7 +124,7 @@ public class Data implements IEncodingAble,InteractWithField {
if(this.nackHeader.isInitial()){
try {
block=new SelfEncodingBase().selfWireEncode(this.nackHeader);
} catch (EncoderException | BlockException e) {
} catch (EncoderException | BlockException | ComponentException e) {
throw new PacketException("Data.fillDataToFields: "+e.getMessage());
}
if(block==null){
@@ -136,7 +136,7 @@ public class Data implements IEncodingAble,InteractWithField {
// Payload
try {
block=new SelfEncodingBase().selfWireEncode(this.payload);
} catch (EncoderException | BlockException e) {
} catch (EncoderException | BlockException | ComponentException e) {
throw new PacketException("Data.fillDataToFields: "+e.getMessage());
}
if(block==null){
+1 -1
View File
@@ -196,7 +196,7 @@ public class Interest implements InteractWithField,IEncodingAble{
return true;
}catch (EncoderException | BlockException e){
}catch (EncoderException | BlockException | ComponentException e){
throw new PacketException("Interest.fillDataToFields: "+e.getMessage());
}
}