openTCS / opentcs-commadapter-vda5050

An implementation of the VDA5050 interface for openTCS (by Fraunhofer IML)
https://www.opentcs.org/
MIT License
30 stars 11 forks source link

Null exception happens in Statemappings if no error or no information data #6

Closed maxwang001 closed 4 months ago

maxwang001 commented 4 months ago

Affected version

v0.19.0

Steps to reproduce

  1. A "State" JSON without "Errors" or "Information" data
  2. The null exception happens once execute function toErrorPropertyValue / toInfoPropertyValue in Statemappings.java

Expected behaviour

Since "errors" and "Information" are optional, no exception happens in function toErrorPropertyValue / toInfoPropertyValue in Statemappings.java

Actual behaviour

Add the judge to return empty if state.getInformation() / state.getErrors() are null or isEmpty.

Additional information

sebo001 commented 4 months ago

Hi @maxwang001 thanks for bringing this up.

You're right, in VDA5050 version 2.0, the information part of the state message is optional, so we are going to fix that. The error part however (and in version 1.1 both error and information), is not optional, so that will remain as is.

maxwang001 commented 4 months ago

Hi @sebo001, thanks for the review. I have created new pull request for this

sebo001 commented 4 months ago

@maxwang001 Thank you for offering that but we are already in the process of making the change.

maxwang001 commented 4 months ago

Understood and will close pull request.