open-dis-java icon indicating copy to clipboard operation
open-dis-java copied to clipboard

Robustness - library crashes because of a null return when a field value is undefined

Open Cabisnotavailable opened this issue 1 year ago • 0 comments

In the standard "SISO-REF-010" there are lists containing defined DIS field-values. For example there are "Electromagnetic Emitters [UID 75]", which is a 16-bit enumeration with possible values between zero and 65535. Not all possible values have a counterpart. Excerpt from SISO-REF-010-2023:

2 1245/6X
3 1L117
4 1L121E
5 1L250
6 1L220-U
7 1L122-1E
10 1RL138
12 5N20
14 5P-10 Puma
15 5P-10E Puma
...

As you can see there are no counterparts for the numbers 0,1,8,9,11 and so on. On top of that these lists get updated almost every year. In a theater simulation we cannot assume that all simulation systems are up to date and use the same SISO Ref Tables.

Here is an example error report from Open DIS when using it in a real world simulation environment: No corresponding enumeration found for value 1 of enum EmitterName java.lang.NullPointerException: Cannot invoke "edu.nps.moves.dis7.enumerations.EmitterName.getValue()" because the return value of "edu.nps.moves.dis7.pdus.EmitterSystem.getEmitterName()" is null

The library is non-responsing from this moment on and you have to restart the application.

It is caused by a simulation software in this network that uses the enum 1. It shouldn't, regarding the standard, but it does. The error makes sense as the value 1 is undefined, but it shouldn't crash the Open DIS library.

Cabisnotavailable avatar Jun 03 '24 13:06 Cabisnotavailable