TLVTable does not preserve ordering of optional parameters
Status: Beta
Brought to you by:
orank
At present if you decode a packet from a byte stream and then reencode the packet back into a byte stream, sometimes the ordering of the optional parameters changes. As a result, the assertion that 'assert(Arrays.equals(byteArray, encodePacket(decodePacket(byteArray))) == true)' does not work reliably.
It would be nice if the implementation of TLVTable was changed to preserve the ordering of optional parameters. This could be done very easily by changing the following line in TLVTable:
private Map map = new HashMap();
...to read...
private Map map = new LinkedHashMap();