dlr-eoc / prosEO

prosEO – A Processing System for Earth Observation Data
GNU General Public License v3.0
14 stars 1 forks source link

All REST interfaces: Check for explicit "null" values of optional parameters #129

Closed tangobravo62 closed 8 months ago

tangobravo62 commented 3 years ago

If in the JSON data passed to the REST API a value is explicitly set to "null", then the corresponding object attribute is also set to null. This may lead to NullPointerExceptions especially for optional array parameters, because instead of leaving the empty ArrayList created during object construction as is (as it happens if the parameter is not present at all in the JSON) the attribute is actively set to "null" by Spring and following constructs like while (Obj x: object.getListAttribute()) fail with a NPE.

For scalar attributes this probably is not an issue generally, but for array/list attributes it is. All interfaces have to be checked therefore.

emelchinger commented 3 years ago

Planner checked.

tangobravo62 commented 8 months ago

Implemented and tested. Issue closed.