openTCS/opentcs-commadapter-vda5050

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

Closed this issue · 4 comments

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

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.

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

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

Understood and will close pull request.