The current implementation of unmarshaling PDUs performs some enumeration lookups of the extracted values. If the value isn't found, it returns a null. This causes issues later in determining the unmarshalledSize() of the PDU, resulting in a NullPointerException (NPE).
One such scenario is seen in #14. ie: When some of the values are high end shorts (read as negative values), resulting in a failed enumeration lookup (no negative mappings in the enumeration classes), which returns a null for that instance. Later the parent object requests a .getMarshalledSize(), which performs the same thing on all member objects, and as one is a null the method bombs out.
But, as a lot of the Enumerations are filled with holes / incomplete, it's very easy to pull out a value that results in the null.
Example
In BeamStatus.java:getMarshalledSize() :
marshalSize += beamState.getMarshalledSize(); // When `beamState` is not mapped from the enumeration possibilities, this is `null`, resulting in a NPE.
Sure, this particular example should be either on or off, but due to how it is unmarshalled, I've seen other values extracted from the byte. This could be related to the next issue (#7 ) though.
There are other PDUs though, such as the name of an emitter / radio / etc where it may not exist either.
Suggestion
If the mapping is insisted at PDU generation time, perhaps ensure that allgenerated Enumeration classes from the SISO standard (SISO-REF-010-v28 at time of viewing) contain an "unknown"/"invalid"/"other" mapping, and return that instead of null? Some already do, but not all.
The current implementation of unmarshaling PDUs performs some enumeration lookups of the extracted values. If the value isn't found, it returns a
null. This causes issues later in determining theunmarshalledSize()of the PDU, resulting in aNullPointerException(NPE).One such scenario is seen in #14. ie: When some of the values are high end shorts (read as negative values), resulting in a failed enumeration lookup (no negative mappings in the enumeration classes), which returns a null for that instance. Later the parent object requests a
.getMarshalledSize(), which performs the same thing on all member objects, and as one is anullthe method bombs out.But, as a lot of the Enumerations are filled with holes / incomplete, it's very easy to pull out a value that results in the
null.Example
In
BeamStatus.java:getMarshalledSize():Sure, this particular example should be either on or off, but due to how it is unmarshalled, I've seen other values extracted from the byte. This could be related to the next issue (#7 ) though.
There are other PDUs though, such as the name of an emitter / radio / etc where it may not exist either.
Suggestion
If the mapping is insisted at PDU generation time, perhaps ensure that allgenerated Enumeration classes from the SISO standard (SISO-REF-010-v28 at time of viewing) contain an "unknown"/"invalid"/"other" mapping, and return that instead of
null? Some already do, but not all.