From 5785f29ec3da733d2b6eb12b04ecfb8e407505e8 Mon Sep 17 00:00:00 2001 From: free will <2647778488@qq.com> Date: Mon, 22 Mar 2021 21:51:38 +0800 Subject: [PATCH] fixed some test error --- src/main/java/encoding/Block.java | 67 ++++++++++++++------ src/main/java/encoding/BlockException.java | 14 ++++ src/main/java/encoding/IEncodingAble.java | 2 +- src/main/java/encoding/SelfEncodingBase.java | 4 +- src/main/java/encoding/VlInt.java | 8 ++- src/main/java/packet/CPacket.java | 4 +- src/main/java/packet/Data.java | 4 +- src/main/java/packet/InteractWithField.java | 3 +- src/main/java/packet/Interest.java | 4 +- src/test/java/encoding/BlockTest.java | 36 +++++++---- src/test/java/encoding/EncoderTest.java | 28 ++++---- src/test/java/others/TestCallBack.java | 3 +- 12 files changed, 118 insertions(+), 59 deletions(-) create mode 100644 src/main/java/encoding/BlockException.java diff --git a/src/main/java/encoding/Block.java b/src/main/java/encoding/Block.java index b368b4f..9e426f5 100644 --- a/src/main/java/encoding/Block.java +++ b/src/main/java/encoding/Block.java @@ -23,6 +23,8 @@ public class Block { public Block(){ this.tlvType=new VlInt(TLV.TlvInvalid); + this.length=new VlInt(0); + this.elements=new ElementContainer(); } /** @@ -32,15 +34,15 @@ public class Block { * 则会对比解析到的 TLV-LENGTH 与 TLV-VALUE的实际长度是否匹配 * @return */ - public static Block createBlockByBuffer(byte[] buffer,boolean verifyLength) throws EncoderException { + public static Block createBlockByBuffer(byte[] buffer,boolean verifyLength) throws BlockException { if(buffer.length==0){ - return null; + throw new BlockException("createBlockByBuffer: buffer.length==0"); } // 读取type VlInt tlvType=TLV.readType(buffer,new VlInt(0)); if(tlvType==null){ - return null; + throw new BlockException("createBlockByBuffer: tlvType read error"); } // 读取length @@ -48,10 +50,10 @@ public class Block { try { tlvLength = TLV.readVarNumber(buffer,new VlInt(tlvType.size())); } catch (ByteHelperException e) { - e.printStackTrace(); + throw new BlockException("createBlockByBuffer: tlvLength read error"); } if(tlvLength==null){ - return null; + throw new BlockException("createBlockByBuffer: tlvLength read error"); } return createBlockByTypeLengthBuffer(tlvType,tlvLength, @@ -67,7 +69,7 @@ public class Block { * @param verifyLength * @return */ - public static Block createBlockByTypeLengthBuffer(VlInt tlvType,VlInt tlvLength,byte[] buffer,boolean verifyLength) throws EncoderException { + public static Block createBlockByTypeLengthBuffer(VlInt tlvType,VlInt tlvLength,byte[] buffer,boolean verifyLength) throws BlockException { return new Block(tlvType,tlvLength,buffer,verifyLength); } @@ -78,33 +80,55 @@ public class Block { * @param buffer * @param verifyLength */ - public Block(VlInt tlvType,VlInt tlvLength,byte[] buffer,boolean verifyLength) throws EncoderException { + public Block(VlInt tlvType,VlInt tlvLength,byte[] buffer,boolean verifyLength) throws BlockException{ this.tlvType=tlvType; this.length=tlvLength; + this.elements=new ElementContainer(); // 检查长度是否正确 if(verifyLength && (!this.length.isEqual(buffer.length))){ - throw new Error("Block(VlInt tlvType,VlInt tlvLength,byte[] buffer,boolean verifyLength): invalid length."); + throw new BlockException("Block(VlInt tlvType,VlInt tlvLength,byte[] buffer,boolean verifyLength): invalid length."); } // 设置 Raw Encoder encoder=new Encoder(); - boolean resetBool=encoder.encoderReset(new SizeT(tlvType.size()+tlvLength.size()+buffer.length),new SizeT(0)); + boolean resetBool= false; + try { + resetBool = encoder.encoderReset(new SizeT(tlvType.size()+tlvLength.size()+buffer.length),new SizeT(0)); + } catch (EncoderException e) { + throw new BlockException("Block(VlInt tlvType,VlInt tlvLength,byte[] buffer,boolean verifyLength): encoderReset error" + +e.getMessage()); + } if(!resetBool){ - throw new Error("Block(VlInt tlvType,VlInt tlvLength,byte[] buffer,boolean verifyLength): encoderReset error"); + throw new BlockException("Block(VlInt tlvType,VlInt tlvLength,byte[] buffer,boolean verifyLength): encoderReset error"); } - if(encoder.prependByteArray(buffer,new SizeT(buffer.length))==0){ - throw new Error("Block(VlInt tlvType,VlInt tlvLength,byte[] buffer,boolean verifyLength): prepenndByteArray buffer error"); + try { + if(encoder.prependByteArray(buffer,new SizeT(buffer.length))==0){ + throw new BlockException("Block(VlInt tlvType,VlInt tlvLength,byte[] buffer,boolean verifyLength): prepenndByteArray buffer error"); + } + } catch (EncoderException e) { + throw new BlockException("Block(VlInt tlvType,VlInt tlvLength,byte[] buffer,boolean verifyLength): prepenndByteArray buffer error" + +e.getMessage()); } - if(encoder.prependVarNumber(tlvLength)==0){ - throw new Error("Block(VlInt tlvType,VlInt tlvLength,byte[] buffer,boolean verifyLength): prependVarNumber tlvLength error"); + try { + if(encoder.prependVarNumber(tlvLength)==0){ + throw new BlockException("Block(VlInt tlvType,VlInt tlvLength,byte[] buffer,boolean verifyLength): prependVarNumber tlvLength error"); + } + } catch (EncoderException e) { + throw new BlockException("Block(VlInt tlvType,VlInt tlvLength,byte[] buffer,boolean verifyLength): prependVarNumber tlvLength error" + +e.getMessage()); } - if(encoder.prependVarNumber(tlvType)==0){ - throw new Error("Block(VlInt tlvType,VlInt tlvLength,byte[] buffer,boolean verifyLength): prependVarNumber tlvType error"); + try { + if(encoder.prependVarNumber(tlvType)==0){ + throw new BlockException("Block(VlInt tlvType,VlInt tlvLength,byte[] buffer,boolean verifyLength): prependVarNumber tlvType error"); + } + } catch (EncoderException e) { + throw new BlockException("Block(VlInt tlvType,VlInt tlvLength,byte[] buffer,boolean verifyLength): prependVarNumber tlvType error" + +e.getMessage()); } byte[] encodedBuffer=encoder.getBuffer(); if(encodedBuffer==null){ - throw new Error("Block(VlInt tlvType,VlInt tlvLength,byte[] buffer,boolean verifyLength): encoder.getBuffer error"); + throw new BlockException("Block(VlInt tlvType,VlInt tlvLength,byte[] buffer,boolean verifyLength): encoder.getBuffer error"); } this.raw=encodedBuffer; @@ -242,13 +266,18 @@ public class Block { try { subBlockValue = new byte[tlvLength.getVlIntValue2Int()]; System.arraycopy(this.value,start,subBlockValue,0,tlvLength.getVlIntValue2Int()); - Block block=createBlockByTypeLengthBuffer(tlvType,tlvLength,subBlockValue,true); + Block block= null; + try { + block = createBlockByTypeLengthBuffer(tlvType,tlvLength,subBlockValue,true); + } catch (BlockException e) { + return false; + } if(block==null){ return false; } this.addElement(block); start+=tlvLength.getVlIntValue2Int(); - } catch (VlIntException | EncoderException e) { + } catch (VlIntException e) { return false; } } diff --git a/src/main/java/encoding/BlockException.java b/src/main/java/encoding/BlockException.java new file mode 100644 index 0000000..ebecab5 --- /dev/null +++ b/src/main/java/encoding/BlockException.java @@ -0,0 +1,14 @@ +package encoding; + +/* + * @Author: Wang Feng + * @Description: + * @Version: 1.0.0 + * @Date: 19:53 2021/3/22 + * @Copyright: MIN-Group;国家重大科技基础设施——未来网络北大实验室;深圳市信息论与未来网络重点实验室 + */ +public class BlockException extends Exception { + public BlockException(String msg){ + super("Block."+msg); + } +} diff --git a/src/main/java/encoding/IEncodingAble.java b/src/main/java/encoding/IEncodingAble.java index fdda48b..cda5935 100644 --- a/src/main/java/encoding/IEncodingAble.java +++ b/src/main/java/encoding/IEncodingAble.java @@ -15,7 +15,7 @@ public interface IEncodingAble { * @param encoder * @return */ - public int wireEncode(Encoder encoder) throws EncoderException; + public int wireEncode(Encoder encoder) throws EncoderException, BlockException; /** * 线速解码,将一个TLV解码成一个网络包 diff --git a/src/main/java/encoding/SelfEncodingBase.java b/src/main/java/encoding/SelfEncodingBase.java index 825d889..c125078 100644 --- a/src/main/java/encoding/SelfEncodingBase.java +++ b/src/main/java/encoding/SelfEncodingBase.java @@ -44,7 +44,7 @@ public class SelfEncodingBase { * @param iEncodingAble * @return */ - public Block selfWireEncode(IEncodingAble iEncodingAble) throws EncoderException { + public Block selfWireEncode(IEncodingAble iEncodingAble) throws EncoderException, BlockException { // this.setiEncodingAble(iEncodingAble); if((this.rawBlock!=null)&&this.rawBlock.isValid()){ return this.rawBlock; @@ -64,7 +64,7 @@ public class SelfEncodingBase { * @param iEncodingAble * @return */ - private Block easyEncoder(IEncodingAble iEncodingAble) throws EncoderException { + private Block easyEncoder(IEncodingAble iEncodingAble) throws EncoderException, BlockException { Encoder encoder=new Encoder(); // 首先测量目标 TLV 的大小 diff --git a/src/main/java/encoding/VlInt.java b/src/main/java/encoding/VlInt.java index 229c6b1..433da66 100644 --- a/src/main/java/encoding/VlInt.java +++ b/src/main/java/encoding/VlInt.java @@ -59,7 +59,8 @@ public class VlInt { new Double(pow(2, 32)).longValue())) < 0){ return 5; }else if(bigInteger.compareTo(BigInteger.valueOf( - new Double(pow(2, 64)).longValue())) < 0){ + new Double(pow(2, 64)).longValue())) <= 0){ + // 这里其实是与long的最大值做对比,所以可以等 return 9; }else{ //MIN1.0中,VlInt的size最大为9 @@ -103,7 +104,8 @@ public class VlInt { return false; } if(bigInteger.compareTo(BigInteger.valueOf( - new Double(pow(2, 64)).longValue())) >= 0){ + new Double(pow(2, 64)).longValue())) > 0){ + // 这里其实是与long的最大值做对比,所以不能等于,暂时用大于 return false; } return true; @@ -176,7 +178,7 @@ public class VlInt { public VlInt(long l){ this.VlIntValue=BigInteger.valueOf(l); if(!isValidVlIntValue(this.VlIntValue)){ - throw new Error("VlInt(long l): The l value is invalid, it is out of the bound."); + throw new Error("VlInt(long l): out of the bound, the l value is invalid."); } this.VlIntBytes=bigInteger2vlintBytes(this.VlIntValue); this.size=SizeOfVarNumber(this.VlIntValue); diff --git a/src/main/java/packet/CPacket.java b/src/main/java/packet/CPacket.java index 0d8be35..a455a37 100644 --- a/src/main/java/packet/CPacket.java +++ b/src/main/java/packet/CPacket.java @@ -51,7 +51,7 @@ public class CPacket implements InteractWithField, IEncodingAble { * @return */ @Override - public boolean fillDataToFields() throws EncoderException{ + public boolean fillDataToFields() throws EncoderException, BlockException { // 可变区 => 受保护区(无) // 填充可变区 => 非受保护区 @@ -128,7 +128,7 @@ public class CPacket implements InteractWithField, IEncodingAble { * @return */ @Override - public int wireEncode(Encoder encoder) throws EncoderException { + public int wireEncode(Encoder encoder) throws EncoderException, BlockException { // 首先将属性填充到分区当中 if(!this.fillDataToFields()){ return 0; diff --git a/src/main/java/packet/Data.java b/src/main/java/packet/Data.java index a094f85..de94b25 100644 --- a/src/main/java/packet/Data.java +++ b/src/main/java/packet/Data.java @@ -68,7 +68,7 @@ public class Data implements IEncodingAble,InteractWithField { * @return */ @Override - public boolean fillDataToFields() throws EncoderException { + public boolean fillDataToFields() throws EncoderException, BlockException { ///////////////////////////////////////////////////////////// //// 填充可变区 // { => 可变区 @@ -216,7 +216,7 @@ public class Data implements IEncodingAble,InteractWithField { * @return */ @Override - public int wireEncode(Encoder encoder) throws EncoderException { + public int wireEncode(Encoder encoder) throws EncoderException, BlockException { // 首先将各项属性填充到分区当中 if(this.fillDataToFields()){ return 0; diff --git a/src/main/java/packet/InteractWithField.java b/src/main/java/packet/InteractWithField.java index 7f334d9..92122c6 100644 --- a/src/main/java/packet/InteractWithField.java +++ b/src/main/java/packet/InteractWithField.java @@ -1,5 +1,6 @@ package packet; +import encoding.BlockException; import encoding.EncoderException; import encoding.VlIntException; @@ -15,7 +16,7 @@ public interface InteractWithField { * 将包的属性填充到网络包的四个分区当中 * @return */ - boolean fillDataToFields() throws EncoderException; + boolean fillDataToFields() throws EncoderException, BlockException; /** * 从网络包的四个分区当中提取出特定网络包的相关属性 diff --git a/src/main/java/packet/Interest.java b/src/main/java/packet/Interest.java index 35d2b71..2c2f87b 100644 --- a/src/main/java/packet/Interest.java +++ b/src/main/java/packet/Interest.java @@ -104,7 +104,7 @@ public class Interest implements InteractWithField,IEncodingAble{ * @return */ @Override - public boolean fillDataToFields() throws EncoderException { + public boolean fillDataToFields() throws EncoderException, BlockException { ///////////////////////////////////////////////////////////// //// 填充可变区 ///////////////////////////////////////////////////////////// @@ -292,7 +292,7 @@ public class Interest implements InteractWithField,IEncodingAble{ * @return */ @Override - public int wireEncode(Encoder encoder) throws EncoderException { + public int wireEncode(Encoder encoder) throws EncoderException, BlockException { // 首先将各项属性填充到分区当中 if(!this.fillDataToFields()){ return 0; diff --git a/src/test/java/encoding/BlockTest.java b/src/test/java/encoding/BlockTest.java index 73be641..a12ed8c 100644 --- a/src/test/java/encoding/BlockTest.java +++ b/src/test/java/encoding/BlockTest.java @@ -16,7 +16,7 @@ import static org.junit.Assert.*; public class BlockTest { @Test - public void TestCreateBlockByTypeLengthBuffer() throws VlIntException, EncoderException { + public void TestCreateBlockByTypeLengthBuffer() throws VlIntException, EncoderException, BlockException { byte[] buf = new byte[10000]; Block block = Block.createBlockByTypeLengthBuffer(new VlInt(241), new VlInt(8000),ByteHelper.getLenBytes(buf, new VlInt(0),8000),true); //测试type与size @@ -42,7 +42,7 @@ public class BlockTest { //error:block.Size().size()错误。 @Test - public void TestCreateBlockByBuffer() throws VlIntException, EncoderException { + public void TestCreateBlockByBuffer() throws VlIntException, EncoderException, BlockException { byte[] buf = new byte[10000]; buf[0] = (byte)212; buf[1] = (byte)241; @@ -54,12 +54,12 @@ public class BlockTest { System.out.println("测试block.Size().size()"); assertEquals(block.getLength().getVlIntValue2Int(),8000); //block.Size()返回一个SizeT,再调用SizeT.size() - assertEquals(block.Size().size(),8004); + assertEquals(block.Size().getVlIntValue2Int(),8004); assertTrue(block.hasValue()); } @Test - public void TestBuildByBlock() throws VlIntException, EncoderException { + public void TestBuildByBlock() throws VlIntException, EncoderException, BlockException { //Block构造方法测试 byte[] buf = new byte[10000]; Block block1 = Block.createBlockByTypeLengthBuffer(new VlInt(241), new VlInt(8000),ByteHelper.getLenBytes(buf, new VlInt(0),8000),true); @@ -85,7 +85,7 @@ public class BlockTest { } @Test - public void TestBuildByTypeLengthBuffer() throws VlIntException, EncoderException { + public void TestBuildByTypeLengthBuffer() throws VlIntException, EncoderException, BlockException { //Block构造方法测试 byte[] buf = new byte[10000]; Block block = new Block(new VlInt(241),new VlInt(8000),ByteHelper.getLenBytes(buf,new VlInt(0),8000),true); @@ -109,31 +109,44 @@ public class BlockTest { assertEquals(rawBuf.length,8006); } + public static void main(String[] args){ + byte a=(byte)254; + System.out.println(a); + } //error //TODO 错误处理 @Test - public void TestParseSubElements() throws EncoderException { + public void TestParseSubElements() throws EncoderException, BlockException, VlIntException { byte[] buf = new byte[10000]; - for (int i = 0; i < 240; i++) { + for (int i = 0; i < 24; i++) { buf[i*8] = (byte)(i+1); buf[i*8+1] = 6; } - Block block = new Block(new VlInt(241),new VlInt(240*8),ByteHelper.getLenBytes(buf,new VlInt(0),240*8),true); + Block block = new Block(new VlInt(241),new VlInt(24*8),ByteHelper.getLenBytes(buf,new VlInt(0),24*8),true); + if(block.isValid()){ + System.out.println("true"); + } block.parseSubElements(); //TODO 错误处理 ElementContainer elementContainer = block.getSubElements(); //测试解析数据正确性 for (int i = 0; i < elementContainer.length(); i++) { - assertEquals(elementContainer.getBlock(i).getType(),new VlInt(i+1)); - assertEquals(elementContainer.getBlock(i).getLength(),new VlInt(6)); +// System.out.println(elementContainer.getBlock(i).getType().equals(new VlInt(i+1))); +// System.out.println(elementContainer.getBlock(i).getLength().equals(new VlInt(6))); + assertArrayEquals(elementContainer.getBlock(i).getType().getVlIntBytes(),new VlInt(i+1).getVlIntBytes()); + assertArrayEquals(elementContainer.getBlock(i).getLength().getVlIntBytes(),new VlInt(6).getVlIntBytes()); + assertEquals(elementContainer.getBlock(i).getType().getVlIntValue2Int(),new VlInt(i+1).getVlIntValue2Int()); + assertEquals(elementContainer.getBlock(i).getLength().getVlIntValue2Int(),new VlInt(6).getVlIntValue2Int()); + assertEquals(elementContainer.getBlock(i).getType().size(),new VlInt(i+1).size()); + assertEquals(elementContainer.getBlock(i).getLength().size(),new VlInt(6).size()); } } //error //TODO 没测完 @Test - public void TestSubElements() throws EncoderException { + public void TestSubElements() throws EncoderException, BlockException { byte[] buf = new byte[10000]; Block block = new Block(); block.setType(new VlInt(7)); @@ -144,6 +157,5 @@ public class BlockTest { // System.out.println("block.hasValue() = "+block.hasValue()); // System.out.println("block.hasSubElement() = "+block.hasSubElement()); ElementContainer elements = block.getSubElements(); - } } diff --git a/src/test/java/encoding/EncoderTest.java b/src/test/java/encoding/EncoderTest.java index 144ec17..5d8ff52 100644 --- a/src/test/java/encoding/EncoderTest.java +++ b/src/test/java/encoding/EncoderTest.java @@ -19,7 +19,7 @@ import static org.junit.Assert.*; public class EncoderTest { int MaxPacketSize = 8800; @Test - public void TestEmpty() { + public void TestEmpty() throws EncoderException { Encoder encoder = new Encoder(); Encoder estimator = new Encoder(); encoder.encoderReset(new SizeT(MaxPacketSize),new SizeT(0)); @@ -38,7 +38,7 @@ public class EncoderTest { } @Test - public void TestEncoder_PrependByte(){ + public void TestEncoder_PrependByte() throws EncoderException, VlIntException { Encoder encoder = new Encoder(); Encoder estimator = new Encoder(); encoder.encoderReset(new SizeT(MaxPacketSize),new SizeT(0)); @@ -78,7 +78,7 @@ public class EncoderTest { } @Test - public void TestEncoder_AppendByte(){ + public void TestEncoder_AppendByte() throws EncoderException, VlIntException { Encoder encoder = new Encoder(); Encoder estimator = new Encoder(); encoder.encoderReset(new SizeT(MaxPacketSize), new SizeT(MaxPacketSize)); @@ -109,7 +109,7 @@ public class EncoderTest { } @Test - public void TestEncoder_PrependByteArray(){ + public void TestEncoder_PrependByteArray() throws EncoderException, VlIntException { Encoder encoder = new Encoder(); Encoder estimator = new Encoder(); encoder.encoderReset(new SizeT(MaxPacketSize),new SizeT(0)); @@ -142,7 +142,7 @@ public class EncoderTest { } @Test - public void TestEncoder_AppendByteArray(){ + public void TestEncoder_AppendByteArray() throws EncoderException, VlIntException { Encoder encoder = new Encoder(); Encoder estimator = new Encoder(); encoder.encoderReset(new SizeT(MaxPacketSize), new SizeT(MaxPacketSize)); @@ -179,7 +179,7 @@ public class EncoderTest { //error @Test - public void TestPrependVarNumber(){ + public void TestPrependVarNumber() throws EncoderException { Encoder encoder = new Encoder(); Encoder estimator = new Encoder(); encoder.encoderReset(new SizeT(MaxPacketSize),new SizeT(0)); @@ -228,7 +228,7 @@ public class EncoderTest { assertEquals(num3,4294967296L); // TODO 测试添加64位整型所能表示的最大值 - // uint64最大值在java中无法表示 + // uint64最大值在java中无法表示=>用Long.MaxValue } @@ -236,7 +236,7 @@ public class EncoderTest { @Test - public void TestAppendVarNumber(){ + public void TestAppendVarNumber() throws EncoderException { Encoder encoder = new Encoder(); Encoder estimator = new Encoder(); encoder.encoderReset(new SizeT(MaxPacketSize), new SizeT(MaxPacketSize)); @@ -285,7 +285,7 @@ public class EncoderTest { } @Test - public void TestPrependNonNegativeInteger(){ + public void TestPrependNonNegativeInteger() throws EncoderException { Encoder encoder = new Encoder(); Encoder estimator = new Encoder(); encoder.encoderReset(new SizeT(MaxPacketSize), new SizeT(0)); @@ -326,7 +326,7 @@ public class EncoderTest { } @Test - public void TestAppendNonNegativeInteger(){ + public void TestAppendNonNegativeInteger() throws EncoderException { Encoder encoder = new Encoder(); Encoder estimator = new Encoder(); encoder.encoderReset(new SizeT(MaxPacketSize), new SizeT(MaxPacketSize)); @@ -373,7 +373,7 @@ public class EncoderTest { } @Test - public void TestPrependByteArrayBlock(){ + public void TestPrependByteArrayBlock() throws EncoderException { Encoder encoder = new Encoder(); Encoder estimator = new Encoder(); encoder.encoderReset(new SizeT(MaxPacketSize), new SizeT(0)); @@ -410,7 +410,7 @@ public class EncoderTest { } @Test - public void TestAppendByteArrayBlock(){ + public void TestAppendByteArrayBlock() throws EncoderException { Encoder encoder = new Encoder(); Encoder estimator = new Encoder(); encoder.encoderReset(new SizeT(MaxPacketSize), new SizeT(MaxPacketSize)); @@ -447,7 +447,7 @@ public class EncoderTest { } @Test - public void TestPrependBlock(){ + public void TestPrependBlock() throws EncoderException { Encoder encoder = new Encoder(); Encoder estimator = new Encoder(); encoder.encoderReset(new SizeT(MaxPacketSize), new SizeT(0)); @@ -478,7 +478,7 @@ public class EncoderTest { } @Test - public void TestAppendBlock(){ + public void TestAppendBlock() throws EncoderException { Encoder encoder = new Encoder(); Encoder estimator = new Encoder(); encoder.encoderReset(new SizeT(MaxPacketSize), new SizeT(MaxPacketSize)); diff --git a/src/test/java/others/TestCallBack.java b/src/test/java/others/TestCallBack.java index 20ea606..e9d618d 100644 --- a/src/test/java/others/TestCallBack.java +++ b/src/test/java/others/TestCallBack.java @@ -2,6 +2,7 @@ package others; import component.CanBePrefix; import encoding.Block; +import encoding.BlockException; import encoding.EncoderException; import encoding.SelfEncodingBase; @@ -13,7 +14,7 @@ import encoding.SelfEncodingBase; * @Copyright: MIN-Group;国家重大科技基础设施——未来网络北大实验室;深圳市信息论与未来网络重点实验室 */ public class TestCallBack { - public static void main(String[] args) throws EncoderException { + public static void main(String[] args) throws EncoderException, BlockException { CanBePrefix canBePrefix=new CanBePrefix(); Block block=new SelfEncodingBase().selfWireEncode(canBePrefix); }